* none */ if (!defined("COMPOMANAGER")) { die("hacking attempt"); } if (ACCESS < ACCESS_HOST) { redirect(BASEDIR); } require_once 'compo.php'; require_once 'archive.php'; $compo = intval($_GET['which']); $result = $mysqli->query("SELECT * FROM `compos` WHERE `idcompo` = {$compo}") or die('query failed'); $row = $result->fetch_assoc(); $result->free(); // can the current user edit votes for this compo? if (!canEditCompo($row)) { // no compo redirect(BASEDIR); } $compo_name = htmlspecialchars($row['name']); $isActive = $row['active']; $result = $mysqli->query("SELECT * FROM `entries` WHERE `idcompo` = {$compo}") or die('query failed'); $songs = array(); $songindex = 0; while ($row = $result->fetch_assoc()) { $songindex++; $row['id'] = $songindex; $row['points'] = 0; $row['penalty'] = 0; $songs[] = $row; }
function viewCompoAjax($compo, $ajax) { global $mysqli; $compo = intval($compo); $result = $mysqli->query("SELECT * FROM `compos` WHERE `idcompo` = {$compo}") or die('query failed'); $row = $result->fetch_assoc(); $result->free(); $downloadable = $row["downloadable"]; if (!canEditCompo($row)) { redirect(BASEDIR); } if ($ajax) { ob_end_clean(); } $alteredFiles = FALSE; $lastUpdate = 0; $result = $mysqli->query("SELECT * FROM `entries` WHERE `idcompo` = {$compo} ORDER BY `date` ASC") or die('query failed'); // Show list of uploading people checkCompoPings($compo, TRUE); if ($result->num_rows) { echo '<ul id="file-list">'; while ($row = $result->fetch_assoc()) { echo '<li> <span class="add-date">'; if ($row["altered"] != 0) { echo ' <span class="updated">updated!</span> '; $alteredFiles = TRUE; } $nameJS = str_replace("'", "\\'", str_replace("\\", "\\\\", htmlspecialchars($row["filename"]))); echo $row['date'], '</span> <a href="', BASEDIR, 'admin/delfile/', $row["identry"], '" onclick="return confirm(\'Delete ', $nameJS, '?\')"><img src="', BASEDIR, 'img/page_delete.png" width="16" height="16" alt="Delete" title="Delete"></a> <a href="', BASEDIR, 'admin/fetchfile/', $row["identry"], '" title="', htmlspecialchars($row["title"]), '"><strong>', htmlspecialchars($row["filename"]), '</strong></a> by <strong>', htmlspecialchars($row["author"]), '</strong></li>'; $lastUpdate = $row['date']; } $result->free(); echo '<li><a href="', BASEDIR, 'admin/fetchpack/', $compo, '"><img src="', BASEDIR, 'img/compress.png" width="16" height="16" alt=""> Download the whole pack (admin only)</a></li>'; echo '</ul>'; echo '<p><a href="', BASEDIR, 'admin/voting/', $compo, '"><img src="', BASEDIR, 'img/table.png" width="16" height="16" alt=""> Enter <strong>votes</strong></a> using lazyvote</p>'; if ($downloadable != 0) { echo '<p>This pack is <strong>downloadable</strong>. Point people to this URL to get the votepack:</p>'; echo '<p><input type="text" name="bar" value="', BASEDIR_ABSOLUTE, 'pack/', $compo, '" style="width:100%;" onfocus="this.select()"></p>'; echo '<p>Compo overview page:</p>'; echo '<p><input type="text" name="bar" value="', BASEDIR_ABSOLUTE, 'compo/', $compo, '" style="width:100%;" onfocus="this.select()"></p>'; } echo '<p><a href="', BASEDIR, 'admin/delpack/', $compo, '" onclick="return confirm(\'Delete all files?\')"><img src="', BASEDIR, 'img/page_delete.png" width="16" height="16" alt=""> Delete <strong>all</strong> files</a></p>'; } else { echo '<p>No files have been uploaded so far.</p>'; } if ($ajax) { echo '<span id="last-update" style="display:none;">', $lastUpdate, '</span>'; die; } return $alteredFiles; }