示例#1
0
 function main()
 {
     if (SessionGet('ADMIN', false) == false) {
         echo "Sorry, admins only";
     } else {
         hprint_r($_SERVER);
         phpinfo();
     }
 }
示例#2
0
function tmpModuleLeft()
{
    // April 4, 2007, KFD.  Allow a breakout here
    if (function_exists('appModuleLeft')) {
        $continue = appModuleLeft();
        return $continue;
    }
    //echo "<br/>";
    if (!LoggedIn()) {
        return;
    }
    // Only display menu if
    if (OptionGet('MENULEFT', 'Y') == 'Y') {
        $module = SessionGet("AGMENU_MODULE");
        $AGMENU = SessionGet("AGMENU");
        $kount = 0;
        if (isset($AGMENU[$module])) {
            $desc = $AGMENU[$module]['description'];
            echo "<ul class=\"nav nav-list\">";
            echo "<li class=\"nav-header\">{$desc}</li>";
            foreach ($AGMENU[$module]['items'] as $key => $info) {
                $hExtra = ' tabindex="' . hpTabIndexNext(100) . '"';
                // We may make the first item the focused item if nothing else
                // has been picked yet.  This code runs when rendering is going on
                // and the class-specific biz code has all run already, so it will
                // not override any business-specific focus setting
                if (vgfGet('HTML_focus') == '') {
                    $hExtra .= ' ID="FIRSTSPLITMENU" NAME="FIRSTSPLITMENU" ';
                    vgfSet('HTML_focus', 'FIRSTSPLITMENU');
                }
                $kount++;
                $d = '?gp_page=' . $key;
                $h = hLink("mainlevel", $info['description'], $d, $hExtra);
                echo "\n<li>{$h}</li>";
                // Possibly two more links
                if (ArraySafe($info, 'linknew') == 'Y') {
                    $hx = ' tabindex="' . hpTabIndexNext(100) . '" style="margin-left:30px"';
                    $h = hLink("mainlevel", 'New', $d . '&gp_mode=ins', $hx);
                    echo "\n<li>{$h}</td></li>";
                }
                if (ArraySafe($info, 'linksearch') == 'Y') {
                    $hx = ' tabindex="' . hpTabIndexNext(100) . '" style="margin-left:30px"';
                    $h = hLink("mainlevel", 'Search', $d . '&gp_mode=search', $hx);
                    echo "\n<li>{$h}</li>";
                }
            }
            echo "</ul>";
        }
    }
    if (isset($continue)) {
        return $continue;
    }
    //while ($kount++ < 30) { echo "<br>"; }
}
示例#3
0
 function mainLayout($container)
 {
     # Erase default help message
     vgfSet('htmlHelp', '');
     html('h1', $container, 'Configuration Review');
     $table = html('table', $container);
     $table->hp['id'] = 'x2data1';
     $thead = html('thead', $table);
     $tr = html('tr', $thead);
     $tr->h('th', 'Setting', 'dark');
     $tr->h('th', 'Framework', 'dark');
     $tr->h('th', 'Application', 'dark');
     $tr->h('th', 'Instance', 'dark');
     $tr->h('th', 'User', 'dark');
     $tr->h('th', 'Your Setting', 'dark');
     # Include any of the files that exist
     $dir = fsDirTop() . "/dynamic/table_config";
     $configfw = $configapp = $configinst = $configuser = array();
     if (file_exists($dir . 'fw.php')) {
         include $dir . 'fw.php';
     }
     if (file_exists($dir . 'app.php')) {
         include $dir . 'app.php';
     }
     if (file_exists($dir . 'inst.php')) {
         include $dir . 'inst.php';
     }
     if (file_exists($dir . 'user_' . SessionGet('UID') . '.php')) {
         include $dir . 'user_' . SessionGet('UID') . '.php';
     }
     $dd = ddTable('configapp');
     $askip = array('recnum', 'skey', 'skey_quiet', '_agg', 'uid_ins');
     $tbody = html('tbody', $table);
     $flipper = 0;
     foreach ($dd['flat'] as $column_id => $colinfo) {
         if (in_array($column_id, $askip)) {
             continue;
         }
         $tr = html('tr', $tbody);
         if ($flipper > 2) {
             $tr->addClass('lightgray');
         } else {
             if ($flipper != 2) {
                 $tr->addClass('lightgraybottom');
             }
         }
         $flipper += 1;
         if ($flipper == 6) {
             $flipper = 0;
         }
         html('td', $tr, $colinfo['description']);
         # The four levels from files
         html('td', $tr, a($configfw, $column_id));
         html('td', $tr, a($configapp, $column_id));
         html('td', $tr, a($configinst, $column_id));
         if (a($colinfo, 'flagcarry', 'N') == 'Y') {
             html('td', $tr, a($configuser, $column_id));
         } else {
             html('td', $tr, 'n/a');
         }
         # The final resolved value
         html('td', $tr, ConfigGet($column_id));
     }
 }
示例#4
0
 function x6main()
 {
     if (SessionGet('ROOT')) {
         phpinfo();
     }
 }
 function LogStart()
 {
     // this works out if we are flushing
     $GLOBALS["log_flush"] = false;
     if (function_exists("x_EchoFlush")) {
         echo "<pre>\n";
         //ob_start();
         $GLOBALS["log_flush"] = true;
     }
     // This prevents attempts to write to file before we've
     // established that we can actually write to it
     //
     $GLOBALS["log_file"] = "";
     $grp = $this->ShellWhoAmI();
     if (!isset($GLOBALS["parm"])) {
         $this->LogEntry("===================================================");
         $this->LogEntry(" ANDROMEDA UPGRADE STARTUP ERROR                   ");
         $this->LogEntry(" >>> this program expects to be invoked using <<<  ");
         $this->LogEntry(" >>> PHP 'include' and for parameters to be   <<<  ");
         $this->LogEntry(' >>> found in $GLOBALS["parm"]                <<<  ');
         $this->LogEntry("===================================================");
         return false;
     }
     // First big error is that we cannot write to the current
     // directory.
     $GLOBALS["log_file"] = "";
     $t = pathinfo(__FILE__);
     $dircur = $this->FS_AddSlash(trim($t["dirname"]));
     if (!is_writable($dircur)) {
         $this->LogEntry("===================================================");
         $this->LogEntry(" ANDROMEDA UPGRADE STARTUP ERROR                   ");
         $this->LogEntry(" >>> this program must be able to write to");
         $this->LogEntry(" >>> workding dir: " . $dircur);
         $this->LogEntry(' >>> Program is running as user ' . $grp);
         $this->LogEntry("===================================================");
         return false;
     }
     // Next big fatal error is that we cannot write to the log
     //
     $pLogFile = "AndroDBB." . $GLOBALS["parm"]["APP"] . ".log";
     $pLogPath = $this->FS_ADDSLASH($dircur) . '../tmp/' . $pLogFile;
     if (file_exists($pLogPath)) {
         if (!is_writable($pLogPath)) {
             $this->LogEntry("===================================================");
             $this->LogEntry(" ANDROMEDA UPGRADE STARTUP ERROR                   ");
             $this->LogEntry(" >>> this program must be able to write to");
             $this->LogEntry(" >>> the log file: " . $pLogPath);
             $this->LogEntry(' >>> Program is running as user ' . $grp);
             $this->LogEntry("===================================================");
             return false;
         }
     }
     // clear the log
     // no need to depend on external system calls
     $handle = fopen($pLogPath, 'w');
     if (!$handle) {
         $this->LogEntry("Cannot open file ({$pLogPath})");
         return false;
     }
     fclose($handle);
     $GLOBALS["log_file"] = $pLogPath;
     // KFD 2/5/08.  If installer is detected, hardcode some entries
     //              so the install can run.
     $x = dirname(__FILE__);
     if (file_exists($x . '/install.php')) {
         $this->dirsAll = array(array('dirname' => 'root', 'flag_copy' => 'Y', 'flag_lib' => 'Y', 'flag_vis' => 'N'), array('dirname' => 'lib', 'flag_copy' => 'Y', 'flag_lib' => 'Y', 'flag_vis' => 'N'), array('dirname' => 'clib', 'flag_copy' => 'Y', 'flag_lib' => 'Y', 'flag_vis' => 'Y'), array('dirname' => 'application', 'flag_copy' => 'Y', 'flag_lib' => 'N', 'flag_vis' => 'N'), array('dirname' => 'appclib', 'flag_copy' => 'Y', 'flag_lib' => 'N', 'flag_vis' => 'Y'), array('dirname' => 'generated', 'flag_copy' => 'N', 'flag_lib' => 'N', 'flag_vis' => 'N'), array('dirname' => 'files', 'flag_copy' => 'N', 'flag_lib' => 'N', 'flag_vis' => 'N'), array('dirname' => 'tmp', 'flag_copy' => 'N', 'flag_lib' => 'N', 'flag_vis' => 'N'), array('dirname' => 'apppub', 'flag_copy' => 'Y', 'flag_lib' => 'N', 'flag_vis' => 'Y'), array('dirname' => 'dynamic', 'flag_copy' => 'N', 'flag_lib' => 'N', 'flag_vis' => 'N'), array('dirname' => 'templates', 'flag_copy' => 'Y', 'flag_lib' => 'N', 'flag_vis' => 'Y'), array('dirname' => 'instpub', 'flag_copy' => 'N', 'flag_lib' => 'N', 'flag_vis' => 'Y'), array('dirname' => 'docslib', 'flag_copy' => 'Y', 'flag_lib' => 'Y', 'flag_vis' => 'N'), array('dirname' => 'docsapp', 'flag_copy' => 'Y', 'flag_lib' => 'N', 'flag_vis' => 'N'), array('dirname' => 'docsgen', 'flag_copy' => 'N', 'flag_lib' => 'N', 'flag_vis' => 'N'));
     }
     //  get the password if necessary
     if (function_exists("SessionGet")) {
         // this means called from web app, get current user's pw
         $GLOBALS['x_password'] = SessionGet('PWD');
     } else {
         // Called from CLI, Unix user must be priveleged or it won't work
         $GLOBALS['x_password'] = '';
     }
     $parm =& $GLOBALS["parm"];
     # KFD 1/27/09, convert app and instance to lower case
     $parm['APP'] = strtolower($parm['APP']);
     if (isset($parm['INST'])) {
         $parm['INST'] = strtolower($parm['INST']);
     }
     if ($this->zzArraySafe($parm, 'ROLE_LOGIN', '') == '') {
         $parm['ROLE_LOGIN'] = '******';
     }
     if ($this->zzArraySafe($parm, 'FLAG_PWMD5', '') == '') {
         $parm['FLAG_PWMD5'] = 'N';
     }
     $parm["DIR_PUB"] = $this->FS_AddSlash($parm["DIR_PUBLIC"]) . $this->FS_AddSlash($parm["DIR_PUBLIC_APP"]);
     $this->LogEntry("===================================================");
     $this->LogEntry(" ANDROMEDA CLIENT UPGRADE PROGRAM ");
     $this->LogEntry("===================================================");
     $this->LogEntry("Starting Log at " . date("r"));
     $this->LogEntry("This program: " . __FILE__);
     $this->LogEntry("===================================================");
     $this->LogEntry("Parameters: ");
     $this->LogEntry("Application Code       : " . $parm["APP"]);
     $this->LogEntry("Instance Code (if appl): " . $this->zzArray($parm, 'INST'));
     $this->LogEntry("Instance Vers (if appl): " . $this->zzArray($parm, 'IVER'));
     $this->LogEntry("Application Description: " . $parm["APPDSC"]);
     $this->LogEntry("Node Public Directory  : " . $parm["DIR_PUBLIC"]);
     $this->LogEntry("App Public SubDir      : " . $parm["DIR_PUBLIC_APP"]);
     $this->LogEntry("App Public Directory   : " . $parm["DIR_PUB"]);
     $this->LogEntry("Library Symlink Source : " . $this->zzArray($parm, "DIR_LINK_LIB"));
     $this->LogEntry("Application Symlink Src: " . $this->zzArray($parm, "DIR_LINK_APP"));
     $this->LogEntry("Database Server        : " . $parm["DBSERVER_URL"]);
     $this->LogEntry("Connecting as user     : "******"UID"]);
     $this->LogEntry("Password               : *** NOT DISPLAYED ***");
     $this->LogEntry("Connecting to database : " . $parm["APP"]);
     $this->LogEntry("Bootstrap Dictionary   : " . $parm["SPEC_BOOT"]);
     $this->LogEntry("Universal Dictionary   : " . $parm["SPEC_LIB"]);
     $this->LogEntry("Application Dictionary : " . $parm["SPEC_LIST"]);
     $this->LogEntry("ROLE Logins allowed    : " . $parm['ROLE_LOGIN']);
     $this->LogEntry("Hardened PW Security   : " . $parm['FLAG_PWMD5']);
     $this->LogEntry("Log File: " . $pLogFile);
     $this->LogEntry("---------------------------------------------------");
     $parm["DIR_WORKING"] = dirname(__FILE__);
     $this->LogEntry("Program executing in  : " . $parm["DIR_WORKING"]);
     $parm["DIR_TMP"] = $parm["DIR_PUB"] . "tmp/";
     $this->LogEntry("Temporary files go to : " . $parm["DIR_TMP"]);
     $this->LogEntry("===================================================");
     return true;
 }
示例#6
0
 /** **********************************************************
    name:fbProc
    returns:echos HTML
    
    Does actual processing.  
    */
 function fbProc()
 {
     ob_start();
     $tid = gp('gp_table_id');
     $fi = SessionGet('importfile', array());
     $t = DD_TableRef($tid);
     if (!isset($t['description']) || count($fi) == 0) {
         echo "Problem with uploads";
         return;
     }
     ?>
   <h1>Table Import Processing</h1>
   <p>For Table: <?php 
     echo $t['description'];
     ?>
   <p>Name in database: <?php 
     echo $tid;
     ?>
   <p>File to process: <?php 
     echo $fi['name'];
     ?>
   <p>File upload size: <?php 
     echo number_format($fi['size']);
     ?>
   <hr>
   <pre>
   <?php 
     list($linenum, $linesok) = $this->fbProcInner($fi, $t);
     echo "</pre>";
     echo "<hr>";
     echo "Processed {$linesok} of {$linenum} lines without errors";
     echo ob_get_clean();
 }
示例#7
0
 function mainLayout(&$div)
 {
     # Add the top level item as an x4Pane so it will fade in
     $x4Window = html('div', $div);
     $x4Window->addClass('x4Window');
     $x4Window->addClass('x4Pane');
     $x4Window->hp['id'] = 'x4Window';
     $x4Window->setAsParent();
     # The first two are simple, a description
     # and the menu bar.  These are permanent and will
     # be displayed for the entire time.
     $h1 = html('h1', $x4Window, $this->dd['description']);
     $h1->hp['id'] = 'x4H1Top';
     # Add the menu bar
     $x4Window->addChild($this->menuBar($this->dd));
     # Temp
     #ob_start();
     #hprint_r($_SESSION);
     #$x4Window->h('div',ob_get_clean());
     #  This is the top level display item
     #
     $x4Display = html('div', $x4Window);
     $x4Display->addClass('x4Pane');
     $x4Display->addClass('x4TableTop');
     $x4Display->ap['xTableId'] = $this->table_id;
     $x4Display->hp['id'] = 'x4TableTop_' . $this->table_id;
     $x4Display->setAsParent();
     # Create a grid for the default display
     $grid = $this->grid($this->dd);
     $grid->addClass('x4VerticalScroll1');
     $x4Display->addChild($grid);
     # Create a container and tab bar,
     #
     $tabC = html('div', $x4Display);
     $tabC->addClass('x4Pane');
     $tabC->addClass('x4TabContainer');
     $tabCId = 'x4TabContainer_' . $this->table_id;
     $tabC->hp['id'] = $tabCId;
     $tabC->ap['xTableId'] = $this->table_id;
     $tabC->setAsParent();
     $tabB = html('div', $tabC);
     $tabB->addClass('x4TabBar');
     $tabB->addClass('x4Div');
     $tabBId = 'x4TabBar';
     $tabB->hp['id'] = $tabBId;
     # For now we create only one detail pane,
     # later on we want more
     #
     $tabid = 'tab_' . $this->dd['table_id'];
     $tabx = html('div', $tabC);
     $detail = $this->detailPane('');
     $detailId = $detail->hp['id'];
     $detail->addClass('x4VerticalScroll2');
     $tabC->addChild($detail);
     $span = html('a-void', $tabB, '1: Detail');
     $span->hp['xAction'] = 'Ctrl1';
     $span->hp['id'] = 'tabFor_' . $detailId;
     $span->hp['onclick'] = "\$a.byId('{$tabCId}').dispatch('{$detailId}')";
     # Child table panes are added in a loop because there
     # may be more than one
     #
     $tabNumber = 2;
     foreach ($this->dd['fk_children'] as $table_id => $info) {
         #  First break: uidisplay set to none
         if (trim(strtolower(arr($info, 'uidisplay', ''))) == 'none') {
             continue;
         }
         # Second break: user not allowed to see
         $perms = SessionGet('TABLEPERMSSEL');
         if (!in_array($table_id, $perms)) {
             continue;
         }
         # Second skip: user not allowed
         $ddChild = ddTable($table_id, true);
         if ($ddChild['perms']['sel'] === 0) {
             continue;
         }
         $tabid = 'x4TableTop_' . $table_id;
         x4Data('dd.' . $table_id, $ddChild);
         # Make a tableTop container
         $tabx = html('div', $tabC);
         $tabx->addClass('x4Pane');
         $tabx->addClass('x4TableTop');
         $tabx->hp['id'] = $tabid;
         $tabx->ap['xTableId'] = $table_id;
         $tabx->setAsParent();
         # Create an x4 object
         $chdobj = x4Object($table_id);
         # KFD 7/8/08, look for a "mover" box, and do an
         #             alternate setup
         $table_id = $this->dd['table_id'];
         $uidisplay = $ddChild['fk_parents'][$table_id]['uidisplay'];
         if (trim($uidisplay) == 'mover') {
             $tabx->addChild($this->mover($ddChild, $table_id));
         } else {
             # Add into it the grid and the detail
             $tabx->addChild($chdobj->grid($this->table_id));
             $tabx->addChild($chdobj->detailPane($this->table_id));
         }
         # Make the tab entry
         $span = html('a-void', $tabB, $tabNumber . ': ' . $ddChild['description']);
         $span->hp['xAction'] = 'Ctrl' . $tabNumber;
         $span->hp['id'] = 'tabFor_' . $tabid;
         $tabNumber++;
         $span->hp['onclick'] = "\$a.byId('{$tabCId}').dispatch('{$tabid}')";
     }
 }
示例#8
0
    function main()
    {
        $x_app = trim(gp('txt_application'));
        session_write_close();
        ob_start();
        echo "<h1>Build in progress</h1>";
        echo "<hr>";
        echo "<p>The system is now building the application: <b>" . $x_app . "</b>.</p>";
        echo "<p>If you are testing and expect to build several times in a row, do not ";
        echo "close this window, just hit REFRESH and the build will start again.</p>";
        echo "<p>All information below this line is from the build log.</p>";
        echo "<hr>";
        // Get everything we need from the database, use it to build
        // a "do" program.
        //
        $GLOBALS["x_password"] = trim(gp("supassword"));
        $tsql = 'SELECT * from applications ' . ' WHERE application = ' . SQL_Format('char', $x_app);
        $row_a = SQL_OneRow($tsql);
        $tsql = 'SELECT * from webpaths ' . ' WHERE webpath = ' . SQL_Format('char', $row_a['webpath']);
        $row_n = SQL_OneRow($tsql);
        $dirws = trim($row_n["dir_pub"]);
        if (substr($dirws, -1, 1) != "/") {
            $dirws .= "/";
        }
        $row["webserver_dir_pub"] = $dirws;
        $string = '
<?php
   // To run this program from the command line, you must
   // be logged in as a user that has superuser priveleges, such
   // as root or postgres.  When running from the web app,
   // the current user\'s priveleges are used.
	
   $GLOBALS["parm"] = array(
   "DBSERVER_URL"=>"localhost"
   ,"UID"=>"' . SessionGet('UID') . '"
   ,"DIR_PUBLIC"=>"' . trim($row_n["dir_pub"]) . '"
	,"DIR_PUBLIC_APP"=>"' . $x_app . '"
   ,"LOCALHOST_SUFFIX"=>"' . ArraySafe($row_n, 'dir_local', '') . '"
   ,"APP"=>"' . $x_app . '"
   ,"APPDSC"=>"' . trim($row_a["description"]) . '"
   ,"XDIRS"=>"' . trim($row_a['xdirs']) . '"
   ,"ROLE_LOGIN"=>"' . ArraySafe($row_a, 'flag_rolelogin', 'Y') . '"
   ,"FLAG_PWMD5"=>"' . ArraySafe($row_a, 'flag_pwmd5', 'N') . '"
   ,"TEMPLATE"=>"' . trim($row_a['template']) . '"
   ,"SPEC_BOOT"=>"' . trim($row_a["appspec_boot"]) . '"
   ,"SPEC_LIB"=>"' . trim($row_a["appspec_lib"]) . '"
   ,"SPEC_LIST"=>"' . trim($row_a["appspec"]) . '");

	include("androBuild.php");  
?>
';
        $t = pathinfo(__FILE__);
        $dircur = AddSlash($t["dirname"]) . "../tmp/";
        $file = $dircur . "do" . $x_app . ".php";
        $FILE = fopen($file, "w");
        fwrite($FILE, $string);
        fclose($FILE);
        x_EchoFlush("");
        include $file;
        echo ob_get_clean();
    }
示例#9
0
    function main_pr_execute()
    {
        ob_start();
        $sApp = SQLFC(gp('gp_app'));
        $sInst = SQLFC(gp('gp_inst'));
        $hApp = hSanitize(gp('gp_app'));
        $hInst = hSanitize(gp('gp_inst'));
        $rows = SQL_AllRows("SELECT * from instances \n           where application={$sApp} AND instance={$sInst}");
        if (count($rows) != 1) {
            ?>
         <div class="errorbox">Incorrect call to instance processing.</div>
         <?php 
            return;
        }
        $row = $rows[0];
        $sVer = SQLFC(gp('gp_ver'));
        $hVer = hSanitize(gp('gp_ver'));
        // KFD 2/4/08, If this is a subversion-enabled server,
        //     get version information from there
        if (OptionGet('DEV_STATION', '') != '') {
            $aversions = svnVersions();
            $mv = '-VER-' . $aversions['andro']['local'];
        } else {
            // Get information on latest version of Node Manager and
            // link to that
            $mv = SQL_OneValue("mv", "SELECT max(version) as mv \n                 FROM appversions\n                WHERE application='andro'");
        }
        $DIR_LINK_LIB = $GLOBALS['AG']['dirs']['root'] . '/pkg-apps/andro' . $mv;
        // Source of symlinks for app directories
        $DIR_LINK_APP = $GLOBALS['AG']['dirs']['root'] . "/pkg-apps/{$hApp}-VER-{$hVer}";
        // Get application information for the DO program
        $tsql = 'SELECT * from applications ' . ' WHERE application = ' . $sApp;
        $row_a = SQL_OneRow($tsql);
        $tsql = 'SELECT * from webpaths ' . ' WHERE webpath = ' . SQLFC($row_a['webpath']);
        $row_n = SQL_OneRow($tsql);
        $dirws = AddSlash(trim($row_n["dir_pub"]));
        //if (substr($dirws,-1,1)<>"/") $dirws.="/";
        //$row["webserver_dir_pub"] = $dirws;
        $string = '<?php
// To run this program from the command line, you must
// be logged in as a user that has superuser priveleges, such
// as root or postgres.  When running from the web app,
// the current user\'s priveleges are used.

$GLOBALS["parm"] = array(
   "DBSERVER_URL"=>"localhost"
   ,"UID"=>"' . SessionGet('UID') . '"
   ,"DIR_PUBLIC"=>"' . $dirws . '"
   ,"DIR_PUBLIC_APP"=>"' . $hApp . '_' . $hInst . '"
   ,"DIR_LINK_LIB"=>"' . $DIR_LINK_LIB . '"
   ,"DIR_LINK_APP"=>"' . $DIR_LINK_APP . '"
   ,"APP"=>"' . $hApp . '_' . $hInst . '"
   ,"INST"=>"' . $hInst . '"
   ,"IVER"=>"' . $hVer . '"
   ,"XDIRS"=>"' . trim($row_a['xdirs']) . '"
   ,"FLAG_PWMD5"=>"' . ArraySafe($row_a, 'flag_pwmd5', 'N') . '"
   ,"ROLE_LOGIN"=>"' . ArraySafe($row_a, 'flag_rolelogin', 'Y') . '"
   ,"TEMPLATE"=>"' . $row['template'] . '"
   ,"APPDSC"=>"' . trim($row_a["description"]) . '"
   ,"SPEC_BOOT"=>"' . trim($row_a["appspec_boot"]) . '"
   ,"SPEC_LIB"=>"' . trim($row_a["appspec_lib"]) . '"
   ,"SPEC_LIST"=>"' . trim($row_a["appspec"]) . '"
);
   
include("androBuild.php");  
?>
   ';
        $t = pathinfo(__FILE__);
        $dircur = AddSlash($t["dirname"]) . "../tmp/";
        //$dircur = $t["dirname"];
        if (substr($dircur, -1) != "/") {
            $dircur .= "/";
        }
        $file = $dircur . "do-{$hApp}-{$hInst}.php";
        $FILE = fopen($file, "w");
        fwrite($FILE, $string);
        fclose($FILE);
        include $file;
        if (ArraySafe($GLOBALS, 'retval', 0) == 1) {
            SQL("update instances set version={$sVer}\n               WHERE application = {$sApp}\n                 AND instance    = {$sInst}");
        }
        echo ob_get_clean();
    }
示例#10
0
    function MenuTable()
    {
        $AGMENU = SessionGet('AGMENU');
        $module = gp('x_module');
        $table_id = gp('x_menu');
        echo "<b>" . $AGMENU[$module]['items'][$table_id]['description'] . "</b>";
        ?>
      <br><br><br><br>
      1 - <a href="?gp_page=<?php 
        echo $table_id;
        ?>
&gp_mode=browse">View</a>
      <br><br><br><br>
      2 - <a href="?gp_page=<?php 
        echo $table_id;
        ?>
&gp_mode=search">Edit</a>
      <br><br><br><br>
      3 - <a href="?gp_page=<?php 
        echo $table_id;
        ?>
&gp_mode=search">Delete</a>
      <br><br><br><br>
      4 - <a href="?gp_page=<?php 
        echo $table_id;
        ?>
&gp_mode=ins">Add</a>
      <br><br><br><br>
      <?php 
        $x = 5;
        // SEAN: Here is where you put the extra stuff like "on hold"
        global $extramenu;
        $rapidchanges = $extramenu;
        $rapidchanges = ArraySafe($rapidchanges, $table_id);
        foreach ($rapidchanges as $change => $columns) {
            $desc = ArraySafe($columns, '_desc');
            unset($columns['_desc']);
            foreach ($columns as $name => $val) {
                $columns[$name] = 'gp_upd_' . $name . "=" . $val;
            }
            $parms = implode('&', $columns);
            ?>
            <?php 
            echo $x;
            ?>
 - <a href="?gp_page=x_pkc&gp_table_upd=<?php 
            echo $table_id . '&' . $parms;
            ?>
"><?php 
            echo $desc;
            ?>
</a>
            <br><br><br><br>
         <?php 
            $x++;
        }
        //hprint_r($rapidchanges);
        ?>
      Z - <a href="?x_module=<?php 
        echo $module;
        ?>
">Exit</a>
      <br><br><br><br>
      <?php 
    }
示例#11
0
 /**
  *  Generates an x3 HTML page requesting input from the
  *  user.  No parameters, accesses the object's yamlP2 property.
  *
  *  @access private
  */
 private function x3HTML()
 {
     $x6 = vgfGet('x6', false);
     $yamlP2 = $this->yamlP2;
     if (isset($yamlP2['options']['title'])) {
         # This is for classic x2 displays
         $this->PageSubtitle = $yamlP2['options']['title'];
     }
     # There are few tweaks based on x4/x_table2 version
     $x4 = gp('x4Page') == '' ? false : true;
     # Create top-level div, x4 library is looking for this
     # and x2 library will ignore it.
     $top = html('div');
     $top->hp['id'] = 'x4Top';
     $top->autoFormat(true);
     if ($x6) {
         $top->hp['id'] = 'x4Top';
         $top->addClass('fadein');
         $top->hp['x6plugin'] = 'androPage';
         jqDocReady("var plugin = x6.byId('x4Top');");
         jqDocReady("x6plugins.androPage(plugin,'x4Top','*');");
     }
     # Hidden variables so posts will come back here
     if ($x4) {
         x4Data('return', 'menu');
         $h = $top->h('input');
         $h->hp['id'] = 'x4Page';
         $h->hp['type'] = 'hidden';
         $h->hp['value'] = $this->page;
     } else {
         hidden('gp_page', $this->page);
     }
     # List of ids for buttons below
     if ($yamlP2['template'] == '') {
         $ids = array('pdf' => 'printNow', 'onscreen' => 'showOnScreen', 'showSql' => 'showSql', 'csv' => 'csvExport');
     } else {
         $ids = array('smarty' => 'RunReport');
     }
     $x4D = html('div', $top);
     if ($x4) {
         $x4D->addClass('x4Pane');
     }
     $x4D->addClass('x4AndroPage');
     # Triggers all browser-side x4 stuff
     $x4D->hp['id'] = 'x4AndroPage';
     $x4D->ap['defaultOutput'] = a($ids, a($yamlP2['options'], 'default'));
     # Put out the title and the help link
     $tabx = html('table', $x4D);
     $tabx->addClass('tab100');
     $tabxtr = html('tr', $tabx);
     $td = html('td', $tabxtr);
     $td->hp['style'] = "text-align: left; vertical-align: top";
     $h1 = html('h1', $td, $this->PageSubtitle);
     $h1->hp['id'] = 'x4H1Top';
     $td = html('td', $tabxtr);
     $td->hp['style'] = "text-align: right; vertical-align: top;\n        padding-top: 8px; font-size: 120%";
     #if($x4) {
     #$a = html('a-void',$td,"F1:Help");
     #$a->hp['onclick'] = "$('#x4AndroPage')[0].help()";
     #$a->addClass('button');
     #}
     # Make top level container
     $tabtop = html('table', $x4D);
     $tr = html('tr', $tabtop);
     $td1 = html('td', $tr);
     $td1->hp['style'] = 'vertical-align: top';
     $td2 = html('td', $tr);
     $td2->hp['style'] = 'vertical-align: top';
     # Do right-hand side first actually, the on-screen display area
     $div = html('div', $td2);
     $div->hp['id'] = 'divOnScreen';
     # Put out the inputs
     if (!$x6) {
         $table = html('table', $td1);
     } else {
         $form = $td1->form();
         $table = $form->h('table');
         $table->addClass('x6Detail');
         $table->hp['style'] = 'float: left';
     }
     $filters = ArraySafe($this->yamlP2, 'uifilter', array());
     foreach ($filters as $id => $options) {
         if (isset($options['table'])) {
             $dd = ddTable($options['table']);
             $opt2 = $dd['flat'][$options['column']];
             $options = array_merge($opt2, $options);
         } else {
             $options['inputId'] = 'ap_' . $id;
         }
         if (isset($options['value']) && gp('ap_' . $id) == '') {
             $options['value'] = $options['value'];
         } else {
             $options['value'] = gp('ap_' . $id);
         }
         $type_id = a($options, 'cotype_id', 'vchar');
         $tr = html('tr', $table);
         $td = html('td', $tr);
         if ($x6) {
             $td->addClass('x6Caption');
         } else {
             $td->hp['style'] = "text-align: right";
         }
         $td->setHTML($options['description']);
         $td = html('td', $tr);
         if ($x6) {
             $td->addClass('x6Input');
         } else {
             $td->hp['style'] = "text-align: left";
         }
         $input = input($options);
         $input->hp['autocomplete'] = 'off';
         if ($x6) {
             $input->hp['xNoPassup'] = 'Y';
         }
         $td->setHTML($input->bufferedRender());
     }
     $h = $top->h('input');
     $h->hp['type'] = 'hidden';
     $h->hp['id'] = 'gp_post';
     $h->hp['name'] = 'gp_post';
     if (isset($yamlP2['template'])) {
         $h->hp['value'] = 'smarty';
     } else {
         $h->hp['value'] = 'pdf';
     }
     $td1->br();
     // DO 7/31/2008 Only need a button to run the report for Smarty AndroPage
     if ($this->yamlP2['template'] == '') {
         # First button: print
         $inp = html('a-void', $td1, '<u>P</u>rint Now');
         $inp->ap['xLabel'] = 'CtrlP';
         $inp->hp['id'] = $ids['pdf'];
         $inp->addClass('button');
         if ($x6) {
             $inp->hp['onclick'] = "x6events.fireEvent('key_CtrlP')";
         } elseif (gpExists('x4Page')) {
             $inp->hp['onclick'] = "\$a.byId('x4AndroPage').printNow()";
         } else {
             $inp->hp['onclick'] = 'formSubmit();';
         }
         $td1->br(2);
         # Second button: show onscreen
         $inp = html('a-void', $td1, 'Show <u>O</u>nscreen');
         $inp->hp['id'] = $ids['onscreen'];
         $inp->ap['xLabel'] = 'CtrlO';
         $inp->addClass('button');
         if ($x6) {
             $inp->hp['onclick'] = "x6events.fireEvent('key_CtrlO')";
         } elseif (gpExists('x4Page')) {
             $inp->hp['onclick'] = "\$a.byId('x4AndroPage').showOnScreen()";
         } else {
             $inp->hp['onclick'] = "SetAndPost('gp_post','onscreen')";
         }
         # KFD 9/20/08, new option: export to csv
         $td1->br(2);
         $inp = html('a-void', $td1, '<u>E</u>xport as CSV');
         $inp->hp['id'] = $ids['csv'];
         $inp->ap['xLabel'] = 'CtrlE';
         $inp->addClass('button');
         if ($x6) {
             $inp->hp['onclick'] = "x6events.fireEvent('key_CtrlE')";
         } else {
             if (gpExists('x4Page')) {
                 $inp->hp['onclick'] = "\$a.byId('x4AndroPage').csvExport()";
             } else {
                 $inp->hp['onclick'] = "SetAndPost('gp_post','csvexport')";
             }
         }
     } else {
         # First button: Run Report
         $inp = html('a-void', $td1, '<u>R</u>un Report');
         $inp->ap['xLabel'] = 'CtrlR';
         $inp->hp['id'] = $ids['smarty'];
         $inp->addClass('button');
         if (gpExists('x4Page')) {
             $inp->hp['onclick'] = "\$a.byId('x4AndroPage').showOnScreen()";
         } else {
             $inp->hp['onclick'] = 'formSubmit();';
         }
     }
     $td1->br(2);
     if (SessionGet('ADMIN') == true && $x4) {
         $x4D->nbsp(2);
         $inp = html('a-void', $td1, 'Show S<u>Q</u>L');
         $inp->ap['xLabel'] = 'CtrlQ';
         $inp->hp['id'] = $ids['showSql'];
         $inp->hp['name'] = 'showsql';
         // For x2
         $inp->addClass('button');
         if ($x6) {
             $inp->hp['onclick'] = "x6events.fireEvent('key_CtrlQ')";
         } else {
             $inp->hp['onclick'] = "\$a.byId('x4AndroPage').showSql()";
         }
     }
     # Put in the spot where we display the SQL
     $td1->br(2);
     $showSql = html('div', $td1);
     $showSql->hp['id'] = 'divShowSql';
     echo $top->render();
 }
示例#12
0
 function x6main()
 {
     $top = html('div');
     $top->hp['style'] = 'text-align: center;';
     $top->addClass('fadein');
     $top->h('h1', configGet('x4menutitle'));
     # Get some basic dimensions we will use to build the
     # menu system.  Our basic metric is 10% of the
     # screen width, and then 10% of that.
     $pad0 = x6CssDefine('pad0');
     $insidewidth = x6CssDefine('insidewidth');
     $width1 = intval($insidewidth / 10);
     $widthl = $width1 * 3;
     $widthr = $width1 * 3;
     $width1b = intval($width1 / 2);
     $width2 = intval($width1 / 10);
     $outer = $top->h('div');
     $outer->hp['id'] = 'x6menu_outer';
     $outer->hp['xWidth1'] = $width1;
     $outer->hp['xWidth1b'] = $width1b;
     $outer->hp['xWidth2'] = $width2;
     $outer->hp['style'] = "padding: {$width1b}px {$width1}px;\n               text-align: left;";
     # Calculate height of inner, this forces height of outer
     $iHeight = x6cssDefine('insideheight');
     $iHeight -= x6cssHeight('h1');
     $iHeight -= $width1b * 2;
     $inner = $outer->h('div');
     $inner->hp['id'] = 'x6menu_inner';
     $inner->hp['style'] = " border: 1px solid " . x6cssDefine('bgcdark') . ";\n               height: {$iHeight}px;\n               padding:{$width2}px";
     # calculate height of left;
     $lHeight = $iHeight - $width2;
     $leftDiv = $inner->h('div');
     $leftDiv->hp['id'] = 'x6menu_left';
     $leftDiv->hp['style'] = "background-color: " . x6cssDefine('bgcdark') . ";\n             float: left;\n             height: {$lHeight}px;\n             width: {$widthl}px";
     $rightDiv = $inner->h('div');
     $rightDiv->hp['id'] = 'x6menu_right';
     $rightDiv->hp['style'] = "position: relative; float: left; width: {$widthr}px;";
     $AGMENU = SessionGet('AGMENU');
     $countLeft = 1;
     foreach ($AGMENU as $menuid => $menuinfo) {
         if (count(arr($menuinfo, 'items', array())) == 0) {
             continue;
         }
         $h2 = $leftDiv->h('div', $countLeft . ": " . $menuinfo['description']);
         $h2->hp['xKey'] = $countLeft;
         $countLeft++;
         $h2->hp['id'] = 'module_' . $menuid;
         $h2->hp['xMenuId'] = $menuid;
         $h2->hp['style'] = "padding: {$width2}px";
         $h2->hp['onclick'] = "x6.byId('x6menu_outer').clicked('module_{$menuid}');";
         $h2->hp['onmouseover'] = "this.style.textDecoration='underline'";
         $h2->hp['onmouseout'] = "this.style.textDecoration=''";
         $idLeft = $width2 * 2;
         $itemsDiv = $rightDiv->h('div');
         $itemsDiv->hp['id'] = 'items_' . $menuid;
         $itemsDiv->hp['style'] = "position: absolute; top: 0; left: {$idLeft}px; display: none";
         $countRight = 65;
         foreach ($menuinfo['items'] as $page => $pageinfo) {
             # Special hardcoded hack for x6 to remove some items
             if ($page == 'apppub') {
                 continue;
             }
             if ($page == 'userssimple') {
                 continue;
             }
             $pd = strtolower(chr($countRight)) . ': ' . $pageinfo['description'];
             $a = $itemsDiv->h('div', $pd);
             $a->hp['xKey'] = strtolower(chr($countRight));
             $a->hp['xactive'] = 'N';
             $countRight++;
             $a->hp['onmouseover'] = "\$('#x6menu_right .hilight').removeClass('hilight');\n                     \$(this).addClass('hilight')";
             # DUPLICATE CODE ALERT.  THIS CODE IS ALSO IN
             #   TEMPLATES/X6/X6MENUTOP.PHP
             # KFD 2/20/09 Sourceforge 2616802
             if ($pageinfo['uix2'] == 'Y') {
                 $href = "?gp_page={$page}&amp;x2=1";
             } else {
                 $href = "?x6page={$page}&amp;x6module={$menuid}";
             }
             $a->hp['onclick'] = "window.location='{$href}'";
             $a->hp['id'] = 'page_' . $page;
             if (arr($pageinfo, 'spaceafter', 'N') == 'Y') {
                 $itemsDiv->h('hr');
             }
         }
     }
     $top->render();
 }
示例#13
0
/**
name:ddColumnsFromProjection
parm:String table
parm:Special projection
Returns a numerically indexed array of columns that the current
user is allowed to see within a certain projection.
The first parameter names a table.
The second parameter can be blank, or it can be the name of a
projection, or it can be an array that
holds a list of desired columns.
There are various errors that can occur that do not have defined
results, such as having a projection and column by the same name,
requesting non-existent columns, naming a non-existent projection,
and so forth.
*/
function ddColumnsFromProjection($table, $projection = '')
{
    $tabdd = ddTable($table);
    // Pass 1 is security projection.  Drop columns completely
    // if they are not in the view
    //
    $view = ddViewFromTab($table);
    if ($table != $view) {
        $g2use = $table['tableresolve'][SessionGet('GROUP_ID_EFF')];
        $geff = SessionGet('GROUP_ID_EFF');
        $g2use = substr($geff, 0, strlen($geff) - 5) . substr($g2use, -5);
        if (substr($g2use, -5) != '99999') {
            $cols2keep =& $tabdd['views'][$g2use];
            foreach ($tabdd['flat'] as $colname => $colinfo) {
                if (!isset($cols2keep[$colname])) {
                    // Delete outright a disallowed column
                    unset($tabdd['flat'][$colname]);
                } else {
                    // If person cannot write to this column, set
                    // the UIRO flag.
                    if ($cols2keep[$colname] == 0) {
                        $table['flat'][$colname]['uiro'] = 'Y';
                    }
                }
            }
        }
    }
    // If projection does not exist (including case of not specificied),
    // use all columns.  If projection is an array, it must be a list of
    // columns
    if (is_array($projection)) {
        $projcand = $projection;
    } else {
        if (!isset($tabdd['projections'][$projection])) {
            // This case also catches where no projection was specified
            $projcand = array_keys($tabdd['flat']);
        } else {
            $projcand = explode(',', $tabdd['projections'][$projection]);
        }
    }
    // Now loop through the projection candidates and figure out which
    // ones to include
    $acols = array();
    foreach ($projcand as $colname) {
        if (!isset($tabdd['flat'][$colname])) {
            continue;
        }
        if ($colname == 'skey') {
            continue;
        }
        //if($colname=='_agg') continue;
        //if($colname=='_agg') continue;
        if (ArraySafe($tabdd['flat'][$colname], 'uino') == 'Y') {
            continue;
        }
        $acols[] = $colname;
    }
    return $acols;
}
示例#14
0
 function DoTests(&$steps)
 {
     $this->error = '';
     // If they manually forced a rollback to an earlier step,
     //  we will catch it below
     $rb = gp('stepreset', '-1');
     // look for flags that indicate manual approval of steps
     if (gp('pgconfig') == 1) {
         sessionSet('pgconfig', true);
     }
     if (gp('pgsuper') == 1) {
         sessionSet('pgsuper', true);
     }
     // If they provided credentials, try to post them
     if (gpExists('loginUID')) {
         if (substr(strtolower(gp('loginUID')), 0, 5) == 'andro') {
             ErrorAdd("Superuser account may not begin with 'andro'");
         } else {
             SessionSet('xUID', gp('loginUID'));
             SessionSet('xPWD', gp('loginPWD'));
         }
     }
     $finished = false;
     foreach ($steps as $current_step => $step) {
         switch ($current_step) {
             case 0:
                 if (!function_exists('pg_connect')) {
                     $finished = true;
                 }
                 break;
             case 1:
                 // If forcing rollback to here, clear user credentials
                 if ($rb == 1) {
                     SessionUnset('xUID');
                     SessionUnSet('xPWD');
                 }
                 // Test if they gave us uid/pwd and if it works
                 if (SessionGet('xUID') == '') {
                     $finished = true;
                 } else {
                     $cs = SQL_ConnString(SessionGet('xUID'), SessionGet('xPWD'), 'postgres');
                     $this->dbx = @pg_connect($cs);
                     if (!$this->dbx) {
                         $this->error = "Could Not Connect with that Username/Password";
                         $finished = true;
                     }
                 }
                 break;
             case 2:
                 // Since we got a connection, try to get versions
                 $res = SQL2("Select version()", $this->dbx);
                 $row = SQL_Fetch_Array($res);
                 $x = explode(' ', $row['version']);
                 $this->pgversion = $x[0] . ' ' . $x[1];
                 $vers = explode('.', $x[1]);
                 $vers = $vers[0] . '.' . $vers[1];
                 if ($vers < 8.1) {
                     $finished = true;
                 }
                 break;
             case 3:
                 if ($rb == 3) {
                     $this->andro = 1;
                     $finished = true;
                     break;
                 }
                 $cs = SQL_ConnString(SessionGet('xUID'), SessionGet('xPWD'), 'andro');
                 $this->dba = @pg_connect($cs);
                 if (!$this->dba) {
                     $finished = true;
                     $this->andro = 0;
                 } else {
                     pg_close($this->dba);
                     $file = $GLOBALS['AG']['dirs']['generated'] . 'ddmodules.php';
                     if (!file_exists($file)) {
                         $finished = true;
                         $this->andro = 1;
                     }
                 }
                 break;
             case 4:
                 // Initialize the node manager
                 SessionSet('UID', SessionGet('xUID'));
                 SessionSet('PWD', SessionGet('xPWD'));
                 scDBConn_Push();
                 $dir_pub = realpath(dirname(__FILE__) . '/../..');
                 if (strpos(ArraySafe($_ENV, 'OS', ''), 'indows') !== false) {
                     $dir_pub = str_replace("\\", "\\\\", $dir_pub);
                 }
                 $row = array('webpath' => 'DEFAULT', 'dir_pub' => $dir_pub, 'description' => 'Default Web Path');
                 $table_dd = dd_TableRef('webpaths');
                 SQLX_UpdateorInsert($table_dd, $row);
                 /*               
                 $table_dd=dd_TableRef('nodes');
                                $row=array(
                                   'node'=>'DHOST2'
                                   ,'description'=>"Andromeda Master Node"
                                   ,'node_url'=>'dhost2.secdat.com'
                                );
                                SQLX_UpdateorInsert($table_dd,$row); 
                                $row=array(
                                   'node'=>'LOCAL'
                                   ,'description'=>"Local Node"
                                   ,'node_url'=>'localhost'
                                );
                                SQLX_UpdateorInsert($table_dd,$row); 
                 */
                 $table_dd = dd_TableRef('applications');
                 $row = array('application' => 'andro', 'description' => "Andromeda Node Manager", 'appspec' => 'andro.dd.yaml', 'node' => 'LOCAL', 'webpath' => 'DEFAULT');
                 SQLX_UpdateorInsert($table_dd, $row);
                 scDBConn_Pop();
                 SessionSet('UID', 'andro');
                 SessionSet('PWD', 'andro');
                 break;
             case 5:
                 break;
             default:
                 $finished = true;
         }
         // if we are clear, stop now
         if ($finished) {
             break;
         }
     }
     for ($x = 0; $x < $current_step; $x++) {
         $steps[$x][0] = true;
     }
     return $current_step;
 }
示例#15
0
function index_hidden_page()
{
    global $AG;
    $sessok = !LoggedIn() ? false : true;
    // KFD 3/6/08, moved here from the main stream of index_hidden
    //             because these are relevant only to page processing
    if (gpExists('x_module')) {
        SessionSet('AGMENU_MODULE', gp('x_module'));
    } elseif (vgaGet('nomodule') != '' && SessionGet('AGMENU_MODULE') == '') {
        SessionSet('AGMENU_MODULE', vgaGet('nomodule'));
    }
    // If the search flag is set, we need to know what class for this
    // application handles searchs
    if (gpExists('gp_search')) {
        gpSet('gp_page', vgaGet('SEARCH_CLASS'));
    }
    // Load up a list of pages that public users are allowed to see,
    // with home and password always there.
    global $MPPages;
    // allows it to be in applib
    $MP = array();
    //$MPPages= array();
    // This is the old method, load $MPPages from its own file
    if (file_exists_incpath('appPublicMenu.php')) {
        include_once 'appPublicMenu.php';
    }
    if (!is_array($MPPages)) {
        $MPPages = array();
    }
    $MPPages['x_home'] = 'Home Page';
    $MPPages['x_login'] = '******';
    $MPPages['x_noauth'] = 'Authorization Required';
    $MPPages['x_password'] = "******";
    $MPPages['x_mpassword'] = "******";
    $MPPages['x_paypalipn'] = 'Paypal IPN';
    // If the install page exists, it will be used, no getting
    // around it.
    $install = $GLOBALS['AG']['dirs']['application'] . 'install.php';
    $instal2 = $GLOBALS['AG']['dirs']['application'] . 'install.done.php';
    if (file_exists($install)) {
        if (gp('gp_install') == 'finish') {
            rename($install, $instal2);
        } else {
            $MPPages['install'] = 'install';
            gpSet('gp_page', 'install');
        }
    }
    // First pass is to look for the "flaglogin" flag.  This says save all
    // current page settings and go to login screen.  They will be restored
    // on a successful login.  Very useful for links that say "Login to
    // see nifty stuff..."
    if (gp('gp_flaglogin') == '1') {
        gpSet('gp_flaglogin', '');
        gpToSession();
        gpSet('gp_page', 'x_login');
    }
    // Second pass redirection, pick default page if there
    // is none, and verify public pages.
    //
    $gp_page = gp('gp_page');
    if ($gp_page == '') {
        if (vgfGet('LoginAttemptOK') === true && vgfGet('x4') === true) {
            $gp_page = 'x4init';
            gpSet('gp_page', 'x4init');
            SessionSet('TEMPLATE', 'x4');
        } else {
            if (function_exists('appNoPage')) {
                $gp_page = appNoPage();
            } else {
                if (!LoggedIn()) {
                    $gp_page = FILE_EXISTS_INCPATH('x_home.php') ? 'x_home' : 'x_login';
                } else {
                    // KFD 3/2/07, pull vga stuff to figure defaults
                    if (vgaGet('nopage') != '') {
                        $gp_page = vgaGet('nopage');
                    } else {
                        $gp_page = 'x_welcome';
                    }
                }
            }
        }
    }
    // If they are trying to access a restricted page and are not
    // logged in, cache their request and redirect to login page
    if (!$sessok && !isset($MPPages[$gp_page])) {
        if (vgfGet('loglogins', false)) {
            fwLogEntry('1014', 'Page access w/o login', $gp_page);
        }
        gpToSession();
        $gp_page = 'x_login';
    }
    // If pos is activated and the current requested page does not
    // match what they are cleared for, redirect to login
    if (vgaGet('POS_SECURITY', false) == true && SessionGet('ADMIN') == false) {
        if (SessionGet('POS_PAGE', '', 'FW') != $gp_page) {
            gpToSession();
            $gp_page = 'x_login';
        }
    }
    gpSet('gp_page', $gp_page);
    // Make any database saves.  Do this universally, even if save
    // was not selected.  If errors, reset to previous request.
    //if(gp('gp_save')=='1') processPost();
    processPost();
    if (Errors()) {
        gpSetFromArray('gp_', aFromGp('gpx_'));
    }
    // Put Userid where HTML forms can find it
    //vgfSet("UID",SessionGet("UID"));
    //if (vgfSet("UID")=="") { vgfSet("UID","Not Logged In"); }
    // THIS IS NEWER X_TABLE2 version of drilldown commands,
    // considerably simpler than the older ones. It makes use of
    // three gp_dd variables.
    //
    // Notice how we process drillbacks FIRST, allowing a link
    // to contain both drillback and drilldown, for the super-nifty
    // effect of a "drill-across"
    hidden('gp_dd_page');
    hidden('gp_dd_skey');
    hidden('gp_dd_back');
    if (intval(gp('gp_dd_back')) > 0 && $sessok) {
        // this is drillback
        $dd = ContextGet('drilldown', array());
        $back = intval(gp('gp_dd_back'));
        if (count($dd) >= $back) {
            $spot = count($dd) - $back;
            $aback = $dd[$spot];
            gpSet('gp_skey', $aback['skey']);
            gpSet('gp_page', $aback['page']);
            $gp_page = $aback['page'];
            gpSet('gpx_skey', $aback['skey']);
            gpSet('gpx_page', $aback['page']);
            gpSetFromArray('parent_', $aback['parent']);
            if (!gpExists('gp_mode')) {
                gpSet('gp_mode', 'upd');
            }
            $dd = $spot == 0 ? array() : array_slice($dd, 0, $spot);
            ContextSet('drilldown', $dd);
            ContextSet('drilldown_top', $aback['page']);
            //ContextSet('drilldown_level',count($dd));
        }
    }
    if (gp('gp_dd_page') != '' && $sessok) {
        // this is drilldown...
        $matches = DrillDownMatches();
        $matches = array_merge($matches, aFromGP('parent_'));
        $dd = ContextGet('drilldown', array());
        $newdd = array('matches' => $matches, 'parent' => aFromGP('parent_'), 'skey' => gp('gpx_skey'), 'page' => gp('gpx_page'));
        $dd[] = $newdd;
        ContextSet('drilldown', $dd);
        ContextSet('drilldown_top', gp('gp_dd_page'));
        //ContextSet('drilldown_level',count($dd));
        // having saved the stack, redirect to new page.
        $tnew = gp('gp_dd_page');
        $gp_page = $tnew;
        gpSet('gp_page', $tnew);
        if (gp('gp_dd_skey') != '') {
            gpSet('gp_skey', gp('gp_dd_skey'));
            gpSet('gp_mode', 'upd');
        }
        // Clear search of new page, set filters to blank
        processPost_TableSearchResultsClear($tnew);
        ConSet('table', $tnew, 'search', array());
    }
    // If no drilldown commands were received, and we are not on
    // the page that is the top, user must have picked a new page
    // altogether, wipe out the drilldown stack
    if (gp('gp_page') != ContextGet('drilldown_top', '')) {
        ContextSet('drilldown', array());
        ContextSet('drilldown_top', '');
    }
    // Must always have these on the user's form.  These can
    // be retired with x_Table, they are for old drilldown
    //
    hidden("dd_page", "");
    hidden("dd_ddc", "");
    hidden("dd_ddv", "");
    hidden("dd_ddback", "");
    hidden("dd_action", "searchexecute");
    hidden("dd_skey", "");
    // Load user preferences just before display
    UserPrefsLoad();
    $dir = $GLOBALS['AG']['dirs']['root'] . 'application/';
    if (file_exists($dir . $gp_page . ".page.yaml")) {
        include 'androPage.php';
        $obj_page = new androPage();
        if ($obj_page->flag_buffer) {
            ob_start();
        }
        $obj_page->main($gp_page);
        if ($obj_page->flag_buffer) {
            vgfSet("HTML", ob_get_clean());
            //ob_end_clean();
        }
        vgfSet("PageSubtitle", $obj_page->PageSubtitle);
    } else {
        $obj_page = DispatchObject($gp_page);
        if ($obj_page->flag_buffer) {
            ob_start();
        }
        $obj_page->main();
        if ($obj_page->flag_buffer && vgfGet('HTML') == '') {
            vgfSet("HTML", ob_get_contents());
            ob_end_clean();
        }
        vgfSet("PageSubtitle", $obj_page->PageSubtitle);
    }
    // Save context onto the page.  Note that it is not really
    // protected by these methods, just compressed and obscured.
    //
    $t2 = serialize($GLOBALS['AG']['clean']['gpContext']);
    $t2 = gzcompress($t2);
    $t2 = base64_encode($t2);
    Hidden('gpContext', $t2);
    // KFD 3/7/07, give the app the final opportunity to process
    //             things before the display, while logged in.
    if (function_exists('appdisplaypre')) {
        appDisplayPre();
    }
    // ...and write output and we are done.  Assume if there was
    // no buffering that the output is already done.
    if ($obj_page->flag_buffer != false) {
        // Work out what template we are using
        index_hidden_template('x2');
        // KFD 5/30/07, send back only main content if asked
        if (gp('ajxBUFFER') == 1) {
            echo "andromeda_main_content|";
            ehStandardContent();
            echo "|-|_focus|" . vgfGet('HTML_focus');
            $ajax = ElementReturn('ajax', array());
            echo '|-|' . implode('|-|', $ajax);
            echo '|-|_title|' . vgfGet('PageTitle');
        } elseif (defined('_VALID_MOS')) {
            // This is the default branch, using a Joomla template
            // DUPLICATE ALERT: This code copied into
            //          index_hidden_x4Dispatch() above
            global $J;
            $mainframe = $J['mainframe'];
            $my = $J['my'];
            $mosConfig_absolute_path = $J['mC_absolute_path'];
            $mosConfig_live_site = $J['mC_live_site'];
            $template_color = $J['template_color'];
            $template_color = 'red';
            $file = $GLOBALS['AG']['dirs']['root'] . '/templates/' . $mainframe->GetTemplate() . "/index.php";
            include $file;
        } elseif ($obj_page->html_template !== '') {
            // This is newer style, let the class specify the template.
            include $obj_page->html_template . '.php';
        } else {
            // This is old style, defaults to "html_main.php", can be
            // set also by vgaSet() or by gp(gp_out)
            $html_main = vgaGet('html_main') == '' ? 'html_main' : vgaGet('html_main');
            switch (CleanGet("gp_out", "", false)) {
                case "print":
                    include "html_print.php";
                    break;
                case "info":
                    include "html_info.php";
                    break;
                case "":
                    include $html_main . ".php";
                    break;
                default:
            }
        }
    }
}
示例#16
0
 function Curl($url, $sql, $col = '')
 {
     // Set up the parms of the array
     $parms = "?gp_uid=" . SessionGet('UID') . "&gp_pwd=" . SessionGet('PWD') . "&gp_col=" . $col . '&gp_sql=' . urlencode($sql);
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, "http://{$url}/andro/{$parms}");
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     $retval = curl_exec($ch);
     curl_close($ch);
     $retval = substr($retval, 0, strlen($retval) - 7);
     $retval = substr($retval, 6);
     $retval = unserialize($retval);
     return $retval;
 }
示例#17
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;
 }
示例#18
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 
    }
示例#19
0
    //}
    $link = vgaGet('menu_preferences', '');
    if ($link != '') {
        echo "&nbsp;&nbsp;&nbsp;";
        echo "<a href=\"javascript:formPostString('{$link}')\">";
        echo "Preferences</a>";
    }
} else {
    echo "not logged in";
}
?>
               </center>
               <hr style="width: 85%">
               </td></tr>
               <?php 
$menufile = 'menu_' . SessionGet('UID') . '.php';
if (FILE_EXISTS_INCPATH($menufile)) {
    include $menufile;
}
?>
            <tr><td class="menufiller">
                <br><br><br>
                </td></tr>
         </table>
      </td>
      <td id="tc-right">
        <?php 
echo ehStandardContent();
?>
      </td>
   </tr>
示例#20
0
/**
* Utility function to recursively work through a vertically indented
* hierarchial menu
*/
function mosRecurseListMenu($id, $level, &$children, $open, &$indents, $class_sfx, $highlight)
{
    global $Itemid;
    global $HTTP_SERVER_VARS, $mosConfig_live_site;
    if (@$children[$id]) {
        $n = min($level, count($indents) - 1);
        echo $indents[$n][0];
        foreach ($children[$id] as $row) {
            switch ($row->type) {
                case 'separator':
                    // do nothing
                    $row->link = "seperator";
                    break;
                case 'url':
                    if (eregi('index.php\\?', $row->link)) {
                        if (!eregi('Itemid=', $row->link)) {
                            $row->link .= '&Itemid=' . $row->id;
                        }
                    }
                    break;
                default:
                    $row->link .= "&Itemid={$row->id}";
                    break;
            }
            $li = "\n" . $indents[$n][1];
            /* ANDROMEDA CHANGE */
            if (defined('_ANDROMEDA_JOOMLA')) {
                $current_itemid = '';
                if ($row->id == SessionGet('AGMENU_MODULE')) {
                    if (vgfGet('menu_mode') != 'x4') {
                        $li = "<li class='active'>";
                    }
                }
            } else {
                $current_itemid = trim(mosGetParam($_REQUEST, 'Itemid', 0));
                if ($row->link != "seperator" && $current_itemid == $row->id || $row->id == $highlight || sefRelToAbs(substr($_SERVER['PHP_SELF'], 0, -9) . $row->link) == $_SERVER['REQUEST_URI'] || sefRelToAbs(substr($_SERVER['PHP_SELF'], 0, -9) . $row->link) == $HTTP_SERVER_VARS['REQUEST_URI']) {
                    $li = "<li class='active'>";
                }
            }
            echo $li;
            // KFD change 4/9/07, AJAX-ification effort
            //echo hjxCheckFirst($row->name,$row->link);
            //txt = "<a href=\"$mitem->link\">$mitem->name</a>";
            echo mosGetLink($row, $level, $class_sfx);
            mosRecurseListMenu($row->id, $level + 1, $children, $open, $indents, $class_sfx, "");
            echo $indents[$n][2];
        }
        echo "\n" . $indents[$n][3];
    }
}
示例#21
0
 function mainPull()
 {
     // Pull the tarball down
     $url = gp('gp_url');
     $app = gp('gp_app');
     x_EchoFlush("Pulling Reference Code for {$app} From {$url}");
     $wp = AppDir($app);
     $wp = "{$wp}/ref";
     if (!is_dir($wp)) {
         mkdir($wp);
     }
     x_echoFLush(" -> Purging out {$wp}");
     $cmd = "rm -r {$wp}/*";
     x_echoFLush(" -> Command is {$cmd}");
     `{$cmd}`;
     x_EchoFlush(" -> Waiting for file...");
     // Set up the parms of the array
     $parms = "?gp_uid=" . SessionGet('remoteUID') . "&gp_pwd=" . SessionGet('remotePWD') . "&gp_page=a_codexfer" . "&gp_app=" . $app . "&gp_action=devpull";
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, "http://{$url}/andro/{$parms}");
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     $retval = curl_exec($ch);
     //echo $retval;
     curl_close($ch);
     x_EchoFlush("");
     x_EchoFlush("Size of returned file was: " . hnumber(strlen($retval), 0) . " bytes");
     if (strlen($retval) < 5000) {
         x_EchoFlush("File contents were: ");
         hprint_r($retval);
     } else {
         // Save it and expand it
         file_put_contents($wp . "/devcode.tgz", $retval);
         x_EchoFlush(" -> Saving to {$wp}/devcode.tgz");
         //$command="tar xpzvf devcode.tgz";
         //chdir($wp);
         //x_EchoFlush(" -> Unpacking with this command: $command");
         //`$command`;
         x_EchoFlush(" -> Expanding file now");
         ExtractTGZ($wp . "/devcode.tgz", $wp);
         unlink($wp . "/devcode.tgz");
         x_EchoFlush(" -> Deleted devcode.tgz, all done");
     }
 }
示例#22
0
/**
name:SQLX_Insert
parm:string/array table
parm:array Row
parm:bool Rewrite_Skey
parm:bool Clip_Fields
returns:int

In its most basic form, this routine accepts a [[Row Array]]
and attempts to insert it into a table.  Upon success, the routine
returns the skey value of the new row.

The first entry can be either a [[Table Reference]] or the name of
a table.  The second entry is always a [[Row Array]].  This function
makes use of the dictionary to determine the correct formatting of all
columns, and ignores any column in the [[Row Array]] that is not
in the table.

The third parameter is used by the framework, and should always be
false.  If the third parameter is set to true, then this routine
executes a [[gpSet]] with the value of skey for the new row, making
it look like this row came from the browser.

If the fourth parameter is true, values are clipped to column width
to prevent overflows.  This almost guarantees the insert will succeed,
but should only be done if it is acceptable to throw away the ends of
columns.
*/
function SQLX_Insert($table, $colvals, $rewrite_skey = true, $clip = false)
{
    # KFD 6/12/08, use new and improved
    errorsClear();
    if (!is_array($table)) {
        $table = DD_TableRef($table);
    }
    $table_id = $table["table_id"];
    $view_id = ddTable_idResolve($table_id);
    $tabflat =& $table["flat"];
    $new_cols = "";
    $new_vals = "";
    foreach ($tabflat as $colname => $colinfo) {
        if (isset($colvals[$colname])) {
            //if($colvals[$colname]<>'') {
            if (DD_ColInsertsOK($colinfo, 'db')) {
                # KFD 6/18/08, % signs really mess things up
                #if(strpos($colvals[$colname],'%')!==false) {
                #    ErrorAdd("The % sign may not be in a saved value");
                #    vgfSet('ErrorRow_'.$table_id,$colvals);
                #    return 0;
                #}
                $cliplen = $clip ? $colinfo['colprec'] : 0;
                $new_cols .= ListDelim($new_cols) . " " . $colname;
                $new_vals .= ListDelim($new_vals) . " " . SQL_FORMAT($colinfo["type_id"], $colvals[$colname], $cliplen);
            }
            //}
        }
    }
    if (!Errors()) {
        $sql = "INSERT INTO " . $view_id . " ({$new_cols}) VALUES ({$new_vals})";
    }
    x4Debug($sql);
    x4Debug(SessionGet('UID'));
    // ERRORROW CHANGE 5/30/07, big change, SQLX_* routines now save
    //  the row for the table if there was an error
    $errflag = false;
    SQL($sql, $errflag);
    if ($errflag) {
        vgfSet('ErrorRow_' . $table_id, $colvals);
    }
    $notices = pg_last_notice($GLOBALS["dbconn"]);
    $retval = 0;
    $matches = array();
    # KFD 10/18/08. This venerable line has been quietly working forever,
    #               until today!  The problem turned out to be the table
    #               name had a number in it, which screwed it up!  So
    #               I've changed one line here.
    #preg_match_all("/SKEY(\D*)(\d*);/",$notices,$matches);
    preg_match_all("/SKEY(.*\\s)(\\d*);/iu", $notices, $matches);
    if (isset($matches[2][0])) {
        $retval = $matches[2][0];
        if ($rewrite_skey) {
            gpSet("gp_skey", $matches[2][0]);
            gpSet("gp_action", "edit");
        }
    }
    // Possibly cache the row
    $cache_pkey0 = vgfget('cache_pkey', array());
    $cache_pkey = array_flip($cache_pkey0);
    if (isset($cache_pkey[$table_id])) {
        CacheRowPut($table, $colvals);
    }
    return $retval;
}
		<table border="0" cellpadding="0" cellspacing="0" class="topleftgray">
			<tr>
			<td align="center" class="topleftmargin">
				<?php 
echo ValueGet("PageTitle");
?>
				<br />
				<img src="images/hrthing.jpg" width="200" height="2" border="0" alt="hrthing" />
				<br />
				<?php 
echo date('M-d-Y g:ia', time());
?>
 (NY Time)
				<br />
            <?php 
$uid = SessionGet("UID");
if ($uid) {
    echo "You are logged in as: <b>{$uid}</b>";
} else {
    echo 'You are not logged in';
}
?>
				<br />
				<img src="images/hrthing.jpg" width="200" height="2" border="0" alt="hrthing" />
				<br />
				<a href="index.php?st2logout=logout" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('logoutset','','images/logoutup.jpg',0)"><img src="images/logoutdown.jpg" alt="Log Out" name="logoutset" width="99" height="19" border="0" id="logoutset" /></a>
				<a href="index.php" target="_blank"  onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('newwindow','','images/newwindowup.jpg',0)"><img src="images/newwindowdown.jpg" alt="New Window" name="newwindow" width="99" height="19" border="0" id="newwindow" /></a>
			</td>
			</tr>
			
			<tr>
示例#24
0
    function mainLayout(&$container)
    {
        # load the javascript
        jsInclude("clib/androX4Menu.js");
        # Set focus if requested
        if (($focus = gp('x4Focus')) != '') {
            x4Script("\$('#x4Menu')[0].lastFocusId = 'x4menu_{$focus}'");
        }
        # Other miscellaneous commands
        vgfSet('suppress_hidden', true);
        //vgfSet('show_menu',false);
        # Fetch some text
        $h1 = configGet("x4menutitle", "Extended Desktop Menu");
        $text = configGet("x4menutext", "");
        ob_start();
        ?>
        <div id="x4Menu" class="x4Pane x4Menu">
        <center>
        <h1><?php 
        echo $h1;
        ?>
</h1>
        <?php 
        echo $text;
        ?>
        </center>
        <br/>
        <?php 
        $table = html('table');
        $table->hp['class'] = 'tab100';
        $tr = html('tr', $table);
        $array = SessionGet('AGMENU');
        $first = true;
        $letters = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z');
        $col = 0;
        $grid = array();
        foreach ($array as $module => $modinfo) {
            if (!$first) {
                $td = html('td', $tr);
                $td->hp['style'] = 'width: 10px';
            }
            $first = false;
            $td = html('td', $tr);
            $td->hp['class'] = 'style1';
            $h3 = html('h3', $td);
            $h3->setHtml($letters[$col] . ') ' . $modinfo['description']);
            $row = 0;
            foreach ($modinfo['items'] as $page => $info) {
                // Add the link
                $a = html('a', $td);
                $a->hp['id'] = 'x4menu_' . $page;
                $a->hp['href'] = "?x4Return=menu&x4Page={$page}";
                $a->setHTML($row . ') ' . $info['description']);
                $a->hp['onkeyup'] = "return \$a.byId('x4Menu').x4KeyUp(event,{$col},{$row})";
                $a->hp['onkeydown'] = "return false;";
                $a->hp['onmouseover'] = '$(this).focus()';
                $a->hp['onfocus'] = "this.className = 'x4MenuOn'";
                $a->hp['onblur'] = "this.className = ''";
                $grid[$col][$row] = 'x4menu_' . $page;
                $row++;
                // Add a BR
                html('br', $td);
            }
            $col++;
        }
        $table->render();
        echo "</div>";
        # put out the grid and set the HTML
        x4data('grid', $grid);
        $container->setHTML(ob_get_clean());
    }