function hWiki($table_id, $pagename, $input, $title = '') { $this->table_id = $table_id; // Remove carriage returns, makes things much easier $html = str_replace("\r", '', $input); // Put in an "edit this page" if user is logged in if (LoggedIn() && $table_id != '') { echo "<br><div>"; echo '<a href="?gp_page=pages&gp_pk=' . urlencode($pagename) . '">EDIT THIS PAGE</a>'; echo "</div>"; } // If a title was provided, put it in h1 at top $retval = $title == '' ? '' : "<h1>" . hSanitize($title) . "</h1>"; // Break into lines and begin outputting $ahtml = explode("\n", $html); $mode = ''; foreach ($ahtml as $oneline) { switch ($mode) { case 'html': $f4 = substr($oneline, 0, 5); if ($f4 == "</div" || $f4 == "</pre") { $mode = ''; $new = $oneline . "\n"; } else { $new = $oneline . "\n"; } break; case 'para': list($mode, $new) = $this->wikiProcessModePara($oneline); $new .= "\n"; break; case 'list': list($mode, $new) = $this->wikiProcessModeList($oneline); $new .= "\n"; break; default: list($mode, $new) = $this->wikiProcessModeBlank($oneline); break; } $retval .= $new; } return $retval; }
function main() { $app = gp('gp_app'); // Today's date will become version. Confirm that it is ok $v = date("Y.m.d", time()); $mv = SQL_AllRows("Select version from appversions \n where version = '{$v}'\n AND application=" . SQLFC($app)); if (count($mv) > 0) { ?> <div class="errorbox">There is already a version of the application stamped for today. Cannot have two versions in the same day. </div> <?php return; } // Will need list of directories. if ($app == 'andro') { $dirs = SQL_AllRows("Select * from appdirs where flag_copy='Y'"); } else { $dirs = SQL_AllRows("Select * from appdirs where flag_copy='Y'\n AND flag_lib='N'"); } // Determine the app and root directory // Get the app $this->app = $app; $root = SQL_OneValue('dir_pub', "select wp.dir_pub \n from webpaths wp\n JOIN applications ap ON wp.webpath=ap.webpath\n WHERE ap.application = " . SQLFC($app)); $root = AddSlash($root) . AddSlash($app); $this->root = $root; //x_echoFlush("Root directory will be: ".$root); // Either run the process.... if (gp('gp_process') == 1) { ob_start(); $this->mainProcess($v, $dirs); echo ob_end_clean(); return; } $link = '?gp_page=appversions_p&gp_process=1&gp_app=' . gp('gp_app'); // ...or ask them to click the button ?> <h1>Freeze Current Version</h1> <p>This program will create a new version of all application files for application <?php echo hSanitize(gp('gp_app')); ?> . It will copy all disk files into the database. The version will be numbered as <?php echo $v; ?> . </p> <p>The top level directory to be scanned is: <?php echo $root; ?> . </p> <p>The subdirectories to be scanned are: </p> <ul> <?php foreach ($dirs as $dir) { echo "<li>" . $dir['dirname']; } ?> </ul> <p><a href="javascript:Popup('<?php echo $link; ?> ')">Process Now</a> </p> <?php }
function PW_ForgotPage2() { $retval = false; $eml = strtolower(gp('eml')); $hash = gp('hash'); // confirm that user/hash is ok // scDBConn_Push('usermaint'); $sql = "\nSelect count(*) as cnt \n FROM users \n where LOWER(email) =" . SQLFC($eml) . "\n and user_pwkey =" . SQLFC($hash) . "\n and user_disabled<>'Y'"; $cnt = SQL_OneValue('cnt', $sql); if ($cnt == 0) { ?> <p>The link that you provided to this page has either expired, been superseded, or was not valid at all.</p> <?php return; } hidden('eml', $eml); hidden('hash', $hash); ?> <input type="hidden" name="gpp" value="3"> <input type="hidden" name="hash" value="<?php echo hSanitize($hash); ?> "> <p>This is the change password page. Enter your account ID and new password below to change your password.</p> <table> <tr><td style="text-align: right">User ID:</td> <td style="text-align: left"> <input name="uid" id="uid" width="20"></input></td> </tr> <tr><td style="text-align: right">New Password:</td> <td style="text-align: left"><input type="password" name="pw1" id="pw1" width="10"></input></td> </tr> <tr><td style="text-align: right">Repeat New Password:</td> <td style="text-align: left"><input type="password" name="pw2" id="pw2" width="10"></input></td> </tr> </table> <br><br> <button type="submit">Save New Password</button> <?php scDBConn_Pop(); }
function main() { $app = gp('gp_app'); $sApp = SQLFC(gp('gp_app')); $sInst = SQLFC(gp('gp_inst')); $hApp = hSanitize(gp('gp_app')); $hInst = hSanitize(gp('gp_inst')); $rows = SQL_AllRows("SELECT * from instances \n where application={$sApp} AND instance={$sInst}"); if (count($rows) != 1) { ?> <div class="errorbox">Incorrect call to instance processing.</div> <?php return; } $row = $rows[0]; $hVer = hSanitize(trim($row['version'])); // Maybe we are on processing branch if (gp('gp_posted') == 1) { $this->Process($rows[0]); return; } // KFD 2/4/08, Modify this to look for versions on disk // for an svn-enabled server node $hWarn = ''; $av = ''; if (OptionGet('DEV_STATION', '') == 'N') { $sq = "Select * from applications where application={$sApp}"; $rapp = SQL_OneRow($sq); if (trim($rapp['svn_url']) == '') { $hWarn = '<br/><br/><b>Subversion url needed.</b> ' . 'You can begin by providing a URL to the subversions ' . 'repository for this application on ' . '<a href="?gp_page=applications&gp_skey=' . $rapp['skey'] . '">the editing screen</a>.'; } $versions = svnVersions(); $verx = trim($versions[$app]['local']); $av = "<p>Latest Andromeda Version: " . trim($versions['andro']['local']); } else { // Get the current version, and get the latest version available $verx = SQL_OneValue("mv", "Select max(version) as mv from appversions\n WHERE application={$sApp}"); if (is_null($verx)) { $verx = ''; } } ?> <h1>Instance Upgrade</h1> <p>Application: <?php echo $hApp; ?> </p> <p>Instance: <?php echo $hInst; ?> </p> <p>Current Version: <?php echo $hVer == '' ? '-none-' : $hVer; ?> </p> <p>Latest Version Available: <?php echo $verx == '' ? '-none-' : $verx; ?> </p> <?php echo $av; ?> <p> </p> <p> <?php if ($verx == '') { ?> <b>No official versions are available.</b> An instance can only be upgraded when an official version is available. You may download release code for this application, or you may generate files out of your development code. </p> <?php echo $hWarn; ?> <?php return; } else { $caption = $hVer == '' ? 'Build as ' : 'Upgrade To'; echo hLinkPopup('', $caption . ' version ' . $verx, array('gp_app' => gp('gp_app'), 'gp_inst' => gp('gp_inst'), 'gp_posted' => 1, 'gp_page' => 'instances_p2', 'gp_out' => 'none', 'gp_ver' => $verx)); } }
function main_pr_execute() { ob_start(); $sApp = SQLFC(gp('gp_app')); $sInst = SQLFC(gp('gp_inst')); $hApp = hSanitize(gp('gp_app')); $hInst = hSanitize(gp('gp_inst')); $rows = SQL_AllRows("SELECT * from instances \n where application={$sApp} AND instance={$sInst}"); if (count($rows) != 1) { ?> <div class="errorbox">Incorrect call to instance processing.</div> <?php return; } $row = $rows[0]; $sVer = SQLFC(gp('gp_ver')); $hVer = hSanitize(gp('gp_ver')); // KFD 2/4/08, If this is a subversion-enabled server, // get version information from there if (OptionGet('DEV_STATION', '') != '') { $aversions = svnVersions(); $mv = '-VER-' . $aversions['andro']['local']; } else { // Get information on latest version of Node Manager and // link to that $mv = SQL_OneValue("mv", "SELECT max(version) as mv \n FROM appversions\n WHERE application='andro'"); } $DIR_LINK_LIB = $GLOBALS['AG']['dirs']['root'] . '/pkg-apps/andro' . $mv; // Source of symlinks for app directories $DIR_LINK_APP = $GLOBALS['AG']['dirs']['root'] . "/pkg-apps/{$hApp}-VER-{$hVer}"; // Get application information for the DO program $tsql = 'SELECT * from applications ' . ' WHERE application = ' . $sApp; $row_a = SQL_OneRow($tsql); $tsql = 'SELECT * from webpaths ' . ' WHERE webpath = ' . SQLFC($row_a['webpath']); $row_n = SQL_OneRow($tsql); $dirws = AddSlash(trim($row_n["dir_pub"])); //if (substr($dirws,-1,1)<>"/") $dirws.="/"; //$row["webserver_dir_pub"] = $dirws; $string = '<?php // To run this program from the command line, you must // be logged in as a user that has superuser priveleges, such // as root or postgres. When running from the web app, // the current user\'s priveleges are used. $GLOBALS["parm"] = array( "DBSERVER_URL"=>"localhost" ,"UID"=>"' . SessionGet('UID') . '" ,"DIR_PUBLIC"=>"' . $dirws . '" ,"DIR_PUBLIC_APP"=>"' . $hApp . '_' . $hInst . '" ,"DIR_LINK_LIB"=>"' . $DIR_LINK_LIB . '" ,"DIR_LINK_APP"=>"' . $DIR_LINK_APP . '" ,"APP"=>"' . $hApp . '_' . $hInst . '" ,"INST"=>"' . $hInst . '" ,"IVER"=>"' . $hVer . '" ,"XDIRS"=>"' . trim($row_a['xdirs']) . '" ,"FLAG_PWMD5"=>"' . ArraySafe($row_a, 'flag_pwmd5', 'N') . '" ,"ROLE_LOGIN"=>"' . ArraySafe($row_a, 'flag_rolelogin', 'Y') . '" ,"TEMPLATE"=>"' . $row['template'] . '" ,"APPDSC"=>"' . trim($row_a["description"]) . '" ,"SPEC_BOOT"=>"' . trim($row_a["appspec_boot"]) . '" ,"SPEC_LIB"=>"' . trim($row_a["appspec_lib"]) . '" ,"SPEC_LIST"=>"' . trim($row_a["appspec"]) . '" ); include("androBuild.php"); ?> '; $t = pathinfo(__FILE__); $dircur = AddSlash($t["dirname"]) . "../tmp/"; //$dircur = $t["dirname"]; if (substr($dircur, -1) != "/") { $dircur .= "/"; } $file = $dircur . "do-{$hApp}-{$hInst}.php"; $FILE = fopen($file, "w"); fwrite($FILE, $string); fclose($FILE); include $file; if (ArraySafe($GLOBALS, 'retval', 0) == 1) { SQL("update instances set version={$sVer}\n WHERE application = {$sApp}\n AND instance = {$sInst}"); } echo ob_get_clean(); }