mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Pull out DB code from trusted user page
* Move DB code in tu.php and tu.php and tu_list.php to new functions in accfuncs.inc.php * Centralization of DB code important in a future transition to PDO interface Signed-off-by: canyonknight <canyonknight@gmail.com> Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
8a59cd6208
commit
c15441762c
3 changed files with 130 additions and 68 deletions
|
@ -14,9 +14,15 @@
|
|||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php if (mysql_num_rows($result) == 0): ?>
|
||||
<?php if (empty($result)): ?>
|
||||
<tr><td align="center" colspan="0"><?php print __("No results found.") ?></td></tr>
|
||||
<?php else: for ($i = 0; $row = mysql_fetch_assoc($result); $i++): (($i % 2) == 0) ? $c = 'odd' : $c = 'even'; ?>
|
||||
<?php else: while (list($indx, $row) = each($result)):
|
||||
if ($indx % 2):
|
||||
$c = "even";
|
||||
else:
|
||||
$c = "odd";
|
||||
endif;
|
||||
?>
|
||||
<tr class="<?php print $c ?>">
|
||||
<td><?php $row["Agenda"] = htmlspecialchars(substr($row["Agenda"], 0, $prev_Len)); ?>
|
||||
<a href="tu.php?id=<?php print $row['ID'] ?>"><?php print $row["Agenda"] ?></a></span></span>
|
||||
|
@ -34,23 +40,15 @@
|
|||
<td><?php print $row['Yes'] ?></td>
|
||||
<td><?php print $row['No'] ?></td>
|
||||
<td>
|
||||
<?php
|
||||
$q = "SELECT * FROM TU_Votes WHERE VoteID = " . $row['ID'] . " AND UserID = " . uid_from_sid($_COOKIE["AURSID"]);
|
||||
$result_tulist = db_query($q, $dbh);
|
||||
if ($result_tulist):
|
||||
$hasvoted = mysql_num_rows($result_tulist);
|
||||
else:
|
||||
$hasvoted = 0;
|
||||
endif;
|
||||
if ($hasvoted == 0): ?>
|
||||
<span style="color: red; font-weight: bold"><?php print __("No") ?></span>
|
||||
<?php else: ?>
|
||||
<?php if (tu_voted($row['ID'], uid_from_sid($_COOKIE["AURSID"]))): ?>
|
||||
<span style="color: green; font-weight: bold"><?php print __("Yes") ?></span>
|
||||
<?php else: ?>
|
||||
<span style="color: red; font-weight: bold"><?php print __("No") ?></span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
endfor;
|
||||
endwhile;
|
||||
endif;
|
||||
?>
|
||||
</tbody>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue