<?php include "./API.php"; protectFile("download.php", "", __LINE__); if (!isset($_GET['f'])) { echo writeError(9098, loadString("download_no_get")); die; } if (!file_exists($API['root'] . "uploads/" . $_GET['f'])) { echo writeError(9097, loadString("download_no_exist")); die; } $f = array("filename" => $_GET['f'], "extention" => strtolower(substr(strrchr($_GET['f'], "."), 1)), "basename" => basename($_GET['f']), "filesize" => filesize($_GET['f']), "mimetype" => mime_content_type($API['root'] . "uploads/" . $_GET['f']), "full" => $API['root'] . "uploads/" . $_GET['f']); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private", false); header("Content-Type: " . $f['mimetype'] . ""); header("Content-Disposition: attachment; filename=\"" . $f['basename'] . "\";"); header("Content-Transfer-Encoding: binary"); header("Content-Length: " . $f['filesize']); readfile($f['full']);
* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ require "/home/winbolo/php/winbolonetcfg.php"; require "/home/winbolo/www/wbn/errors.php"; #Header stuff header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Pragma: no-cache"); // HTTP/1.0 # Extract data $argstmp = explode("&", getenv('QUERY_STRING')); while (list($stuff, $crap) = each($argstmp)) { list($idx, $val) = explode("=", $crap); $args[$idx] = rawurldecode($val); } $fullData = $args[data]; # Check length if (strlen($fullData) < 4) { echo "Sorry. Wrong way"; exit; } $header = substr($fullData, 0, 3); #Check Header if (ord($header[0]) != $cfg_wbnversion_major || ord($header[1]) != $cfg_wbnversion_minor || ord($header[2]) != $cfg_wbnversion_revision) { writeError("Incorrect WinBolo.net Version"); exit; } $messageType = ord(substr($fullData, 3, 1)); $data = substr($fullData, 4);
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. ******************************************************************************/ include_once 'utils.php'; /** * Clean all the current data. * * @author Richard Friedman */ writeDatabaseInformation(); writeLine("<b>Cleaning up all the data.</b>"); $database = RingsideApiDbDatabase::getDatabaseConnection(); if ($database === false) { writeLine("No such database is currently available"); RingsideApiDbDatabase::closeConnection($database); } else { $schema = readSqlFile('RingsideDbCleanData.sql'); if ($schema === false) { writeError(' The SQL could not be loade from the application '); exit; } $result = RingsideApiDbDatabase::queryMultiLine($schema, $database); if ($result === false) { writeError('The database was not cleaned properly, check the error log.'); } else { writeLine("Database " . RingsideApiConfig::$db_name . " cleaned successfully "); } } writeLine(); writeLine("<b>Other options</b>"); writeLink("index.php", "Main Page"); writeLink("clean.php", "Clean Database");
// IF SECTION IS BLANK --> RETURN ALL FINDING AIDS if ($section == "") { print '<script language="javascript">location.href="' . $docroot . '";</script>'; exit; } // if level1 not valid ('','','') --> error $validSections = array("dsc", "title", "summary", "history", "using_collection", "about_findaid", "subjects"); if ($section != "" && !in_array($section, $validSections)) { writeError("There has been an error with the section you requested."); } // if there is a level2, and it is not an integer --> error if ($level1 != "" && !is_numeric($level1)) { writeError("There has been an error with the series you requested."); } if ($level2 != "" && !is_numeric($level2)) { writeError("There has been an error with the subseries you requested."); } $citation = getCitation($citeurl, $coinsurl, $docroot); if ($level1 != "") { $file .= "&level1=" . $level1; } if ($level2 != "") { $file .= "&level2={$level2}"; } $title = getSection($appurl, $phpurl, $doc, $section, $menuOrder, "title"); $briefTitle = getSection($appurl, $phpurl, $doc, $section, $menuOrder, "brieftitle"); if ($title != "") { // make breadcrumbs //print '<p class="breadcrumbs"> <a href="' . $acpurl . '">Archival Collections Portal</a> > <a href="' . str_replace("ead/","index/",$phpurl) . '">' . $repName . ' </a> > ' . $briefTitle . '</p>' . "\n"; print '<p class="breadcrumbs"> <a href="' . $acpurl . '">Archival Collections Portal</a> > <a href="' . $repLink . '">' . $repName . ' Collections</a> > Finding Aid: ' . $briefTitle . '</p>' . "\n"; print "<h1 style=\"padding-bottom:0px;margin-bottom:0px;padding-top:10px;margin-top:10px;margin-left:15px;\">" . $title . "</h1>";
include_once "helpers.php"; } // #$path = " /www/data/cu/lweb/archival/collections/ssi/" . $repository . ".html"; // #$url = "http://www.columbia.edu/cu/lweb/archival/collections/ssi/" . $repository . "/information.html"; //$path = " /www/data/cu/lweb/archival/collections/ssi/" . $repository . ".html"; // marquis, 2/2012 - is this used anywhere? // $path = "/lamp/ldpd/archivesportal/includes/" . $repository . ".php"; //$url = "http://www.columbia.edu/cu/lweb/archival/collections/ssi/" . $repository . "/information.html"; $url = "http://archivesportal.cul.columbia.edu/includes/" . $repository . ".php"; $headerFile = 'header_print.php'; include_once $headerFile; // content print "<hr />\n"; print "<div class=\"page\"><br /><br />\n"; if ($repository == "" || $doc == "") { writeError("There was an error accessing this finding aid."); include_once "footer_print.php"; exit; } $title = getTitle($appurl, $doc); echo $title . "\n"; // NODES ONLY -- NOT ATTRIBUTES $validHTML = array('p' => 'p', 'ul' => 'ul', 'li' => 'li', 'head' => 'h2', 'title' => 'em'); $hrefTag = false; $validHTML['unittitle'] = 'span'; $validHTML['unitdate'] = 'span'; $validHTML['c'] = 'div'; $validHTML['extent'] = 'span'; $validHTML['unitid'] = 'span'; $validHTML['unittitle'] = 'span'; $validHTML['unitdate'] = 'span';
function runScript($scriptName, $skipSleep = false) { global $dbconn; echo $scriptName . "\n "; $start_time = time(); try { include $scriptName . '.php'; } catch (Exception $e) { writeError($e); } if (!$skipSleep) { $end_time = time(); $time_dif = $end_time - $start_time; $timeran = 92 - $time_dif; echo " sleeping {$timeran} "; if ($timeran > 0) { sleep($timeran); } else { sleep(1); } } }
function action_split($options) { global $config; $gitDir = $config['git_dir']; $tmpFolder = $config['tmp_dir']; $projectFolder = $config['project_dir']; $moduleRelPath = $config['module_rel_path']; if (!isset($options['package'])) { writeError('package not provided in param --package'); exit(1); } if (!isset($options['module-dir'])) { writeError('module-dir not provided in param --module-dir'); exit(1); } $package = $options['package']; $moduleDir = $options['module-dir']; //prepare tmp execCmd("rm -Rf {$tmpFolder};mkdir {$tmpFolder};cd {$tmpFolder};git init --bare"); execCmd("git subtree split --prefix={$moduleRelPath}/{$moduleDir} -b {$package}", $projectFolder); execCmd("git push {$tmpFolder}/ {$package}:master"); execCmd("git remote add origin {$gitDir}/{$package}.git", $tmpFolder); execCmd("git push origin master", $tmpFolder); execCmd("git rm -r {$moduleRelPath}/{$moduleDir}", $projectFolder); execCmd('git commit -am "Remove split code from module."', $projectFolder); execCmd("git remote add origin/modules-{$package} {$gitDir}/{$package}.git", $projectFolder); execCmd("git subtree add --prefix={$moduleRelPath}/{$moduleDir} --squash origin/modules-{$package} master", $projectFolder); //git branch -D rest execCmd("git branch -D {$package}", $projectFolder); echo "\nUpdate file [configs.php] add new key under [subtrees]:\n '{$package}' => '{$moduleDir}',\n\nLater, you can also use this same script to push, tag these subtrees.\n"; }
/** * Load the basic data to get started out of box. * * @param string $defaultPassword * @param string $adminPassword * @param database_connection $database * @return true/false on setting up data. */ function loadBasicData($defaultPassword, $adminPassword, $database = null) { $fixtureInstallFailed = false; if ((include_once 'RingsideWebFixtures.php') === false) { writeError('Could not include web fixtures.'); } try { RingsideWebFixtures::installLocalDomain(); RingsideWebFixtures::installApps(); } catch (Exception $e) { writeError('Could not install web fixtures: ' . $e->getMessage()); $fixtureInstallFailed = true; } if (!$fixtureInstallFailed) { writeLine('Successfully installed web fixtures.'); } $schema = readSqlFile('RingsideDbBasicData.sql'); if ($schema === false) { writeError(' The SQL could not be loaded from the application '); return false; } // Some replacements need to happen for this script. $schema = str_replace('$everyPassword', sha1($defaultPassword), $schema); $schema = str_replace('$adminPassword', sha1($adminPassword), $schema); $schema = str_replace('$socialApiKey', RingsideSocialConfig::$apiKey, $schema); $schema = str_replace('$socialSecretKey', RingsideSocialConfig::$secretKey, $schema); $schema = str_replace('$webNetworkKey', RingsideWebConfig::$networkKey, $schema); $schema = str_replace('$webUrl', RingsideApiClientsConfig::$webUrl, $schema); $schema = str_replace('$socialUrl', RingsideApiClientsConfig::$socialUrl, $schema); $schema = str_replace('$serverUrl', RingsideApiClientsConfig::$serverUrl, $schema); global $demoUrl; if (isset($demoUrl) && !empty($demoUrl)) { $schema = str_replace('$demoUrl', $demoUrl, $schema); } else { $schema = str_replace('$demoUrl', RingsideApiClientsConfig::$webUrl, $schema); } $database = RingsideApiDbDatabase::getDatabaseConnection(); $result = RingsideApiDbDatabase::queryMultiLine($schema, $database); if ($result === false) { writeError('The database was not setup properly, check the error log. <br /> ' . mysql_error()); return false; } else { writeLine("Database <b>" . RingsideApiConfig::$db_name . "</b> setup successfully "); return true; } }
} echo "<hr />"; writeLine("<h1>Step 5: Setting up initial data.</h1>"); $adminPassword = createRandomPassword(); $result = loadBasicData('ringside', $adminPassword, $database); if ($result == true) { writeLine(" Basic setup information and some sample data was written to the database."); // writeLine( " Admin user name is <b>admin</b> and password is <b>$adminPassword</b>" ); writeLine(" The following example users were created as well, all with password <b>ringside</b>"); echo "<table cellpadding='4' width='80%'> "; writeRow('*****@*****.**', '*****@*****.**', '*****@*****.**', 1); writeRow('*****@*****.**', '*****@*****.**', '*****@*****.**', 2); writeRow('*****@*****.**', '*****@*****.**', '*****@*****.**', 3); echo "</table>"; } else { writeError(" While everything seems to be setup we could not add the data to the database. <br />" . "<b>Maybe do some clean up of an old install/version first?</b>"); writeLink("drop.php", "Drop Schema, Start Again"); return; } $href = ""; if (isset($_SERVER['PATH_INFO'])) { $href = "../" . $href; } echo "<hr />"; $successMessage = "You are configured <br />"; $successMessage .= "Login as administrator: <b>username</b> : admin <b>password</b>: {$adminPassword} <br />"; $successMessage .= "OR<br />"; $successMessage .= "Login with user <b>username</b> : joe@goringside.net <b>password</b>: ringside <br />"; $successMessage .= '<a href="' . $href . 'login.php">Go to Login Page </a> '; $successMessage .= ' or <a href="' . $href . 'register.php">Register a new user!</a>'; writeSuccess($successMessage);
$error = "Not a valid game: " . $key; $proceed = false; } } # Try creating updating table if ($proceed == true) { $query = "update archived_game_server set ags_log_available = 'Y', ags_log_size = {$size}, ags_log_downloads = 0 where ags_key = '{$sqlKey}'"; $result2 = mysql_query($query); if (!$result2) { $proceed = false; $error = "Create error . {$query}"; } else { $path = $cfg_upload_log_path . $key; } } if ($proceed == true) { $proceed = move_uploaded_file($logfile['tmp_name'], $path); if ($proceed == false) { $error = "Move failed"; $query = "update archived_game_server set ags_log_available='N' where ags_key = '{$sqlKey}'"; mysql_query($query); } } if ($error == "OK") { echo chr(1); echo chr(1); exit; } else { writeError($error); exit; }
<?php include "../API.php"; if (file_exists($API['root'] . "xml/config.xml")) { writeJARDMessage("Welcome to JArD", "This pages shows you have sucessfully installed JArD onto your personal webserver."); } else { writeError(9095, parseString(loadString("new_install_welcome"))); }
function protectFile($file, $key = "", $line = null) { if (strpos($_SERVER['PHP_SELF'], $file)) { if (!empty($key)) { if (isset($_GET['accesskey'])) { if ($_GET['accesskey'] == $key) { return; } } } $error = parseString(loadString("direct_access_forbidden") . "[dotted]protectFile(\"{$file}\")[/dotted]"); if ($line) { $error .= parseString(" on line {$line}"); } $error .= parseString(" in {$file}."); if (empty($key)) { $error .= parseString("<br />" . loadString("file_no_accesskey")); } echo writeError(9099, $error); die; } }
<input type="text" name="username" id="username" maxlength="50" value="<?php echo $username; ?> " required/> <?php if ($formSend && $usernameValid != "") { writeError($usernameValid, "username"); } ?> <br> <br> <label for="password"><strong>Password:</strong></label><br> <input type="password" name="password" id="password" maxlength="50" required/> <?php if ($formSend && $passwordValid != "") { writeError($passwordValid, "password"); } ?> <br> <br> <br> <input type="submit" name="Submit" value="Login" id="submit"/> </fieldset> </form> <h2>Don't have an account yet? Register <a href="register.php">here</a>.</h2> </div> <footer> </footer> </body> </html>
function shutdownError() { $feil = error_get_last(); /* returnerer en array */ writeError($feil['type'], $feil['message'], $feil['file'], $feil['line']); }
?> <br> <br> <label for="password"><strong>Password:</strong></label><br> <input type="password" name="password" id="password" maxlength="50" required/> <?php if ($formSend && $passwordValid != "") { writeError($passwordValid, "password"); } ?> <br> <br> <label for="passwordC"><strong>Confirm password:</strong></label><br> <input type="password" name="passwordC" id="passwordC" maxlength="50" required/> <?php if ($formSend && $passwordCValid != "") { writeError($passwordCValid, "passwordC"); } ?> <br> <br> <br> <input type="submit" name="Submit" value="Register" id="submit"/> </fieldset> </form> </div> <footer> </footer> </body> </html>
function openDatabase($open) { global $link; global $cfg_winbolodb_user; global $cfg_winbolodb_pass; global $cfg_winbolodb; # declare some variables $site = "localhost"; $username = $cfg_winbolodb_user; $password = $cfg_winbolodb_pass; $dbName = $cfg_winbolodb; if ($open == true) { $link = @mysql_connect($site, $username, $password); if (!$link) { writeError("WinBolo.net Temporarily Unavailable"); } if (!mysql_select_db($dbName)) { writeError("WinBolo.net Temporarily Unavailable"); } } }
public static function logActivity($activity, $message, $result) { if (!self::initialize()) { writeError("No connection error:\n" . $activity . "\n" . $message . "\n" . $result); return false; } $createTable = "CREATE TABLE IF NOT EXISTS `activity_log` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `activity` text NOT NULL,\n `message` text NOT NULL,\n `result` text NOT NULL,\n `session` text NOT NULL,\n `createdOn` datetime NOT NULL,\n `updatedOn` datetime NOT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;"; self::query($createTable); $data = array("activity" => $activity, "message" => $message, "result" => $result); $table = "activity_log"; $data['session'] = print_r($_SESSION, true); $data['updatedOn'] = date("Y-m-d H:i:s"); $data['createdOn'] = date("Y-m-d H:i:s"); return self::insert($table, $data); }
function processServerQuit($key) { global $link; $ip = getenv("REMOTE_ADDR"); if (strlen($key) != 32) { writeError("Invalid data length"); } $sqlServerKey = mysql_escape_string($key); openDatabase(true); #Copy into the archived_game_server table $sql = "insert into archived_game_server (ags_key, ags_ip, ags_port, ags_mapname, ags_password, ags_numbases, ags_numpills, ags_mines, ags_freebases, ags_freepills, ags_numtanks, ags_starttime, ags_firstheard, ags_lastheard, ags_ai , ags_gametype, ags_version) select gs_key, gs_ip, gs_port, gs_mapname, gs_password, gs_numbases, gs_numpills, gs_mines, gs_freebases, gs_freepills, gs_numtanks, gs_starttime, gs_firstheard, gs_lastheard, gs_ai , gs_gametype, gs_version from game_server where gs_key='{$sqlServerKey}'"; $result = mysql_query($sql); if (mysql_affected_rows() != 1) { writeError("<br>Database error"); } $sql = "SELECT gs_gametype from game_server where gs_key = '{$sqlServerKey}'"; $result = mysql_query($sql); $gameType = getGameType(mysql_result($result, 0, "gs_gametype")); #Copy game events into archived_game_events table # Player A and Player B is null $sql = "insert into archived_game_event (age_serverkey, age_eventtype, age_timestamp) select g.ge_serverkey, g.ge_eventtype, g.ge_timestamp from game_event g where g.ge_playera is null and g.ge_playerb is null and g.ge_serverkey = '{$sqlServerKey}' "; $result = mysql_query($sql); # Player A is not null and Player B is null $sql = "insert into archived_game_event (age_serverkey, age_eventtype, age_playera, age_timestamp) select g.ge_serverkey, g.ge_eventtype, a.ap_pid, g.ge_timestamp from game_event g, active_player a where g.ge_playera = a.ap_key and g.ge_playerb is null and g.ge_serverkey = '{$sqlServerKey}'"; $result = mysql_query($sql); # Player A is null and Player B is not null $sql = "insert into archived_game_event (age_serverkey, age_eventtype, age_playerb, age_timestamp) select g.ge_serverkey, g.ge_eventtype, a.ap_pid, g.ge_timestamp from game_event g, active_player a where g.ge_playerb = a.ap_key and g.ge_playera is null and g.ge_serverkey = '{$sqlServerKey}'"; $result = mysql_query($sql); # Player A and Player B are not null $sql = "insert into archived_game_event (age_serverkey, age_eventtype, age_playera, age_playerb, age_timestamp) select g.ge_serverkey, g.ge_eventtype, a.ap_pid, a2.ap_pid, g.ge_timestamp from game_event g, active_player a, active_player a2 where g.ge_playera = a.ap_key and g.ge_playerb = a2.ap_key and g.ge_playerb is not null and g.ge_serverkey = '{$sqlServerKey}'"; $result = mysql_query($sql); # Do stats run # Update number of pill/base/tank takes $sql = "SELECT a.ap_pid, g.ge_eventtype, count(*) as total from game_event g, active_player a where g.ge_serverkey = '{$sqlServerKey}' and g.ge_playera = a.ap_key group by a.ap_pid, g.ge_eventtype"; $playersResult = mysql_query($sql); $rows = mysql_num_rows($playersResult); $count = 0; while ($count < $rows) { $type = mysql_result($playersResult, $count, "ge_eventtype"); $value = mysql_result($playersResult, $count, "total"); $pid = mysql_result($playersResult, $count, "ap_pid"); $proceed = false; if ($type == WINBOLO_NET_EVENT_BASE_CAPTURE || $type == WINBOLO_NET_EVENT_BASE_STEAL) { $event = $gameType . "_num_bases"; $proceed = true; } else { if ($type == WINBOLO_NET_EVENT_PILL_CAPTURE || $type == WINBOLO_NET_EVENT_PILL_STEAL) { $event = $gameType . "_num_pills"; $proceed = true; } else { if ($type == WINBOLO_NET_EVENT_TANK_KILL) { $event = $gameType . "_num_tanks"; $proceed = true; } } } if ($proceed == true) { $sql = "UPDATE stats_player set {$event} = {$event} + {$value} where pid = {$pid}"; $result = mysql_query($sql); } $count++; } #update number of games played $sql = "SELECT distinct ap_pid from active_player where ap_serverkey = '{$sqlServerKey}'"; $playersResult = mysql_query($sql); $rows = mysql_num_rows($playersResult); $count = 0; while ($count < $rows) { $pid = mysql_result($playersResult, $count, "ap_pid"); $fieldName = $gameType . "_num_games"; $sql = "UPDATE stats_player set {$fieldName} = {$fieldName} + 1 where pid = {$pid}"; $result = mysql_query($sql); $count++; } #Calculate Ranks calculateRanks($sqlServerKey); # Insert into the player journal table $sql = "insert into journal (j_key, j_pid) select distinct g.ge_serverkey, a.ap_pid from game_event g, active_player a where g.ge_serverkey = '{$sqlServerKey}' and g.ge_playera = a.ap_key and g.ge_playera is not null;"; $result = mysql_query($sql); # Lastly delete it from the active games list $sql = "delete from game_event where ge_serverkey = '{$sqlServerKey}'"; $result = mysql_query($sql); $sql = "delete from active_player where ap_serverkey = '{$sqlServerKey}'"; $result = mysql_query($sql); $sql = "delete from game_server where gs_key = '{$sqlServerKey}'"; $result = mysql_query($sql); $sql = "delete from active_team where at_serverkey = '{$sqlServerKey}'"; $result = mysql_query($sql); }