************************************************************************/
// Some security stuff...
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!is_admin())) {
+if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
require($INC);
} // END - if
// Add description as navigation point
-ADD_DESCR("admin", basename(__FILE__));
+ADD_DESCR("admin", __FILE__);
+
+// By default show the list...
+$show = true;
+
+// Check for 'id' element
+if ((count($_POST) > 0) && ((!isset($_POST['id'])) || (!is_array($_POST['id'])) || (count($_POST['id']) == 0))) {
+ // Not found so output message
+ LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_SURFBAR_NO_SELECTIONS'));
+
+ // Abort here
+ return;
+}
+
+// Edit or delete button hit?
+if (isset($_POST['edit'])) {
+ // Show entries for editing
+ ADMIN_EDIT_ENTRIES_CONFIRM(
+ $_POST['id'],
+ "surfbar_urls",
+ array("id", "userid", "url"),
+ array("bigintval", "ADD_MEMBER_SELECTION_BOX", ""),
+ array("", array(false, true, true), "")
+ );
+ $show = false;
+} elseif (isset($_POST['do_edit'])) {
+ // Change data of entries
+ ADMIN_EDIT_ENTRIES_CONFIRM(
+ $_POST['id'],
+ "surfbar_urls",
+ array(),
+ array(),
+ array(),
+ true
+ );
+} elseif (isset($_POST['delete'])) {
+ // Show entries for deletion
+ ADMIN_DELETE_ENTRIES_CONFIRM(
+ $_POST['id'],
+ "surfbar_urls",
+ array("id", "userid", "url", "registered"),
+ array("bigintval", "ADMIN_USER_PROFILE_LINK", "FRAMETESTER", ""),
+ array("", "", "", "")
+ );
+ $show = false;
+} elseif (isset($_POST['do_delete'])) {
+ // Remove entries from database
+ ADMIN_DELETE_ENTRIES_CONFIRM($_POST['id'], "surfbar_urls", array(), array(), array(), true);
+} elseif (isset($_POST['lock'])) {
+ // Un-/lock selected URLs. This does not work for pending URLs
+ ADMIN_LOCK_ENTRIES_CONFIRM(
+ $_POST['id'],
+ "surfbar_urls",
+ array("id", "userid", "url", "registered", "status"),
+ array("bigintval", "ADMIN_USER_PROFILE_LINK", "FRAMETESTER", "", "SURFBAR_TRANSLATE_STATUS"),
+ array("", "", "", "", "")
+ );
+ $show = false;
+} elseif (isset($_POST['do_lock'])) {
+ // Un-/lock selected URLs. This does not work for pending URLs
+ ADMIN_LOCK_ENTRIES_CONFIRM(
+ $_POST['id'],
+ "surfbar_urls",
+ array(),
+ array(),
+ array(),
+ array("status" => array("ACTIVE" => "LOCKED", "LOCKED" => "ACTIVE")),
+ true
+ );
+} elseif (isset($_POST['undelete'])) {
+ // Undelete selected URLs. This does only work for deleted URLs... ;-)
+ ADMIN_UNDELETE_ENTRIES_CONFIRM(
+ $_POST['id'],
+ "surfbar_urls",
+ array("id", "userid", "url", "registered", "status"),
+ array("bigintval", "ADMIN_USER_PROFILE_LINK", "FRAMETESTER", "", "SURFBAR_TRANSLATE_STATUS"),
+ array("", "", "", "", "")
+ );
+ $show = false;
+} elseif (isset($_POST['do_undelete'])) {
+ // Undelete selected URLs. This does only work for deleted URLs... ;-)
+ ADMIN_UNDELETE_ENTRIES_CONFIRM(
+ $_POST['id'],
+ "surfbar_urls",
+ array(),
+ array(),
+ array(),
+ array("status" => array("DELETED" => "ACTIVE")),
+ true
+ );
+}
+
+// Show entries?
+if (!$show) return false;
// List all URLs
-$result = SQL_QUERY("SELECT id, userid, url, reward, costs, views_total, status, UNIX_TIMESTAMP(registered) AS registered, UNIX_TIMESTAMP(last_locked) AS last_locked, lock_reason
-FROM "._MYSQL_PREFIX."_surfbar_urls
-ORDER BY id ASC", __FILE__, __LINE__);
+$result = SQL_QUERY("SELECT id, userid, url, views_total, status, UNIX_TIMESTAMP(registered) AS registered, UNIX_TIMESTAMP(last_locked) AS last_locked, lock_reason
+FROM `{!_MYSQL_PREFIX!}_surfbar_urls`
+ORDER BY `id` ASC", __FILE__, __LINE__);
// Do we have some URLs left?
if (SQL_NUMROWS($result) > 0) {
$content['sw'] = $SW;
$content['userid'] = ADMIN_USER_PROFILE_LINK($content['userid']);
$content['url'] = FRAMETESTER($content['url']);
- $content['reward'] = TRANSLATE_COMMA($content['reward']);
- $content['costs'] = TRANSLATE_COMMA($content['costs']);
$content['views_total'] = TRANSLATE_COMMA($content['views_total']);
$content['status'] = SURFBAR_TRANSLATE_STATUS($content['status']);
$content['registered'] = MAKE_DATETIME($content['registered'], 2);
LOAD_TEMPLATE("admin_list_surfbar_urls", false, $OUT);
} else {
// No URLs in surfbar
- LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_SURFBAR_NO_URLS_FOUND);
+ LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_SURFBAR_NO_URLS_FOUND'));
}
// Free result