-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreadme.txt
207 lines (164 loc) · 6.2 KB
/
readme.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
##
##
## Mod title: Adsense after First Post
##
## Mod version: 1.2.3
## Works on FluxBB: 1.4.*, 1.5.*
## Release date: 2013-05-01
## Author: Smartys ([email protected])
##
## Description: This mod allows you to place a Google ad after the first
## post in every thread, disguised as a post.
##
## Affected files: viewtopic.php
## include/common.php
## include/cache.php
##
## Affects DB: Yes
##
## Notes: This doesn't change the color of the ad based on the style used.
## If people need it, I'll try and implement it in the next version.
## If you need to upgrade, just replace the plugin
##
## DISCLAIMER: Please note that "mods" are not officially supported by
## FluxBB. Installation of this modification is done at your
## own risk. Backup your forum database and any and all
## applicable files before proceeding.
##
##
#
#---------[ 1. UPLOAD ]-------------------------------------------------------
#
install_mod.php to /
AP_Adsense_Options.php to plugins/
#
#---------[ 2. RUN ]----------------------------------------------------------
#
install_mod.php
#
#---------[ 3. DELETE ]-------------------------------------------------------
#
install_mod.php
#
#---------[ 4. OPEN ]---------------------------------------------------------
#
include/common.php
#
#---------[ 5. FIND ]---------------------------------------------------------
#
// Load cached config
if (file_exists(FORUM_CACHE_DIR.'cache_config.php'))
include FORUM_CACHE_DIR.'cache_config.php';
if (!defined('PUN_CONFIG_LOADED'))
{
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
require PUN_ROOT.'include/cache.php';
generate_config_cache();
require FORUM_CACHE_DIR.'cache_config.php';
}
#
#---------[ 6. AFTER, ADD ]---------------------------------------------------
#
// Load cached adsense config
if (file_exists(FORUM_CACHE_DIR.'cache_adsense_config.php'))
include FORUM_CACHE_DIR.'cache_adsense_config.php';
if (!defined('PUN_ADSENSE_CONFIG_LOADED'))
{
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
require PUN_ROOT.'include/cache.php';
generate_adsense_config_cache();
require FORUM_CACHE_DIR.'cache_adsense_config.php';
}
#
#---------[ 7. OPEN ]---------------------------------------------------------
#
include/cache.php
#
#---------[ 8. FIND ]---------------------------------------------------------
#
define('FORUM_CACHE_FUNCTIONS_LOADED', true);
#
#---------[ 9. BEFORE, ADD ]---------------------------------------------------
#
//
// Generate the adsense config cache PHP script
//
function generate_adsense_config_cache()
{
global $db;
// Get the forum config from the DB
$result = $db->query('SELECT * FROM '.$db->prefix.'adsense_config', true) or error('Unable to fetch adsense config', __FILE__, __LINE__, $db->error());
while ($cur_config_item = $db->fetch_row($result))
$output[$cur_config_item[0]] = $cur_config_item[1];
// Output config as PHP code
$fh = @fopen(FORUM_CACHE_DIR.'cache_adsense_config.php', 'wb');
if (!$fh)
error('Unable to write adsense configuration cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'', __FILE__, __LINE__);
fwrite($fh, '<?php'."\n\n".'define(\'PUN_ADSENSE_CONFIG_LOADED\', 1);'."\n\n".'$adsense_config = '.var_export($output, true).';'."\n\n".'?>');
fclose($fh);
}
#
#---------[ 10. OPEN ]-------------------------------------------------------
#
viewtopic.php
#
#---------[ 11. FIND ]--------------------------------------------------------
#
<?php if (count($post_actions)) echo "\t\t\t\t".'<div class="postfootright">'."\n\t\t\t\t\t".'<ul>'."\n\t\t\t\t\t\t".implode("\n\t\t\t\t\t\t", $post_actions)."\n\t\t\t\t\t".'</ul>'."\n\t\t\t\t".'</div>'."\n" ?>
</div>
</div>
</div>
</div>
<?php
#
#---------[ 12. AFTER, ADD ]---------------------------------------------------
#
if ($post_count == '1' && $adsense_config['google_adsense_enabled'] == '1' && strpos($adsense_config['google_exclude_forums'], ','.$cur_topic['forum_id'].',') === FALSE && strpos($adsense_config['google_exclude_groups'], ','.$pun_user['g_id'].',') === FALSE)
{
++$post_count;
?>
<div class="blockpost<?php echo ($post_count % 2 == 0) ? ' roweven' : ' rowodd' ?>">
<h2><span><?php echo format_time($cur_post['posted']) ?></span></h2>
<div class="box">
<div class="inbox">
<div class="postbody">
<div class="postleft">
<dl>
<dt><strong><?php echo $adsense_config['google_bot_name'] ?></strong></dt>
<dd class="usertitle"><strong><?php echo $adsense_config['google_bot_tag'] ?></strong></dd>
</dl>
</div>
<div class="postright">
<h3><?php echo $lang_topic['Re'].' '; ?><?php echo pun_htmlspecialchars($cur_topic['subject']) ?></h3>
<div class="postmsg">
<?php echo "<br /><div style=\"TEXT-ALIGN: center\">
<script type=\"text/javascript\">
<!--
google_ad_client = \"".$adsense_config['google_ad_client']."\";
google_ad_width = ".$adsense_config['google_ad_width'].";
google_ad_height = ".$adsense_config['google_ad_height'].";
google_ad_format = \"".$adsense_config['google_ad_format']."\";
google_ad_channel = \"".$adsense_config['google_ad_channel']."\";
google_ad_type = \"".$adsense_config['google_ad_type']."\";
google_color_border = \"".$adsense_config['google_color_border']."\";
google_color_bg = \"".$adsense_config['google_color_bg']."\";
google_color_link = \"".$adsense_config['google_color_link']."\";
google_color_url = \"".$adsense_config['google_color_url']."\";
google_color_text = \"".$adsense_config['google_color_text']."\";
google_alternate_color = \"".$adsense_config['google_alternate_color']."\";
//-->
</script>
<script type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\"></script>
</div><br />\n" ?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
--$post_count;
}
#
#---------[ 13. SAVE/UPLOAD ]---------------------------------------------------
#