2 /************************************************************************
3 * MXChange v0.2.1 Start: 10/19/2003 *
4 * =============== Last change: 09/10/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-reflinks.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Referal links *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Referal-Links *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * Needs to be in all Files and every File needs "svn propset *
18 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
19 * -------------------------------------------------------------------- *
20 * Copyright (c) 2003 - 2009 by Roland Haeder *
21 * For more information visit: http://www.mxchange.org *
23 * This program is free software; you can redistribute it and/or modify *
24 * it under the terms of the GNU General Public License as published by *
25 * the Free Software Foundation; either version 2 of the License, or *
26 * (at your option) any later version. *
28 * This program is distributed in the hope that it will be useful, *
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
31 * GNU General Public License for more details. *
33 * You should have received a copy of the GNU General Public License *
34 * along with this program; if not, write to the Free Software *
35 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
37 ************************************************************************/
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
42 } elseif (!isMember()) {
43 redirectToIndexMemberOnlyModule();
46 // Add description as navigation point
47 addMenuDescription('member', __FILE__);
49 // Load current referal clicks
50 $result = SQL_QUERY_ESC("SELECT `ref_clicks` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s LIMIT 1",
51 array(getUserId()), __FILE__, __LINE__);
52 $content = SQL_FETCHARRAY($result);
53 SQL_FREERESULT($result);
55 outputHtml("<div class=\"tiny\">{--YOUR_PERSONAL_REFLINK--}:<br />
56 <strong><a href=\"{?URL?}/ref.php?refid=".getUserId()."\" target=\"_blank\">{?URL?}/ref.php?ref=".getUserId()."</a></strong><br />
59 if (isExtensionActive('nickname')) {
60 // Add nickname link when nickname is entered
61 $nick = getNickname(getUserId());
64 // Display nickname link
65 outputHtml("{--NICKNAME_YOUR_REFLINK--}:<br />
66 <strong><a href=\"{?URL?}/ref.php?ref=".$nick."\" target=\"_blank\">{?URL?}/ref.php?ref=".$nick."</a></strong><br />
69 // Display link to nickname form
70 outputHtml("<div class=\"guest_note\">{--NO_NICKNAME_SET--}</strong><br />
71 <a class=\"tiny\" href=\"{?URL?}/modules.php?module=login&what=nickname\">{--PLEASE_CLICK_NICKNAME_FORM--}</a>");
75 // Clicks on your reflink
76 outputHtml("{--YOUR_REFCLICKS--}: <strong>".$content['ref_clicks']."</strong> {--CLICKS--}</div><br /><br />");
78 $whereStatement = " WHERE `visible`='Y'";
79 if (isAdmin()) $whereStatement = '';
80 $result = SQL_QUERY("SELECT `id`, `url`, `alternate`, `counter`, `clicks` FROM `{?_MYSQL_PREFIX?}_refbanner`", __FILE__, __LINE__);
82 if (SQL_NUMROWS($result) > 0) {
83 // List available ref banners
85 while ($content = SQL_FETCHARRAY($result)) {
86 $test = str_replace(getConfig('URL'), getConfig('PATH'), $content['url']); $size = 0;
87 if ($test == $content['url']) {
88 // Download banner (I hope you keep the banner on same server???)
89 $fp = sendGetRequest($content['url']); $bannerContent = '';
90 if ((!empty($fp)) && (is_array($fp)) && (count($fp) > 0)) {
91 // Loads only found banner, when there is a 404 error this foreach() command
92 // will cause an "Invalid argument supplied for foreach()" error
97 $size = strlen($bannerContent);
98 } elseif (isFileReadable($test)) {
99 $size = filesize($test);
102 if ($size > 0) $content['alternate'] .= ' (' .translateComma(round($size / 102.4) / 10) . ' {--KBYTES--})';
104 // Add some more data
105 $content['sw'] = $SW;
106 $content['userid'] = getUserId();
109 $OUT .= loadTemplate('member_reflinks_row', true, $content);
115 // Load final template
116 loadTemplate('member_reflinks_table', false, $OUT);
118 // No refbanner found!
119 loadTemplate('admin_settings_saved', false, getMessage('MEMBER_NO_REFBANNER_FOUND'));
123 SQL_FREERESULT($result);