adv_intercat.php
2.15 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
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: adv_intercat.php 26440 2011-12-13 06:28:38Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class adv_intercat {
var $version = '1.1';
var $name = 'intercat_name';
var $description = 'intercat_desc';
var $copyright = '<a href="http://www.comsenz.com" target="_blank">Comsenz Inc.</a>';
var $targets = array('forum');
var $imagesizes = array('468x60', '658x60', '728x90', '760x90', '950x90');
function getsetting() {
global $_G;
$settings = array(
'fids' => array(
'title' => 'intercat_fids',
'type' => 'mselect',
'value' => array(),
),
'position' => array(
'title' => 'intercat_position',
'type' => 'mradio',
'value' => array(),
'default' => 0,
),
);
loadcache('forums');
$settings['fids']['value'][] = array(0, ' ');
$settings['fids']['value'][] = array(-1, 'intercat_position_fav');
$settings['position']['value'][] = array(0, 'intercat_position_random');
$settings['position']['value'][] = array(-1, 'intercat_position_fav');
if(empty($_G['cache']['forums'])) $_G['cache']['forums'] = array();
foreach($_G['cache']['forums'] as $fid => $forum) {
if($forum['type'] == 'group') {
$settings['fids']['value'][] = array($fid, $forum['name']);
$settings['position']['value'][] = array($fid, $forum['name']);
}
}
return $settings;
}
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();
}
}
function evalcode() {
return array(
'check' => '
if(!(!$parameter[\'position\'] || $parameter[\'position\'] && $params[2] == $parameter[\'position\'] || $parameter[\'fids\'] && in_array($_GET[\'gid\'], $parameter[\'fids\']))) {
$checked = false;
}',
'create' => '$adcode = $codes[$adids[array_rand($adids)]];',
);
}
}
?>