]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/member/what-beg.php
Comments fixed, ext-network continued, fix for mod stats:
[mailer.git] / inc / modules / member / what-beg.php
index 8cd19555c8351f3d490d927ff1d7a1469d310998..8e0ca1077e9b57f7ab425c159d73605b6ef72f06 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
- * MXChange v0.2.1                                    Start: 01/09/2005 *
- * ================                             Last change: 01/09/2005 *
+ * Mailer v0.2.1-FINAL                                Start: 01/09/2005 *
+ * ===================                          Last change: 01/09/2005 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : what-beg.php                                     *
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Bettel-Link                                      *
  * -------------------------------------------------------------------- *
- *                                                                      *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author::                                                          $ *
+ * Needs to be in all Files and every File needs "svn propset           *
+ * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
  * 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')) {
-       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
-       require($INC);
-} elseif (!IS_MEMBER()) {
-       LOAD_URL("modules.php?module=index");
-} elseif ((!EXT_IS_ACTIVE("beg")) && (!IS_ADMIN())) {
-       ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE, "beg");
-       return;
+       die();
+} elseif (!isMember()) {
+       redirectToIndexMemberOnlyModule();
 }
 
 // Add description as navigation point
-ADD_DESCR("member", __FILE__);
+addMenuDescription('member', __FILE__);
+
+if ((!isExtensionActive('beg')) && (!isAdmin())) {
+       loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('beg'));
+       return;
+} // END - if
+
+// Get userid
+$userid = getMemberId();
 
-$uid = $GLOBALS['userid'];
-if (EXT_IS_ACTIVE("nickname"))
-{
+if (isExtensionActive('nickname')) {
        // Load nickname
-       $data = "nickname";
-}
- else
-{
+       $data = 'nickname';
+} else {
        // Load userid
-       $data = "userid";
+       $data = 'userid';
 }
 
 // Run SQL command
-$result = SQL_QUERY_ESC("SELECT ".$data.", beg_clicks FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1", array($uid), __FILE__, __LINE__);
-list($uid, $clicks) = SQL_FETCHROW($result);
+$result = SQL_QUERY_ESC("SELECT
+       `".$data."`, `beg_clicks`
+FROM
+       `{?_MYSQL_PREFIX?}_user_data`
+WHERE
+       `userid`=%s
+LIMIT 1", array($userid), __FILE__, __LINE__);
+
+list($userid, $clicks) = SQL_FETCHROW($result);
+
+// Free result
 SQL_FREERESULT($result);
 
-// Set User-ID when no nickname was found
+// Set user id when no nickname was found
 $nickname = true;
-if (empty($uid)) { $uid = $GLOBALS['userid']; $nickname = false; }
+if (empty($userid)) { $userid = getMemberId(); $nickname = false; }
 
 // Prepare constants
-define('__BEG_UID'       , $uid);
-define('__BEG_CLICKS'    , $clicks);
-define('__BEG_POINTS'    , TRANSLATE_COMMA($_CONFIG['beg_points']));
-define('__BEG_POINTS_MAX', TRANSLATE_COMMA($_CONFIG['beg_points_max']));
-
-if (function_exists('CREATE_FANCY_TIME'))
-{
-       define('__BEG_TIMEOUT'    , CREATE_FANCY_TIME($_CONFIG['beg_timeout']));
-       define('__BEG_UID_TIMEOUT', CREATE_FANCY_TIME($_CONFIG['beg_uid_timeout']));
-}
- else
-{
-       define('__BEG_TIMEOUT '   , round($_CONFIG['beg_timeout']     / 60)." ".MINUTES);
-       define('__BEG_UID_TIMEOUT', round($_CONFIG['beg_uid_timeout'] / 60)." ".MINUTES);
-}
+$content['userid'] = $userid;
+$content['clicks'] = $clicks;
+$content['points'] = translateComma(getConfig('beg_points'));
+$content['points_max'] = translateComma(getConfig('beg_points_max'));
+$content['timeout'] = createFancyTime(getConfig('beg_timeout'));
+// @TODO No more needed? define('__BEG_UID_TIMEOUT', createFancyTime(getConfig('beg_userid_timeout')));
 
 // Load template
-LOAD_TEMPLATE("member_".substr(basename(__FILE__), 5, -4));
+loadTemplate('member_' . substr(basename(__FILE__), 5, -4), false, $content);
 
-//
+// [EOF]
 ?>