-
Notifications
You must be signed in to change notification settings - Fork 3
/
themes.inc.php
executable file
·83 lines (76 loc) · 2.04 KB
/
themes.inc.php
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
<?php
/**
* Author: Hidden
* Date: Mon Aug 23 22:14:34 CST 2010
*
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
function webim_scan_subdir( $dir ){
$d = dir( $dir."/" );
$dn = array();
while ( false !== ( $f = $d->read() ) ) {
if(is_dir($dir."/".$f) && $f!='.' && $f!='..') $dn[]=$f;
}
$d->close();
return $dn;
}
//$sl = $scriptlang['webim'];
$tl = $templatelang['webim'];
$notice = "";
if($_G['gp_theme']){
$theme = $_G['gp_theme'];
DB::query("UPDATE ".DB::table('common_pluginvar')." SET value='$theme' WHERE pluginid='$pluginid' AND variable='theme'");
updatecache('plugin');
$notice = "<div id='notice'>".$tl['themes_success']."</div>";
}else{
$res = DB::fetch_first("SELECT * FROM ".DB::table('common_pluginvar')." WHERE pluginid='$pluginid' AND variable='theme'");
if($res){
$theme = $res['value'];
}else{
$theme = 'base';
}
}
echo $notice;
showtips($tl['themes_tips']);
$path = dirname(__FILE__).DIRECTORY_SEPARATOR."static".DIRECTORY_SEPARATOR."themes";
$files = webim_scan_subdir( $path );
$html = '<ul id="themes">';
foreach ($files as $k => $v){
$t_path = $path.DIRECTORY_SEPARATOR.$v;
if(is_dir($t_path) && is_file($t_path.DIRECTORY_SEPARATOR."jquery.ui.theme.css")){
$cur = $v == $theme ? " class='current'" : "";
$url = ADMINSCRIPT.'?action=plugins&operation=config&do='.$pluginid.'&identifier=webim&pmod=themes&theme='.$v;
$html .= "<li$cur><h4><a href='$url'>$v</a></h4><p><a href='$url'><img width=100 height=134 src='source/plugin/webim/static/themes/images/$v.png' alt='$v' title='$v'/></a></p></li>";
}
}
$html .= '</ul>';
?>
<style type="text/css">
#notice{
margin-top: 5px;
padding: 10px;
text-align: center;
background: #FFFAF0;
border: 1px solid #FFD700;
}
#themes{
overflow: hidden;
list-style: none;
padding: 0;
margin: 0;
margin-top: 20px;
}
#themes li{
float: left;
padding: 10px;
}
#themes li h4{
margin: 0 0 5px 0;
}
#themes li.current{
background: yellow;
}
</style>
<?php echo $html;?>