From: Roland Häder Date: Mon, 22 Sep 2008 00:28:55 +0000 (+0000) Subject: Surfbar member actions continued (good night! :)) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5d8ee76fbc3fc9829ac17344c143f45083753b22;p=mailer.git Surfbar member actions continued (good night! :)) --- diff --git a/.gitattributes b/.gitattributes index a046419f20..9d237d6244 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1300,6 +1300,8 @@ templates/de/html/member/member_support_form.tpl -text templates/de/html/member/member_surfbar_book_dynamic.tpl -text templates/de/html/member/member_surfbar_book_static.tpl -text templates/de/html/member/member_surfbar_link.tpl -text +templates/de/html/member/member_surfbar_list.tpl -text +templates/de/html/member/member_surfbar_list_row.tpl -text templates/de/html/member/member_surfbar_start_dynamic.tpl -text templates/de/html/member/member_surfbar_start_static.tpl -text templates/de/html/member/member_themes.tpl -text diff --git a/inc/language/surfbar_de.php b/inc/language/surfbar_de.php index be6cb67efb..ed6f45856b 100644 --- a/inc/language/surfbar_de.php +++ b/inc/language/surfbar_de.php @@ -87,12 +87,25 @@ define('ADMIN_SURFBAR_DELETE_URLS_TITLE', "Surfbar - URLs entfernen"); define('ADMIN_SURFBAR_EDIT_URLS_TITLE', "Surfbar - URLs editieren"); define('ADMIN_SURFBAR_LOCK_URLS_TITLE', "Surfbar - URLs sperren/entsperren"); +// Member titles +define('MEMBER_SURFBAR_LIST_TITLE', "Ihre URLs in der Surfbar verwalten"); + // General member text define('MEMBER_SURFBAR_URL_ADDED', "URL hinzugefügt und wartet auf Freischaltung."); define('MEMBER_SURFBAR_URL_NOT_ADDED', "URL konnte nicht hinzugefügt werden, da ein Fehler vorliegt."); define('MEMBER_SURFBAR_ADD_URL', "URL in Surfbar buchen"); define('MEMBER_SURFBAR_NO_MORE_ALLOWED', "Sie können leider nicht mehr URLs in der Surfbar buchen, da Sie das Maximum erreicht haben."); define('MEMBER_SURFBAR_NO_URLS_FOUND', "Sie haben noch keine URLs für die Surfbar gebucht."); +define('MEMBER_SURFBAR_VIEWS_TOTAL', "Views"); +define('MEMBER_SURFBAR_STATUS', "Anmeldestatus"); +define('MEMBER_SURFBAR_REGISTERED', "Angemeldet"); +define('MEMBER_SURFBAR_LAST_LOCKED', "Letzte Sperre"); +define('MEMBER_SURFBAR_LOCK_REASON', "Sperrgrund"); +define('MEMBER_SURFBAR_ACTIONS', "Aktionen"); +define('MEMBER_SURFBAR_TEST_URL', "URL anzeigen"); +define('MEMBER_SURFBAR_LIST_NOTE', "Bitte beachten Sie, dass Editieren und erneutes Aktivieren von gestoppten URLs eine Freischaltung durch unsere Administratoren nötig ist."); +define('MEMBER_SURFBAR_ACTION_DONE', "Ausgew&aumml;hlte Aktion ausgeführt."); +define('MEMBER_SURFBAR_ACTION_FAILED', "Ausgewählte Aktion konnte nicht vollständig ausgeführt werden!"); // Subject lines for admins define('ADMIN_SURFBAR_NOTIFY_URL_UNLOCK_SUBJECT', "URL in Surfbar gebucht"); @@ -128,5 +141,9 @@ define('SURFBAR_URL_STATUS_DELETED', "Gelöscht"); define('MEMBER_SURFBAR_ACTION_RETREAT_SUBMIT', "Zurücknehmen"); define('MEMBER_SURFBAR_ACTION_FRAMETEST_SUBMIT', "Framkiller-Test"); +// Member actions - button titles +define('MEMBER_SURFBAR_ACTION_RETREAT_TITLE', "Nehmen Sie hiermit Ihre Buchung wieder zurück, falls Sie diese doch nicht bewerben wollten."); +define('MEMBER_SURFBAR_ACTION_FRAMETEST_TITLE', "Testen Sie die Seite auf Framekiller hin, diese sind in unserer Surfbar grundsätzlich nicht gestattet."); + // ?> diff --git a/inc/libs/surfbar_functions.php b/inc/libs/surfbar_functions.php index 0a40440988..9d4ebe630d 100644 --- a/inc/libs/surfbar_functions.php +++ b/inc/libs/surfbar_functions.php @@ -40,7 +40,7 @@ if (!defined('__SECURITY')) { // ----------------------------------------------------------------------------- // Admin functions // ----------------------------------------------------------------------------- - +// // Admin has added an URL with given user id and so on function SURFBAR_ADMIN_ADD_URL ($url) { // Do some pre-checks @@ -91,11 +91,11 @@ function SURFBAR_ADMIN_UNLOCK_URL_IDS ($IDs) { // Return total status return $done; } - +// // ----------------------------------------------------------------------------- // Member functions // ----------------------------------------------------------------------------- - +// // Member has added an URL function SURFBAR_MEMBER_ADD_URL ($url) { global $_CONFIG; @@ -122,10 +122,58 @@ function SURFBAR_MEMBER_ADD_URL ($url) { // Register the new URL return SURFBAR_REGISTER_URL($url, $GLOBALS['userid'], $reward, $costs); } +// Create list of actions depending on status for the user +function SURFBAR_MEMBER_ACTIONS ($urlId, $status) { + // Load all actions in an array for given status + $actionArray = SURFBAR_GET_ACTION_ARRAY($status); + + // Init HTML code + $OUT = " +\n"; + + // Calculate width + $width = round(100 / count($actionArray)); + + // "Walk" through all actions and create forms + foreach ($actionArray as $actionId=>$action) { + // Add form for this action + $OUT .= sprintf(" \n", + $width, + bigintval($urlId), + strtolower($action), + strtoupper($action), + strtoupper($action) + ); + } // END - foreach + + // Close table + $OUT .= " +
+
+ + + +
+
\n"; + + // Return code + return $OUT; +} +// Do the member form request +function SURFBAR_MEMBER_DO_FORM ($formData, $URLs) { + // Is this a member? + if (!IS_MEMBER()) { + // No member! + return false; + } // END - if + + /* DEBUG: */ die("
".print_r($formData, true)."
".print_r($URLs, true)."
"); +} +// // ----------------------------------------------------------------------------- // Generic functions // ----------------------------------------------------------------------------- - +// // Looks up by an URL function SURFBAR_LOOKUP_BY_URL ($url) { // Now lookup that given URL by itself @@ -481,7 +529,7 @@ LIMIT %s", return $cnt; } // Generate a validation code for the given id number -function SURFBAR_GENERATE_VALIDATION_CODE ($id, $salt="") { +function SURFBAR_GENERATE_VALIDATION_CODE ($urlId, $salt="") { global $_CONFIG, $SURFBAR_CACHE; // @TODO Invalid salt should be refused @@ -508,7 +556,7 @@ function SURFBAR_GENERATE_VALIDATION_CODE ($id, $salt="") { } // ... and now the validation code - $valCode = GEN_RANDOM_CODE($length, sha1(SURFBAR_GET_SALT().":".$id), $GLOBALS['userid']); + $valCode = GEN_RANDOM_CODE($length, sha1(SURFBAR_GET_SALT().":".$urlId), $GLOBALS['userid']); //DEBUG_LOG(__FUNCTION__.":valCode={$valCode}"); } // END - while @@ -521,14 +569,14 @@ function SURFBAR_GENERATE_VALIDATION_CODE ($id, $salt="") { return $valHashedCode; } // Check validation code -function SURFBAR_CHECK_VALIDATION_CODE ($id, $check, $salt) { +function SURFBAR_CHECK_VALIDATION_CODE ($urlId, $check, $salt) { global $SURFBAR_CACHE; // Secure id number - $id = bigintval($id); + $urlId = bigintval($urlId); // Now generate the code again - $code = SURFBAR_GENERATE_VALIDATION_CODE($id, $salt); + $code = SURFBAR_GENERATE_VALIDATION_CODE($urlId, $salt); // Return result of checking hashes and salts //DEBUG_LOG(__FUNCTION__.":---".$code."|".$check."---"); @@ -536,19 +584,19 @@ function SURFBAR_CHECK_VALIDATION_CODE ($id, $check, $salt) { return (($code == $check) && ($salt == SURFBAR_GET_DATA('last_salt'))); } // Lockdown the userid/id combination (reload lock) -function SURFBAR_LOCKDOWN_ID ($id) { +function SURFBAR_LOCKDOWN_ID ($urlId) { //* //DEBUG: */ print "LOCK!"); ///* //DEBUG: */ return; // Just add it to the database SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_surfbar_locks (userid, url_id) VALUES(%s, %s)", - array($GLOBALS['userid'], bigintval($id)), __FILE__, __LINE__); + array($GLOBALS['userid'], bigintval($urlId)), __FILE__, __LINE__); // Remove the salt from database SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_surfbar_salts WHERE url_id=%s AND userid=%s LIMIT 1", - array(bigintval($id), $GLOBALS['userid']), __FILE__, __LINE__); + array(bigintval($urlId), $GLOBALS['userid']), __FILE__, __LINE__); } // Pay points to the user and remove it from the sender -function SURFBAR_PAY_POINTS ($id) { +function SURFBAR_PAY_POINTS ($urlId) { // Remove it from the URL owner //DEBUG_LOG(__FUNCTION__.":uid=".SURFBAR_GET_USERID().",costs=".SURFBAR_GET_COSTS().""); if (SURFBAR_GET_USERID() > 0) { @@ -613,15 +661,15 @@ function SURFBAR_UPDATE_SALT_STATS () { return (SQL_AFFECTEDROWS() == 1); } // Check if the reload lock is active for given id -function SURFBAR_CHECK_RELOAD_LOCK ($id) { - //DEBUG_LOG(__FUNCTION__.":id={$id}"); +function SURFBAR_CHECK_RELOAD_LOCK ($urlId) { + //DEBUG_LOG(__FUNCTION__.":id={$urlId}"); // Ask the database $result = SQL_QUERY_ESC("SELECT COUNT(id) AS cnt FROM "._MYSQL_PREFIX."_surfbar_locks WHERE userid=%s AND url_id=%s AND (UNIX_TIMESTAMP() - ".SURFBAR_GET_DATA('surf_lock').") < UNIX_TIMESTAMP(last_surfed) ORDER BY last_surfed ASC LIMIT 1", - array($GLOBALS['userid'], bigintval($id)), __FILE__, __LINE__ + array($GLOBALS['userid'], bigintval($urlId)), __FILE__, __LINE__ ); // Fetch counter @@ -718,19 +766,19 @@ function SURFBAR_DETERMINE_WAIT_TIME () { return $time; } // Changes the status of an URL from given to other -function SURFBAR_CHANGE_STATUS ($id, $prevStatus, $newStatus) { +function SURFBAR_CHANGE_STATUS ($urlId, $prevStatus, $newStatus) { // Get URL data for status comparison - $data = SURFBAR_GET_URL_DATA($id); + $data = SURFBAR_GET_URL_DATA($urlId); // Is the status like prevStatus is saying? - if ($data[$id]['status'] != $prevStatus) { + if ($data[$urlId]['status'] != $prevStatus) { // No, then abort here return false; } // END - if // Update the status now SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_surfbar_urls SET status='%s' WHERE id=%s LIMIT 1", - array($newStatus, bigintval($id)), __FILE__, __LINE__); + array($newStatus, bigintval($urlId)), __FILE__, __LINE__); // Was that fine? if (SQL_AFFECTEDROWS() != 1) { @@ -739,19 +787,19 @@ function SURFBAR_CHANGE_STATUS ($id, $prevStatus, $newStatus) { } // END - if // Prepare content for notification routines - $data[$id]['uid'] = $data[$id]['userid']; - $data[$id]['frametester'] = FRAMETESTER($data[$id]['url']); - $data[$id]['reward'] = TRANSLATE_COMMA($data[$id]['reward']); - $data[$id]['costs'] = TRANSLATE_COMMA($data[$id]['costs']); - $data[$id]['status'] = SURFBAR_TRANSLATE_STATUS($newStatus); - $data[$id]['registered'] = MAKE_DATETIME($data[$id]['registered'], "2"); + $data[$urlId]['uid'] = $data[$urlId]['userid']; + $data[$urlId]['frametester'] = FRAMETESTER($data[$urlId]['url']); + $data[$urlId]['reward'] = TRANSLATE_COMMA($data[$urlId]['reward']); + $data[$urlId]['costs'] = TRANSLATE_COMMA($data[$urlId]['costs']); + $data[$urlId]['status'] = SURFBAR_TRANSLATE_STATUS($newStatus); + $data[$urlId]['registered'] = MAKE_DATETIME($data[$urlId]['registered'], "2"); $newStatus = strtolower($newStatus); // Send admin notification - SURFBAR_NOTIFY_ADMIN("url_{$newStatus}", $data[$id]); + SURFBAR_NOTIFY_ADMIN("url_{$newStatus}", $data[$urlId]); // Send user notification - SURFBAR_NOTIFY_USER("url_{$newStatus}", $data[$id]); + SURFBAR_NOTIFY_USER("url_{$newStatus}", $data[$urlId]); // All done! return true; @@ -963,31 +1011,9 @@ function SURFBAR_GET_ACTION_ARRAY ($status) { // Return result return $returnArray; } -// Create list of actions depending on status for the user -function SURFBAR_MEMBER_ACTIONS ($id, $status) { - // Load all actions in an array for given status - $actionArray = SURFBAR_GET_ACTION_ARRAY($status); - - // Init HTML code - $OUT = ""; - - // "Walk" through all actions and create forms - foreach ($actionArray as $action) { - // Add form for this action - $OUT .= sprintf("
- -
", - $action, - strtoupper($action) - ); - } // END - if - - // Return code - return $OUT; -} // Determine next id for surfbar or get data for given id, always call this before you call other // getters below this function!!! -function SURFBAR_DETERMINE_NEXT_ID ($id = 0) { +function SURFBAR_DETERMINE_NEXT_ID ($urlId = 0) { global $SURFBAR_CACHE, $_CONFIG; // Default is no id and no random number @@ -995,7 +1021,7 @@ function SURFBAR_DETERMINE_NEXT_ID ($id = 0) { $randNum = 0; // Is the ID set? - if ($id == 0) { + if ($urlId == 0) { // Get array with lock ids $USE = SURFBAR_GET_LOCK_IDS(); @@ -1049,7 +1075,7 @@ LEFT JOIN "._MYSQL_PREFIX."_surfbar_locks AS l ON sbu.id=l.url_id WHERE sbu.userid != %s AND sbu.status='CONFIRMED' AND sbu.id=%s LIMIT 1", - array($GLOBALS['userid'], bigintval($id)), __FILE__, __LINE__ + array($GLOBALS['userid'], bigintval($urlId)), __FILE__, __LINE__ ); } diff --git a/inc/modules/member/what-surfbar_list.php b/inc/modules/member/what-surfbar_list.php index c551004e66..05657ff174 100644 --- a/inc/modules/member/what-surfbar_list.php +++ b/inc/modules/member/what-surfbar_list.php @@ -45,14 +45,23 @@ ADD_DESCR("member", basename(__FILE__)); // Load user URLs $URLs = SURFBAR_GET_USER_URLS(); -// Are there entries? -if (count($URLs) > 0) { +// Are there entries or form is submitted? +if ((isset($_POST['ok'])) && (isset($_POST['action'])) && (isset($_POST['id']))) { + // Process the form + if (SURFBAR_MEMBER_DO_FORM($_POST)) { + // Action performed + LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_SURFBAR_ACTION_DONE); + } else { + // Something went wrong + LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_SURFBAR_ACTION_FAILED); + } +} elseif (count($URLs) > 0) { // List all URLs $OUT = ""; $SW = 2; foreach ($URLs as $id => $content) { // "Translate"/insert data $content['sw'] = $SW; - $content['url'] = FRAMETESTER($content['url']); + $content['url'] = DEREFERER($content['url']); if ($content['views_total'] > 0) { // Include link to stats $content['views_total'] = "[".TRANSLATE_COMMA($content['views_total'])."]"; @@ -61,6 +70,10 @@ if (count($URLs) > 0) { $content['last_locked'] = MAKE_DATETIME($content['last_locked'], "2"); $content['actions'] = SURFBAR_MEMBER_ACTIONS($content['id'], $content['status']); $content['status'] = SURFBAR_TRANSLATE_STATUS($content['status']); + if (empty($content['lock_reason'])) { + // Fixes some HTML problems with empty cells + $content['lock_reason'] = "---"; + } // END - if // Load row template $OUT .= LOAD_TEMPLATE("member_surfbar_list_row", true, $content); diff --git a/templates/de/html/member/member_surfbar_list.tpl b/templates/de/html/member/member_surfbar_list.tpl new file mode 100644 index 0000000000..df1fb54957 --- /dev/null +++ b/templates/de/html/member/member_surfbar_list.tpl @@ -0,0 +1,36 @@ + + + + + + + + + + + + + +$content + + + +
+ {--MEMBER_SURFBAR_LIST_TITLE--} +
+ {--MEMBER_SURFBAR_TEST_URL--} + + {--MEMBER_SURFBAR_VIEWS_TOTAL--} + + {--MEMBER_SURFBAR_STATUS--} + + {--MEMBER_SURFBAR_REGISTERED--} + + {--MEMBER_SURFBAR_LAST_LOCKED--} + + {--MEMBER_SURFBAR_LOCK_REASON--} + + {--MEMBER_SURFBAR_ACTIONS--} +
diff --git a/templates/de/html/member/member_surfbar_list_row.tpl b/templates/de/html/member/member_surfbar_list_row.tpl new file mode 100644 index 0000000000..7141b3b25e --- /dev/null +++ b/templates/de/html/member/member_surfbar_list_row.tpl @@ -0,0 +1,23 @@ + + + {--MEMBER_SURFBAR_TEST_URL--} + + + $content[views_total] + + + $content[status] + + + $content[registered] + + + $content[last_locked] + + + $content[lock_reason] + + + $content[actions] + + diff --git a/theme/business/css/general.css b/theme/business/css/general.css index d7b3189c56..70e891a97e 100644 --- a/theme/business/css/general.css +++ b/theme/business/css/general.css @@ -57,17 +57,20 @@ ul, ol { border-style : groove; border : solid 1px #000000; color : #000000; + cursor : pointer; } .admin_submit, .guest_submit, .member_submit { color : #000000; border-color : #000000; + cursor : pointer; } .admin_submit_reject { border-style : groove; color : #000000; border-color : #000000; + cursor : pointer; } .runtime_fatal, .runtime_fatalcontent { diff --git a/theme/default/css/general.css b/theme/default/css/general.css index c499540f55..3ac6cfecb4 100644 --- a/theme/default/css/general.css +++ b/theme/default/css/general.css @@ -75,17 +75,20 @@ ul, ol { border-style : groove; border : solid 1px #009900; color : #AA0044; + cursor : pointer; } .admin_submit, .guest_submit, .member_submit { color : #AA0044; border-color : #009900; + cursor : pointer; } .admin_submit_reject { border-style : groove; color : #881111; border-color : #009900; + cursor : pointer; } .runtime_fatal, .runtime_fatalcontent { diff --git a/theme/desert/css/general.css b/theme/desert/css/general.css index 48a74bce6d..23f0dbc4af 100644 --- a/theme/desert/css/general.css +++ b/theme/desert/css/general.css @@ -55,55 +55,58 @@ ul, ol { .admin_reset, .guest_reset, .member_reset { border-style : groove; - border : solid 1px #880000; - color : #880000; + border : solid 1px #880000; + color : #880000; + cursor : pointer; } .admin_submit, .guest_submit, .member_submit { - color : #880000; + color : #880000; border-color : #880000; + cursor : pointer; } .admin_submit_reject { border-style : groove; - color : #880000; + color : #880000; border-color : #880000; + cursor : pointer; } .runtime_fatal, .runtime_fatalcontent { - color : #880000; + color : #880000; background-color : #FFFFCC; - font-family : Verdana, Arial, Geneva, Helvetica, sans-serif; + font-family : Verdana, Arial, Geneva, Helvetica, sans-serif; } .runtime_fatal { - color : #880000; + color : #880000; } .runtime_fatalcontent { - text-align : left; + text-align : left; font-size : 12px; } .admin { - color : #880000; + color : #880000; background-color : #FFFFCC; - font-family : Verdana, Arial, Geneva, Helvetica, sans-serif; + font-family : Verdana, Arial, Geneva, Helvetica, sans-serif; } .admin_note { - color : #880000; + color : #880000; font-size : 12px; } DIV.admin_note { - padding-top : 10px; + padding-top : 10px; padding-right : 10px; padding-left : 10px; } .admin_fatal { - color : #880000; + color : #880000; font-size : 18px; } @@ -113,7 +116,7 @@ DIV.admin_note { .member_banner { background-color : #FFFFCC; - width : 488px; + width : 488px; } .admin_error {