adv_footerbanner.php
4.34 KB
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
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: adv_footerbanner.php 22514 2011-05-10 11:11:11Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class adv_footerbanner {
var $version = '1.0';
var $name = 'footerbanner_name';
var $description = 'footerbanner_desc';
var $copyright = '<a href="http://www.comsenz.com" target="_blank">Comsenz Inc.</a>';
var $targets = array('portal', 'home', 'member', 'forum', 'group', 'search', 'userapp', 'plugin', 'custom');
var $imagesizes = array('468x60', '658x60', '728x90', '760x90', '950x90', '950x130');
function getsetting() {
global $_G;
$settings = array(
'fids' => array(
'title' => 'footerbanner_fids',
'type' => 'mselect',
'value' => array(),
),
'groups' => array(
'title' => 'footerbanner_groups',
'type' => 'mselect',
'value' => array(),
),
'category' => array(
'title' => 'footerbanner_category',
'type' => 'mselect',
'value' => array(),
),
'position' => array(
'title' => 'footerbanner_position',
'type' => 'mradio',
'value' => array(
array(1, 'footerbanner_position_up'),
array(2, 'footerbanner_position_middle'),
array(3, 'footerbanner_position_down'),
),
'default' => 1,
),
);
loadcache(array('forums', 'grouptype'));
$settings['fids']['value'][] = $settings['groups']['value'][] = array(0, ' ');
$settings['fids']['value'][] = $settings['groups']['value'][] = array(-1, 'footerbanner_index');
$settings['fids']['value'][] = array(-2, 'Archiver');
if(empty($_G['cache']['forums'])) $_G['cache']['forums'] = array();
foreach($_G['cache']['forums'] as $fid => $forum) {
$settings['fids']['value'][] = array($fid, ($forum['type'] == 'forum' ? str_repeat(' ', 4) : ($forum['type'] == 'sub' ? str_repeat(' ', 8) : '')).$forum['name']);
}
foreach($_G['cache']['grouptype']['first'] as $gid => $group) {
$settings['groups']['value'][] = array($gid, str_repeat(' ', 4).$group['name']);
if($group['secondlist']) {
foreach($group['secondlist'] as $sgid) {
$settings['groups']['value'][] = array($sgid, str_repeat(' ', 8).$_G['cache']['grouptype']['second'][$sgid]['name']);
}
}
}
loadcache('portalcategory');
$this->categoryvalue[] = array(-1, 'footerbanner_index');
$this->getcategory(0);
$settings['category']['value'] = $this->categoryvalue;
return $settings;
}
function getcategory($upid) {
global $_G;
foreach($_G['cache']['portalcategory'] as $category) {
if($category['upid'] == $upid) {
$this->categoryvalue[] = array($category['catid'], str_repeat(' ', $category['level'] * 4).$category['catname']);
$this->getcategory($category['catid']);
}
}
}
function setsetting(&$advnew, &$parameters) {
global $_G;
if(is_array($advnew['targets'])) {
$advnew['targets'] = implode("\t", $advnew['targets']);
}
if(is_array($parameters['extra']['fids']) && in_array(0, $parameters['extra']['fids'])) {
$parameters['extra']['fids'] = array();
}
if(is_array($parameters['extra']['groups']) && in_array(0, $parameters['extra']['groups'])) {
$parameters['extra']['groups'] = array();
}
if(is_array($parameters['extra']['category']) && in_array(0, $parameters['extra']['category'])) {
$parameters['extra']['category'] = array();
}
}
function evalcode() {
return array(
'check' => '
if($params[2] != $parameter[\'position\']
|| $_G[\'basescript\'] == \'forum\' && $parameter[\'fids\'] && !(!defined(\'IN_ARCHIVER\') && (in_array($_G[\'fid\'], $parameter[\'fids\']) || CURMODULE == \'index\' && in_array(-1, $parameter[\'fids\'])) || defined(\'IN_ARCHIVER\') && in_array(-2, $parameter[\'fids\']))
|| $_G[\'basescript\'] == \'group\' && $parameter[\'groups\'] && !(in_array($_G[\'grouptypeid\'], $parameter[\'groups\']) || CURMODULE == \'index\' && in_array(-1, $parameter[\'groups\']))
|| $_G[\'basescript\'] == \'portal\' && $parameter[\'category\'] && !(!empty($_G[\'catid\']) && in_array($_G[\'catid\'], $parameter[\'category\']) || empty($_G[\'catid\']) && in_array(-1, $parameter[\'category\']))
) {
$checked = false;
}',
'create' => '$adcode = $codes[$adids[array_rand($adids)]];',
);
}
}
?>