]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-list_surfbar_urls.php
Code style changed, ext-user continued:
[mailer.git] / inc / modules / admin / what-list_surfbar_urls.php
index 3b8f7b7afc8f5626d740e83cc4eeb876be704146..02943e89dfcc1dd9e1741000d968fb91a517ee96 100644 (file)
@@ -1,7 +1,7 @@
 <?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::                                                        $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2008 by Roland Haeder                           *
- * For more information visit: http://www.mxchange.org                  *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
  * it under the terms of the GNU General Public License as published by *
  ************************************************************************/
 
 // Some security stuff...
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!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", basename(__FILE__));
+addYouAreHereLink('admin', __FILE__);
 
 // By default show the list...
-$show = true;
+$show = TRUE;
 
-// Edit or delete button hit?
-if (isset($_POST['edit'])) {
-       // Delete entries (with confirmation)
-       ADMIN_EDIT_ENTRIES_CONFIRM(
-               $_POST['id'],
-               "surfbar_urls",
-               array("id", "userid", "url", "reward", "costs"),
-               array("bigintval", "ADD_MEMBER_SELECTION_BOX", "", "TRANSLATE_COMMA", "TRANSLATE_COMMA"),
-               array("", array(false, true, true), "", "", "")
-       );
-       $show = false;
-} elseif (isset($_POST['do_edit'])) {
-       // Delete entries (with confirmation)
-       ADMIN_EDIT_ENTRIES_CONFIRM(
-               $_POST['id'],
-               "surfbar_urls",
-               array("", ""),
-               array('reward' => "REVERT_COMMA", 'costs' => "REVERT_COMMA"),
-               array('reward' => "", 'costs' => ""),
-               true
-       );
-} elseif (isset($_POST['delete'])) {
-       // Delete entries (with confirmation)
-       ADMIN_DELETE_ENTRIES_CONFIRM($_POST['id'], "surfbar_urls", array("id", "userid", "url", "registered"), array("bigintval", "ADMIN_USER_PROFILE_LINK", "FRAMETESTER", "MAKE_DATETIME"), array("", "", "", "2"));
-       $show = false;
-} elseif (isset($_POST['remove'])) {
-       // Delete entries (with confirmation)
-       ADMIN_DELETE_ENTRIES_CONFIRM($_POST['id'], "surfbar_urls", array(), array(), array(), true);
-}
+// Check for 'url_id' element
+if ((countRequestPost() > 0) && (!ifPostContainsSelections('url_id'))) {
+       // Not found so output message
+       displayMessage('{--ADMIN_SURFBAR_NO_SELECTIONS--}');
 
-// Show entries?
-if (!$show) return false;
+       // Abort here
+       return;
+} // END - if
 
-// 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__);
+// Edit or delete button hit?
+if (isFormSent('edit')) {
+       // Show entries for editing
+       showEntriesByXmlCallback('admin_edit_show_surfbar_urls');
 
-// Do we have some URLs left?
-if (SQL_NUMROWS($result) > 0) {
-       // List all URLs
-       $OUT = ""; $SW = 2;
-       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['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);
-               $content['last_locked'] = MAKE_DATETIME($content['last_locked'], 2);
-               if (empty($content['lock_reason'])) $content['lock_reason'] = "---";
+       // Do not show the list of URLs after this template
+       $show = FALSE;
+} elseif (isFormSent('do_edit')) {
+       // Change data of entries
+       showEntriesByXmlCallback('admin_edit_do_surfbar_urls');
+} elseif (isFormSent('delete')) {
+       // Show entries for deletion
+       showEntriesByXmlCallback('admin_delete_show_surfbar_urls');
 
-               // Load row template
-               $OUT .= LOAD_TEMPLATE("admin_list_surfbar_urls_row", true, $content);
+       // Do not show the list of URLs after this template
+       $show = FALSE;
+} elseif (isFormSent('do_delete')) {
+       // Remove entries from database
+       showEntriesByXmlCallback('admin_delete_do_surfbar_urls');
+} elseif (isFormSent('lock')) {
+       // Un-/lock selected URLs. This does not work for pending URLs
+       showEntriesByXmlCallback('admin_lock_show_surfbar_urls');
 
-               // Switch color
-               $SW = 3 - $SW;
-       } // END - while
+       // Do not show the list of URLs after this template
+       $show = FALSE;
+} elseif (isFormSent('do_lock')) {
+       // Un-/lock selected URLs. This does not work for pending URLs
+       showEntriesByXmlCallback('admin_lock_do_surfbar_urls');
+} elseif (isFormSent('undelete')) {
+       // Undelete selected URLs. This does only work for deleted URLs... ;-)
+       showEntriesByXmlCallback('admin_undelete_show_surfbar_urls');
 
-       // Load main template
-       LOAD_TEMPLATE("admin_list_surfbar_urls", false, $OUT);
-} else {
-       // No URLs in surfbar
-       LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_SURFBAR_NO_URLS_FOUND);
+       // Do not show the list of URLs after this template
+       $show = FALSE;
+} elseif (isFormSent('do_undelete')) {
+       // Undelete selected URLs. This does only work for deleted URLs... ;-)
+       showEntriesByXmlCallback('admin_undelete_do_surfbar_urls');
 }
 
-// Free result
-SQL_FREERESULT($result);
+// Show entries?
+if ($show === FALSE) {
+       // No, a form has already been show
+       return FALSE;
+} // END - if
+
+// List all URLs
+showEntriesByXmlCallback('admin_list_surfbar_urls');
 
-//
+// [EOF]
 ?>