Esempio n. 1
0
 function RepStandard()
 {
     // First Generate the query
     $sq = $this->RepStandardQuery();
     if ($this->display == 'SQL') {
         echo "<h1>The Generated SQL</h1>";
         hprint_r($sq);
         return;
     }
     // Now execute the query and run the report
     if ($this->display == 'CSV') {
         echo "<pre>";
         echo implode(',', $this->Cols) . "\n";
         $res = SQL($sq);
         while ($row = pg_fetch_row($res)) {
             echo implode(',', $row) . "\n";
         }
         echo "</pre>";
         return;
     }
     // Pull the info on breaking, sums, etc.
     $srep = SQLFC($this->report_id);
     $s2 = "SELECT rcl.column_id,rcl.reportlevel,rcl.summact\n             FROM reportcollevels rcl\n             JOIN reportcolumns   rc  ON rcl.column_id = rc.column_id\n            WHERE rc.report = {$srep}\n            ORDER BY rcl.reportlevel,rc.uicolseq";
     $breaks = SQL_AllRows($s2);
     $abreaks = array();
     foreach ($breaks as $break) {
         if ($break['summact'] == 'BREAK') {
             $abreaks[$break['reportlevel']]['breaks'][$break['column_id']] = '';
         } else {
             $abreaks[$break['reportlevel']]['data'][$break['column_id']] = array('summact' => $break['summact'], 'val' => 0, 'cnt' => 0);
         }
     }
     // There is always some setup, for either PDF or HTML, so do that
     // here.
     $this->RepHeader();
     // Now execute the query and run the report
     $res = SQL($sq);
     $firstrow = true;
     while ($row = SQL_Fetch_Array($res)) {
         if ($firstrow) {
             $firstrow = false;
             $this->RepStandardBreakLevelsInit($abreaks, $row);
         } else {
             $this->RepStandardBreakLevels($abreaks, $row);
         }
         $xpos = 0;
         foreach ($this->rows_col as $column_id => $colinfo) {
             $disp = substr($row[$column_id], 0, $colinfo['dispsize']);
             $disp = STR_PAD($disp, $colinfo['dispsize'], ' ');
             $this->PlaceCell($xpos, $disp);
             $xpos += 2 + $colinfo['dispsize'];
         }
         $this->ehFlushLine();
         $this->RepStandardRowsToLevels($abreaks, $row);
     }
     $this->RepStandardBreakLevels($abreaks, $row, true);
     // There is always some cleanup, either PDF or HTML
     $this->RepFooter();
 }
Esempio n. 2
0
 function main()
 {
     if (SessionGet('ADMIN', false) == false) {
         echo "Sorry, admins only";
     } else {
         hprint_r($_SERVER);
         phpinfo();
     }
 }
Esempio n. 3
0
 function main()
 {
     $file = $GLOBALS['AG']['dirs']['root'] . 'application/' . gp('file');
     include_once "spyc.php";
     echo "\n<h2>Examine YAML file {$file}</h2>";
     echo "\n<h3>HERE IS THE SOURCE FILE:</h3>";
     echo "\n<pre>";
     readfile($file);
     echo "\n</pre>";
     $temparray = Spyc::YAMLLoad($file);
     echo "<h3>HERE IT IS PARSED:</h3>";
     hprint_r($temparray);
 }
Esempio n. 4
0
 function x6main()
 {
     ?>
     <h1>Skin Details</h1>
     
     <p><b>Current Skin:</b><?php 
     echo arr($_COOKIE, 'x6skin', 'win2k.gray.1024');
     ?>
     </p>
     <?php 
     if (isset($GLOBALS['AG']['x6skin'])) {
         hprint_r($GLOBALS['AG']['x6skin']);
     } else {
         echo "The skin was not loaded.";
     }
 }
Esempio n. 5
0
 function mainProcess()
 {
     $errors = array();
     # Make x6main scrollable
     jqDocReady("\$('.x6body').css('overflow-y','scroll')");
     # Define the directories
     $dirx6 = fsDirTop() . 'templates/x6/';
     $dirx6src = $dirx6 . 'skinsources/';
     $dirapp = fsDirTop() . 'application/';
     # Now scan for other skins and process those
     $dirs = array($dirx6src, $dirapp);
     foreach ($dirs as $dir) {
         $files = scandir($dir);
         foreach ($files as $file) {
             echo "<br/>{$dir}{$file};";
             # These lines filter out entries that are not skins
             $apieces = explode('.', $file);
             if (count($apieces) != 3) {
                 continue;
             }
             if ($apieces[0] != 'x6skin') {
                 continue;
             }
             if ($apieces[2] != 'yaml') {
                 continue;
             }
             # Load the file and process it.  We assume the
             # middle piece of the file is the name of the
             # template.
             list($yaml, $errors) = loadYaml($dir . $file);
             if (count($errors) > 0) {
                 echo "<h2>Errors encountered in skin file</h2>";
                 echo "<p>File: {$dir}{$file}</p>";
                 hprint_r($errors);
                 return;
             }
             removeYamlLineNumbers($yaml);
             $this->writeCSS($apieces[1], $yaml['defines'], $yaml['css']);
         }
     }
     # Finally, write the list of skins out to apppub
     file_put_contents(fsDirTop() . 'templates/x6/skinsphp/x6skins.ser.txt', serialize($this->skinFiles));
 }
Esempio n. 6
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");
     }
 }
Esempio n. 7
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);
     }
 }
 function DBB_Insert($prefix, $table, $suffix, $colvals, $noblanks = false)
 {
     $cols = '';
     $vals = '';
     # KFD 1/26/09, SF BUG 1948051, trap bad properties
     $insert_error = false;
     foreach ($colvals as $name => $value) {
         if (!isset($this->utabs[$table]['flat'][$name])) {
             # Don't stop on our hardcoded meta values
             if ($name == '__yaml_line') {
                 continue;
             }
             // generated
             if ($name == '__keystub') {
                 continue;
             }
             // generated
             if ($name == 'uicolseq') {
                 continue;
             }
             // generated
             if ($name == 'srcfile') {
                 continue;
             }
             // generated
             if ($name == 'auto') {
                 continue;
             }
             // shortcut, gets parsed
             if ($name == 'columns') {
                 continue;
             }
             // for content
             if ($name == 'x6xrefdesc') {
                 continue;
             }
             if ($name == 'suffix' && $table == 'perm_cols') {
                 continue;
             }
             if ($name == 'prefix' && $table == 'perm_cols') {
                 continue;
             }
             if ($table == 'colchainargs') {
                 continue;
             }
             // derived tables
             if ($table == 'colchaintests') {
                 continue;
             }
             // derived tables
             if ($table == 'colchains') {
                 continue;
             }
             // derived tables
             if ($table == 'tabchainargs') {
                 continue;
             }
             // derived tables
             if ($table == 'tabchaintests') {
                 continue;
             }
             // derived tables
             if ($table == 'tabchains') {
                 continue;
             }
             // derived tables
             x_EchoFlush(">>> ERROR: No Property Named '{$name}' (value '{$value}')");
             $insert_error = true;
         }
     }
     if ($insert_error) {
         return false;
     }
     foreach ($this->utabs[$table]["flat"] as $colname => $colinfo) {
         if (isset($colvals[$colname])) {
             $val = $colvals[$colname];
         } else {
             if ($noblanks) {
                 continue;
             }
         }
         $cols .= $this->AddComma($cols) . $colname;
         $type = $colinfo["type_id"];
         if ($type == "int" || $type == "numb") {
             if (!isset($colvals[$colname])) {
                 $val = '0';
             }
             $vals .= $this->AddComma($vals) . $val;
         } else {
             if (!isset($colvals[$colname])) {
                 $val = '';
             }
             // KFD 1/31/07.  Not all builds support pg_escape_string for
             //    some strange reason, so we must use str_replace.
             //    We must use \' instead of '' because of strange behavior of
             //    str_replace that can get confused and mess up.  There is a
             //    known vulnerability with \', but the builder does not use
             //    any code from a web browser, so we are ok.
             if ($colinfo['type_id'] == 'char' || $colinfo['type_id'] == 'vchar') {
                 if (isset($colinfo['colprec'])) {
                     $val = substr($val, 0, $colinfo['colprec']);
                 }
             }
             $valx = function_exists('pg_escape_string') ? pg_escape_string(trim($val)) : str_replace("'", "\\'", trim($val));
             $vals .= $this->AddComma($vals) . "'" . $valx . "'";
             //$vals
             //	.= $this->AddComma($vals)
             // ."'".pg_escape_string(trim($val))."'";
         }
     }
     $sql = "INSERT INTO " . $prefix . $table . $suffix . " ( " . $cols . " ) VALUES ( " . $vals . " )";
     $retval = $this->SQL($sql);
     if (!$retval) {
         hprint_r($colvals);
     }
     return $retval;
 }
Esempio n. 9
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);
 }
Esempio n. 10
0
 function render($parentId = '', $singleQuotes = false, $x6wrapperPane = '')
 {
     # Accept a parentId, maybe assign one to
     if ($parentId != '') {
         $this->ap['xParentId'] = $parentId;
     }
     if ($this->isParent) {
         $parentId = a($this->hp, 'id', '');
         if ($parentId == '') {
             echo "Object has no id but wants to be parent";
             hprint_r($this);
             exit;
         }
     }
     # KFD 12/30/08, IE Compatibility.  All inputs, selects and
     #               so forth must have an ID.  This is actually
     #               due to jQuery returning strange items with
     #               the :input selector, and we can only distinguish
     #               real from bogus by looking for IDs
     if (in_array($this->htype, array('input', 'select', 'checkbox'))) {
         if (arr($this->hp, 'id', '') == '') {
             $id = rand(1000, 9999);
             while (isset($GLOBALS['AG']['id'][$id])) {
                 $id = rand(1000, 9999);
             }
             $this->hp['id'] = 'id_' . $id;
             $GLOBALS['AG']['id'][$id] = 1;
         }
     }
     # Set the x6 parent tab if exists
     if (arr($this->hp, 'x6plugin') == 'x6tabs') {
         $this->hp['x6wrapperPane'] = $x6wrapperPane;
     }
     # Before we render, we are going to take the code
     # snippets and generate top-level functions for them
     $twoparms = array('click', 'keypress', 'keyup', 'keydown');
     $snippet_id = a($this->hp, 'id');
     if ($snippet_id == '') {
         $snippet_id = 'snip_' . rand(1, 100000);
     }
     foreach ($this->code as $event => $snippet) {
         $fname = $snippet_id . '_' . $event;
         jqDocReady("window.{$fname} = {$snippet}");
         if (in_array($event, $twoparms)) {
             $this->hp['on' . $event] = "{$fname}(this,event)";
         } else {
             $this->hp['on' . $event] = "{$fname}(this)";
         }
     }
     foreach ($this->functions as $name => $snippet) {
         jqDocReady("x6.byId('{$this->hp['id']}').{$name} = " . $snippet);
     }
     # KFD 10/7/08 if data has been attached, send it as json
     if (isset($this->data)) {
         $js = "x6.byId('" . $this->hp['id'] . "').zData = " . json_encode($this->data);
         jqDocReady($js);
     }
     if ($this->autoFormat) {
         echo "\n<!-- ELEMENT ID " . $this->hp['id'] . " (BEGIN) -->";
         //echo "$indent\n<!-- ELEMENT ID ".$this->hp['id']." (BEGIN) -->";
     }
     $parms = '';
     if (count($this->classes) > 0) {
         $this->hp['class'] = implode(' ', $this->classes);
     }
     if (count($this->style) > 0) {
         $style = '';
         foreach ($this->style as $prop => $value) {
             $style .= "{$prop}: {$value};";
         }
         $this->hp['style'] = $style;
     }
     $q = $singleQuotes ? "'" : '"';
     foreach ($this->hp as $parmname => $parmvalue) {
         if ($parmname == 'href') {
             $parmvalue = preg_replace('/&([a-zA-z])/', '&amp;$1', $parmvalue);
         }
         $parms .= "\n  {$parmname}={$q}{$parmvalue}{$q}";
     }
     foreach ($this->ap as $parmname => $parmvalue) {
         $parms .= "\n  {$parmname}={$q}{$parmvalue}{$q}";
     }
     echo "<" . $this->htype . ' ' . $parms . '>' . $this->innerHtml;
     foreach ($this->children as $child) {
         if (is_string($child)) {
             echo $child;
         } else {
             if (arr($this->hp, 'x6plugin') == 'x6tabsPane') {
                 $x6wrapperPane = $this->hp['id'];
             }
             $child->render($parentId, $singleQuotes, $x6wrapperPane);
         }
     }
     echo "</{$this->htype} \n>";
     if ($this->autoFormat) {
         echo "\n<!-- ELEMENT ID " . $this->hp['id'] . " (END) -->";
         //echo "$indent\n<!-- ELEMENT ID ".$this->hp['id']." (END) -->";
     }
 }
Esempio n. 11
0
 function main()
 {
     //get global configuration information
     // Debugging.  If you want to trace through what happens,
     // turn this on here. THen turn on the "file_put_contents" at
     // the bottom of the method.
     $log = SysLogOpen('IPN');
     sysLogEntry($log, 'Began work in x_paypalipn, next entry is $_POST');
     # KFD 10/1/08, add more logging.  Project CME occassionally
     # misses the trx, we want more logging.
     ob_start();
     hprint_r($_POST);
     sysLogEntry($log, ob_get_clean());
     sysLogEntry($log, 'Invoice ' . a($_POST, 'invoice', ''));
     global $paypal;
     include_once 'paypal_global_config.inc.php';
     //get pay pal configuration file
     include_once 'paypal_config.inc.php';
     //decide which post method to use
     sysLogEntry($log, 'Paypal postmethod is ' . $paypal['post_method']);
     switch ($paypal['post_method']) {
         case "libCurl":
             //php compiled with libCurl support
             $result = libCurlPost($paypal['url'], $_POST);
             break;
         case "curl":
             //cURL via command line
             $result = curlPost($paypal['url'], $_POST);
             break;
         case "fso":
             //php fsockopen();
             $result = fsockPost($paypal['url'], $_POST);
             break;
         default:
             //use the fsockopen method as default post method
             $result = fsockPost($paypal['url'], $_POST);
             break;
     }
     sysLogEntry($log, "Next log entry is postback result");
     sysLogEntry($log, $result);
     //check the ipn result received back from paypal
     if (eregi("VERIFIED", $result)) {
         sysLogEntry($log, "Verified, continuing");
         if (function_exists('paypal_ipn_success')) {
             sysLogEntry($log, "Calling function paypal_ipn_success");
             paypal_ipn_success($log);
         } else {
             sysLogEntry($log, "ERROR, function paypal_ipn_success does not exist");
         }
     } else {
         sysLogEntry($log, "Not verified, no further action");
         if (function_exists('paypal_ipn_cancel')) {
             sysLogEntry($log, "Calling function paypal_ipn_cancel");
             paypal_ipn_cancel($log);
         } else {
             sysLogEntry($log, "Function paypal_ipn_cancel does not exist");
         }
     }
     syslogEntry($log, 'end of processing');
     sysLogClose($log);
 }