public function getEntries($f_iLimit = 0, $f_szOrder = 'o ASC') { if (null === $this->_entries) { $es = AROGuestbookEntry::finder()->findMany('deleted = \'0\' AND ' . ($this->must_verify ? 'verified = \'1\' AND ' : '') . 'guestbook_implementation_id = ? ORDER BY ' . $f_szOrder . ', id ASC' . (0 < $f_iLimit ? ' LIMIT ' . $f_iLimit : ''), $this->implementation_id); if (0 < count($es)) { $es[0]->sequenceStart = true; $es[count($es) - 1]->sequenceEnd = true; } foreach ($es as $e) { $e->init($this); } $this->_entries = $es; } return $this->_entries; }
&sort=1">Sort</a></p> <table id="sortable" border="2" cellpadding="3" cellspacing="0" bordercolor="white" width="700"> <thead> <tr> <th>o</th> <th>Name</th> <th>E-mail</th> <th>Subject</th> <th>When</th> <th>Approved</th> </tr> </thead> <tbody> <?php $arrEntries = AROGuestbookEntry::finder()->findMany((empty($_GET['showdeleted']) ? "deleted = '0' AND " : '') . 'guestbook_implementation_id = ' . $objGuestbook->implementation_id . ' ORDER BY o ASC, id ASC'); foreach ($arrEntries as $e) { echo '<tr mid="' . $e->id . '"' . (empty($_GET['sort']) ? '' : ' bgcolor="#cccccc"') . '>'; echo ' <td>' . $e->o . '</td>'; echo ' <td>' . $e->name . '</td>'; echo ' <td>' . $e->email . '</td>'; echo ' <td>' . $e->subject . '</td>'; echo ' <td><a href="edit_entry.php?id=' . $_GET['id'] . '&entry=' . $e->id . '">' . date('Y-m-d H:i:s', $e->utc) . '</td>'; echo ' <td align="center">' . ($e->verified ? 'Y' : 'N') . '</td>'; echo ' <td><a href="?id=' . $_GET['id'] . '&del=' . $e->id . '">x</a></td>'; echo '</tr>'; } ?> </tbody> </table> <?php
<?php require_once 'cfg_admin.php'; logincheck(); $objGuestbook = AROImplementation::loadImplementationByID($_GET['id']); $objEntry = AROGuestbookEntry::finder()->findOne('id = ? AND guestbook_implementation_id = ?', $_GET['entry'], $objGuestbook->implementation_id); if (isset($_POST['name'], $_POST['email'], $_POST['website'], $_POST['subject'], $_POST['message'], $_POST['message_2'], $_POST['verified'])) { unset($_POST['id'], $_POST['o'], $_POST['deleted'], $_POST['ip'], $_POST['utc'], $_POST['guestbook_implementation_id']); $db->update('guestbook_entries', $_POST, 'id = ' . $objEntry->id); header('Location: entries.php?id=' . $_GET['id']); exit; } tpl_header(); echo '<h1>Editing entry in guestbook: ' . $objGuestbook->title . '</h1>'; ?> <form method="post" action=""> <p><?php echo $objGuestbook->label_for_name; ?> :<br /><input type="text" name="name" value="<?php echo $objEntry->name; ?> " /></p> <p><?php echo $objGuestbook->label_for_email; ?> :<br /><input type="text" name="email" value="<?php echo $objEntry->email; ?>