<?php
/************************************************************************
- * MXChange v0.2.1 Start: 08/31/2008 *
- * ================ Last change: 08/31/2008 *
+ * Mailer v0.2.1-FINAL Start: 08/31/2008 *
+ * =================== Last change: 08/31/2008 *
* *
* -------------------------------------------------------------------- *
* File : what-list_surfbar_urls.php *
* -------------------------------------------------------------------- *
* Kurzbeschreibung : Alle URLs in Surfbar auflisten und syncen *
* -------------------------------------------------------------------- *
- * $Revision:: 856 $ *
- * $Date:: 2009-03-06 20:24:32 +0100 (Fr, 06. Mär 2009) $ *
+ * $Revision:: $ *
+ * $Date:: $ *
* $Tag:: 0.2.1-FINAL $ *
- * $Author:: stelzi $ *
- * Needs to be in all Files and every File needs "svn propset *
- * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
+ * $Author:: $ *
* -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2008 by Roland Haeder *
+ * Copyright (c) 2003 - 2009 by Roland Haeder *
+ * Copyright (c) 2009, 2010 by Mailer Developer Team *
* For more information visit: http://www.mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
************************************************************************/
// Some security stuff...
-if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
- $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
- require($INC);
+if ((!defined('__SECURITY')) || (!isAdmin())) {
+ die();
} // END - if
// Add description as navigation point
-ADD_DESCR("admin", __FILE__);
+addMenuDescription('admin', __FILE__);
// By default show the list...
$show = true;
-// Check for 'id' element
-if ((REQUEST_POST_COUNT() > 0) && ((!REQUEST_ISSET_POST(('id'))) || (!is_array(REQUEST_POST('id'))) || (count(REQUEST_POST('id')) == 0))) {
+// Check for 'url_id' element
+if ((countRequestPost() > 0) && ((!isPostRequestParameterSet('url_id')) || (!is_array(postRequestParameter('url_id'))) || (count(postRequestParameter('url_id')) == 0))) {
// Not found so output message
- LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_SURFBAR_NO_SELECTIONS'));
+ loadTemplate('admin_settings_saved', false, '{--ADMIN_SURFBAR_NO_SELECTIONS--}');
// Abort here
return;
-}
+} // END - if
// Edit or delete button hit?
-if (REQUEST_ISSET_POST('edit')) {
+if (isFormSent('edit')) {
// Show entries for editing
- ADMIN_EDIT_ENTRIES_CONFIRM(
- REQUEST_POST('id'),
- "surfbar_urls",
- array("id", "userid", "url"),
- array("bigintval", "ADD_MEMBER_SELECTION_BOX", ""),
- array("", array(false, true, true), "")
+ adminEditEntriesConfirm(
+ postRequestParameter('url_id'),
+ 'surfbar_urls',
+ array('url_id', 'url_userid', 'url'),
+ array('bigintval', 'addMemberSelectionBox', ''),
+ array('', array(false, true, true, 'url_userid[]'), ''),
+ false,
+ 'url_id',
+ 'url_userid',
+ 'url_userid'
);
$show = false;
-} elseif (REQUEST_ISSET_POST(('do_edit'))) {
+} elseif (isPostRequestParameterSet('do_edit')) {
// Change data of entries
- ADMIN_EDIT_ENTRIES_CONFIRM(
- REQUEST_POST('id'),
- "surfbar_urls",
+ adminEditEntriesConfirm(
+ postRequestParameter('url_id'),
+ 'surfbar_urls',
array(),
array(),
array(),
- true
+ true,
+ 'url_id',
+ 'url_userid',
+ 'url_userid'
);
-} elseif (REQUEST_ISSET_POST(('delete'))) {
+} elseif (isPostRequestParameterSet('delete')) {
// Show entries for deletion
- ADMIN_DELETE_ENTRIES_CONFIRM(
- REQUEST_POST('id'),
- "surfbar_urls",
- array("id", "userid", "url", "registered"),
- array("bigintval", "ADMIN_USER_PROFILE_LINK", "FRAMETESTER", ""),
- array("", "", "", "")
+ adminDeleteEntriesConfirm(
+ postRequestParameter('url_id'),
+ 'surfbar_urls',
+ array('url_id', 'url_userid', 'url', 'url_registered'),
+ array('bigintval', 'generateUserProfileLink', 'generateFrametesterUrl', ''),
+ array('', '', '', ''),
+ false,
+ 'url_id',
+ 'url_userid',
+ 'url_userid'
);
$show = false;
-} elseif (REQUEST_ISSET_POST(('do_delete'))) {
+} elseif (isPostRequestParameterSet('do_delete')) {
// Remove entries from database
- ADMIN_DELETE_ENTRIES_CONFIRM(REQUEST_POST('id'), "surfbar_urls", array(), array(), array(), true);
-} elseif (REQUEST_ISSET_POST(('lock'))) {
+ adminDeleteEntriesConfirm(postRequestParameter('url_id'), 'surfbar_urls', array(), array(), array(), true, 'url_id');
+} elseif (isFormSent('lock')) {
// Un-/lock selected URLs. This does not work for pending URLs
- ADMIN_LOCK_ENTRIES_CONFIRM(
- REQUEST_POST('id'),
- "surfbar_urls",
- array("id", "userid", "url", "registered", "status"),
- array("bigintval", "ADMIN_USER_PROFILE_LINK", "FRAMETESTER", "", "SURFBAR_TRANSLATE_STATUS"),
- array("", "", "", "", "")
+ adminLockEntriesConfirm(
+ postRequestParameter('url_id'),
+ 'surfbar_urls',
+ array('url_id', 'url_userid', 'url', 'url_registered', 'url_status'),
+ array('bigintval', 'generateUserProfileLink', 'generateFrametesterUrl', '', 'translateSurfbarUrlStatus'),
+ array('', '', '', '', ''),
+ false,
+ 'url_id',
+ 'url_userid',
+ 'url_userid'
);
$show = false;
-} elseif (REQUEST_ISSET_POST(('do_lock'))) {
+} elseif (isPostRequestParameterSet('do_lock')) {
// Un-/lock selected URLs. This does not work for pending URLs
- ADMIN_LOCK_ENTRIES_CONFIRM(
- REQUEST_POST('id'),
- "surfbar_urls",
+ adminLockEntriesConfirm(
+ postRequestParameter('url_id'),
+ 'surfbar_urls',
array(),
array(),
array(),
- array("status" => array("ACTIVE" => "LOCKED", "LOCKED" => "ACTIVE")),
- true
+ array('url_status' => array('ACTIVE' => 'LOCKED', 'LOCKED' => 'ACTIVE')),
+ true,
+ 'url_id',
+ 'url_userid',
+ 'url_userid'
);
-} elseif (REQUEST_ISSET_POST(('undelete'))) {
+} elseif (isPostRequestParameterSet('undelete')) {
// Undelete selected URLs. This does only work for deleted URLs... ;-)
- ADMIN_UNDELETE_ENTRIES_CONFIRM(
- REQUEST_POST('id'),
- "surfbar_urls",
- array("id", "userid", "url", "registered", "status"),
- array("bigintval", "ADMIN_USER_PROFILE_LINK", "FRAMETESTER", "", "SURFBAR_TRANSLATE_STATUS"),
- array("", "", "", "", "")
+ adminUndeleteEntriesConfirm(
+ postRequestParameter('url_id'),
+ 'surfbar_urls',
+ array('url_id', 'url_userid', 'url', 'url_registered', 'url_status'),
+ array('bigintval', 'generateUserProfileLink', 'generateFrametesterUrl', '', 'translateSurfbarUrlStatus'),
+ array('', '', '', '', ''),
+ false,
+ 'url_id',
+ 'url_userid',
+ 'url_userid'
);
$show = false;
-} elseif (REQUEST_ISSET_POST(('do_undelete'))) {
+} elseif (isPostRequestParameterSet('do_undelete')) {
// Undelete selected URLs. This does only work for deleted URLs... ;-)
- ADMIN_UNDELETE_ENTRIES_CONFIRM(
- REQUEST_POST('id'),
- "surfbar_urls",
+ adminUndeleteEntriesConfirm(
+ postRequestParameter('url_id'),
+ 'surfbar_urls',
array(),
array(),
array(),
- array("status" => array("DELETED" => "ACTIVE")),
- true
+ array('url_status' => array('DELETED' => 'ACTIVE')),
+ true,
+ 'url_id',
+ 'url_userid',
+ 'url_userid'
);
}
// Show entries?
-if (!$show) return false;
+if ($show === false) return false;
// List all URLs
-$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__);
+$result = SQL_QUERY("SELECT
+ `url_id`, `url_userid`, `url`, `url_views_total`, `url_status`,
+ UNIX_TIMESTAMP(`url_registered`) AS `url_registered`,
+ UNIX_TIMESTAMP(`url_last_locked`) AS `url_last_locked`,
+ `url_lock_reason`
+FROM
+ `{?_MYSQL_PREFIX?}_surfbar_urls`
+ORDER BY
+ `url_id` ASC", __FILE__, __LINE__);
// Do we have some URLs left?
-if (SQL_NUMROWS($result) > 0) {
+if (!SQL_HASZERONUMS($result)) {
// List all URLs
- $OUT = ""; $SW = 2;
+ $OUT = '';
while ($content = SQL_FETCHARRAY($result)) {
// "Translate"/add content
- $content['sw'] = $SW;
- $content['userid'] = ADMIN_USER_PROFILE_LINK($content['userid']);
- $content['url'] = FRAMETESTER($content['url']);
- $content['views_total'] = TRANSLATE_COMMA($content['views_total']);
- $content['status'] = SURFBAR_TRANSLATE_STATUS($content['status']);
- $content['registered'] = MAKE_DATETIME($content['registered'], 2);
- $content['last_locked'] = MAKE_DATETIME($content['last_locked'], 2);
- if (empty($content['lock_reason'])) $content['lock_reason'] = "---";
+ $content['url_registered'] = generateDateTime($content['url_registered'], 2);
+ $content['url_last_locked'] = generateDateTime($content['url_last_locked'], 2);
// Load row template
- $OUT .= LOAD_TEMPLATE("admin_list_surfbar_urls_row", true, $content);
-
- // Switch color
- $SW = 3 - $SW;
+ $OUT .= loadTemplate('admin_list_surfbar_urls_row', true, $content);
} // END - while
// Load main template
- LOAD_TEMPLATE("admin_list_surfbar_urls", false, $OUT);
+ loadTemplate('admin_list_surfbar_urls', false, $OUT);
} else {
// No URLs in surfbar
- LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_SURFBAR_NO_URLS_FOUND'));
+ loadTemplate('admin_settings_saved', false, '{--ADMIN_SURFBAR_NO_URLS_FOUND--}');
}
// Free result
SQL_FREERESULT($result);
-//
+// [EOF]
?>