Example #1
0
 function ehProcessData()
 {
     x_EchoFlush("Processing Tables");
     $this->PageUpdate('Tables', '', 'Data Dictionary');
     x_EchoFlush("Processing Modules");
     $this->PageUpdate('Modules', '', 'Data Dictionary');
     x_EchoFlush("Processing Groups");
     $this->PageUpdate('Groups', '', 'Data Dictionary');
     x_EchoFlush("Processing Column Definitions");
     $this->PageUpdate('Column Definitions', '', 'Data Dictionary');
     x_EchoFlush("Processing Spec Files");
     $this->PageUpdate('Spec Files', '', 'Data Dictionary');
     // Build the top page, which is a bunch of links to other pages
     $this->ProcessData_Top();
     $this->ProcessData_Columns();
     $this->ProcessData_Modules();
     $this->ProcessData_Groups();
     $this->ProcessData_SpecFiles();
     $this->ProcessData_Tables();
     echo hErrors();
 }
Example #2
0
 /**
  *  Run the report based on options provided by user.
  *
  *  @param string $yamlP2  A processed YAML page description
  *  @access private
  */
 private function pageReport()
 {
     // Create the reporting object
     require_once 'androPageReport.php';
     $oReport = new androPageReport();
     // For each section, run the output
     foreach ($this->yamlP2['section'] as $secname => $secinfo) {
         $dbres = SQL($secinfo['sql']);
         if (gp("showsql") == 1) {
             hprint_r($secinfo['sql']);
         }
         if (Errors()) {
             hprint_r($secinfo['sql']);
             echo hErrors();
         }
         if (gp("showsql") == 1) {
             return;
         }
         // Now pass the SQL resource to the reporting engine
         $oReport->main($dbres, $this->yamlP2, $secinfo);
     }
 }
Example #3
0
 function processSubmit()
 {
     // Get the submitted data
     $table = gp('gp_table_upd', '');
     // Get the flat table def
     $table_dd = dd_TableRef($table);
     $tabflat = ArraySafe($table_dd, 'flat');
     //hprint_r($table);
     $row = aFromGP('gp_upd_');
     //hprint_r($row);
     //hprint_r($row);
     // Build a WHERE clause
     $where = array();
     foreach ($row as $col => $val) {
         if (ArraySafe($tabflat[$col], 'primary_key', 'N') != 'Y') {
             continue;
         }
         $where[] = $col . " = '" . $val . "'";
     }
     //hprint_r($where);
     $where = implode(' AND ', $where);
     // Build a SELECT
     $sql = "SELECT skey\n                 FROM " . ddTable_IDResolve($table) . "\n                WHERE " . $where;
     //hprint_r($sql);
     $records = SQL_AllRows($sql);
     if (count($records) != 1) {
         echo "Invalid or non-unique key supplied\n<br>";
         return;
     }
     // Well, we haven't failed yet, let's add the skey before the update, just to be safe.
     $row['skey'] = $records[0]['skey'];
     $skey = $records[0]['skey'];
     //hprint_r($row);
     SQLX_Update($table_dd, $row);
     if (Errors()) {
         echo hErrors();
     } else {
         echo "Update Successful.  <a href=\"?gp_page={$table}&gp_skey={$skey}\">View Record</a> <br>\n";
     }
 }
Example #4
0
 function fbProcInner($fi, $t)
 {
     x_EchoFlush("BEGIN FILE PROCESSING");
     $FILE = fopen($fi['uname'], 'r');
     if (!$FILE) {
         x_EchoFlush("Trouble opening local uploaded file.");
         x_EchoFlush("ABORT WITH ERROR");
         return 0;
     }
     // Make sure first line is ok
     $line1 = fsGets($FILE);
     if (strlen($line1) == 0) {
         x_EchoFlush("Failed reading first line, file is empty?");
         x_EchoFlush("ABORT WITH ERROR");
         return 0;
     }
     if (strlen($line1) > 4998) {
         x_EchoFlush("First line is &gt; 4998 bytes, this cannot be right.");
         x_EchoFlush("ABORT WITH ERROR");
         return 0;
     }
     // Now convert the first line into the list of columns
     $acols = explode('|', $line1);
     x_echoFlush("COLUMNS IN FILE:");
     foreach ($acols as $acol) {
         x_EchoFlush($acol);
     }
     // Retrieve maps
     $mapcols = SQL_AllRows("SELECT column_id,COALESCE(column_id_src,'') as src\n            FROM importmapcolumns\n           WHERE table_id=" . SQLFC($t['table_id']) . "\n             AND importmap=" . SQLFC(gp('gp_map')), 'column_id');
     echo "<hr>";
     echo "<h2>Map is as follows: " . gp('gp_map') . "</h2>";
     hprint_r($mapcols);
     echo "<hr>";
     // Now convert each line as we go
     $linenum = 0;
     $linesok = 0;
     while (($oneline = fsGets($FILE)) !== false) {
         $linenum++;
         // Give the user something to believe in
         if ($linenum % 100 == 0) {
             x_EchoFlush("Line: {$linenum} processing");
         }
         // Pull the line
         $data = explode('|', $oneline);
         // Maybe a problem?
         if (count($data) != count($acols)) {
             x_EchoFlush("ERROR LINE {$linenum}");
             x_EchoFlush("Too many or too few values");
             hprint_r($data);
             continue;
         }
         // No problem yet, attempt the insert
         ErrorsClear();
         // Assign first-row column names to incoming data
         $row = array_combine($acols, $data);
         // Match the values from the map
         $rowi = array();
         foreach ($mapcols as $mapcol => $info) {
             if ($info['src'] != '') {
                 if (isset($row[$info['src']])) {
                     $rowi[$mapcol] = $row[$info['src']];
                 }
             }
         }
         $mixed = array($t['table_id'] => array($rowi));
         SQLX_Cleanup($mixed);
         SQLX_insert($t, $mixed[$t['table_id']][0]);
         // Complaints?  Problems? Report them!
         if (Errors() && strpos(hErrors(), 'Duplicate Value') === false) {
             x_EchoFlush('------------------------------------------------');
             x_EchoFlush("ERROR LINE {$linenum} when attempting to insert");
             x_EchoFlush(hErrors());
             x_EchoFlush('------------------------------------------------');
             continue;
         }
         $linesok++;
     }
     return array($linenum, $linesok);
 }
Example #5
0
 function mainPRocess($v, $dirs)
 {
     // First create the version
     $table_dd = DD_TableRef('appversions');
     $row = array('version' => $v, 'date' => time(), 'application' => $this->app);
     SQLX_Insert($table_dd, $row);
     if (Errors()) {
         echo hErrors();
         return;
     }
     // We'll need this for every file we load
     $this->tlf = DD_TableRef('appfiles');
     // Create the application save directory
     $app = $this->app;
     $r2 = $GLOBALS['AG']['dirs']['root'];
     if (!file_exists($r2 . 'pkg-apps')) {
         mkdir($r2 . 'pkg-apps');
     }
     if (!file_exists($r2 . "pkg-apps/{$app}-{$v}")) {
         mkdir($r2 . "pkg-apps/{$app}-{$v}");
     }
     $r2 = $r2 . "pkg-apps/{$app}-{$v}";
     foreach ($dirs as $dir) {
         if (!file_exists($this->root . $dir['dirname'])) {
             mkdir($this->root . $dir['dirname']);
         }
         $this->mainPR_DirFiles($v, $r2, $this->root, $dir['dirname'], '');
     }
     $dpa = $GLOBALS['AG']['dirs']['root'] . 'pkg-apps/';
     chdir($GLOBALS['AG']['dirs']['root'] . 'pkg-apps/');
     $command = "tar czvf {$app}-{$v}.tgz {$app}-{$v}";
     x_EchoFlush("");
     x_EchoFlush("Tarballing with this command: {$command}");
     `{$command}`;
     x_EchoFlush("");
     // Now create the install version.
     if ($this->app == 'andro') {
         x_EchoFlush("Renaming install.done.php to install.php");
         rename("{$dpa}{$app}-{$v}/application/install.done.php", "{$dpa}{$app}-{$v}/application/install.php");
         x_EchoFlush("Renaming directory to andro, copying index.php");
         rename("{$dpa}{$app}-{$v}", $dpa . "andro");
         copy($dpa . "andro/root/index.php", $dpa . "andro/index.php");
         copy($dpa . "andro/root/htaccess", $dpa . "andro/.htaccess");
         // KFD 8/2/07, Sourceforge bug #1755244, for the node manager
         //             these are created by build but we need them for
         //             the build, so make them here.
         mkdir($dpa . "andro/tmp");
         mkdir($dpa . "andro/generated");
         // KFD 8/2/07, Sourceforge bug #1755244, END
         $command = "tar czvf {$app}-{$v}-install.tgz andro index.php .htaccess";
         x_EchoFlush("");
         x_EchoFlush("Tarballing install version with this command: {$command}");
         `{$command}`;
         x_EchoFlush("Renaming directory back to {$app}-{$v}");
         unlink($dpa . "andro/index.php");
         unlink($dpa . "andro/.htaccess");
         rename($dpa . "andro", "{$dpa}{$app}-{$v}");
         x_EchoFlush("Process is complete!");
     }
 }
Example #6
0
 function MD5_ForgotPage3()
 {
     $UID = gp('uid');
     $md5 = gp('md5');
     $pw1 = gp('pw1');
     $pw2 = gp('pw2');
     fwLogEntry('1025', 'PW Change Attempt', $UID);
     if ($pw1 != $pw2) {
         ErrorAdd("Password values did not match");
     }
     if (strlen($pw1) < 6) {
         ErrorAdd("Password must be at least 5 characters");
     }
     if (!preg_match("/[0-9]/", $pw1)) {
         ErrorAdd("Password must contain at least one numeric digit");
     }
     if (!preg_match("/[a-z]/", $pw1)) {
         ErrorAdd("Password must contain at least one lower case character");
     }
     if (!preg_match("/[A-Z]/", $pw1)) {
         ErrorAdd("Password must contain at least one upper case character");
     }
     if (strpos(strtolower($pw1), strtolower($UID)) !== false) {
         ErrorAdd("You cannot use your user_id in your password!");
     }
     if (Errors()) {
         echo hErrors();
         gpSet('gpp', '2');
         ErrorsClear();
         return;
     }
     $row = array('user_id' => $UID, 'md5' => $md5, 'member_password' => $pw1);
     SQLX_Insert('users_pwverifies', $row);
     if (Errors()) {
         echo hErrors();
         gpSet('gpp', '2');
         ErrorsClear();
         return;
     } else {
         fwLogEntry('1026', 'PW Change Success', $UID);
         ?>
      <p>Your password has been set, you can now 
         <a href="?gp_page=x_login">Login</a>.
      
      <?php 
     }
 }
Example #7
0
 /**
  * Execute an skey-based delete
  *
  */
 function delete()
 {
     $perm = $this->uiPerm(gp('x6page'), 'del');
     if (!$perm) {
         x6Error("Deletion not allowed from this screen");
         return;
     }
     # KFD 6/8/09 Google #29 Various changes to allow pre- and post-
     #                       delete methods
     $table_id = gp('x6page');
     $view = ddView(gp('x6page'));
     $skey = SQLFN(gp('skey'));
     $method = $table_id . "_before_delete";
     $continue = true;
     if (method_exists($this, $method)) {
         $continue = $this->{$method}($skey);
     }
     if ($continue) {
         $sq = "Delete from {$view} where skey = {$skey}";
         SQL($sq);
         if (Errors()) {
             x6Errors(hErrors());
         } else {
             $method = $table_id . "_after_delete";
             if (method_exists($this, $method)) {
                 $this->{$method}();
             }
         }
     }
 }
Example #8
0
function index_hidden_ajaxsql()
{
    switch (gp('gp_ajaxsql')) {
        case 'update':
            $row = aFromgp('txt_');
            foreach ($row as $key => $value) {
                if ($value == 'b:true') {
                    $row[$key] = 'Y';
                }
                if ($value == 'b:false') {
                    $row[$key] = 'N';
                }
            }
            $table_id = gp('gp_table');
            SQLX_Update($table_id, $row);
            break;
        case 'insert':
            $row = aFromgp('txt_');
            $table_id = gp('gp_table');
            // XDB
            SQLX_Insert($table_id, $row);
            break;
    }
    if (Errors()) {
        echo 'echo|' . hErrors();
    }
}
Example #9
0
 function ehAjax_Levels()
 {
     $skey = SQLFN(gp('gp_skey'));
     $report = SQL_OneValue('report', "Select report from reports where skey={$skey}");
     $levaction = gp('gp_ajax');
     $sq = "SELECT max(reportlevel) as maxlev \n            FROM reportcollevels WHERE report = '{$report}'";
     $maxlev = SQL_AllRows($sq);
     $maxlev = count($maxlev) == 0 ? 1 : $maxlev[0]['maxlev'];
     if ($levaction == 'levadd') {
         //if(is_null($maxlev)) $maxlev=1; else $maxlev++;
         $maxlev++;
         SQL("INSERT INTO reportcollevels \n                     (report,table_id,column_id,reportlevel,summact)\n              SELECT rc.report,rc.table_id,rc.column_id,{$maxlev},'-NA-'\n                FROM reportcolumns rc\n               WHERE report='{$report}'");
         echo hErrors();
     } elseif ($levaction == 'levdel') {
         //echo "hi".$maxlev.'hi';
         $sq = "Delete from reportcollevels\n               where report='{$report}'\n                 AND reportlevel = {$maxlev}";
         SQL($sq);
         //echo $sq;
         //if(Errors()) echo hErrors();
     } elseif ($levaction == 'levmod') {
         $skeycl = SQLFN(gp('gp_skeycl'));
         $newval = SQLFC(gp('gp_value'));
         SQL("UPDATE reportcollevels \n                SET summact = {$newval}\n              WHERE skey={$skeycl}");
     }
     $this->ehTab_Levels();
 }