Beispiel #1
0
 /**
  *  Standard Andromeda main entry point for an
  *  extension of the x_table2 class.
  * 
  */
 function main()
 {
     if (gpExists('gp_out')) {
         ob_start();
         $this->mainPull();
         ob_end_clean();
     } else {
         $this->mainHTML();
     }
 }
Beispiel #2
0
 function main()
 {
     if (gpExists('gp_posted')) {
         return $this->mainDoIt();
     }
     # The basic idea here is to get all user-group assignments
     # from the old instance, and prompt the user
     $groups = SQL_AllRows("select * from zdd.groups", 'group_id');
     $groupsx = SQL_AllRows("Select distinct group_id from usersxgroups", 'group_id');
     $html = html('div');
     $html->h('h1', 'User Migration');
     $html->h('p', 'Use this program after you have migrated a database
         from one server to another.  It will create all users and
         put them into the correct groups.');
     $html->h('p', '<B>This works only for "simple" password systems.</b>');
     $html->h('h3', 'Group Reconciliation');
     $html->h('p', 'Please tell me how to re-assign groups:');
     $table = $html->h('table');
     $tbody = $table->h('tbody');
     $tr = $tbody->h('tr');
     $tr->h('Anybody In this Group:');
     $tr->h('Put into this group:');
     foreach ($groupsx as $groupx => $x) {
         $tr = $tbody->h('tr');
         $td = $tr->h('td', $groupx);
         $td = $tr->h('td', '&nbsp;&nbsp;&nbsp;&nbsp;');
         if (isset($groups[$groupx])) {
             $input = html('input');
             $input->hp['value'] = $groupx;
             $input->hp['readonly'] = true;
             $input->hp['style'] = 'border: 0';
         } else {
             $input = html('select');
             foreach ($groups as $group => $x) {
                 $option = $input->h('option', $group);
                 $option->hp['value'] = $group;
             }
         }
         $input->hp['name'] = 'grp_' . $groupx;
         $td = $tr->h('td');
         $td->addChild($input);
     }
     $html->hidden('gp_page', 'userssimple');
     $html->hidden('gp_posted', 1);
     $html->br(3);
     $but = $html->h('input');
     $but->hp['type'] = 'submit';
     $but->hp['value'] = 'Run Now';
     $html->br(2);
     $p = $html->h('p', '<b>Please give the program up to five minutes to run.</p>');
     $p->hp['style'] = 'color: red';
     $html->render();
 }
Beispiel #3
0
 /**
  *  Standard Andromeda main entry point for an
  *  extension of the x_table2 class.
  * 
  */
 function main()
 {
     # KFD 4/15/08, overhaul to go app-by-app on downloads
     #if(gpExists('gp_set')) $this->mainDevSet();
     # KFD 4/15/08, overhaul to go app-by-app on downloads
     #$dev_station = OptionGet('DEV_STATION');
     #if($dev_station=='') return $this->mainPick();
     #if($dev_station=='Y') return $this->mainNotAllowed();
     if (gpExists('svnpull')) {
         return $this->mainPull();
     } else {
         $this->mainHTML();
     }
 }
Beispiel #4
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();
 }
Beispiel #5
0
 /**
  *  Generate the SQL expression for each section by
  *  examining the table/column information.  This routine
  *  actually recurses the sections and invokes genSQLSection
  *  for each one.
  *
  *  @access private
  */
 function genSQL()
 {
     if (ArraySafe($this->yamlP2['options'], 'noquery', 'N') == 'N') {
         // Get the values from the UI Filter fields into a temp array,
         // for use below in the column list building
         $uifilter = ArraySafe($this->yamlP2, 'uifilter', array());
         foreach ($uifilter as $colname => $info) {
             if (gpExists('ap_' . $colname)) {
                 $this->yamlP2['uifilter'][$colname]['value'] = gp('ap_' . $colname);
             } elseif (isset($info['table'])) {
                 $gp = 'x4inp_' . $info['table'] . '_' . $info['column'];
                 $this->yamlP2['uifilter'][$colname]['value'] = gp($gp);
             }
         }
         foreach ($this->yamlP2['section'] as $secname => $info) {
             $this->yamlP2['section'][$secname]['sql'] = $this->genSQLSection($secname);
         }
     }
 }
Beispiel #6
0
 /**
  * Generate search results for an x4browse/search
  *
  * @author: Kenneth Downs
  */
 function browseFetch()
 {
     #  This is the list of columns to return
     $acols = explode(',', $this->dd['projections']['_uisearch']);
     #  By default the search criteria come from the
     #  variables, unless it is a child table search
     $vals = aFromGP('x4w_');
     $awhere = array();
     $tabPar = gp('tableIdPar');
     if ($tabPar != '') {
         $ddpar = ddTable(gp('tableIdPar'));
         $pks = $ddpar['pks'];
         $stab = ddView(gp('tableIdPar'));
         $skey = SQLFN(gp('skeyPar'));
         $vals2 = SQL_OneRow("SELECT {$pks} FROM {$stab} WHERE skey = {$skey}");
         if (!$vals2) {
             $vals2 = array();
         }
         $vals = array_merge($vals, $vals2);
     }
     # Build the where clause
     #
     foreach ($vals as $column_id => $colvalue) {
         if (!isset($this->flat[$column_id])) {
             continue;
         }
         $colinfo = $this->flat[$column_id];
         $exact = isset($vals2[$column_id]);
         //$tcv  = trim($colvalue);
         $tcv = $colvalue;
         $type = $colinfo['type_id'];
         if ($tcv != "") {
             // trap for a % sign in non-string
             $xwhere = sqlFilter($this->flat[$column_id], $tcv);
             if ($xwhere != '') {
                 $awhere[] = "({$xwhere})";
             }
         }
     }
     # <----- RETURN
     if (count($awhere) == 0) {
         x4Debug("returning");
         return;
     }
     # Generate the limit
     # KFD 11/12/08, modified to respect sql_limit, with default of 100
     $SLimit = ' LIMIT ' . configGet('sql_limit', 100);
     if ($tabPar != '') {
         if (a($this->dd['fk_parents'][$tabPar], 'uiallrows', 'N') == 'Y') {
             $SLimit = '';
         }
     }
     #  Build the Order by
     #
     $ascDesc = gp('sortAD') == 'ASC' ? ' ASC' : ' DESC';
     $aorder = array();
     $searchsort = trim(a($this->dd, 'uisearchsort', ''));
     if (gpExists('sortAD')) {
         $aorder[] = gp('sortCol') . ' ' . gp('sortAD');
     }
     if ($searchsort != '') {
         $aocols = explode(",", $searchsort);
         foreach ($aocols as $pmcol) {
             $char1 = substr($pmcol, 0, 1);
             $column_id = substr($pmcol, 1);
             if ($char1 == '+') {
                 $aorder[] = $column_id . ' ASC';
             } else {
                 $aorder[] = $column_id . ' DESC';
             }
         }
         $SQLOrder = " ORDER BY " . implode(',', $aorder);
     } else {
         # KFD 6/18/08, new routine that works out sort
         $aorder = sqlOrderBy($vals);
         if (count($aorder) == 0) {
             $SQLOrder = '';
         } else {
             $SQLOrder = " ORDER BY " . implode(',', $aorder);
         }
     }
     # just before building the query, drop out
     # any columns that have a table_id_fko to the parent
     foreach ($acols as $idx => $column_id) {
         if ($this->flat[$column_id]['table_id_fko'] == $tabPar && $tabPar != '') {
             unset($acols[$idx]);
         }
     }
     // Build the where and limit
     $SWhere = ' WHERE ' . implode(' AND ', $awhere);
     // Retrieve data
     $SQL = "SELECT skey," . implode(',', $acols) . "  FROM " . $this->view_id . $SWhere . $SQLOrder . $SLimit;
     $answer = SQL_AllRows($SQL);
     $this->browseFetchModify($answer);
     x4Data('browseFetch', $answer);
     return;
 }
Beispiel #7
0
    function xajax()
    {
        if (gp('gp_xajax') != '1') {
            return $this->xAjaxColSave();
        }
        // No conditionals here, this is always ajax
        echo "xajax|";
        $tid = gp('gp_table_id');
        $parms['gp_table_id'] = $tid;
        $parms['gp_page'] = 'x_import';
        $parms['gp_xajax'] = '1';
        $parms['gp_map'] = gp('gp_map', '');
        //$a1=aFromgp('gp_');
        //hprint_r($a1);
        //$a2=aFromgp('txt_');
        //hprint_r($a2);
        // Look for a map delete command
        if (gpExists('gp_del')) {
            SQL("Delete from importmaps where importmap=" . SQLFC(gp('gp_del')));
            if (gp('gp_del') == gp('gp_map')) {
                gpSet('gp_map', '');
                $parms['gp_map'] = '';
            }
        }
        // Look for a map insert command. If found and works, automatically
        // select this as the map we want.
        $row = aFromGP('txt_');
        if (count($row) > 0 && gpExists('gp_new')) {
            $dd = DD_TableRef('importmaps');
            $row['table_id'] = gp('gp_table_id');
            SQLX_Insert($dd, $row);
            if (!Errors()) {
                gpSet('gp_map', $row['importmap']);
                $parms['gp_map'] = gp('gp_map');
            }
        }
        // Display a list of maps we may use
        $maps = SQL_AllRows("Select importmap,name_prefix from importmaps\n           where table_id=" . SQLFC($tid), 'importmap');
        //hprint_r($maps);
        ?>

      <h2>Map Selection</h2>
      
      <p>Please choose a map to use.  If no map exists, please create
         a new one.  After a map is chosen you can map individual columns.
      </p>
      
      <table id="x2data1">
        <thead>
          <tr><th>Map Name
              <th>Select
              <th>Delete
        </thead>
        <tbody>
      <?php 
        foreach ($maps as $map) {
            $px = $parms;
            $px['gp_map'] = $map['importmap'];
            $hp1 = http_build_query($px);
            $px['gp_del'] = $map['importmap'];
            $hp2 = http_build_query($px);
            echo $map['importmap'] == $parms['gp_map'] ? '<tr class="hilite">' : '<tr>';
            ?>
         <td><?php 
            echo $map['importmap'];
            ?>
         <td><a href="javascript:andrax('?<?php 
            echo $hp1;
            ?>
')">Select</a>
         <td><a href="javascript:andrax('?<?php 
            echo $hp2;
            ?>
')">Delete</a>
         <?php 
        }
        // Now the row for a new entry
        $px = $parms;
        $px['gp_new'] = 1;
        $hp = "'?" . http_build_query($px);
        $hp .= "&txt_importmap='+ob('txt_importmap').value";
        ?>
         <tr><td><input name="txt_importmap"   id="txt_importmap">
             <td>&nbsp;
             <td><a href="javascript:andrax(<?php 
        echo $hp;
        ?>
)">Create</a>
      </table>
      <?php 
        // If they have not picked a map, we are done.  If we continue
        // we will let them pick individual columns.
        if ($parms['gp_map'] == '') {
            return;
        }
        // Get column listing from dictionary
        $dd = DD_TableRef(gp('gp_table_id'));
        $cols = array_keys($dd['flat']);
        // Get cols available from import
        $fi = SessionGet('importfile');
        $FILE = fopen($fi['uname'], 'r');
        $sline = fsGets($FILE);
        $aline = explode('|', $sline);
        array_unshift($aline, '');
        $aline = array_combine($aline, $aline);
        // make keys and values the same
        fclose($FILE);
        // Get current map
        $mapcols = SQL_AllRows("Select column_id,column_id_src FROM importmapcolumns\n           WHERE importmap=" . SQLFC(gp('gp_map')) . "\n             AND table_id =" . SQLFC(gp('gp_table_id')), 'column_id');
        ?>
      <hr />
      <h2>Individual Column Mappings</h2>
      <table id="x2data1">
        <thead><tr><th>Destination Column</td>
                   <th>Caption</td>
                   <th>Source Column</td>
        </thead>
        <tbody>
      <?php 
        foreach ($cols as $col) {
            $value = ArraySafe($mapcols, $col, array());
            $value = ArraySafe($value, 'column_id_src', '');
            $px = $parms;
            $px['gp_xajax'] = $col;
            $andrax = "?" . http_build_query($px);
            $extra = "onchange=\"andrax('{$andrax}&gp_xval='+this.value)\"";
            $hSelect = hSelectFromAA($aline, 'anycol', $value, $extra);
            if ($dd['flat'][$col]['uino'] != 'Y') {
                ?>
            <tr><td><?php 
                echo $col;
                ?>
                <td><?php 
                echo $dd['flat'][$col]['description'];
                ?>
                <td><?php 
                echo $hSelect;
                ?>
            <?php 
            }
        }
        ?>
        </tbody>
      </table>
      <?php 
        $href = '?gp_page=x_import&gp_table_id=' . $tid . '&gp_fbproc=1' . '&gp_map=' . $parms['gp_map'];
        ?>
      <hr />
      <h2>File Process</h2>
      
      <p>The file <?php 
        echo $fi['name'];
        ?>
 was uploaded, size 
         <?php 
        echo number_format($fi['size']);
        ?>
 bytes.
      </p>
      
      <p><a href="javascript:SetAndPost('gp_nofile',1)">
         Upload A Different File
         </a>
      </p>  
         
      <p><a href="javascript:Popup('<?php 
        echo $href;
        ?>
')">Process Now</a>
      </p>
      
      <?php 
    }
Beispiel #8
0
 function custom_construct()
 {
     if (gpExists('gp_posted')) {
         $this->flag_buffer = false;
     }
 }
Beispiel #9
0
 function hBoxes($mode)
 {
     // Obtain a row depending on the mode we are in.  If there
     // wdas an error then reload the first row for this table
     if (is_array(vgfGet('ErrorRow_' . $this->table_id, ''))) {
         $row = vgfGet('ErrorRow_' . $this->table_id);
         $row['skey'] = gp('gpx_skey');
     } else {
         switch ($mode) {
             case 'search':
                 // if a previous search, use that, else fall through
                 // to using current row
                 $row = ConGet('table', $this->table_id, 'search', array());
                 if (count($row) != 0) {
                     break;
                 }
             case 'ins':
                 $row = DrillDownMatches();
                 if (count($row) == 0) {
                     $row = aFromGP('pre_');
                 }
                 // KFD 8/13/07, part of COPY ability
                 if (gp('gp_action') == 'copy') {
                     $row2 = SQL_OneRow("SELECT * FROM " . $this->table_id . " where skey=" . SQLFN(gp('gp_skey')));
                     foreach ($row2 as $column_id => $colvalue) {
                         if (is_numeric($column_id)) {
                             continue;
                         }
                         if (!isset($this->table['flat'][$column_id])) {
                             continue;
                         }
                         $aid = $this->table['flat'][$column_id]['automation_id'];
                         if ($aid == 'SEQUENCE' || $column_id == gp('gp_exclude')) {
                             unset($row2[$column_id]);
                         }
                     }
                     $row = array_merge($row, $row2);
                 }
                 break;
             case 'upd':
                 $skey = gp('gp_skey');
                 hidden('gp_skey', '');
                 if (trim($skey) == '') {
                     $row = array();
                 } else {
                     $skey = " WHERE skey=" . $skey;
                     $sq = "Select * FROM " . $this->view_id . $skey;
                     $row = SQL_OneRow($sq);
                 }
         }
     }
     // Save the row for other routines
     $this->row = $row;
     // Find out what skey we are on, give a next/prev
     // kind of button for stuff like that.
     // Set the next/prev stuff based on rows
     $HTML_PagePrev = $HTML_PageNext = $HTML_ViewingPage = "";
     if ($mode == "upd") {
         $lprev = $lnext = false;
         $skey = $this->row['skey'];
         $sess_skeys = ConGet("table", $this->table_id, "skeys", array());
         if (count($sess_skeys) > 1) {
             $sess_srows = array_flip($sess_skeys);
             $sess_srow = $sess_srows[$row['skey']];
             $lprev = $sess_srow == 0 ? false : true;
             $skeyf = $sess_srow == 0 ? 0 : $sess_skeys[0];
             $skeyp = $sess_srow == 0 ? 0 : $sess_skeys[$sess_srow - 1];
             $skeyn = $sess_srow >= count($sess_srows) - 1 ? 0 : $sess_skeys[$sess_srow + 1];
             $skeyl = $sess_srow >= count($sess_srows) - 1 ? 0 : $sess_skeys[count($sess_srows) - 1];
             $hprev = hLinkImage('first', 'First', 'gp_skey', $skeyf, $lprev) . hLinkImage('previous', 'Previous', 'gp_skey', $skeyp, $lprev);
             $lnext = $sess_srow < count($sess_srows) - 1 ? true : false;
             $hnext = hLinkImage('next', 'Next', 'gp_skey', $skeyn, $lnext) . hLinkImage('last', 'Last', 'gp_skey', $skeyl, $lnext);
             $HTML_ViewingPage = "Page " . ($sess_srow + 1) . " of " . count($sess_srows);
         }
     }
     // Output and save the navbar
     ob_start();
     if ($HTML_ViewingPage != '') {
         $hprev = $this->hTextButton('\\First', 'gp_skey', $skeyf, $lprev) . $this->hTextButton('\\Previous', 'gp_skey', $skeyp, $lprev);
         $hnext = $this->hTextButton('Ne\\xt', 'gp_skey', $skeyn, $lnext) . $this->hTextButton('Las\\t', 'gp_skey', $skeyl, $lnext);
         if (vgfget('buttons_in_commands')) {
             $this->h['NavBar'] = '';
             vgfSet('html_navbar', $hprev . $hnext);
         } else {
             $this->h['NavBar'] = "\n<div class=\"x2menubar\">\n" . $hprev . $HTML_ViewingPage . "&nbsp;&nbsp;&nbsp;" . $hnext . "\n</div><br>";
         }
     }
     // Second output is main content
     // KFD 8/9/07, Project DUPECHECK
     //             If a "dupecheck" projection exists, and they are
     //             doing a new entry, we first ask them to enter
     //             those values
     $dc = ArraySafe($this->table['projections'], 'dupecheck');
     if ($dc != '' && $mode == 'ins' && !gpExists('gp_nodupecheck')) {
         hidden('gp_action', 'dupecheck');
         $this->h['Content'] = $this->hBoxesX3($mode, 'dupecheck');
         $this->h['Content'] .= '<br/><br/>' . '<button  class="btn btn-primary id="object_for_enter" onclick="formSubmit()">(ENTER) Check For Duplicates</button>';
     } else {
         $this->h['Content'] = $this->hBoxesDefault($mode);
     }
 }
Beispiel #10
0
function x4index_page($x4xPage)
{
    // Begin by loading the data dictionary.  If there is
    // none, not to worry, it comes back blank.
    $ref = ddTable($x4xPage, true);
    if (isset($ref['projections'])) {
        foreach ($ref['projections'] as $key => $list) {
            $ref['aProjections'][$key] = explode(',', $list);
        }
    }
    // Now check for a custom page and its various tricks.
    global $AGdir;
    if (file_exists("{$AGdir}/application/{$x4xPage}.php")) {
        include "{$AGdir}/application/{$x4xPage}.php";
        $oPage = new $x4xPage();
        // KFD 12/31/07 (Happy new year!) If a server-side method
        //              call, branch out to that instead.  Second
        //              half of branch is all default stuff.
        //
        if (gpExists('x4xMethod')) {
            $method = gp('x4xMethod');
            if (method_exists($oPage, $method)) {
                $ref['x'] = 0;
                // prevents "Page not found" error,
                // even if nothing happens in code
                $oPage->{$method}();
            } else {
                ri('message', 'error', 'Page Method Not found: ' . $x4xPage . '.' . $method);
            }
        } else {
            // execute the build code if there
            if (method_exists($oPage, 'build')) {
                $oPage->build($ref);
            }
            // load literal html if it is there
            if (method_exists($oPage, 'pageHTML')) {
                ob_start();
                $oPage->pageHTML();
                $ref['HTML'] = ob_get_clean();
            }
            // Load a script if it is there
            if (method_exists($oPage, 'pageScript')) {
                ob_start();
                $oPage->pageScript();
                $ref['Script'] = ob_get_clean();
                $ref['Script'] = str_replace('<script>', '', $ref['Script']);
                $ref['Script'] = str_replace('</script>', '', $ref['Script']);
            }
        }
    }
    // An empty array means nothing was loaded, we
    // have a bad page request
    if (count($ref) == 0) {
        ri('message', 'error', 'Page Not found');
    }
    ReturnItem('page', 'data', $ref);
    return;
}
Beispiel #11
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;
 }
Beispiel #12
0
 function mainMD5()
 {
     if (gpexists('md5') && !gpExists('gpp')) {
         gpSet('gpp', '2');
     }
     $gpp = gp('gpp');
     if (gp('gpp') == '3') {
         $this->MD5_ForgotPage3();
     }
     // process new pw
     if (gp('gpp') == '2') {
         $this->MD5_ForgotPage2();
     }
     // link back
     if (gp('gpp') == '1') {
         $this->MD5_ForgotPage1();
     }
     // send email
     if (Errors() || $gpp == '') {
         $this->MD5_ForgotPage0();
     }
     // get info
     Hidden("gp_page", "x_password");
 }
Beispiel #13
0
 function browseFetch()
 {
     $mtime = microtime(true);
     $table_id = $this->dd['table_id'];
     $tabPar = gp('tableIdPar');
     #  This is the list of columns to return.  Maybe override
     #  if there is something specific named for this table
     $acols = explode(',', $this->dd['projections']['_uisearch']);
     if ($tabPar != '') {
         if (isset($this->dd['projections']['child_' . $tabPar])) {
             $acols = explode(',', $this->dd['projections']['child_' . $tabPar]);
         }
     }
     #  By default the search criteria come from the
     #  variables, unless it is a child table search
     $vals = aFromGP('x6w_');
     $awhere = array();
     $projSort = '';
     if ($tabPar == '') {
         $vals2 = array();
     } else {
         $vals2 = $this->fetchParent();
         $vals = array_merge($vals, $vals2);
         # KFD 12/27/08, if the sortdesc flag has been set on any
         #               columns in the projection, those columns
         #               become the default sort.  Work it up here
         #               and set them aside.
         $proj = 'child_' . $tabPar;
         $aprojSort = array();
         if (isset($this->dd['projdetails'][$proj])) {
             foreach ($this->dd['projdetails'][$proj] as $column => $sortasc) {
                 if ($sortasc == 'Y') {
                     $aprojSort[] = "+{$column}";
                 }
                 if ($sortasc == 'N') {
                     $aprojSort[] = "-{$column}";
                 }
             }
         }
         $projSort = implode(",", $aprojSort);
     }
     # Build the where clause
     #
     $this->flat = $this->dd['flat'];
     $allowNoFilters = false;
     foreach ($vals as $column_id => $colvalue) {
         if (!isset($this->flat[$column_id])) {
             continue;
         }
         if ($colvalue == '*') {
             $awhere = array();
             # KFD 2/17/09 Sourceforge 2609083
             #             Doing this returned all rows on regular
             #             searches.  Whatever it was for, it cannot
             #             be done here this way.
             #gpSet('xReturnAll','Y');
             $allowNoFilters = true;
             break;
         }
         $colinfo = $this->flat[$column_id];
         $exact = isset($vals2[$column_id]);
         $expre = gp('x6exactPre', 0);
         //$tcv  = trim($colvalue);
         $tcv = $colvalue;
         $type = $colinfo['type_id'];
         if ($tcv != "") {
             if ($exact) {
                 gpSet('x6exactPre', 1);
             }
             // trap for a % sign in non-string
             $xwhere = sqlFilter($this->flat[$column_id], $tcv);
             if ($xwhere != '') {
                 $awhere[] = "({$xwhere})";
             }
             if ($exact && $expre == 0) {
                 gpUnset('x6exactpre');
             }
         }
     }
     # <----- RETURN (MAYBE)
     #        Sourceforge 2612788 - this is actually an exit, not
     #        a return.
     if (count($awhere) == 0) {
         if (gp('xReturnAll', 'N') == 'N' && !$allowNoFilters) {
             exit;
         }
     }
     # Generate the limit
     $SLimit = ' LIMIT 100';
     if ($tabPar != '') {
         if (a($this->dd['fk_parents'][$tabPar], 'uiallrows', 'N') == 'Y') {
             $SLimit = ' LIMIT 100';
         }
     }
     if (gp('xReturnAll', 'N') == 'Y') {
         $SLimit = '';
     }
     #  Build the Order by
     #
     $ascDesc = gp('sortAD') == 'ASC' ? ' ASC' : ' DESC';
     $aorder = array();
     $searchsort = '';
     if (gpExists('sortAsc')) {
         x6Debug(gp('sortAsc'));
         $ascDesc = gp('sortAsc') == 'true' ? ' ASC' : ' DESC';
         $aorder[] = gp('sortCol') . ' ' . gp('sortAD');
     } else {
         # KFD 12/27/08, Use the search sort that was
         #               set aside above if it is there
         $searchsort = $projSort == '' ? trim(arr($this->dd, 'uisearchsort', '')) : $projSort;
     }
     if ($searchsort != '') {
         $aocols = explode(",", $searchsort);
         foreach ($aocols as $pmcol) {
             $char1 = substr($pmcol, 0, 1);
             $column_id = substr($pmcol, 1);
             if ($char1 == '+') {
                 $aorder[] = $column_id . ' ASC';
             } else {
                 $aorder[] = $column_id . ' DESC';
             }
         }
         $SQLOrder = " ORDER BY " . implode(',', $aorder);
     } else {
         # KFD 6/18/08, new routine that works out sort
         $aorder = sqlOrderBy($vals);
         if (count($aorder) == 0) {
             $SQLOrder = '';
         } else {
             $SQLOrder = " ORDER BY " . implode(',', $aorder);
         }
     }
     # just before building the query, drop out
     # any columns that have a table_id_fko to the parent
     foreach ($acols as $idx => $column_id) {
         if ($this->flat[$column_id]['table_id_fko'] == $tabPar && $tabPar != '') {
             unset($acols[$idx]);
         }
     }
     // Build the where and limit
     if (count($awhere) == 0) {
         $SWhere = '';
     } else {
         $SWhere = ' WHERE ' . implode(' AND ', $awhere);
     }
     // Retrieve data
     #$SQL ="SELECT skey,".implode(',',$acols)
     # KFD 11/15/08.  We can actually select *, because the grid
     #                works out what columns it needs, and we
     #                don't want to accidentally reduce the column
     #                list and exclude something it needs.
     $SQL = "SELECT * " . "  FROM " . $this->dd['viewname'] . $SWhere . $SQLOrder . $SLimit;
     $answer = SQL_AllRows($SQL);
     # These parameters have to be sent from the back.  They
     # figure everything out.
     $sortable = gp('xSortable', 'N') == 'Y';
     $gridHeight = gp('xGridHeight', 500);
     $lookups = gp('xLookups', 'N') == 'Y';
     $edit = 0;
     $childedit = in_array($this->dd['x6childwrites'], array('Y', 'grid'));
     if ($tabPar != '' && $childedit) {
         $edit = 1;
     }
     # The button bar is either a 1/0 or a list of buttons.
     # Make the simple setting first, then possibly override
     $bb = gp('xButtonBar', 'N') == 'Y' || $edit;
     if ($tabPar != '' && $this->dd['x6childwrites'] == 'detail') {
         $bb = 'new';
     }
     # Now grab us a grid
     $grid = new androHTMLGrid($gridHeight, $table_id, $lookups, $sortable, $bb, $edit);
     $this->gridGeneric($grid, $this->dd, $tabPar, $vals2);
     $grid->addData($answer);
     $grid->hp['x6profile'] = 'grid';
     # Put some important properties on the grid!
     $grid->ap['xGridHeight'] = $gridHeight;
     $grid->ap['xReturnAll'] = gp('xReturnAll', 'N');
     if ($tabPar != '') {
         $grid->ap['x6tablePar'] = $tabPar;
     }
     # If they asked for the entire grid, send it back
     # as *MAIN* and let the browser put it where it belongs
     if (gp('sendGrid', 0) == 1) {
         if (count($answer) == 0) {
             $grid->noResults();
         }
         x6html('*MAIN*', $grid->bufferedRender());
         return;
     }
     # ..otherwise just send the body back.  But kill
     #   any script they created.
     if (count($answer) == 0) {
         $grid->noResults();
     }
     $mtimer = microtime(true);
     $grid->dbody->render();
     exit;
 }
 /**
  * Puts a value into a specific column.
  *
  * @param int $col  Column position, zero indexed.  Columns
  *                  must be defined already by a call to
  *                  setupColumns().
  * @param string $text Value to write.  Numerics and dates
  *                     must be formatted into the string
  *                     representation you want.
  * @param string $titles This is true when a line of titles
  *                       is being written.  Suppresses conversion
  *                       of values like numbers and dates.
  */
 function AtCol($col, $text, $titles = false, $last = false)
 {
     if (!isset($this->cols[$col])) {
         echo "<b>ERROR: Output past last column, did you \n            forget a \$this->nextLine()?";
         exit;
     }
     // work out the x position in points, don't mess with y
     $xposition = $this->cols[$col]['xpos'];
     $width = $this->cols[$col]['width'];
     $align = $this->cols[$col]['align'];
     if ($this->cols[$col]['clip'] != 0) {
         # KFD 1/23/09, do not clip if x6 and onscreen
         if (!($this->format == 'onscreen' && $this->x6)) {
             $text = substr($text, 0, $this->cols[$col]['clip']);
         }
     }
     // if a money column, reformat value, unless it
     // looks like a
     //if($this->cols[$col]['money'] && !$titles) {
     //     $text = number_format($text);
     //}
     if ($this->cols[$col]['colscale'] > 0 && !$titles) {
         $colscale = $this->cols[$col]['colscale'];
         $text = number_format($text, $colscale);
     }
     # Onscreen version: just output a table cell
     # PDF version: output a cell and advance column counter
     if ($this->format == 'csvexport') {
         $this->csvline[] = $text;
     } elseif ($this->format == 'onscreen') {
         $class = '';
         if ($last) {
             $text .= "&nbsp;&nbsp;&nbsp;";
         }
         if (a($this->md[$col], 'linkpage') != '' && !$titles) {
             $class = 'class="link"';
             $link = $this->md[$col]['linkpage'];
             $lsky = a($this->md[$col], 'linkskey', 'N');
             if ($lsky == 'Y') {
                 $href = '&gp_skey=' . $this->skey;
             } else {
                 $href = '&pre_' . $this->md[$col]['linkcolumn'] . '=' . $text;
             }
             if ($this->source != '') {
                 $href .= '&gp_source=' . $this->source;
             }
             if ($this->x6) {
                 $ahref = "?x6page={$link}{$href}&x6return=exit";
                 $text = "<a href='javascript:x6.openWindow(\"{$ahref}\")'\n                        >{$text}</a>";
             } else {
                 if (gpExists('x4Page')) {
                     $ahref = "?x4Page={$link}{$href}&x4Return=exit";
                     $text = "<a href='javascript:\$a.openWindow(\"{$ahref}\")'\n                        >{$text}</a>";
                 } else {
                     $text = "<a href='?gp_page={$link}{$href}'>{$text}</a>";
                 }
             }
         }
         $align = $align == 'R' ? 'right' : 'left';
         $final = "<td {$class} style=\"text-align: {$align}\">{$text}</td>";
         if ($this->x6) {
             $this->grid->addCell($final, '', '', false);
         } else {
             echo $final;
         }
     } else {
         $this->Setx($xposition);
         $this->Cell($width, 0, $text, 0, 0, $align);
     }
     $this->lastCol = $col;
 }
Beispiel #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:
            }
        }
    }
}
Beispiel #16
0
    function main()
    {
        switch (gp('gp_action')) {
            case 'pull':
                $this->mainPull();
                break;
            case 'over':
                $this->mainOver();
                break;
            case 'diff':
                $this->mainDiff();
                break;
        }
        if (gp('gp_action') != '') {
            return;
        }
        if (gpExists('gp_clearremote')) {
            SessionSet('remoteUID', '');
            SessionSet('remotePWD', '');
            SessionSet('remoteNODE', '');
        }
        // Need this basic stuff for everything
        $skey = gp('gp_skey');
        hidden('gp_skey', $skey);
        hidden('gp_page', 'a_scontrol');
        $row = SQL_OneRow("Select * from applications WHERE skey={$skey}");
        $App = trim($row['application']);
        $sApp = SQLFC($App);
        $node = SQL_OneRow("Select * from nodes WHERE node=" . SQLFC($row['node']));
        $this->row = $row;
        $this->node = $node;
        // Some file functions execute before showing the screen, because
        // they affect what is displayed on the screen
        switch (gp('gpfa')) {
            case 'patch':
                $this->Patch();
                break;
            case 'overlocal':
                $this->OverLocal();
                break;
            case 'servsend':
                $this->ServerSend();
                break;
            case 'servdel':
                $this->ServerDel();
                break;
        }
        $h1 = "?gp_page=a_scontrol" . "&gp_action=pull&gp_url=" . $node['node_url'] . "&gp_app=" . $App;
        $h2 = "?gp_page=a_scontrol&gp_action=over";
        $h3 = "?gp_page=a_scontrol&gp_skey={$skey}";
        ?>
      <h1>Source Code Operations</h1>
      <p>For application 
         <a href="?gp_page=applications&gp_skey=<?php 
        echo $skey;
        ?>
"><?php 
        echo $App;
        ?>
</a>.
      </p>
      <?php 
        echo sourceDeprecated();
        ?>
      <?php 
        if (!$this->CheckRemoteUID($node['node'])) {
            return;
        }
        ?>

      <p><a href="javascript:formPostString('x=y')">Refresh This Page</a></p>
      <p>The Authoritative Node for this application is 
         <?php 
        echo $node['node'];
        ?>
 at <?php 
        echo $node['node_url'];
        ?>
.
         You are using username <b><?php 
        echo SessionGet('remoteUID');
        ?>
</b> on
         the remote node.
         <a href="javascript:formPostString('gp_clearremote=1')">Connect as New User</a>.
      </p>
      <br>
      
      <style>table.sc td { padding: 3px; }</style>
      <table cellpadding=0 cellspacing=0 class="sc">
        <tr><td class="dhead" width=100>Function</td>
            <td class="dhead">Details</td>
        <tr><td>
            <a href="javascript:Popup('<?php 
        echo $h1;
        ?>
')">
               Update Reference</a>
            <td>Pulls the latest code from the Authoritative Node and puts
                it into the "ref" directory of the application.  Does not
                modify programs in 'application' or 'appclib' (or 'lib',
                'clib', 'root' and 'templates' for the node manager).
        <!--
        <tr><td>
            <a href="javascript:Popup('< ?=$h2? >')">
               Overwrite From Reference</a>
            <td><font color=red>Unconditionally destroys any code you have
                for this application</font> and replaces it with the
                reference code. Before being destroyed, the code is backed up into
                a directory named "ref-"+current timestamp, so that it can
                be recovered if necessary.  It is the programmer's
                responsibility to delete these backup directories as desired.
           -->
      </table>
      <?php 
        $hbase = "?gp_page=a_scontrol&gp_app={$App}&gp_skey={$skey}";
        $dir = AppDir($App);
        $dirs = AppDirs($App);
        $filesL = array();
        $filesR = array();
        clearstatcache();
        // need this before scanning dirs
        foreach ($dirs as $onedir) {
            $this->WalkDir($filesL, $dir, trim($onedir));
            $this->WalkDir($filesR, $dir . "ref/", trim($onedir));
        }
        // Files they have and we don't. Pretty easy
        ?>
      <br><br>
      <h2>Server Files Not on Local Machine</h2>
      <table>
        <tr><td class="dhead">Filename
            <td class="dhead">&nbsp;
            <td class="dhead">&nbsp;
      <?php 
        $count = 0;
        foreach ($filesR as $name => $fileR) {
            if (!isset($filesL[$name])) {
                $hlinkC = $hbase . '&gpfa=overlocal' . '&gpfile=' . urlencode($name);
                $hlinkD = $hbase . '&gpfa=servdel' . '&gpfile=' . urlencode($name);
                $count++;
                $row = array($name, "&nbsp&nbsp;<a href='{$hlinkC}'>Overwrite Local</a>&nbsp&nbsp;", "&nbsp&nbsp;<a href='{$hlinkD}'>Delete From Server</a>&nbsp&nbsp;");
                echo hTRFromArray('', $row);
            }
        }
        if ($count == 0) {
            echo hTrFromArray('', array('none', ''));
        }
        echo "</table>";
        // Files we have and they dont
        ?>
      <br><br>
      <h2>Local Files Not on Server</h2>
      <table>
        <tr><td class="dhead">Name
            <td class="dhead">&nbsp;
      <?php 
        $count = 0;
        foreach ($filesL as $name => $fileL) {
            if (!isset($filesR[$name])) {
                $count++;
                $hlink = $hbase . '&gpfa=servsend' . '&gpfile=' . urlencode($name);
                $row = array($name, "&nbsp&nbsp;<a href='{$hlink}'>Send To Server</a>&nbsp&nbsp;");
                echo hTRFromArray('', $row);
            }
        }
        if ($count == 0) {
            echo hTrFromArray('', array('none', ''));
        }
        echo "</table>";
        ?>
      <br><br>
      <h2>Files That Are Different</h2>
      <table>
        <tr><td class="dhead">Name
            <td class="dhead">Differences
            <td class="dhead">&nbsp;
            <td class="dhead">&nbsp;
            <td class="dhead">&nbsp;
      <?php 
        foreach ($filesR as $name => $fileR) {
            if (!isset($filesL[$name])) {
                continue;
            }
            $fileL = $filesL[$name];
            $diffs = array();
            if ($fileL['fsize'] != $fileR['fsize']) {
                $diffs[] = 'fsize';
            }
            if ($fileL['md5'] != $fileR['md5']) {
                $diffs[] = 'md5';
            }
            if (count($diffs) != 0) {
                $hlinkP = $hbase . '&gpfa=patch' . '&gpfile=' . urlencode($name);
                $hlinkC = $hbase . '&gpfa=overlocal' . '&gpfile=' . urlencode($name);
                $hlinkD = "javascript:Popup('{$hbase}" . '&gp_action=diff' . '&gpfile=' . urlencode($name) . "')";
                $row = array($name . "&nbsp;&nbsp;", "&nbsp;&nbsp;" . implode(' ', $diffs) . "&nbsp;&nbsp;", "&nbsp;&nbsp;<a href='{$hlinkP}'>Patch To Server</a>&nbsp;&nbsp;", "&nbsp;&nbsp;<a href='{$hlinkC}'>Overwrite Local</a>&nbsp;&nbsp;", "&nbsp;&nbsp;<a href=\"{$hlinkD}\">View Diff</a>&nbsp;&nbsp;");
                echo hTRFromArray('', $row);
            }
        }
        echo "</table>";
        //hprint_r($filesL);
        //hprint_r($filesR);
        /*
        <table cellpadding=0 cellspacing=0 class="sc">
          <tr><td class="dhead">File</td>
              <td class="dhead">Local</td>
              <td class="dhead">Reference</td>
              <td class="dhead">Patch to Server</td>
              <td class="dhead">New To Server</td>
              <td class="dhead">Ovewrite Local</td>
        */
    }
Beispiel #17
0
				</tr>
			</table>
            <?php 
if (!(vgfGet('x4') === true && LoggedIn())) {
    ?>
			<div id="bot-footer">
				<?php 
    mosLoadModules('footer', -1);
    ?>
			</div>
            <?php 
}
?>
		</div>
        <?php 
if (!gpExists('x4Page')) {
    ?>
		<div id="bot-rocket">
			<a href="http://www.rockettheme.com"><span class="rocket">&nbsp;</span></a>
		</div>
        <?php 
}
?>
	</div>

<div id="jqmModal" class="jqmWindow">
       <table border="0" 
         cellspacing="0" cellpadding="0" 
         style="width:100%:height:100%;" 
         id="jqmModalWindow">
               <tr class="jqmHeader">
Beispiel #18
0
function processPost_Textboxes($row)
{
    $gp_action = gp('gp_action');
    $gp_mode = gp('gpx_mode');
    $gp_skey = gp('gpx_skey');
    $table_id = gp('gpx_page');
    $table = DD_TableREf($table_id);
    // Cache flags.  This was introduced for Worldcare 5/22/06.
    // For worldcare the setting is made in applib, it is not set
    // anywhere in the data dictionary.  The idea is that a table
    // that is 'cache_table_pk' gets each row cached by the pk.  Perhaps
    // also we would have 'cache_table' for things like states, where
    // the entire table is cached.
    //
    $user_pref = $table_id == vgaGet('user_preferences') ? true : false;
    // Deletion is pretty simple
    if ($gp_action == 'del') {
        $view_id = DDTable_IDResolve($table_id);
        $sq = "DELETE FROM {$view_id} where skey={$gp_skey}";
        SQL($sq);
        processPost_TableSearchResultsClear($table_id);
        return;
        // <<<<<<<<<< RETURN
    }
    // Saving an insert requires an explicit command
    if ($gp_action == 'save' && $gp_mode == 'ins') {
        // KFD 6/15/07, remove blanks from an insert.
        foreach ($row as $key => $value) {
            if (trim($value == '')) {
                unset($row[$key]);
            }
        }
        $skey = SQLX_Insert($table, $row);
        if (Errors()) {
            // ERRORROW CHANGE 5/30/07, moved to SQLX_* routines
            //vgfSet('ErrorRow',$row);
        } else {
            if ($user_pref) {
                UserPrefsLoad();
            }
            processPost_TableSearchResultsClear($table_id);
            // If there was a page set to return to, do that now
            if (SessionGet('gp_aftersave', '') != '') {
                gpSet('gp_page', SessionGet('gp_aftersave'));
                $rowx = SQL_OneRow("Select * from {$table_id} where skey={$skey}");
                SessionSet("ROW_" . strtoupper($table_id), $rowx);
            }
        }
        return;
        // <<<<<<<<<< RETURN
    }
    // If the old mode was search, then set the new search criteria
    if ($gp_mode == 'search') {
        ConSet('table', $table_id, 'search', $row);
        processPost_TableSearchResultsClear($table_id);
        return;
        // <<<<<<<<<< RETURN
    }
    // Finally, if the old mode was view (update), then look for
    // changed values and figure out if we need to do an update
    if ($gp_mode == 'upd') {
        //echo "i am trying to update, here are old controls: ";
        $controls = ContextGet('OldRow', array());
        //html_vardump($controls);
        $changed = array();
        $errrow = $controls;
        foreach ($controls as $colname => $colvalue) {
            $value = null;
            if (!isset($row[$colname])) {
                // tough call. If did not come back, assume an
                // unchecked check box.
                if ($colvalue == 'Y') {
                    $changed[$colname] = 'N';
                }
            } else {
                // KFD 6/27/07, allow explicit force save of all values
                if (gpExists('gp_forcesave') || trim($colvalue) !== trim($row[$colname])) {
                    $changed[$colname] = $row[$colname];
                    $errrow[$colname] = $row[$colname];
                }
            }
        }
        if (count($changed) > 0) {
            $changed['skey'] = $gp_skey;
            $table = DD_TableRef($table_id);
            #hprint_r($changed);
            SQLX_Update($table, $changed, $errrow);
            if (Errors()) {
                // ERRORROW CHANGE 5/30/07, moved to SQLX_* routines
                //vgfSet('ErrorRow',$row);
            } else {
                if ($user_pref) {
                    UserPrefsLoad();
                }
                /*
                if($cache_pk<>'') {
                    DynFromA($cache_pk,$row);
                    if ($reload_user) {
                      $up=SQL_OneRow(
                         "Select * from $table_id WHERE user_id='".$row['user_id']."'"
                      );
                      vgaSet('this_user_prefs',$up);
                    }
                }
                */
            }
        }
        //html_vardump($row);
        //html_vardump($controls);
        //html_vardump($changed);
        return;
        // <<<<<<<<<< RETURN
    }
}
Beispiel #19
0
        return $continue;
    }
    //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");
Beispiel #20
0
function tmpModuleMenuRight()
{
    if (!LoggedIn()) {
        return;
    }
    $extra = '';
    if (!vgfGet('x4Welcome', false) && gpExists('x4Page')) {
        $extra = '<li><a href="?index.php">Classic</a>';
    }
    ?>
    <ul>
        <?php 
    echo $extra;
    ?>
        <li><a href='?st2logout=1'>Logout</a></li>
    </ul>
    <?php 
    return false;
}