function get_latest_text($page_title, $namespace = 0, $opt = 0) { global $db; $text_id = get_latest($page_title, $namespace, $opt = 0); if (!$text_id) { return false; } $sql = "SELECT * FROM text WHERE old_id='{$text_id}'"; $result = do_select($sql); return $result[1]['old_text']; }
function process_params() { $post_funcs = explode(',', POST_FUNCS); foreach ($post_funcs as $func) { if (!GET_EMPTY($func)) { // Process parametrized functions switch ($func) { case 'rate': update_rating(GET('file'), GET('rate'), SESSION()); break; // break for file/rate, return for all others // break for file/rate, return for all others case 'search': //move down //move down case 'q': get_results(GET('category'), GET('subcategory'), GET('sort'), GET('q', GET('search', '')), '', GET('order'), GET('commentsearch')); return; // default: // do nothing } // Process built-in functions switch ($func . ":" . GET($func)) { case 'comment:add': require "./comment_file.php"; return; case 'content:add': require "./add_file.php"; return; case 'content:update': require "./edit_file.php"; return; case 'content:delete': require "./delete_file.php"; return; case 'account:settings': require "./user_settings.php"; return; case 'action:show': show_file(GET("file"), SESSION()); return; case 'action:register': require "./register.php"; return; case 'action:browse': // Browsing by category seems is currently only supported "browse" option if (!GET_EMPTY('category')) { get_results(GET('category'), GET('subcategory'), GET('sort'), '', '', GET('order')); return; } else { if (!GET_EMPTY('user')) { get_results(GET('category'), GET('subcategory'), GET('sort'), '', GET('user'), GET('order')); return; } } // default: // do nothing } } } // All else fails, show the "Latest Uploads" page get_latest(); }
<?php if (empty($argv[1])) { die("Invocation error: team not specified\n"); } chdir(dirname(__FILE__)); $team = $argv[1]; function get_latest($team, $thing) { $files = glob("../bin/pocketcampus-server-{$team}-*-*.{$thing}"); sort($files); return basename(array_pop($files)); } $jarname = get_latest($team, "jar"); $configname = get_latest($team, "config"); $jarname or die("jar not found\n"); $configname or die("config not found\n"); date_default_timezone_set("Europe/Zurich"); $d = date("YmdHis"); $u = uniqid(''); //die("we should restart the server for $team\n"); $sig = "TERM"; $try = 0; while ("" != ($proc = exec("ps aux | grep pocketcampus-server-{$team}- | grep -v grep | tr '\t' ' ' | tr -s ' ' | cut -f 2 -d ' '"))) { echo "sending signal {$sig} to process {$proc}\n"; system("kill -{$sig} {$proc}"); $try++; sleep(1); if ($try > 5) { $sig = "KILL"; }
<?php include_once "vars.php"; function get_latest($team, $thing) { $files = glob("bin/pocketcampus-server-{$team}-*-*.{$thing}"); sort($files); return basename(array_pop($files)); } $logfile = get_latest($team, "log"); $logfile or die("No log file"); require 'PHPTail.php'; /** * Initilize a new instance of PHPTail * @var PHPTail */ $tail = new PHPTail("bin/{$logfile}"); /** * We're getting an AJAX call */ if (isset($_GET['ajax'])) { echo $tail->getNewLines($_GET['lastsize'], $_GET['grep'], $_GET['invert']); die; } /** * Regular GET/POST call, print out the GUI */ $tail->generateGUI();
<?php require_once 'utils.php'; require_once 'dbo.php'; require_once 'xhtml.php'; global $LSP_URL; if (!SESSION_EMPTY() && (get_user_id(SESSION()) == get_file_owner(GET('file')) || is_admin(get_user_id(SESSION())))) { if (GET('confirmation') == "true") { if (delete_file(GET('file'))) { display_success('File deleted successfully', array('Delete')); } else { display_error('Sorry, file ' . GET('file') . ' could not be deleted', array('Delete')); } get_latest(); } else { display_warning('This will delete all comments and ratings.', array('Delete', get_file_url())); echo '<div class="col-md-9">'; $form = new form(null, 'Confirm Delete', 'fa-trash'); ?> <p class="lead">Confirm deletion of <strong><?php echo get_file_name(GET('file')); ?> </strong>?</p> <div class="form-group"> <a class="btn btn-danger" href="<?php echo "{$LSP_URL}?content=delete&confirmation=true&file=" . GET('file'); ?> "> <span class="fa fa-check"></span> Delete</a> <a class="btn btn-warning" href="<?php echo "{$LSP_URL}?action=show&file=" . GET('file');
while (count($tmp) < 30 && count($tmp) < count($n)) { $tmp = array_filter($n, function ($e) use($time) { $current = microtime(TRUE); $old = str_to_microtime($e); $lapsed = $current - $old; return $lapsed < $time; }); $time += 600; } $num = count($tmp); return array_values($tmp); } if (isset($_GET["last"])) { $last_path = $_GET["last"]; $cnt = 0; $images = get_latest($cnt); if ($last_path == $images[count($images) - 1]) { echo $images[0]; } else { for ($i = 0; $i < count($images) - 1; ++$i) { if ($last_path == $images[$i]) { echo $images[$i + 1]; exit; } } echo end($images); } } else { if (isset($_GET["list"])) { $imgs = glob('uploads/*'); sort($imgs);