First commit

This commit is contained in:
2025-06-18 10:24:27 +08:00
commit ebc39cd5dd
3873 changed files with 412712 additions and 0 deletions

View File

@@ -0,0 +1,442 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_admingroup.php 31651 2012-09-18 10:23:26Z zhangjie $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
if(!$operation) {
if(submitcheck('groupsubmit') && $ids = dimplode($_GET['delete'])) {
$gids = array();
$query = C::t('common_usergroup')->fetch_all_by_groupid($_GET['delete']);
foreach($query as $g) {
$gids[] = $g['groupid'];
}
if($gids) {
C::t('common_usergroup')->delete_usergroup($gids);
C::t('common_usergroup_field')->delete($gids);
C::t('common_admingroup')->delete($gids);
$newgroupid = C::t('common_usergroup')->fetch_new_groupid();
C::t('common_member')->update_by_groupid($gids, array('groupid' => $newgroupid, 'adminid' => '0'), 'UNBUFFERED');
deletegroupcache($gids);
}
}
$grouplist = C::t('common_admingroup')->fetch_all_merge_usergroup();
if(!submitcheck('groupsubmit')) {
shownav('user', 'nav_admingroups');
showsubmenu('nav_admingroups');
showtips('admingroup_tips');
showformheader('admingroup');
showtableheader('', 'fixpadding');
showsubtitle(array('', 'usergroups_title', '', 'type', 'admingroup_level', 'usergroups_stars', 'usergroups_color',
'<input class="checkbox" type="checkbox" name="gbcmember" onclick="checkAll(\'value\', this.form, \'gbmember\', \'gbcmember\', 1)" /> <a href="javascript:;" onclick="if(getmultiids()) location.href=\''.ADMINSCRIPT.'?action=usergroups&operation=edit&multi=\' + getmultiids();return false;">'.$lang['multiedit'].'</a>',
'<input class="checkbox" type="checkbox" name="gpcmember" onclick="checkAll(\'value\', this.form, \'gpmember\', \'gpcmember\', 1)" /> <a href="javascript:;" onclick="if(getmultiids()) location.href=\''.ADMINSCRIPT.'?action=admingroup&operation=edit&multi=\' + getmultiids();return false;">'.$lang['multiedit'].'</a>',
));
foreach($grouplist as $gid => $group) {
$adminidselect = '<select name="newradminid['.$group['groupid'].']">';
for($i = 1;$i <= 3;$i++) {
$adminidselect .= '<option value="'.$i.'"'.($i == $group['radminid'] ? ' selected="selected"' : '').'>'.$lang['usergroups_system_'.$i].'</option>';
}
$adminidselect .= '</select>';
$staticurl = STATICURL;
showtablerow('', array('', '', 'class="td23 lightfont"', 'class="td25"', '', 'class="td25"'), array(
$group['type'] == 'system' ? '<input type="checkbox" class="checkbox" disabled="disabled" />' : "<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"{$group['groupid']}\">",
'<span style="color:'.$group['color'].'">'.$group['grouptitle'].'</span>',
"(groupid:{$group['groupid']})",
$group['type'] == 'system' ? cplang('inbuilt') : cplang('custom'),
$group['type'] == 'system' ? $lang['usergroups_system_'.$group['radminid']] : $adminidselect,
"<input type=\"text\" class=\"txt\" size=\"2\" name=\"group_stars[{$group['groupid']}]\" value=\"{$group['stars']}\">",
"<input type=\"text\" id=\"group_color_{$group['groupid']}_v\" class=\"left txt\" size=\"6\" name=\"group_color[{$group['groupid']}]\" value=\"{$group['color']}\" onchange=\"updatecolorpreview('group_color_P{$group['groupid']}')\"><input type=\"button\" id=\"group_color_{$group['groupid']}\" class=\"colorwd\" onclick=\"group_color_{$group['groupid']}_frame.location='{$staticurl}image/admincp/getcolor.htm?group_color_{$group['groupid']}|group_color_{$group['groupid']}_v';showMenu({'ctrlid':'group_color_{$group['groupid']}'})\" style=\"background: {$group['color']}\" /><span id=\"group_color_{$group['groupid']}_menu\" style=\"display: none\"><iframe name=\"group_color_{$group['groupid']}_frame\" src=\"\" frameborder=\"0\" width=\"210\" height=\"148\" scrolling=\"no\"></iframe></span>",
"<input class=\"checkbox\" type=\"checkbox\" chkvalue=\"gbmember\" value=\"{$group['groupid']}\" onclick=\"multiupdate(this)\" /><a href=\"".ADMINSCRIPT."?action=usergroups&operation=edit&id={$group['admingid']}\" class=\"act\">{$lang['admingroup_setting_user']}</a>",
"<input class=\"checkbox\" type=\"checkbox\" chkvalue=\"gpmember\" value=\"{$group['groupid']}\" onclick=\"multiupdate(this)\" /><a href=\"".ADMINSCRIPT."?action=admingroup&operation=edit&id={$group['admingid']}\" class=\"act\">{$lang['admingroup_setting_admin']}</a>"
));
}
showtablerow('', array('class="td25"', '', '', '', 'colspan="6"'), array(
cplang('add_new'),
'<input type="text" class="txt" size="12" name="grouptitlenew">',
'',
cplang('custom'),
"<select name=\"radminidnew\"><option value=\"1\">{$lang['usergroups_system_1']}</option><option value=\"2\">{$lang['usergroups_system_2']}</option><option value=\"3\" selected=\"selected\">{$lang['usergroups_system_3']}</option>",
));
showsubmit('groupsubmit', 'submit', 'del');
showtablefooter();
showformfooter();
} else {
foreach($grouplist as $gid => $group) {
$stars = intval($_GET['group_stars'][$gid]);
$color = dhtmlspecialchars($_GET['group_color'][$gid]);
if($group['color'] != $color || $group['stars'] != $stars || $group['icon'] != $avatar) {
C::t('common_usergroup')->update_usergroup($gid, array('stars' => $stars, 'color' => $color));
}
}
$grouptitlenew = dhtmlspecialchars(trim($_GET['grouptitlenew']));
$radminidnew = intval($_GET['radminidnew']);
foreach($_GET['newradminid'] as $groupid => $newradminid) {
C::t('common_usergroup')->update_usergroup($groupid, array('radminid' => $newradminid));
}
if($grouptitlenew && in_array($radminidnew, array(1, 2, 3))) {
$data = array();
$usergroup = C::t('common_usergroup')->fetch($radminidnew);
foreach ($usergroup as $key => $val) {
if(!in_array($key, array('groupid', 'radminid', 'type', 'system', 'grouptitle'))) {
$val = addslashes($val);
$data[$key] = $val;
}
}
$fielddata = array();
$usergroup = C::t('common_usergroup_field')->fetch($radminidnew);
foreach ($usergroup as $key => $val) {
if(!in_array($key, array('groupid'))) {
$val = addslashes($val);
$fielddata[$key] = $val;
}
}
$adata = array();
$admingroup = C::t('common_admingroup')->fetch($radminidnew);
foreach ($admingroup as $key => $val) {
if(!in_array($key, array('admingid'))) {
$val = addslashes($val);
$adata[$key] = $val;
}
}
$data['radminid'] = $radminidnew;
$data['type'] = 'special';
$data['grouptitle'] = $grouptitlenew;
$newgroupid = C::t('common_usergroup')->insert($data, true);
if($newgroupid) {
$adata['admingid'] = $newgroupid;
$fielddata['groupid'] = $newgroupid;
C::t('common_admingroup')->insert($adata);
C::t('common_usergroup_field')->insert($fielddata);
}
}
updatecache(array('usergroups', 'groupreadaccess', 'admingroups'));
cpmsg('admingroups_edit_succeed', 'action=admingroup', 'succeed');
}
} elseif($operation == 'edit') {
$submitcheck = submitcheck('groupsubmit');
$multiset = 0;
if(empty($_GET['multi'])) {
$gids = $_GET['id'];
} else {
$multiset = 1;
if(is_array($_GET['multi'])) {
$gids = $_GET['multi'];
} else {
$_GET['multi'] = explode(',', $_GET['multi']);
array_walk($_GET['multi'], 'intval');
$gids = $_GET['multi'];
}
}
if(!empty($_GET['multi']) && is_array($_GET['multi']) && count($_GET['multi']) == 1) {
$gids = $_GET['multi'][0];
$multiset = 0;
}
if(!$submitcheck) {
if(empty($gids)) {
$grouplist = "<select name=\"id\" style=\"width: 150px\">\n";
foreach(C::t('common_admingroup')->fetch_all_merge_usergroup() as $group) {
$grouplist .= "<option value=\"{$group['groupid']}\">{$group['grouptitle']}</option>\n";
}
$grouplist .= '</select>';
$highlight = getgpc('highlight');
$highlight = !empty($highlight) ? dhtmlspecialchars($highlight, ENT_QUOTES) : '';
cpmsg('admingroups_edit_nonexistence', 'action=admingroup&operation=edit'.(!empty($highlight) ? "&highlight=$highlight" : ''), 'form', array(), $grouplist);
}
$mgroup = C::t('common_admingroup')->fetch_all_merge_usergroup($gids);
if(!$mgroup) {
cpmsg('usergroups_nonexistence', '', 'error');
}/* else {
while($group = DB::fetch($query)) {
$mgroup[] = $group;
}
}*/
$grouplist = $gutype = '';
foreach(C::t('common_admingroup')->fetch_all_order() as $ggroup) {
$checked = $_GET['id'] == $ggroup['groupid'] || (is_array($_GET['multi']) && in_array($ggroup['groupid'], $_GET['multi']));
if($gutype != $ggroup['radminid']) {
$grouplist .= '<em><span class="right"><input name="checkall_'.$ggroup['radminid'].'" onclick="checkAll(\'value\', this.form, \'g'.$ggroup['radminid'].'\', \'checkall_'.$ggroup['radminid'].'\')" type="checkbox" class="vmiddle checkbox" /></span>'.
($ggroup['radminid'] == 1 ? $lang['usergroups_system_1'] : ($ggroup['radminid'] == 2 ? $lang['usergroups_system_2'] : $lang['usergroups_system_3'])).'</em>';
$gutype = $ggroup['radminid'];
}
$grouplist .= '<input class="left checkbox ck" chkvalue="g'.$ggroup['radminid'].'" name="multi[]" value="'.$ggroup['groupid'].'" type="checkbox" '.($checked ? 'checked="checked" ' : '').'/>'.
'<a href="###" onclick="location.href=\''.ADMINSCRIPT.'?action=admingroup&operation=edit&switch=yes&id='.$ggroup['groupid'].'&anchor=\'+currentAnchor+\'&scrolltop=\'+document.documentElement.scrollTop"'.($checked ? ' class="current"' : '').'>'.$ggroup['grouptitle'].'</a>';
}
$gselect = '<span id="ugselect" class="right popupmenu_dropmenu" onmouseover="showMenu({\'ctrlid\':this.id,\'pos\':\'34\'});$(\'ugselect_menu\').style.top=(parseInt($(\'ugselect_menu\').style.top)-scrollTopBody())+\'px\';$(\'ugselect_menu\').style.left=(parseInt($(\'ugselect_menu\').style.left)-document.documentElement.scrollLeft-20)+\'px\'">'.$lang['usergroups_switch'].'<em>&nbsp;&nbsp;</em></span>'.
'<div id="ugselect_menu" class="popupmenu_popup" style="display:none">'.
$grouplist.
'<br style="clear:both" /><div class="cl"><input type="button" class="btn right" onclick="$(\'menuform\').submit()" value="'.cplang('admingroups_multiedit').'" /></div>'.
'</div>';
$_GET['anchor'] = in_array($_GET['anchor'], array('threadperm', 'postperm', 'modcpperm', 'portalperm', 'otherperm', 'spaceperm')) ? $_GET['anchor'] : 'threadperm';
$anchorarray = array(
array('admingroup_edit_threadperm', 'threadperm', $_GET['anchor'] == 'threadperm'),
array('admingroup_edit_postperm', 'postperm', $_GET['anchor'] == 'postperm'),
array('admingroup_edit_modcpperm', 'modcpperm', $_GET['anchor'] == 'modcpperm'),
array('admingroup_edit_spaceperm', 'spaceperm', $_GET['anchor'] == 'spaceperm'),
array('admingroup_edit_portalperm', 'portalperm', $_GET['anchor'] == 'portalperm'),
array('admingroup_edit_otherperm', 'otherperm', $_GET['anchor'] == 'otherperm'),
);
showformheader('', '', 'menuform', 'get');
showhiddenfields(array('action' => 'admingroup', 'operation' => 'edit'));
showsubmenuanchors($lang['admingroup_edit'].(count($mgroup) == 1 ? ' - '.$mgroup[$_GET['id']]['grouptitle'].'(groupid:'.$mgroup[$_GET['id']]['groupid'].')' : ''), $anchorarray, $gselect);
showformfooter();
if($multiset) {
showtips('setting_multi_tips');
}
showformheader("admingroup&operation=edit&id={$_GET['id']}");
if($multiset) {
$_G['showsetting_multi'] = 0;
$_G['showsetting_multicount'] = count($mgroup);
foreach($mgroup as $group) {
$_G['showtableheader_multi'][] = '<a href="javascript:;" onclick="location.href=\''.ADMINSCRIPT.'?action=admingroup&operation=edit&id='.$group['groupid'].'&anchor=\'+$(\'cpform\').anchor.value;return false">'.$group['grouptitle'].'(groupid:'.$group['groupid'].')</a>';
}
}
$mgids = array();
foreach($mgroup as $group) {
$_GET['id'] = $gid = $group['groupid'];
$mgids[] = $gid;
showmultititle();
showtableheader('', 'nobottom');
showtagheader('tbody', 'threadperm', $_GET['anchor'] == 'threadperm');
showtitle('admingroup_edit_threadperm');
showsetting('admingroup_edit_stick_thread', array('allowstickthreadnew', array(
array(0, $lang['admingroup_edit_stick_thread_none']),
array(1, $lang['admingroup_edit_stick_thread_1']),
array(2, $lang['admingroup_edit_stick_thread_2']),
array(3, $lang['admingroup_edit_stick_thread_3'])
)), $group['allowstickthread'], 'mradio');
showsetting('admingroup_edit_digest_thread', array('allowdigestthreadnew', array(
array(0, $lang['admingroup_edit_digest_thread_none']),
array(1, $lang['admingroup_edit_digest_thread_1']),
array(2, $lang['admingroup_edit_digest_thread_2']),
array(3, $lang['admingroup_edit_digest_thread_3'])
)), $group['allowdigestthread'], 'mradio');
showsetting('admingroup_edit_bump_thread', 'allowbumpthreadnew', $group['allowbumpthread'], 'radio');
showsetting('admingroup_edit_highlight_thread', 'allowhighlightthreadnew', $group['allowhighlightthread'], 'radio');
showsetting('admingroup_edit_live_thread', 'allowlivethreadnew', $group['allowlivethread'], 'radio');
showsetting('admingroup_edit_recommend_thread', 'allowrecommendthreadnew', $group['allowrecommendthread'], 'radio');
showsetting('admingroup_edit_stamp_thread', 'allowstampthreadnew', $group['allowstampthread'], 'radio');
showsetting('admingroup_edit_stamp_list', 'allowstamplistnew', $group['allowstamplist'], 'radio');
showsetting('admingroup_edit_close_thread', 'allowclosethreadnew', $group['allowclosethread'], 'radio');
showsetting('admingroup_edit_move_thread', 'allowmovethreadnew', $group['allowmovethread'], 'radio');
showsetting('admingroup_edit_edittype_thread', 'allowedittypethreadnew', $group['allowedittypethread'], 'radio');
showsetting('admingroup_edit_copy_thread', 'allowcopythreadnew', $group['allowcopythread'], 'radio');
showsetting('admingroup_edit_merge_thread', 'allowmergethreadnew', $group['allowmergethread'], 'radio');
showsetting('admingroup_edit_split_thread', 'allowsplitthreadnew', $group['allowsplitthread'], 'radio');
showsetting('admingroup_edit_repair_thread', 'allowrepairthreadnew', $group['allowrepairthread'], 'radio');
showsetting('admingroup_edit_refund', 'allowrefundnew', $group['allowrefund'], 'radio');
showsetting('admingroup_edit_edit_poll', 'alloweditpollnew', $group['alloweditpoll'], 'radio');
showsetting('admingroup_edit_remove_reward', 'allowremoverewardnew', $group['allowremovereward'], 'radio');
showsetting('admingroup_edit_edit_activity', 'alloweditactivitynew', $group['alloweditactivity'], 'radio');
showsetting('admingroup_edit_edit_trade', 'allowedittradenew', $group['allowedittrade'], 'radio');
showsetting('admingroup_edit_usertag', 'alloweditusertagnew', $group['alloweditusertag'], 'radio');
showtagfooter('tbody');
showtagheader('tbody', 'postperm', $_GET['anchor'] == 'postperm');
showtitle('admingroup_edit_postperm');
showsetting('admingroup_edit_edit_post', 'alloweditpostnew', $group['alloweditpost'], 'radio');
showsetting('admingroup_edit_warn_post', 'allowwarnpostnew', $group['allowwarnpost'], 'radio');
showsetting('admingroup_edit_ban_post', 'allowbanpostnew', $group['allowbanpost'], 'radio');
showsetting('admingroup_edit_del_post', 'allowdelpostnew', $group['allowdelpost'], 'radio');
showsetting('admingroup_edit_stick_post', 'allowstickreplynew', $group['allowstickreply'], 'radio');
showsetting('admingroup_edit_manage_tag', 'allowmanagetagnew', $group['allowmanagetag'], 'radio');
showtagfooter('tbody');
showtagheader('tbody', 'modcpperm', $_GET['anchor'] == 'modcpperm');
showtitle('admingroup_edit_modcpperm');
showsetting('admingroup_edit_mod_post', 'allowmodpostnew', $group['allowmodpost'], 'radio');
showsetting('admingroup_edit_mod_user', 'allowmodusernew', $group['allowmoduser'], 'radio');
showsetting('admingroup_edit_ban_user', 'allowbanusernew', $group['allowbanuser'], 'radio');
showsetting('admingroup_edit_ban_user_visit', 'allowbanvisitusernew', $group['allowbanvisituser'], 'radio');
showsetting('admingroup_edit_ban_ip', 'allowbanipnew', $group['allowbanip'], 'radio');
showsetting('admingroup_edit_edit_user', 'alloweditusernew', $group['allowedituser'], 'radio');
showsetting('admingroup_edit_mass_prune', 'allowmassprunenew', $group['allowmassprune'], 'radio');
showsetting('admingroup_edit_edit_forum', 'alloweditforumnew', $group['alloweditforum'], 'radio');
showsetting('admingroup_edit_post_announce', 'allowpostannouncenew', $group['allowpostannounce'], 'radio');
showsetting('admingroup_edit_clear_recycle', 'allowclearrecyclenew', $group['allowclearrecycle'], 'radio');
showsetting('admingroup_edit_view_log', 'allowviewlognew', $group['allowviewlog'], 'radio');
showtagfooter('tbody');
showtagheader('tbody', 'spaceperm', $_GET['anchor'] == 'spaceperm');
showtitle('admingroup_edit_spaceperm');
showsetting('admingroup_edit_manage_feed', 'managefeednew', $group['managefeed'], 'radio');
showsetting('admingroup_edit_manage_doing', 'managedoingnew', $group['managedoing'], 'radio');
showsetting('admingroup_edit_manage_share', 'managesharenew', $group['manageshare'], 'radio');
showsetting('admingroup_edit_manage_blog', 'manageblognew', $group['manageblog'], 'radio');
showsetting('admingroup_edit_manage_album', 'managealbumnew', $group['managealbum'], 'radio');
showsetting('admingroup_edit_manage_comment', 'managecommentnew', $group['managecomment'], 'radio');
showsetting('admingroup_edit_manage_magiclog', 'managemagiclognew', $group['managemagiclog'], 'radio');
showsetting('admingroup_edit_manage_report', 'managereportnew', $group['managereport'], 'radio');
showsetting('admingroup_edit_manage_hotuser', 'managehotusernew', $group['managehotuser'], 'radio');
showsetting('admingroup_edit_manage_defaultuser', 'managedefaultusernew', $group['managedefaultuser'], 'radio');
showsetting('admingroup_edit_manage_magic', 'managemagicnew', $group['managemagic'], 'radio');
showsetting('admingroup_edit_manage_click', 'manageclicknew', $group['manageclick'], 'radio');
showtagfooter('tbody');
showtagheader('tbody', 'otherperm', $_GET['anchor'] == 'otherperm');
showtitle('admingroup_edit_otherperm');
showsetting('admingroup_edit_view_ip', 'allowviewipnew', $group['allowviewip'], 'radio');
showsetting('admingroup_edit_manage_collection', 'allowmanagecollectionnew', $group['allowmanagecollection'], 'radio');
showsetting('admingroup_edit_allow_make_html', 'allowmakehtmlnew', $group['allowmakehtml'], 'radio');
showtagfooter('tbody');
showtablefooter();
showtagheader('div', 'portalperm', $_GET['anchor'] == 'portalperm');
showtableheader('', 'nobottom');
showtagheader('tbody', '', true);
showtitle('admingroup_edit_portalperm');
showsetting('admingroup_edit_manage_article', 'allowmanagearticlenew', $group['allowmanagearticle'], 'radio');
showtagfooter('tbody');
showtagheader('tbody', '', true);
showsetting('admingroup_edit_add_topic', 'allowaddtopicnew', $group['allowaddtopic'], 'radio');
showsetting('admingroup_edit_manage_topic', 'allowmanagetopicnew', $group['allowmanagetopic'], 'radio');
showsetting('admingroup_edit_diy', 'allowdiynew', $group['allowdiy'], 'radio');
showtagfooter('tbody');
showtablefooter();
showtagfooter('div');
showtableheader();
showsubmit('groupsubmit');
showtablefooter();
$_G['showsetting_multi']++;
}
if($_G['showsetting_multicount'] > 1) {
showhiddenfields(array('multi' => implode(',', $mgids)));
showmulti();
}
showformfooter();
} else {
if(!$multiset) {
$_GET['multinew'] = array(0 => array('single' => 1));
}
foreach($_GET['multinew'] as $k => $row) {
if(empty($row['single'])) {
foreach($row as $key => $value) {
$_GET[''.$key] = $value;
}
$_GET['id'] = $_GET['multi'][$k];
}
$group = $mgroup[$k];
$data = array(
'alloweditpost' => $_GET['alloweditpostnew'],
'alloweditpoll' => $_GET['alloweditpollnew'],
'allowedittrade' => $_GET['allowedittradenew'],
'alloweditusertag' => $_GET['alloweditusertagnew'],
'allowremovereward' => $_GET['allowremoverewardnew'],
'alloweditactivity' => $_GET['alloweditactivitynew'],
'allowstickthread' => $_GET['allowstickthreadnew'],
'allowmodpost' => $_GET['allowmodpostnew'],
'allowbanpost' => $_GET['allowbanpostnew'],
'allowdelpost' => $_GET['allowdelpostnew'],
'allowmassprune' => $_GET['allowmassprunenew'],
'allowrefund' => $_GET['allowrefundnew'],
'allowcensorword' => $_GET['allowcensorwordnew'],
'allowviewip' => $_GET['allowviewipnew'],
'allowmanagecollection' => $_GET['allowmanagecollectionnew'],
'allowbanip' => $_GET['allowbanipnew'],
'allowedituser' => $_GET['alloweditusernew'],
'allowbanuser' => $_GET['allowbanusernew'],
'allowbanvisituser' => $_GET['allowbanvisitusernew'],
'allowmoduser' => $_GET['allowmodusernew'],
'allowpostannounce' => $_GET['allowpostannouncenew'],
'allowclearrecycle' => $_GET['allowclearrecyclenew'],
'allowhighlightthread' => $_GET['allowhighlightthreadnew'],
'allowlivethread' => $_GET['allowlivethreadnew'],
'allowdigestthread' => $_GET['allowdigestthreadnew'],
'allowrecommendthread' => $_GET['allowrecommendthreadnew'],
'allowbumpthread' => $_GET['allowbumpthreadnew'],
'allowclosethread' => $_GET['allowclosethreadnew'],
'allowmovethread' => $_GET['allowmovethreadnew'],
'allowedittypethread' => $_GET['allowedittypethreadnew'],
'allowstampthread' => $_GET['allowstampthreadnew'],
'allowstamplist' => $_GET['allowstamplistnew'],
'allowcopythread' => $_GET['allowcopythreadnew'],
'allowmergethread' => $_GET['allowmergethreadnew'],
'allowsplitthread' => $_GET['allowsplitthreadnew'],
'allowrepairthread' => $_GET['allowrepairthreadnew'],
'allowwarnpost' => $_GET['allowwarnpostnew'],
'alloweditforum' => $_GET['alloweditforumnew'],
'allowviewlog' => $_GET['allowviewlognew'],
'allowmanagearticle' => $_GET['allowmanagearticlenew'],
'allowaddtopic' => $_GET['allowaddtopicnew'],
'allowmanagetopic' => $_GET['allowmanagetopicnew'],
'allowdiy' => $_GET['allowdiynew'],
'allowstickreply' => $_GET['allowstickreplynew'],
'allowmanagetag' => $_GET['allowmanagetagnew'],
'managefeed' => $_GET['managefeednew'],
'managedoing' => $_GET['managedoingnew'],
'manageshare' => $_GET['managesharenew'],
'manageblog' => $_GET['manageblognew'],
'managealbum' => $_GET['managealbumnew'],
'managecomment' => $_GET['managecommentnew'],
'managemagiclog' => $_GET['managemagiclognew'],
'managereport' => $_GET['managereportnew'],
'managehotuser' => $_GET['managehotusernew'],
'managedefaultuser' => $_GET['managedefaultusernew'],
'managemagic' => $_GET['managemagicnew'],
'manageclick' => $_GET['manageclicknew'],
'allowmakehtml' => $_GET['allowmakehtmlnew'],
);
C::t('common_admingroup')->update($_GET['id'], array_map('intval', $data));
}
updatecache(array('usergroups', 'groupreadaccess', 'admingroups'));
cpmsg('admingroups_edit_succeed', 'action=admingroup&operation=edit&'.($multiset ? 'multi='.implode(',', $_GET['multi']) : 'id='.$_GET['id']).'&anchor='.$_GET['anchor'], 'succeed');
}
}
function deletegroupcache($groupidarray) {
if(!empty($groupidarray) && is_array($groupidarray)) {
$cachenames = array();
foreach ($groupidarray as $id) {
if(($id = dintval($id))) {
$cachenames['usergroup_'.$id] = 'usergroup_'.$id;
$cachenames['admingroup_'.$id] = 'admingroup_'.$id;
}
}
if(!empty($cachenames)) {
C::t('common_syscache')->delete_syscache($cachenames);
}
}
}
?>

View File

@@ -0,0 +1,718 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_adv.php 34093 2013-10-09 05:41:18Z nemohou $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
$root = '<a href="'.ADMINSCRIPT.'?action=adv">'.cplang('adv_admin').'</a>';
$operation = $operation ? $operation : 'list';
$defaulttargets = array('portal', 'home', 'member', 'forum', 'group', 'plugin');
if(!empty($_GET['preview'])) {
$_GET['advnew'][$_GET['advnew']['style']]['url'] = $_GET['TMPadvnew'.$_GET['advnew']['style']] ? $_GET['TMPadvnew'.$_GET['advnew']['style']] : $_GET['advnew'.$_GET['advnew']['style']];
$data = encodeadvcode($_GET['advnew']);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="<?php echo CHARSET;?>" />
<meta name="renderer" content="webkit" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<script type="text/javascript">var IMGDIR = '<?php echo $_G['style']['imgdir']; ?>', cookiepre = '<?php echo $_G['config']['cookie']['cookiepre'];?>', cookiedomain = '<?php echo $_G['config']['cookie']['cookiedomain'];?>', cookiepath = '<?php echo $_G['config']['cookie']['cookiepath'];?>';</script>
<script type="text/javascript" src="<?php echo STATICURL; ?>js/common.js"></script>
<link rel="stylesheet" type="text/css" href="data/cache/style_<?php echo $_G['setting']['styleid'];?>_common.css" />
</head>
<body>
<div id="append_parent"></div><div id="ajaxwaitid"></div>
<div id="hd"><div class="wp">
<?php echo $data;?>
</div></div>
</body>
</html>
<?php
exit;
}
cpheader();
if($operation == 'ad') {
if(!submitcheck('advsubmit')) {
shownav('extended', 'adv_admin');
$type = $_GET['type'];
$target = $_GET['target'];
$typeadd = $advfile = '';
if($type) {
$etype = explode(':', $type);
if(count($etype) > 1 && preg_match('/^[\w\_:]+$/', $type)) {
if(ispluginkey($etype[0]) && preg_match('/^\w$/', $etype[1])) {
$advfile = DISCUZ_ROOT.'./source/plugin/'.$etype[0].'/adv/adv_'.$etype[1].'.php';
$advclass = 'adv_'.$etype[1];
}
} else {
$advfile = libfile('adv/'.$type, 'class');
$advclass = 'adv_'.$type;
}
if($advfile && file_exists($advfile)) {
require_once $advfile;
$advclassv = new $advclass();
if(class_exists($advclass)) {
$advsetting = $advclassv->getsetting();
$typeadd = ' - '.lang('adv/'.$type, $advclassv->name);
if($type == 'custom') {
$typeadd .= ' '.$advclassv->customname;
}
$typeadd .= ' <a href="'.ADMINSCRIPT.'?action=adv&operation=ad" style="font-weight:normal;font-size:12px">('.cplang('adv_admin_listall').')</a>';
}
}
}
showsubmenu($root.' &raquo; '.cplang('adv_list').$typeadd);
showformheader('adv&operation=ad');
showtableheader('', 'fixpadding');
showsubtitle(array('', 'display_order', 'available', 'subject', !$type ? 'type' : '', 'adv_style', 'start_time', 'end_time', 'adv_targets', ''));
$advppp = $type != 'custom' ? 25 : 9999;
$conditions = '';
$order_by = 'displayorder, advid DESC, targets DESC';
$start_limit = ($page - 1) * $advppp;
$title = $_GET['title'];
$starttime = $_GET['starttime'];
$endtime = $_GET['endtime'];
$orderby = $_GET['orderby'];
$advnum = C::t('common_advertisement')->count_search($title, $starttime, $endtime, $type, $target);
if(!$type) {
$customadv = array();
foreach(C::t('common_advertisement_custom')->fetch_all_data() as $custom) {
$customadv[$custom['id']] = $custom['name'];
}
}
$typenames = array();
foreach(C::t('common_advertisement')->fetch_all_search($title, $starttime, $endtime, $type, $target, $orderby, $start_limit, $advppp) as $adv) {
if(!$type) {
$advfile = '';
$etype = explode(':', $adv['type']);
if(count($etype) > 1 && preg_match('/^[\w\_:]+$/', $adv['type'])) {
$advfile = DISCUZ_ROOT.'./source/plugin/'.$etype[0].'/adv/adv_'.$etype[1].'.php';
$advclass = 'adv_'.$etype[1];
} else {
$advfile = libfile('adv/'.$adv['type'], 'class');
$advclass = 'adv_'.$adv['type'];
}
if(!$advfile || !file_exists($advfile)) {
continue;
}
if(!isset($typenames[$adv['type']])) {
require_once $advfile;
if(class_exists($advclass)) {
$advclassv = new $advclass();
$typenames[$adv['type']] = lang('adv/'.$adv['type'], $advclassv->name);
} else {
$typenames[$adv['type']] = $adv['type'];
}
}
}
$adv['parameters'] = dunserialize($adv['parameters']);
if($adv['type'] == 'custom' && $type && $_GET['customid'] != $adv['parameters']['extra']['customid']) {
continue;
}
$targets = array();
foreach(explode("\t", $adv['targets']) as $t) {
if('adv_edit_targets_'.$t != 'adv_edit_targets_custom') {
$targets[] = $lang['adv_edit_targets_'.$t] ? $lang['adv_edit_targets_'.$t] : $t;
}
}
showtablerow('', array('class="td25"', 'class="td25"', 'class="td25"'), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"{$adv['advid']}\">",
"<input type=\"text\" class=\"txt\" size=\"2\" name=\"displayordernew[{$adv['advid']}]\" value=\"{$adv['displayorder']}\">",
"<input class=\"checkbox\" type=\"checkbox\" name=\"availablenew[{$adv['advid']}]\" value=\"1\" ".($adv['available'] ? 'checked' : '').">",
"<input type=\"text\" class=\"txt\" size=\"15\" name=\"titlenew[{$adv['advid']}]\" value=\"".dhtmlspecialchars($adv['title'])."\">",
!$type ? '<a href="'.ADMINSCRIPT.'?action=adv&operation=ad&type='.$adv['type'].($adv['type'] != 'custom' ? '' : '&customid='.$adv['parameters']['extra']['customid']).'">'.$typenames[$adv['type']].($adv['type'] != 'custom' ? '' : ' '.$customadv[$adv['parameters']['extra']['customid']]).'</a>' : '',
$lang['adv_style_'.$adv['parameters']['style']],
$adv['starttime'] ? dgmdate($adv['starttime'], 'd') : $lang['unlimited'],
$adv['endtime'] ? dgmdate($adv['endtime'], 'd') : $lang['unlimited'],
$adv['type'] != 'custom' ? implode(', ', $targets) : $lang['custom'],
"<a href=\"".ADMINSCRIPT."?action=adv&operation=edit&advid={$adv['advid']}".($adv['type'] != 'custom' ? '' : '&customid='.$adv['parameters']['extra']['customid']).(!$type ? '&from=all' : '')."\" class=\"act\">{$lang['edit']}</a>"
));
}
$multipage = multi($advnum, $advppp, $page, ADMINSCRIPT.'?action=adv&operation=ad'.($type ? '&type='.rawurlencode($type) : '').($target ? '&target='.rawurlencode($target) : '').($title ? '&title='.rawurlencode($title) : '').($starttime ? "&starttime=$starttime" : '').($endtime ? "&endtime=$endtime" : '').($orderby ? "&orderby=$orderby" : ''), 0, 3, TRUE, TRUE);
$starttimecheck = array($starttime => 'selected="selected"');
$endtimecheck = array($endtime => 'selected="selected"');
$orderbycheck = array($orderby => 'selected="selected"');
$targetselect = '<select name="target"><option value="">'.$lang['adv_targets'].'</option>';
foreach($defaulttargets as $v) {
$targetselect .= '<option value="'.$v.'"'.($v == $target ? ' selected="selected"' : '').'>'.$lang['adv_edit_targets_'.$v].'</option>';
}
$targetselect .= '</select>';
showsubmit('advsubmit', 'submit', 'del', $type ? '<input type="button" class="btn" onclick="location.href=\''.ADMINSCRIPT.'?action=adv&operation=add&type='.$_GET['type'].($_GET['type'] != 'custom' ? '' : '&customid='.$_GET['customid']).'\'" value="'.cplang('add').'" />' : '', $multipage.'
<input type="text" class="txt" name="title" value="'.$title.'" size="15" onkeyup="if(event.keyCode == 13) this.form.searchsubmit.click()" onclick="this.value=\'\'"> &nbsp;&nbsp;
<select name="starttime">
<option value=""> '.cplang('start_time').'</option>
<option value="0" '.$starttimecheck['0'].'> '.cplang('all').'</option>
<option value="-1" '.$starttimecheck['-1'].'> '.cplang('nolimit').'</option>
<option value="86400" '.$starttimecheck['86400'].'> '.cplang('1_day').'</option>
<option value="604800" '.$starttimecheck['604800'].'> '.cplang('7_day').'</option>
<option value="2592000" '.$starttimecheck['2592000'].'> '.cplang('30_day').'</option>
<option value="7776000" '.$starttimecheck['7776000'].'> '.cplang('90_day').'</option>
<option value="15552000" '.$starttimecheck['15552000'].'> '.cplang('180_day').'</option>
<option value="31536000" '.$starttimecheck['31536000'].'> '.cplang('365_day').'</option>
</select> &nbsp;&nbsp;
<select name="endtime">
<option value=""> '.cplang('end_time').'</option>
<option value="0" '.$endtimecheck['0'].'> '.cplang('all').'</option>
<option value="-1" '.$endtimecheck['-1'].'> '.cplang('nolimit').'</option>
<option value="86400" '.$endtimecheck['86400'].'> '.cplang('1_day').'</option>
<option value="604800" '.$endtimecheck['604800'].'> '.cplang('7_day').'</option>
<option value="2592000" '.$endtimecheck['2592000'].'> '.cplang('30_day').'</option>
<option value="7776000" '.$endtimecheck['7776000'].'> '.cplang('90_day').'</option>
<option value="15552000" '.$endtimecheck['15552000'].'> '.cplang('180_day').'</option>
<option value="31536000" '.$endtimecheck['31536000'].'> '.cplang('365_day').'</option>
</select> &nbsp;&nbsp;
<select name="orderby">
<option value=""> '.cplang('adv_orderby').'</option>
<option value="starttime" '.$orderbycheck['starttime'].'> '.cplang('adv_addtime').'</option>
'.(!$type ? '<option value="type" '.$orderbycheck['type'].'> '.cplang('adv_type').'</option>' : '').'
<option value="displayorder" '.$orderbycheck['displayorder'].'> '.cplang('display_order').'</option>
</select> &nbsp;&nbsp;
'.$targetselect.' &nbsp;&nbsp;
<input type="button" class="btn" name="searchsubmit" value="'.cplang('search').'" onclick="if(this.form.title.value==\''.cplang('adv_inputtitle').'\'){this.form.title.value=\'\'}location.href=\''.ADMINSCRIPT.'?action=adv&operation=ad'.($type ? '&type='.rawurlencode($type) : '').'&title=\'+this.form.title.value+\'&starttime=\'+this.form.starttime.value+\'&endtime=\'+this.form.endtime.value+\'&target=\'+this.form.target.value+\'&orderby=\'+this.form.orderby.value;"> &nbsp;
');
showtablefooter();
showformfooter();
} else {
if($_GET['delete']) {
C::t('common_advertisement')->delete($_GET['delete']);
}
if(is_array($_GET['titlenew'])) {
foreach($_GET['titlenew'] as $advid => $title) {
C::t('common_advertisement')->update($advid, array(
'available' => $_GET['availablenew'][$advid],
'displayorder' => $_GET['displayordernew'][$advid],
'title' => cutstr($_GET['titlenew'][$advid], 50)
));
}
}
updatecache('advs');
updatecache('setting');
cpmsg('adv_update_succeed', dreferer(), 'succeed');
}
} elseif($operation == 'add' && !empty($_GET['type']) || $operation == 'edit' && !empty($_GET['advid'])) {
if(!submitcheck('advsubmit')) {
if($operation == 'edit') {
$advid = $_GET['advid'];
$adv = C::t('common_advertisement')->fetch($advid);
if(!$adv) {
cpmsg('advertisement_nonexistence', '', 'error');
}
$adv['parameters'] = dunserialize($adv['parameters']);
$type = $adv['type'];
} else {
$adv['parameters']['style'] = 'code';
$type = $_GET['type'];
}
$etype = explode(':', $type);
if(count($etype) > 1 && preg_match('/^[\w\_:]+$/', $type)) {
include_once DISCUZ_ROOT.'./source/plugin/'.$etype[0].'/adv/adv_'.$etype[1].'.php';
$advclass = 'adv_'.$etype[1];
} else {
require_once libfile('adv/'.$type, 'class');
$advclass = 'adv_'.$type;
}
$advclass = new $advclass;
$advsetting = $advclass->getsetting();
$advtitle = lang('adv/'.$type, $advclass->name).($type != 'custom' ? '' : ' '.$advclass->customname);
$returnurl = 'action=adv&operation=ad'.(empty($_GET['from']) ? '&type='.$type.($type != 'custom' ? '' : '&customid='.$_GET['customid']) : '');
$return = '<a href="'.ADMINSCRIPT.'?'.$returnurl.'">'.cplang('adv_list').(empty($_GET['from']) ? ' - '.$advtitle : '').'</a>';
shownav('extended', 'adv_admin');
showsubmenu($root.' &raquo; '.$return.' &raquo; '.($operation == 'edit' ? cplang('adv_edit') : cplang('adv_add')));
echo '<br />';
$targets = array();
foreach($advclass->targets as $target) {
if($target != 'custom') {
$targets[] = array($target, $lang['adv_edit_targets_'.$target]);
} else {
$ets = explode("\t", $adv['targets']);
$customv = array();
foreach($ets as $et) {
if(!in_array($et, $advclass->targets)) {
$customv[] = $et;
}
}
$targets[] = array($target, '<input title="'.cplang('adv_custom_target').'" name="advnew[targetcustom]" value="'.implode(',', $customv).'" />');
}
}
$imagesizes = '';
if(!empty($advclass->imagesizes)) {
foreach($advclass->imagesizes as $size) {
$imagesizes .= '<option value="'.$size.'">'.$size.'</option>';
}
}
$adv['starttime'] = $adv['starttime'] ? dgmdate($adv['starttime'], 'Y-n-j') : '';
$adv['endtime'] = $adv['endtime'] ? dgmdate($adv['endtime'], 'Y-n-j') : '';
echo '<script type="text/javascript" src="' . STATICURL . 'js/calendar.js"></script>'.
'<div class="colorbox"><h4>'.lang('adv/'.$type, $advclass->name).'</h4>'.
'<table cellspacing="0" cellpadding="3"><tr><td>'.
(count($etype) > 1 && preg_match('/^[\w\_:]+$/', $type) ? (file_exists(DISCUZ_ROOT.'./source/plugin/'.$etype[0].'/adv/adv_'.$etype[1].'.gif') ? '<img src="source/plugin/'.$etype[0].'/adv/adv_'.$etype[1].'.gif" />' : '')
: (file_exists(DISCUZ_ROOT.'./static/image/admincp/'.$type.'.gif') ? '<img src="static/image/admincp/'.$type.'.gif" />' : '')).
'</td><td valign="top">'.lang('adv/'.$type, $advclass->description).'</td></tr></table>'.
'<div style="width:95%" align="right">'.lang('adv/'.$type, $advclass->copyright).'</div></div>';
if($operation == 'edit') {
echo '<input type="button" class="btn" onclick="$(\'previewbtn\').click()" name="jspreview" value="'.$lang['preview'].'">';
echo '<div class="jswizard" id="advpreview" style="display:none"><iframe id="preview" name="preview" frameborder="0" allowtransparency="true" onload="this.style.height = (this.contentWindow.document.body.scrollHeight + 50) + \'px\'" width="95%" height="0"></iframe></div>';
}
showformheader("adv&operation=$operation".($operation == 'add' ? '&type='.$type : '&advid='.$advid), 'enctype');
if($type == 'custom') {
showhiddenfields(array('parameters[extra][customid]' => $_GET['customid']));
}
showhiddenfields(array('referer' => $returnurl));
showtableheader();
showtableheader(($operation == 'edit' ? cplang('adv_edit') : cplang('adv_add')).' - '.lang('adv/'.$type, $advclass->name), 'fixpadding');
showsetting('adv_edit_title', 'advnew[title]', $adv['title'], 'text');
if($type != 'custom') {
showsetting('adv_edit_targets', array('advnew[targets]', $targets), explode("\t",$adv['targets']), 'mcheckbox');
}
if(is_array($advsetting)) {
foreach($advsetting as $settingvar => $setting) {
if(!empty($setting['value']) && is_array($setting['value'])) {
foreach($setting['value'] as $k => $v) {
$setting['value'][$k][1] = lang('adv/'.$type, $setting['value'][$k][1]);
}
}
$varname = in_array($setting['type'], array('mradio', 'mcheckbox', 'select', 'mselect')) ?
($setting['type'] == 'mselect' ? array('parameters[extra]['.$settingvar.'][]', $setting['value']) : array('parameters[extra]['.$settingvar.']', $setting['value']))
: 'parameters['.$settingvar.']';
$value = $adv['parameters']['extra'][$settingvar] != '' ? $adv['parameters']['extra'][$settingvar] : $setting['default'];
$comment = lang('adv/'.$type, $setting['title'].'_comment');
$comment = $comment != $setting['title'].'_comment' ? $comment : '';
showsetting(lang('adv/'.$type, $setting['title']).':', $varname, $value, $setting['type'], '', 0, $comment);
}
}
$adtypearray = array();
$adtypes = array('code', 'text', 'image', 'flash');
foreach($adtypes as $adtype) {
$displayary = array();
foreach($adtypes as $adtype1) {
$displayary['style_'.$adtype1] = $adtype1 == $adtype ? '' : 'none';
}
$adtypearray[] = array($adtype, $lang['adv_style_'.$adtype], $displayary);
}
showsetting('adv_edit_starttime', 'advnew[starttime]', $adv['starttime'], 'calendar');
showsetting('adv_edit_endtime', 'advnew[endtime]', $adv['endtime'], 'calendar');
showsetting('adv_edit_style', array('advnew[style]', $adtypearray), $adv['parameters']['style'], 'mradio');
showtagheader('tbody', 'style_code', $adv['parameters']['style'] == 'code');
showtitle('adv_edit_style_code');
showsetting('adv_edit_style_code_html', 'advnew[code][html]', $adv['parameters']['html'], 'textarea');
showtagfooter('tbody');
showtagheader('tbody', 'style_text', $adv['parameters']['style'] == 'text');
showtitle('adv_edit_style_text');
showsetting('adv_edit_style_text_title', 'advnew[text][title]', $adv['parameters']['title'], 'htmltext');
showsetting('adv_edit_style_text_link', 'advnew[text][link]', $adv['parameters']['link'], 'text');
showsetting('adv_edit_style_text_size', 'advnew[text][size]', $adv['parameters']['size'], 'text');
showtagfooter('tbody');
showtagheader('tbody', 'style_image', $adv['parameters']['style'] == 'image');
showtitle('adv_edit_style_image');
showsetting('adv_edit_style_image_url', 'advnewimage', $adv['parameters']['url'], 'filetext');
showsetting('adv_edit_style_image_link', 'advnew[image][link]', $adv['parameters']['link'], 'text');
showsetting('adv_edit_style_image_alt', 'advnew[image][alt]', $adv['parameters']['alt'], 'text');
if($imagesizes) {
$v = $adv['parameters']['width'].'x'.$adv['parameters']['height'];
showsetting('adv_edit_style_image_size', '', '', '<select onchange="setsize(this.value, \'image\')"><option value="x">'.cplang('adv_edit_style_custom').'</option>'.str_replace('"'.$v.'"', '"'.$v.'" selected="selected"', $imagesizes).'</select>');
}
showsetting('adv_edit_style_image_width', 'advnew[image][width]', $adv['parameters']['width'], 'text', '', 0, '', 'id="imagewidth" onchange="setpreview(\'image\')"');
showsetting('adv_edit_style_image_height', 'advnew[image][height]', $adv['parameters']['height'], 'text', '', 0, '', 'id="imageheight" onchange="setpreview(\'image\')"');
showtagfooter('tbody');
showtagheader('tbody', 'style_flash', $adv['parameters']['style'] == 'flash');
showtitle('adv_edit_style_flash');
showsetting('adv_edit_style_flash_url', 'advnewflash', $adv['parameters']['url'], 'filetext');
if($imagesizes) {
$v = $adv['parameters']['flash'].'x'.$adv['parameters']['flash'];
showsetting('adv_edit_style_flash_size', '', '', '<select onchange="setsize(this.value, \'flash\')"><option>'.cplang('adv_edit_style_custom').'</option>'.str_replace('"'.$v.'"', '"'.$v.'" selected="selected"', $imagesizes).'</select>');
}
showsetting('adv_edit_style_flash_width', 'advnew[flash][width]', $adv['parameters']['width'], 'text', '', 0, '', 'id="flashwidth" onchange="setpreview(\'flash\')"');
showsetting('adv_edit_style_flash_height', 'advnew[flash][height]', $adv['parameters']['height'], 'text', '', 0, '', 'id="flashheight" onchange="setpreview(\'flash\')"');
showtagfooter('tbody');
echo '<tr><td colspan="2">';
if($operation == 'edit') {
echo '<input id="previewbtn" type="button" class="btn" onclick="$(\'advpreview\').style.display=\'\';this.form.preview.value=1;this.form.target=\'preview\';this.form.submit();" name="jspreview" value="'.$lang['preview'].'">&nbsp; &nbsp;';
}
echo '<input type="submit" class="btn" name="advsubmit" onclick="this.form.preview.value=0;this.form.target=\'\'" value="'.$lang['submit'].'"><input name="preview" type="hidden" value="0"></td></tr>';
showtablefooter();
showtableheader();
echo '<tr><td colspan="2" id="imagesizepreviewtd" style="border:0"><div id="imagesizepreview" style="display:none;border:1px dotted gray"></div></td></tr>';
echo '<tr><td colspan="2" id="flashsizepreviewtd" style="border:0"><div id="flashsizepreview" style="display:none;border:1px dotted gray"></div></td></tr>';
showtablefooter();
showformfooter();
echo '<script type="text/JavaScript">
function setsize(v, o) {
if(v) {
var size = v.split(\'x\');
$(o + \'width\').value = size[0];
$(o + \'height\').value = size[1];
}
setpreview(o);
}
function setpreview(o) {
var w = $(o + \'width\').value > 0 ? $(o + \'width\').value : 0;
var h = $(o + \'height\').value > 0 ? $(o + \'height\').value : 0;
var obj = $(o + \'sizepreview\');
var tdobj = $(o + \'sizepreviewtd\');
obj.style.display = \'\';
obj.style.width = w + \'px\';
obj.style.height = h + \'px\';
tdobj.style.height = (parseInt(h) + 10) + \'px\';
}';
if($operation == 'edit' && ($adv['parameters']['style'] == 'image' || $adv['parameters']['style'] == 'flash')) {
echo 'setpreview(\''.$adv['parameters']['style'].'\');';
}
echo '</script>';
} else {
if($operation == 'edit') {
$advid = $_GET['advid'];
$adv = C::t('common_advertisement')->fetch($advid);
$type = $adv['type'];
$adv['parameters'] = dunserialize($adv['parameters']);
} else {
$type = $_GET['type'];
}
$etype = explode(':', $type);
if(count($etype) > 1 && preg_match('/^[\w\_:]+$/', $type)) {
include_once DISCUZ_ROOT.'./source/plugin/'.$etype[0].'/adv/adv_'.$etype[1].'.php';
$advclass = 'adv_'.$etype[1];
} else {
require_once libfile('adv/'.$type, 'class');
$advclass = 'adv_'.$type;
}
$advclass = new $advclass;
$advnew = $_GET['advnew'];
$parameters = !empty($_GET['parameters']) ? $_GET['parameters'] : array();
if(is_array($advnew['targets']) && in_array('custom', $advnew['targets'])) {
$targetcustom = explode(',', $advnew['targetcustom']);
$advnew['targets'] = array_merge($advnew['targets'], $targetcustom);
}
$advclass->setsetting($advnew, $parameters);
$advnew['starttime'] = $advnew['starttime'] ? strtotime($advnew['starttime']) : 0;
$advnew['endtime'] = $advnew['endtime'] ? strtotime($advnew['endtime']) : 0;
if(!$advnew['title']) {
cpmsg('adv_title_invalid', '', 'error');
} elseif(strlen($advnew['title']) > 50) {
cpmsg('adv_title_more', '', 'error');
} elseif($advnew['endtime'] && ($advnew['endtime'] <= TIMESTAMP || $advnew['endtime'] <= $advnew['starttime'])) {
cpmsg('adv_endtime_invalid', '', 'error');
} elseif(($advnew['style'] == 'code' && !$advnew['code']['html'])
|| ($advnew['style'] == 'text' && (!$advnew['text']['title'] || !$advnew['text']['link']))
|| ($advnew['style'] == 'image' && (!$_FILES['advnewimage'] && !$_GET['advnewimage'] || !$advnew['image']['link']))
|| ($advnew['style'] == 'flash' && (!$_FILES['advnewflash'] && !$_GET['advnewflash'] || !$advnew['flash']['width'] || !$advnew['flash']['height']))) {
cpmsg('adv_parameter_invalid', '', 'error');
}
if($operation == 'add') {
$advid = C::t('common_advertisement')->insert(array('available' => 1, 'type' => $type), true);
}
if($advnew['style'] == 'image' || $advnew['style'] == 'flash') {
if($_FILES['advnew'.$advnew['style']]) {
$upload = new discuz_upload();
if($upload->init($_FILES['advnew'.$advnew['style']], 'common') && $upload->save(1)) {
$advnew[$advnew['style']]['url'] = (!strstr($_G['setting']['attachurl'], '://') ? $_G['siteurl'] : '').$_G['setting']['attachurl'].'common/'.$upload->attach['attachment'];
}
} else {
$advnew[$advnew['style']]['url'] = $_GET['advnew'.$advnew['style']];
}
}
$advnew['displayorder'] = isset($advnew['displayorder']) ? implode("\t", $advnew['displayorder']) : '';
$advnew['code'] = encodeadvcode($advnew);
$extra = $type != 'custom' ? '' : '&customid='.$parameters['extra']['customid'];
$advnew['parameters'] = serialize(array_merge(is_array($parameters) ? $parameters : array(), array('style' => $advnew['style']), $advnew['style'] == 'code' ? array() : $advnew[$advnew['style']], array('html' => $advnew['code']), array('displayorder' => $advnew['displayorder'])));
C::t('common_advertisement')->update($advid, array(
'title' => $advnew['title'],
'targets' => $advnew['targets'],
'parameters' => $advnew['parameters'],
'code' => $advnew['code'],
'starttime' => $advnew['starttime'],
'endtime' => $advnew['endtime']
));
updatecache('advs');
updatecache('setting');
cpmsg('adv_succeed', 'action=adv&operation=edit&advid='.$advid.$extra, 'succeed');
}
} elseif($operation == 'setting') {
if(submitcheck('advsubmit')) {
$_GET['advexpirationnew']['allow'] = $_GET['advexpirationnew']['allow'] && $_GET['advexpirationnew']['day'] > 0 && $_GET['advexpirationnew']['method'] && $_GET['advexpirationnew']['users'];
C::t('common_setting')->update_setting('advexpiration', $_GET['advexpirationnew']);
updatecache('setting');
cpmsg('setting_update_succeed', 'action=adv&operation=setting', 'succeed');
} else {
shownav('extended', 'adv_admin');
showsubmenu('adv_admin', array(
array('adv_admin_setting', 'adv&operation=setting', 1),
array('adv_admin_list', 'adv&operation=list', 0),
array('adv_admin_listall', 'adv&operation=ad', 0),
));
$advexpiration = C::t('common_setting')->fetch_setting('advexpiration', true);
showformheader('adv&operation=setting');
showtableheader();
showsetting('adv_setting_advexpiration', 'advexpirationnew[allow]', $advexpiration['allow'], 'radio', 0, 1);
showsetting('adv_setting_advexpiration_day', 'advexpirationnew[day]', $advexpiration['day'], 'text');
showsetting('adv_setting_advexpiration_method', array('advexpirationnew[method]', array(
array('email', cplang('adv_setting_advexpiration_method_email')),
array('notice', cplang('adv_setting_advexpiration_method_notice')),
)), $advexpiration['method'], 'mcheckbox');
showsetting('adv_setting_advexpiration_users', 'advexpirationnew[users]', $advexpiration['users'], 'textarea');
showtagfooter('tbody');
showsubmit('advsubmit');
showtablefooter();
showformfooter();
}
} elseif($operation == 'list') {
shownav('extended', 'adv_admin');
showsubmenu('adv_admin', array(
array('adv_admin_setting', 'adv&operation=setting', 0),
array('adv_admin_list', 'adv&operation=list', 1),
array('adv_admin_listall', 'adv&operation=ad', 0),
));
showtips('adv_list_tip');
$advs = getadvs();
showtableheader('', 'fixpadding');
echo '<tr><td colspan="4">'.$lang['adv_targets'].': &nbsp;&nbsp; ';
foreach($defaulttargets as $target) {
echo '<a href="'.ADMINSCRIPT.'?action=adv&operation=ad&target='.$target.'">'.$lang['adv_edit_targets_'.$target].'</a> &nbsp;&nbsp; ';
}
$row = 4;
$rowwidth = 1 / $row * 100;
$customadv = $ads = array();
$tmp = $advs['adv_custom.php'];
unset($advs['adv_custom.php']);
$advs['adv_custom.php'] = $tmp;
foreach(C::t('common_advertisement')->fetch_all_type() as $ad) {
$ads[$ad['type']] = $ad['count'];
}
foreach(C::t('common_advertisement')->fetch_all_by_type('custom') as $ad) {
$parameters = dunserialize($ad['parameters']);
$ads['custom_'.$parameters['extra']['customid']]++;
}
if($advs) {
$i = $row;
foreach($advs as $adv) {
if($i == $row) {
echo '<tr>';
}
if($adv['class'] == 'custom') {
$customadv = $adv;
$img = file_exists(DISCUZ_ROOT.'./static/image/admincp/'.$customadv['class'].'.gif') ? '<img src="static/image/admincp/'.$customadv['class'].'.gif" /><br />' : '';
echo '<td width="'.$rowwidth.'%" class="hover" align="center">';
echo $img.$lang['adv_custom_add'];
showformheader("adv&operation=custom&do=add");
echo '<input name="addcustom" class="txt" /><input name="submit" class="btn" type="submit" value="'.$lang['submit'].'" />';
showformfooter();
echo '</td>';
} else {
echo '<td width="'.$rowwidth.'%" class="hover" align="center"><a href="'.ADMINSCRIPT.'?action=adv&operation=ad&type='.$adv['class'].'">';
$eclass = explode(':', $adv['class']);
if(count($eclass) > 1) {
echo file_exists(DISCUZ_ROOT.'./source/plugin/'.$eclass[0].'/adv/adv_'.$eclass[1].'.gif') ? '<img src="source/plugin/'.$eclass[0].'/adv/adv_'.$eclass[1].'.gif" /><br />' : '';
} else {
echo file_exists(DISCUZ_ROOT.'./static/image/admincp/'.$adv['class'].'.gif') ? '<img src="static/image/admincp/'.$adv['class'].'.gif" /><br />' : '';
}
echo $adv['name'].($ads[$adv['class']] ? '('.$ads[$adv['class']].')' : '').($adv['filemtime'] > TIMESTAMP - 86400 ? ' <font color="red">New!</font>' : '');
echo '</a></td>';
}
$i--;
if(!$i) {
$i = $row;
}
}
if($i != $row) {
echo str_repeat('<td></td>', $i);
}
} else {
showtablerow('', '', $lang['adv_nonexistence']);
}
if($customadv) {
$img = file_exists(DISCUZ_ROOT.'./static/image/admincp/'.$customadv['class'].'.gif') ? '<img src="static/image/admincp/'.$customadv['class'].'.gif" /><br />' : '';
$i = $row;
foreach(C::t('common_advertisement_custom')->fetch_all_data() as $custom) {
if($i == $row) {
echo '<tr>';
}
echo '<td width="'.$rowwidth.'%" class="hover" align="center"><div id="op_'.$custom['id'].'"><a href="'.ADMINSCRIPT.'?action=adv&operation=ad&type='.$customadv['class'].'&customid='.$custom['id'].'">';
echo $img.$lang['adv_custom'].' '.$custom['name'].($ads['custom_'.$custom['id']] ? '('.$ads['custom_'.$custom['id']].')' : '');
echo '</a><br /><div class="right">';
echo '<a onclick="ajaxget(this.href, \'op_'.$custom['id'].'\');return false;" href="'.ADMINSCRIPT.'?action=adv&operation=custom&do=edit&id='.$custom['id'].'">'.$lang['edit'].'</a>&nbsp;';
echo '<a onclick="ajaxget(this.href, \'op_'.$custom['id'].'\');return false;" href="'.ADMINSCRIPT.'?action=adv&operation=custom&do=delete&id='.$custom['id'].'">'.$lang['delete'].'</a>';
echo '</div></div></td>';
$i--;
if(!$i) {
$i = $row;
}
}
if($i != $row) {
echo str_repeat('<td></td>', $i);
}
}
echo '<tr>'.str_repeat('<td width="'.$rowwidth.'%"></td>', $row).'</tr>';
showtablefooter();
} elseif($operation == 'custom') {
if($do == 'add') {
$addcustom = strip_tags($_GET['addcustom']);
if($addcustom) {
if(!($customid = C::t('common_advertisement_custom')->get_id_by_name($addcustom))) {
$customid = C::t('common_advertisement_custom')->insert(array('name' => $addcustom), true);
}
dheader('location: '.ADMINSCRIPT.'?action=adv&operation=add&type=custom&customid='.$customid);
}
} elseif($do == 'edit') {
$custom = C::t('common_advertisement_custom')->fetch($_GET['id']);
$name = $custom['name'];
if(!submitcheck('submit')) {
ajaxshowheader();
showformheader("adv&operation=custom&do=edit&id={$_GET['id']}");
echo $lang['adv_custom_edit'].'<br /><input name="customnew" class="txt" value="'.dhtmlspecialchars($name).'" />&nbsp;'.
'<input name="submit" class="btn" type="submit" value="'.$lang['submit'].'" />&nbsp;'.
'<input class="btn" type="button" onclick="location.href=\''.ADMINSCRIPT.'?action=adv&operation=list\'" value="'.$lang['cancel'].'" />';
showformfooter();
ajaxshowfooter();
} else {
$customnew = strip_tags($_GET['customnew']);
if($_GET['customnew'] != $name) {
C::t('common_advertisement_custom')->update($_GET['id'], array('name' => $customnew));
}
}
} elseif($do == 'delete') {
if(!submitcheck('submit')) {
ajaxshowheader();
showformheader("adv&operation=custom&do=delete&id={$_GET['id']}");
echo $lang['adv_custom_delete'].'<br /><input name="submit" class="btn" type="submit" value="'.$lang['delete'].'" />&nbsp;'.
'<input class="btn" type="button" onclick="location.href=\''.ADMINSCRIPT.'?action=adv&operation=list\'" value="'.$lang['cancel'].'" />';
showformfooter();
ajaxshowfooter();
} else {
C::t('common_advertisement_custom')->delete($_GET['id']);
}
}
dheader('location: '.ADMINSCRIPT.'?action=adv&operation=list');
}
function encodeadvcode($advnew) {
switch($advnew['style']) {
case 'code':
$advnew['code'] = $advnew['code']['html'];
break;
case 'text':
$advnew['code'] = '<a href="'.$advnew['text']['link'].'" target="_blank" '.($advnew['text']['size'] ? 'style="font-size: '.$advnew['text']['size'].'"' : '').'>'.$advnew['text']['title'].'</a>';
break;
case 'image':
$advnew['code'] = '<a href="'.$advnew['image']['link'].'" target="_blank"><img src="'.$advnew['image']['url'].'"'.($advnew['image']['height'] ? ' height="'.$advnew['image']['height'].'"' : '').($advnew['image']['width'] ? ' width="'.$advnew['image']['width'].'"' : '').($advnew['image']['alt'] ? ' alt="'.$advnew['image']['alt'].'"' : '').' border="0"></a>';
break;
case 'flash':
$advnew['code'] = '<embed width="'.$advnew['flash']['width'].'" height="'.$advnew['flash']['height'].'" src="'.$advnew['flash']['url'].'" type="application/x-shockwave-flash" wmode="transparent"></embed>';
break;
}
return $advnew['code'];
}
function getadvs() {
global $_G;
$checkdirs = array_merge(array(''), $_G['setting']['plugins']['available']);
$advs = array();
foreach($checkdirs as $key) {
if($key) {
$dir = DISCUZ_ROOT.'./source/plugin/'.$key.'/adv';
} else {
$dir = DISCUZ_ROOT.'./source/class/adv';
}
if(!file_exists($dir)) {
continue;
}
$advdir = dir($dir);
while($entry = $advdir->read()) {
if(!in_array($entry, array('.', '..')) && preg_match("/^adv\_[\w\.]+$/", $entry) && substr($entry, -4) == '.php' && strlen($entry) < 30 && is_file($dir.'/'.$entry)) {
@include_once $dir.'/'.$entry;
$advclass = substr($entry, 0, -4);
if(class_exists($advclass)) {
$adv = new $advclass();
$script = substr($advclass, 4);
$script = ($key ? $key.':' : '').$script;
$advs[$entry] = array(
'class' => $script,
'name' => lang('adv/'.$script, $adv->name),
'version' => $adv->version,
'copyright' => lang('adv/'.$script, $adv->copyright),
'filemtime' => @filemtime($dir.'/'.$entry)
);
}
}
}
}
uasort($advs, 'filemtimesort');
return $advs;
}
?>

View File

@@ -0,0 +1,293 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_album.php 27892 2012-02-16 07:24:19Z chenmengshu $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
include_once libfile('function/portalcp');
cpheader();
$detail = $_GET['detail'];
$albumname = $_GET['albumname'];
$albumid = $_GET['albumid'];
$uid = $_GET['uid'];
$users = $_GET['users'];
$starttime = $_GET['starttime'];
$endtime = $_GET['endtime'];
$searchsubmit = $_GET['searchsubmit'];
$albumids = $_GET['albumids'];
$friend = $_GET['friend'];
$orderby = $_GET['orderby'];
$ordersc = $_GET['ordersc'];
$fromumanage = $_GET['fromumanage'] ? 1 : 0;
$muticondition = '';
$muticondition .= $albumname ? '&albumname='.$albumname : '';
$muticondition .= $albumid ? '&albumid='.$albumid : '';
$muticondition .= $uid ? '&uid='.$uid : '';
$muticondition .= $users ? '&users='.$users : '';
$muticondition .= $starttime ? '&starttime='.$starttime : '';
$muticondition .= $endtime ? '&endtime='.$endtime : '';
$muticondition .= $friend ? '&friend='.$friend : '';
$muticondition .= $orderby ? '&orderby='.$orderby : '';
$muticondition .= $ordersc ? '&ordersc='.$ordersc : '';
$muticondition .= $fromumanage ? '&fromumanage='.$fromumanage : '';
$muticondition .= $searchsubmit ? '&searchsubmit='.$searchsubmit : '';
$muticondition .= $_GET['search'] ? '&search='.$_GET['search'] : '';
$muticondition .= $detail ? '&detail='.$detail : '';
if(!submitcheck('albumsubmit')) {
if(empty($_GET['search'])) {
$newlist = 1;
$detail = 1;
}
if($fromumanage) {
$starttime = !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $starttime) ? '' : $starttime;
$endtime = $_G['adminid'] == 3 || !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $endtime) ? '' : $endtime;
} else {
$starttime = !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $starttime) ? dgmdate(TIMESTAMP - 86400 * 7, 'Y-n-j') : $starttime;
$endtime = $_G['adminid'] == 3 || !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $endtime) ? dgmdate(TIMESTAMP, 'Y-n-j') : $endtime;
}
shownav('topic', 'nav_album');
showsubmenu('nav_album', array(
array('newlist', 'album', !empty($newlist)),
array('search', 'album&search=true', empty($newlist)),
));
empty($newlist) && showsubmenusteps('', array(
array('album_search', !$searchsubmit),
array('nav_album', $searchsubmit)
));
if($muticondition) {
showtips('album_tips');
}
$staticurl = STATICURL;
echo <<<EOT
<script type="text/javascript" src="{$staticurl}js/calendar.js"></script>
<script type="text/JavaScript">
function page(number) {
$('albumforum').page.value=number;
$('albumforum').searchsubmit.click();
}
</script>
EOT;
showtagheader('div', 'searchposts', !$searchsubmit && empty($newlist));
showformheader("album".(!empty($_GET['search']) ? '&search=true' : ''), '', 'albumforum');
showhiddenfields(array('page' => $page, 'pp' => $_GET['pp'] ? $_GET['pp'] : $_GET['perpage']));
showtableheader();
showsetting('album_search_detail', 'detail', $detail, 'radio');
showsetting('album_search_perpage', '', $_GET['perpage'], "<select name='perpage'><option value='20'>{$lang['perpage_20']}</option><option value='50'>{$lang['perpage_50']}</option><option value='100'>{$lang['perpage_100']}</option></select>");
showsetting('resultsort', '', $orderby, "<select name='orderby'><option value=''>{$lang['defaultsort']}</option><option value='dateline'>{$lang['topic_dateline']}</option><option value='updatetime'>{$lang['updatetime']}</option><option value='picnum'>{$lang['pic_num']}</option></select> ");
showsetting('', '', $ordersc, "<select name='ordersc'><option value='desc'>{$lang['orderdesc']}</option><option value='asc'>{$lang['orderasc']}</option></select>", '', 0, '', '', '', true);
showsetting('album_search_albumname', 'albumname', $albumname, 'text');
showsetting('album_search_albumid', 'albumid', $albumid, 'text');
showsetting('album_search_uid', 'uid', $uid, 'text');
showsetting('album_search_user', 'users', $users, 'text');
showsetting('blog_search_friend', '', $friend, "<select name='friend'><option value='0'>{$lang['setting_home_privacy_alluser']}</option><option value='1'>{$lang['setting_home_privacy_friend']}</option><option value='2'>{$lang['setting_home_privacy_specified_friend']}</option><option value='3'>{$lang['setting_home_privacy_self']}</option><option value='4'>{$lang['setting_home_privacy_password']}</option></select>");
showsetting('album_search_time', array('starttime', 'endtime'), array($starttime, $endtime), 'daterange');
echo '<input type="hidden" name="fromumanage" value="'.$fromumanage.'">';
showsubmit('searchsubmit');
showtablefooter();
showformfooter();
showtagfooter('div');
} else {
if($_GET['albumids']) {
$albumids = authcode($_GET['albumids'], 'DECODE');
$albumidsadd = $albumids ? explode(',', $albumids) : $_GET['delete'];
include_once libfile('function/delete');
$deletecount = count(deletealbums($albumidsadd));
$cpmsg = cplang('album_succeed', array('deletecount' => $deletecount));
} else {
$albums = $catids = array();
$selectalbumids = !empty($_GET['ids']) && is_array($_GET['ids']) ? $_GET['ids'] : array();
if($selectalbumids) {
$query = C::t('home_album')->fetch_all_album($selectalbumids);
foreach($query as $value) {
$albums[$value['albumid']] = $value;
$catids[] = intval($value['catid']);
}
}
if($albums) {
$selectalbumids = array_keys($albums);
if($_POST['optype'] == 'delete') {
include_once libfile('function/delete');
$deletecount = count(deletealbums($selectalbumids));
$cpmsg = cplang('album_succeed', array('deletecount' => $deletecount));
} elseif($_POST['optype'] == 'move') {
$tocatid = intval($_POST['tocatid']);
$catids[] = $tocatid;
$catids = array_merge($catids);
C::t('home_album')->update($selectalbumids, array('catid'=>$tocatid));
foreach($catids as $catid) {
$catid = intval($catid);
$cnt = C::t('home_album')->count_by_catid($catid);
C::t('home_album_category')->update($catid, array('num'=>intval($cnt)));
}
$cpmsg = cplang('album_move_succeed');
} else {
$cpmsg = cplang('album_choose_at_least_one_operation');
}
} else {
$cpmsg = cplang('album_choose_at_least_one_album');
}
}
?>
<script type="text/JavaScript">alert('<?php echo $cpmsg;?>');parent.$('albumforum').searchsubmit.click();</script>
<?php
}
if(submitcheck('searchsubmit', 1) || $newlist) {
$albumids = $albumcount = '0';
$sql = $error = '';
$users = trim($users);
if($users != '') {
$uids = array(-1);
$query = C::t('home_album')->fetch_uid_by_username(explode(',', $users));
$uids = array_keys($query) + $uids;
}
if($starttime != '') {
$starttime = strtotime($starttime);
}
if($_G['adminid'] == 1 && $endtime != dgmdate(TIMESTAMP, 'Y-n-j')) {
if($endtime != '') {
$endtime = strtotime($endtime);
}
} else {
$endtime = TIMESTAMP;
}
if($albumid != '') {
$albumids = explode(',', $albumid);
}
if($uid != '') {
$query = C::t('home_album')->fetch_uid_by_uid($uid);
if(!$uids) {
$uids = array_keys($query);
} else {
$uids = array_intersect(array_keys($query), $uids);
}
if(!$uids) {
$uids = array(-1);
}
}
$orderby = $orderby ? $orderby : 'updatetime';
$ordersc = $ordersc ? $ordersc : 'DESC';
if(($_G['adminid'] == 2 && $endtime - $starttime > 86400 * 16) || ($_G['adminid'] == 3 && $endtime - $starttime > 86400 * 8)) {
$error = 'album_mod_range_illegal';
}
if(!$error) {
if($detail) {
$_GET['perpage'] = intval($_GET['perpage']) < 1 ? 20 : intval($_GET['perpage']);
$perpage = $_GET['pp'] ? $_GET['pp'] : $_GET['perpage'];
$query = C::t('home_album')->fetch_all_by_search(1, $uids, $albumname, false, '', $starttime, $endtime, $albumids, $friend, $orderby, $ordersc, (($page - 1) * $perpage), $perpage);
$albums = '';
include_once libfile('function/home');
foreach($query as $album) {
if($album['friend'] != 4 && ckfriend($album['uid'], $album['friend'], $album['target_ids'])) {
$album['pic'] = pic_cover_get($album['pic'], $album['picflag']);
} else {
$album['pic'] = STATICURL.'image/common/nopublish.svg';
}
$album['updatetime'] = dgmdate($album['updatetime']);
switch ($album['friend']) {
case '0':
$privacy_name = $lang['setting_home_privacy_alluser'];
break;
case '1':
$privacy_name = $lang['setting_home_privacy_friend'];
break;
case '2':
$privacy_name = $lang['setting_home_privacy_specified_friend'];
break;
case '3':
$privacy_name = $lang['setting_home_privacy_self'];
break;
case '4':
$privacy_name = $lang['setting_home_privacy_password'];
break;
default:
$privacy_name = $lang['setting_home_privacy_alluser'];
}
$album['friend'] = $album['friend'] ? " <a href=\"".ADMINSCRIPT."?action=album&friend={$album['friend']}\">$privacy_name</a>" : $privacy_name;
$albums .= showtablerow('', '', array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"ids[]\" value=\"{$album['albumid']}\" />",
"<a href=\"home.php?mod=space&uid={$album['uid']}&do=album&id={$album['albumid']}\" target=\"_blank\"><img src='{$album['pic']}' /></a>",
"<a href=\"home.php?mod=space&uid={$album['uid']}&do=album&id={$album['albumid']}\" target=\"_blank\">{$album['albumname']}</a>",
"<a href=\"home.php?mod=space&uid={$album['uid']}\" target=\"_blank\">".$album['username']."</a>",
$album['updatetime'],"<a href=\"".ADMINSCRIPT."?action=pic&albumid={$album['albumid']}\">".$album['picnum']."</a>",
$album['friend']
), TRUE);
}
$albumcount = C::t('home_album')->fetch_all_by_search(3, $uids, $albumname, false, '', $starttime, $endtime, $albumids, $friend);
$multi = multi($albumcount, $perpage, $page, ADMINSCRIPT."?action=album$muticondition");
} else {
$albumcount = 0;
$query = C::t('home_album')->fetch_all_by_search(2, $uids, $albumname, false, '', $starttime, $endtime, $albumids, $friend);
foreach($query as $album) {
$albumids .= ','.$album['albumid'];
$albumcount++;
}
$multi = '';
}
if(!$albumcount) {
$error = 'album_post_nonexistence';
}
}
showtagheader('div', 'postlist', $searchsubmit || $newlist);
showformheader('album&frame=no', 'target="albumframe"');
if(!$muticondition) {
showtableheader(cplang('album_new_result').' '.$albumcount, 'fixpadding');
} else {
showtableheader(cplang('album_result').' '.$albumcount.(empty($newlist) ? ' <a href="###" onclick="$(\'searchposts\').style.display=\'\';$(\'postlist\').style.display=\'none\';$(\'albumforum\').pp.value=\'\';$(\'albumforum\').page.value=\'\';" class="act lightlink normal">'.cplang('research').'</a>' : ''), 'fixpadding');
}
if($error) {
echo "<tr><td class=\"lineheight\" colspan=\"15\">$lang[$error]</td></tr>";
} else {
if($detail) {
showsubtitle(array('', 'albumpic', 'albumname', 'author', 'updatetime', 'pic_num', 'privacy'));
echo $albums;
$optypehtml = ''
.'<input type="radio" name="optype" id="optype_delete" value="delete" class="radio" /><label for="optype_delete">'.cplang('delete').'</label>&nbsp;&nbsp;'
;
$optypehtml .= '<input type="radio" name="optype" id="optype_move" value="move" class="radio" /><label for="optype_move">'.cplang('article_opmove').'</label> '
.category_showselect('album', 'tocatid', false)
.'&nbsp;&nbsp;';
showsubmit('', '', '', '<input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'ids\')" /><label for="chkall">'.cplang('select_all').'</label>&nbsp;&nbsp;'.$optypehtml.'<input type="submit" class="btn" name="albumsubmit" value="'.cplang('submit').'" />', $multi);
} else {
showhiddenfields(array('albumids' => authcode($albumids, 'ENCODE')));
showsubmit('albumsubmit', 'delete', $detail ? 'del' : '', '', $multi);
}
}
showtablefooter();
showformfooter();
echo '<iframe name="albumframe" style="display:none;"></iframe>';
showtagfooter('div');
}
?>

View File

@@ -0,0 +1,212 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_albumcategory.php 24658 2011-09-29 09:39:40Z chenmengshu $
*/
if(!defined('IN_DISCUZ') || !defined('IN_DISCUZ')) {
exit('Access Denied');
}
cpheader();
$operation = $operation == 'delete' ? 'delete' : 'list';
loadcache('albumcategory');
$category = $_G['cache']['albumcategory'];
if($operation == 'list') {
if(!submitcheck('editsubmit')) {
shownav('portal', 'albumcategory');
showsubmenu('albumcategory', array(
array('list', 'albumcategory', 1)
));
showformheader('albumcategory');
showtableheader('', 'nobottom');
showsetting('system_category_stat', 'settingnew[albumcategorystat]', $_G['setting']['albumcategorystat'], 'radio', '', 1);
showsetting('system_category_required', 'settingnew[albumcategoryrequired]', $_G['setting']['albumcategoryrequired'], 'radio', '');
echo '<tr><td colspan="2">';
showtableheader();
showsubtitle(array('order', 'albumcategory_name', 'albumcategory_num', 'operation'));
foreach ($category as $key=>$value) {
if($value['level'] == 0) {
echo showcategoryrow($key, 0, '');
}
}
echo '<tr><td class="td25">&nbsp;</td><td colspan="3"><div><a class="addtr" onclick="addrow(this, 0, 0)" href="###">'.cplang('albumcategory_addcategory').'</a></div></td></tr>';
showtablefooter();
echo '</td></tr>';
showtablefooter();
showtableheader('', 'notop');
showsubmit('editsubmit');
showtablefooter();
showformfooter();
$langs = array();
$keys = array('albumcategory_addcategory', 'albumcategory_addsubcategory', 'albumcategory_addthirdcategory');
foreach ($keys as $key) {
$langs[$key] = cplang($key);
}
echo <<<SCRIPT
<script type="text/Javascript">
var rowtypedata = [
[[1,'<input type="text" class="txt" name="neworder[{1}][]" value="0" />', 'td25'], [3, '<div class="parentboard"><input type="text" class="txt" value="{$lang['albumcategory_addcategory']}" name="newname[{1}][]"/></div>']],
[[1,'<input type="text" class="txt" name="neworder[{1}][]" value="0" />', 'td25'], [3, '<div class="board"><input type="text" class="txt" value="{$lang['albumcategory_addsubcategory']}" name="newname[{1}][]"/></div>']],
[[1,'<input type="text" class="txt" name="neworder[{1}][]" value="0" />', 'td25'], [3, '<div class="childboard"><input type="text" class="txt" value="{$lang['albumcategory_addthirdcategory']}" name="newname[{1}][]"/></div>']],
];
</script>
SCRIPT;
} else {
if($_POST['name']) {
foreach($_POST['name'] as $key=>$value) {
$sets = array();
$value = trim($value);
if($category[$key] && $category[$key]['catname'] != $value) {
$sets['catname'] = $value;
}
if($category[$key] && $category[$key]['displayorder'] != $_POST['order'][$key]) {
$sets['displayorder'] = $_POST['order'][$key] ? $_POST['order'][$key] : '0';
}
if($sets) {
C::t('home_album_category')->update($key, $sets);
}
}
}
if($_POST['newname']) {
foreach ($_POST['newname'] as $upid=>$names) {
foreach ($names as $nameid=>$name) {
C::t('home_album_category')->insert(array('upid' => $upid, 'catname' => trim($name), 'displayorder'=>intval($_POST['neworder'][$upid][$nameid])));
}
}
}
if($_POST['settingnew']) {
$_POST['settingnew'] = array_map('intval', $_POST['settingnew']);
C::t('common_setting')->update_batch($_POST['settingnew']);
updatecache('setting');
}
include_once libfile('function/cache');
updatecache('albumcategory');
cpmsg('albumcategory_update_succeed', 'action=albumcategory', 'succeed');
}
} elseif($operation == 'delete') {
if(!$_GET['catid'] || !$category[$_GET['catid']]) {
cpmsg('albumcategory_catgory_not_found', '', 'error');
}
if(!submitcheck('deletesubmit')) {
$a_count = C::t('home_album')->count_by_catid($_GET['catid']);
if(!$a_count && empty($category[$_GET['catid']]['children'])) {
C::t('home_album_category')->delete($_GET['catid']);
include_once libfile('function/cache');
updatecache('albumcategory');
cpmsg('albumcategory_delete_succeed', 'action=albumcategory', 'succeed');
}
shownav('portal', 'albumcategory');
showsubmenu('albumcategory', array(
array('list', 'albumcategory', 0),
array('delete', 'albumcategory&operation=delete&catid='.$_GET['catid'], 1)
));
showformheader('albumcategory&operation=delete&catid='.$_GET['catid']);
showtableheader();
if($category[$_GET['catid']]['children']) {
showsetting('albumcategory_subcategory_moveto', '', '',
'<input type="radio" name="subcat_op" value="trash" id="subcat_op_trash" checked="checked" />'.
'<label for="subcat_op_trash" />'.cplang('albumcategory_subcategory_moveto_trash').'</label>'.
'<input type="radio" name="subcat_op" value="parent" id="subcat_op_parent" checked="checked" />'.
'<label for="subcat_op_parent" />'.cplang('albumcategory_subcategory_moveto_parent').'</label>'
);
}
include_once libfile('function/portalcp');
showsetting('albumcategory_article_moveto', '', '', category_showselect('album', 'tocatid', false, $category[$_GET['catid']]['upid']));
showsubmit('deletesubmit');
showtablefooter();
showformfooter();
} else {
if($_POST['tocatid'] == $_GET['catid']) {
cpmsg('albumcategory_move_category_failed', 'action=albumcategory', 'error');
}
$delids = array($_GET['catid']);
if($category[$_GET['catid']]['children']) {
if($_POST['subcat_op'] == 'parent') {
$upid = intval($category[$_GET['catid']]['upid']);
C::t('home_album_category')->update($category[$_GET['catid']]['children'], array('upid'=>$upid));
} else {
$delids = array_merge($delids, $category[$_GET['catid']]['children']);
foreach ($category[$_GET['catid']]['children'] as $id) {
$value = $category[$id];
if($value['children']) {
$delids = array_merge($delids, $value['children']);
}
}
if(!$category[$_POST['tocatid']] || in_array($_POST['tocatid'], $delids)) {
cpmsg('albumcategory_move_category_failed', 'action=albumcategory', 'error');
}
}
}
if($delids) {
C::t('home_album')->update_by_catid($delids, array('catid' => $_POST['tocatid']));
C::t('home_album_category')->delete($delids);
$num =C::t('home_album')->count_by_catid($_GET['tocatid']);
C::t('home_album_category')->update($_POST['tocatid'], array('num'=>$num));
}
include_once libfile('function/cache');
updatecache('albumcategory');
cpmsg('albumcategory_delete_succeed', 'action=albumcategory', 'succeed');
}
}
function showcategoryrow($key, $level = 0, $last = '') {
global $_G;
loadcache('albumcategory');
$value = $_G['cache']['albumcategory'][$key];
$return = '';
include_once libfile('function/portalcp');
$value['num'] = category_get_num('album', $key);
if($level == 2) {
$class = $last ? 'lastchildboard' : 'childboard';
$return = '<tr class="hover"><td class="td25"><input type="text" class="txt" name="order['.$value['catid'].']" value="'.$value['displayorder'].'" /></td><td><div class="'.$class.'">'.
'<input type="text" name="name['.$value['catid'].']" value="'.$value['catname'].'" class="txt" />'.
'</div>'.
'</td><td>'.$value['num'].'</td><td><a href="'.ADMINSCRIPT.'?action=albumcategory&operation=delete&catid='.$value['catid'].'">'.cplang('delete').'</a></td></tr>';
} elseif($level == 1) {
$return = '<tr class="hover"><td class="td25"><input type="text" class="txt" name="order['.$value['catid'].']" value="'.$value['displayorder'].'" /></td><td><div class="board">'.
'<input type="text" name="name['.$value['catid'].']" value="'.$value['catname'].'" class="txt" />'.
'<a class="addchildboard" onclick="addrowdirect = 1;addrow(this, 2, '.$value['catid'].')" href="###">'.cplang('albumcategory_addthirdcategory').'</a></div>'.
'</td><td>'.$value['num'].'</td><td><a href="'.ADMINSCRIPT.'?action=albumcategory&operation=delete&catid='.$value['catid'].'">'.cplang('delete').'</a></td></tr>';
for($i=0,$L=(is_array($value['children']) ? count($value['children']) : 0); $i<$L; $i++) {
$return .= showcategoryrow($value['children'][$i], 2, $i==$L-1);
}
} else {
$return = '<tr class="hover"><td class="td25"><input type="text" class="txt" name="order['.$value['catid'].']" value="'.$value['displayorder'].'" /></td><td><div class="parentboard">'.
'<input type="text" name="name['.$value['catid'].']" value="'.$value['catname'].'" class="txt" />'.
'</div>'.
'</td><td>'.$value['num'].'</td><td><a href="'.ADMINSCRIPT.'?action=albumcategory&operation=delete&catid='.$value['catid'].'">'.cplang('delete').'</a></td></tr>';
for($i=0,$L=(is_array($value['children']) ? count($value['children']) : 0); $i<$L; $i++) {
$return .= showcategoryrow($value['children'][$i], 1, '');
}
$return .= '<tr><td class="td25"></td><td colspan="3"><div class="lastboard"><a class="addtr" onclick="addrow(this, 1, '.$value['catid'].')" href="###">'.cplang('albumcategory_addsubcategory').'</a></div>';
}
return $return;
}
?>

View File

@@ -0,0 +1,208 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_announce.php 33271 2013-05-13 08:16:21Z kamichen $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
if(empty($operation)) {
if(!submitcheck('announcesubmit')) {
shownav('extended', 'announce', 'admin');
showsubmenu('announce', array(
array('admin', 'announce', 1),
array('add', 'announce&operation=add', 0)
));
showtips('announce_tips');
showformheader('announce');
showtableheader();
showsubtitle(array('del', 'display_order', 'author', 'subject', 'message', 'announce_type', 'start_time', 'end_time', ''));
$announce_type = array(0=>$lang['announce_words'], 1=>$lang['announce_url']);
$annlist = C::t('forum_announcement')->fetch_all_by_displayorder();
foreach ($annlist as $announce) {
$disabled = $_G['adminid'] != 1 && $announce['author'] != $_G['member']['username'] ? 'disabled' : NULL;
$announce['starttime'] = $announce['starttime'] ? dgmdate($announce['starttime'], 'Y-n-j H:i') : $lang['unlimited'];
$announce['endtime'] = $announce['endtime'] ? dgmdate($announce['endtime'], 'Y-n-j H:i') : $lang['unlimited'];
showtablerow('', array('class="td25"', 'class="td28"'), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"{$announce['id']}\" $disabled>",
"<input type=\"text\" class=\"txt\" name=\"displayordernew[{$announce['id']}]\" value=\"{$announce['displayorder']}\" size=\"2\" $disabled>",
"<a href=\"./home.php?mod=space&username=".rawurlencode($announce['author'])."\" target=\"_blank\">{$announce['author']}</a>",
$announce['subject'],
cutstr(strip_tags($announce['message']), 20),
$announce_type[$announce['type']],
$announce['starttime'],
$announce['endtime'],
"<a href=\"".ADMINSCRIPT."?action=announce&operation=edit&announceid={$announce['id']}\" $disabled>{$lang['edit']}</a>"
));
}
showsubmit('announcesubmit', 'submit', 'select_all');
showtablefooter();
showformfooter();
} else {
if(is_array($_GET['delete'])) {
C::t('forum_announcement')->delete_by_id_username($_GET['delete'], $_G['username'], $_G['adminid']);
}
if(is_array($_GET['displayordernew'])) {
foreach($_GET['displayordernew'] as $id => $displayorder) {
C::t('forum_announcement')->update_displayorder_by_id_username($id, $displayorder, $_G['username'], $_G['adminid']);
}
}
updatecache(array('announcements', 'announcements_forum'));
cpmsg('announce_update_succeed', 'action=announce', 'succeed');
}
} elseif($operation == 'add') {
if(!submitcheck('addsubmit')) {
$newstarttime = dgmdate(TIMESTAMP, 'Y-n-j H:i');
$newendtime = dgmdate(TIMESTAMP + 86400* 7, 'Y-n-j H:i');
shownav('extended', 'announce', 'add');
showsubmenu('announce', array(
array('admin', 'announce', 0),
array('add', 'announce&operation=add', 1)
));
showformheader('announce&operation=add');
showtableheader('announce_add');
showsetting($lang['subject'], 'newsubject', '', 'htmltext');
showsetting($lang['start_time'], 'newstarttime', $newstarttime, 'calendar', '', 0, '', 1);
showsetting($lang['end_time'], 'newendtime', $newendtime, 'calendar', '', 0, '', 1);
showsetting('announce_type', array('newtype', array(
array(0, $lang['announce_words']),
array(1, $lang['announce_url']))), 0, 'mradio');
showsetting('announce_message', 'newmessage', '', 'textarea');
showsubmit('addsubmit');
showtablefooter();
showformfooter();
} else {
$newstarttime = $_GET['newstarttime'] ? strtotime($_GET['newstarttime']) : 0;
$newendtime = $_GET['newendtime'] ? strtotime($_GET['newendtime']) : 0;
if($newendtime && $newstarttime > $newendtime) {
cpmsg('announce_time_invalid', '', 'error');
}
$newsubject = trim($_GET['newsubject']);
$newmessage = trim($_GET['newmessage']);
if(!$newstarttime) {
cpmsg('announce_time_invalid', '', 'error');
} elseif(!$newsubject || !$newmessage) {
cpmsg('announce_invalid', '', 'error');
} else {
$newmessage = $_GET['newtype'] == 1 ? explode("\n", $_GET['newmessage']) : array(0 => $_GET['newmessage']);
$data = array(
'author' => $_G['username'],
'subject' => strip_tags($newsubject, '<u><i><b><font>'),
'type' => $_GET['newtype'],
'starttime' => $newstarttime,
'endtime' => $newendtime,
'message' => $newmessage[0],
);
C::t('forum_announcement')->insert($data);
updatecache(array('announcements', 'announcements_forum'));
cpmsg('announce_succeed', 'action=announce', 'succeed');
}
}
} elseif($operation == 'edit' && $_GET['announceid']) {
$announce = C::t('forum_announcement')->fetch_by_id_username($_GET['announceid'], $_G['username'], $_G['adminid']);
if(!$announce) {
cpmsg('announce_nonexistence', '', 'error');
}
if(!submitcheck('editsubmit')) {
$announce['starttime'] = $announce['starttime'] ? dgmdate($announce['starttime'], 'Y-n-j H:i') : "";
$announce['endtime'] = $announce['endtime'] ? dgmdate($announce['endtime'], 'Y-n-j H:i') : "";
$b = $i = $u = $colorselect = $colorcheck = '';
if(preg_match('/<b>(.*?)<\/b>/i', $announce['subject'])) {
$b = 'class="a"';
}
if(preg_match('/<i>(.*?)<\/i>/i', $announce['subject'])) {
$i = 'class="a"';
}
if(preg_match('/<u>(.*?)<\/u>/i', $announce['subject'])) {
$u = 'class="a"';
}
$colorselect = preg_replace('/<font color=(.*?)>(.*?)<\/font>/i', '$1', $announce['subject']);
$colorselect = strip_tags($colorselect);
$_G['forum_colorarray'] = array(1=>'#EE1B2E', 2=>'#EE5023', 3=>'#996600', 4=>'#3C9D40', 5=>'#2897C5', 6=>'#2B65B7', 7=>'#8F2A90', 8=>'#EC1282');
if(in_array($colorselect, $_G['forum_colorarray'])) {
$colorcheck = "style=\"background: $colorselect\"";
}
shownav('extended', 'announce');
showsubmenu('announce', array(
array('admin', 'announce', 0),
array('add', 'announce&operation=add', 0)
));
showformheader("announce&operation=edit&announceid={$_GET['announceid']}");
showtableheader();
showtitle('announce_edit');
showsetting($lang['subject'], 'newsubject', $announce['subject'], 'htmltext');
showsetting('start_time', 'starttimenew', $announce['starttime'], 'calendar', '', 0, '', 1);
showsetting('end_time', 'endtimenew', $announce['endtime'], 'calendar', '', 0, '', 1);
showsetting('announce_type', array('typenew', array(
array(0, $lang['announce_words']),
array(1, $lang['announce_url'])
)), $announce['type'], 'mradio');
showsetting('announce_message', 'messagenew', $announce['message'], 'textarea');
showsubmit('editsubmit');
showtablefooter();
showformfooter();
} else {
if(strpos($_GET['starttimenew'], '-')) {
$starttimenew = strtotime($_GET['starttimenew']);
} else {
$starttimenew = 0;
}
if(strpos($_GET['endtimenew'], '-')) {
$endtimenew = strtotime($_GET['endtimenew']);
} else {
$endtimenew = 0;
}
$subjectnew = trim($_GET['newsubject']);
$messagenew = trim($_GET['messagenew']);
if(!$starttimenew || ($endtimenew && $endtimenew <= TIMESTAMP) || $endtimenew && $starttimenew > $endtimenew) {
cpmsg('announce_time_invalid', '', 'error');
} elseif(!$subjectnew || !$messagenew) {
cpmsg('announce_invalid', '', 'error');
} else {
$messagenew = $_GET['typenew'] == 1 ? explode("\n", $messagenew) : array(0 => $messagenew);
C::t('forum_announcement')->update_by_id_username($_GET['announceid'], array(
'subject' => strip_tags($subjectnew, '<u><i><b><font>'),
'type' => $_GET['typenew'],
'starttime' => $starttimenew,
'endtime' => $endtimenew,
'message' => $messagenew[0],
), $_G['username'], $_G['adminid']);
updatecache(array('announcements', 'announcements_forum'));
cpmsg('announce_succeed', 'action=announce', 'succeed');
}
}
}
echo '<script type="text/javascript" src="' . STATICURL . 'js/calendar.js"></script>';
?>

View File

@@ -0,0 +1,452 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_article.php 33047 2013-04-12 08:46:56Z zhangguosheng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_DISCUZ')) {
exit('Access Denied');
}
$operation = in_array($operation, array('trash', 'tag')) ? $operation : 'list';
loadcache('portalcategory');
$category = $_G['cache']['portalcategory'];
cpheader();
shownav('portal', 'article');
$searchctrl = '';
if($operation == 'list') {
$searchctrl = '<span style="float: right; padding-right: 40px;">'
.'<a href="javascript:;" onclick="$(\'tb_search\').style.display=\'\';$(\'a_search_show\').style.display=\'none\';$(\'a_search_hide\').style.display=\'\';" id="a_search_show" style="display:none">'.cplang('show_search').'</a>'
.'<a href="javascript:;" onclick="$(\'tb_search\').style.display=\'none\';$(\'a_search_show\').style.display=\'\';$(\'a_search_hide\').style.display=\'none\';" id="a_search_hide">'.cplang('hide_search').'</a>'
.'</span>';
}
$catid = $_GET['catid'] = intval($_GET['catid']);
showsubmenu('article', array(
array('list', 'article&catid='.$catid, $operation == 'list'),
array('article_trash', 'article&operation=trash&catid='.$catid, $operation == 'trash'),
array('article_tag', 'article&operation=tag', $operation == 'tag'),
array('article_add', 'portal.php?mod=portalcp&ac=article', false, 1, 1)
), $searchctrl);
if($operation == 'tag') {
showtips('article_tag_tip');
if(submitcheck('articletagsubmit')) {
C::t('common_setting')->update_setting('article_tags', $_POST['tag']);
updatecache('setting');
cpmsg('update_articletag_succeed', 'action=article&operation=tag', 'succeed');
}
require_once libfile('function/portalcp');
$tag_names = article_tagnames();
showformheader('article&operation=tag');
showtableheader('article_tag_setting');
for($i=1; $i<=8; $i++) {
showtablerow('', array('width=80', ''),
array(lang('portalcp', 'article_tag').$i, "<input type=\"text\" class=\"txt\" name=\"tag[$i]\" value=\"$tag_names[$i]\" />"));
}
showsubmit('articletagsubmit', 'submit');
showtablefooter();
showformfooter();
} elseif($operation == 'trash') {
if(submitcheck('batchsubmit', true)) {
$_POST['optype'] = empty($_POST['optype']) ? $_GET['optype'] : $_POST['optype'];
if(empty($_POST['ids']) && $_POST['optype'] != 'clear') {
cpmsg('article_choose_at_least_one_article', 'action=article&operation=trash', 'error');
}
if($_POST['optype'] == 'recover') {
$inserts = $ids = $catids = array();
foreach(C::t('portal_article_trash')->fetch_all($_POST['ids']) as $value) {
$ids[] = intval($value['aid']);
$article = dunserialize($value['content']);
$catids[] = intval($article['catid']);
$inserts[] = array (
'aid' => $article['aid'],
'catid' => $article['catid'],
'uid' => $article['uid'],
'username' => $article['username'],
'title' => $article['title'],
'url' => $article['url'],
'summary' => $article['summary'],
'pic' => $article['pic'],
'id' => $article['id'],
'idtype' => $article['idtype'],
'contents' => $article['contents'],
'dateline' => $article['dateline'],
'thumb' => $article['thumb'],
'remote' => $article['remote'],
'click1' => $article['click1'],
'click2' => $article['click2'],
'click3' => $article['click3'],
'click4' => $article['click4'],
'click5' => $article['click5'],
'click6' => $article['click6'],
'click7' => $article['click7'],
'click8' => $article['click8'],
'author' => $article['author'],
'from' => $article['from'],
'fromurl' => $article['fromurl'],
'bid' => $article['bid'],
'allowcomment' => $article['allowcomment'],
'tag' => $article['tag'],
'owncomment' => $article['owncomment'],
'status' => $article['status'],
'highlight' => $article['highlight'],
'showinnernav' => $article['showinnernav'],
'preaid' => $article['preaid'],
'nextaid' => $article['nextaid'],
'htmlmade' => $article['htmlmade'],
'htmlname' => $article['htmlname'],
'htmldir' => $article['htmldir'],
);
}
if($inserts) {
foreach($inserts as $data) {
C::t('portal_article_title')->insert($data, 0, 1);
}
C::t('portal_article_trash')->delete($ids);
}
$catids = array_unique($catids);
if($catids) {
foreach($catids as $catid) {
$cnt = C::t('portal_article_title')->fetch_count_for_cat($catid);
C::t('portal_category')->update($catid, array('articles'=>dintval($cnt)));
}
}
cpmsg('article_trash_recover_succeed', 'action=article&operation=trash', 'succeed');
} elseif($_POST['optype'] == 'delete') {
require_once libfile('function/delete');
deletetrasharticle($_POST['ids']);
cpmsg('article_trash_delete_succeed', 'action=article&operation=trash', 'succeed');
} elseif($_POST['optype'] == 'clear') {
$aids = array();
foreach(C::t('portal_article_trash')->range(50) as $value) {
$aids[$value['aid']] = $value['aid'];
}
if(!empty($aids)) {
require_once libfile('function/delete');
deletetrasharticle($aids);
cpmsg('article_trash_is_clearing', 'action=article&operation=trash&optype=clear&batchsubmit=yes&formhash='.FORMHASH);
} else {
cpmsg('article_trash_is_empty', 'action=article');
}
} else {
cpmsg('article_choose_at_least_one_operation', 'action=article&operation=trash', 'error');
}
} else {
$perpage = 50;
$start = ($page-1)*$perpage;
$mpurl .= '&perpage='.$perpage;
$perpages = array($perpage => ' selected');
$mpurl = ADMINSCRIPT.'?mod=portal&action=article&operation='.$operation;
showformheader('article&operation=trash');
showtableheader('article_trash_list');
showsubtitle(array('', 'article_title', 'article_category', 'article_username', 'article_dateline'));
$multipage = '';
$count = C::t('portal_article_trash')->count();
if($count) {
foreach(C::t('portal_article_trash')->range($start, $perpage) as $value) {
$value = dunserialize($value['content']);
showtablerow('', array('class="td25"', 'class=""', 'class="td28"'), array(
"<input type=\"checkbox\" class=\"checkbox\" name=\"ids[]\" value=\"{$value['aid']}\">",
$value['title'],
$category[$value['catid']]['catname'],
"<a href=\"home.php?mod=space&uid={$value['uid']}&do=profile\" target=\"_blank\">{$value['username']}</a>",
dgmdate($value['dateline'])
));
}
$multipage = multi($count, $perpage, $page, $mpurl);
}
$batchradio = '<input type="radio" name="optype" value="recover" id="op_recover" class="radio" /><label for="op_recover">'.cplang('article_trash_recover').'</label>&nbsp;&nbsp;';
$batchradio .= '<input type="radio" name="optype" value="delete" id="op_delete" class="radio" /><label for="op_delete">'.cplang('article_trash_delete').'</label>&nbsp;&nbsp;';
$batchradio .= '<input type="radio" name="optype" value="clear" id="op_clear" class="radio" style="display:none;"/><input type="hidden" name="batchsubmit" value="yes" />';
showsubmit('', '', '', '<input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'ids\')" /><label for="chkall">'.cplang('select_all').'</label>&nbsp;&nbsp;'
.$batchradio.'<input type="submit" class="btn" name="batchbutton" value="'.cplang('submit').'" />
<input type="button" class="btn" name="clearbutton" value="'.cplang('article_clear_trash').'" onclick="if(confirm(\''.cplang('article_clear_trash_confirm').'?\')){this.form.optype[2].checked=\'checked\';this.form.submit();}"/>', $multipage);
showtablefooter();
showformfooter();
}
} else {
if(submitcheck('articlesubmit')) {
$perpage = intval($_GET['hiddenperpage']);
$page = intval($_GET['hiddenpage']);
$catid = intval($_GET['hiddencatid']);
$articles = $catids = array();
$aids = !empty($_GET['ids']) && is_array($_GET['ids']) ? $_GET['ids'] : array();
if($aids) {
$query = C::t('portal_article_title')->fetch_all($aids);
foreach($query as $value) {
$articles[$value['aid']] = array('aid' => $value['aid'], 'catid' => $value['catid']);
$catids[] = intval($value['catid']);
}
}
if(empty($articles)) {
cpmsg('article_choose_at_least_one_article', 'action=article&catid='.$catid.'&perpage='.$perpage.'&page='.$page, 'error');
}
$aids = array_keys($articles);
if($_POST['optype'] == 'trash') {
require_once libfile('function/delete');
deletearticle($aids, true);
cpmsg('article_trash_succeed', 'action=article&catid='.$catid.'&perpage='.$perpage.'&page='.$page, 'succeed');
} elseif($_POST['optype'] == 'move') {
$tocatid = intval($_POST['tocatid']);
$catids[] = $tocatid;
$catids = array_merge($catids);
C::t('portal_article_title')->update($aids, array('catid'=>$tocatid));
foreach($catids as $catid) {
$catid = intval($catid);
$cnt = C::t('portal_article_title')->fetch_count_for_cat($catid);
C::t('portal_category')->update($catid, array('articles'=>dintval($cnt)));
}
cpmsg('article_move_succeed', 'action=article&catid='.$catid.'&perpage='.$perpage.'&page='.$page, 'succeed');
} else {
cpmsg('article_choose_at_least_one_operation', 'action=article&catid='.$catid.'&perpage='.$perpage.'&page='.$page, 'error');
}
} else {
include_once libfile('function/portalcp');
$mpurl = ADMINSCRIPT.'?action=article&operation='.$operation;
$intkeys = array('aid', 'uid');
$strkeys = array();
$randkeys = array();
$likekeys = array('title', 'username');
$results = getwheres($intkeys, $strkeys, $randkeys, $likekeys);
foreach($likekeys as $k) {
$_GET[$k] = dhtmlspecialchars($_GET[$k]);
}
$wherearr = $results['wherearr'];
$mpurl .= '&'.implode('&', $results['urls']);
if(!empty($_GET['catid'])) {
$catid = intval($_GET['catid']);
$mpurl .= '&catid='.$catid;
$catids = category_get_childids('portal', $_GET['catid']);
$catids[] = $_GET['catid'];
$wherearr[] = 'catid IN ('.dimplode($catids).')';
}
if(!empty($_GET['tag'])) {
$tag = article_make_tag($_GET['tag']);
$wherearr[] = "(tag & '$tag' = '$tag')";
foreach($_GET['tag'] as $k=>$v) {
$mpurl .= "&tag[$k]=$v";
}
}
$wheresql = empty($wherearr)?'1':implode(' AND ', $wherearr);
$orders = getorders(array('dateline'), 'aid');
$ordersql = $orders['sql'];
if($orders['urls']) $mpurl .= '&'.implode('&', $orders['urls']);
$orderby = array($_GET['orderby']=>' selected');
$ordersc = array($_GET['ordersc']=>' selected');
$perpage = empty($_GET['perpage'])?0:intval($_GET['perpage']);
if(!in_array($perpage, array(10,20,50,100))) $perpage = 10;
$categoryselect = category_showselect('portal', 'catid', true, $_GET['catid']);
$searchlang = array();
$keys = array('search', 'likesupport', 'resultsort', 'defaultsort', 'orderdesc', 'orderasc', 'perpage_10', 'perpage_20', 'perpage_50', 'perpage_100',
'article_dateline', 'article_id', 'article_title', 'article_uid', 'article_username', 'article_category', 'article_tag');
foreach ($keys as $key) {
$searchlang[$key] = cplang($key);
}
$articletagcheckbox = '';
$article_tags = article_tagnames();
foreach($article_tags as $k=>$v) {
$checked = !empty($_GET['tag']) && !empty($_GET['tag'][$k]) ? 'checked="checked"' : '';
$articletagcheckbox .= "<input type=\"checkbox\" class=\"checkbox\" id=\"tag_$k\" name=\"tag[$k]\" value=\"1\"$checked />";
$articletagcheckbox .= "<label for=\"tag_$k\">$v</label>";
}
$start = ($page-1)*$perpage;
$mpurl .= '&perpage='.$perpage;
$perpages = array($perpage => ' selected');
$adminscript = ADMINSCRIPT;
$staticurl = STATICURL;
echo <<<SEARCH
<form method="get" autocomplete="off" action="$adminscript" id="tb_search">
<table cellspacing="3" cellpadding="3" class="tb tb2">
<tr>
<th>{$searchlang['article_id']}</th><td><input type="text" class="txt" name="aid" value="{$_GET['aid']}"></td>
<th>{$searchlang['article_title']}*</th><td><input type="text" class="txt" name="title" value="{$_GET['title']}">*{$searchlang['likesupport']}</td>
</tr>
<tr>
<th>{$searchlang['article_uid']}</th><td><input type="text" class="txt" name="uid" value="{$_GET['uid']}"></td>
<th>{$searchlang['article_username']}*</th><td><input type="text" class="txt" name="username" value="{$_GET['username']}"></td>
</tr>
<tr>
<th>{$searchlang['article_category']}</th><td>$categoryselect</td>
<th>&nbsp;</th><td>&nbsp;</td>
</tr>
<tr>
<th>{$searchlang['article_tag']}</th><td colspan="3">$articletagcheckbox</td>
</tr>
<tr>
<th>{$searchlang['resultsort']}</th>
<td colspan="3">
<select name="orderby">
<option value="">{$searchlang['defaultsort']}</option>
<option value="dateline"{$orderby['dateline']}>{$searchlang['article_dateline']}</option>
</select>
<select name="ordersc">
<option value="desc"{$ordersc['desc']}>{$searchlang['orderdesc']}</option>
<option value="asc"{$ordersc['asc']}>{$searchlang['orderasc']}</option>
</select>
<select name="perpage">
<option value="10"{$perpages[10]}>{$searchlang['perpage_10']}</option>
<option value="20"{$perpages[20]}>{$searchlang['perpage_20']}</option>
<option value="50"{$perpages[50]}>{$searchlang['perpage_50']}</option>
<option value="100"{$perpages[100]}>{$searchlang['perpage_100']}</option>
</select>
<input type="hidden" name="action" value="article">
<input type="submit" name="searchsubmit" value="{$searchlang['search']}" class="btn">
</td>
</tr>
</table>
</form>
<script src="{$staticurl}js/makehtml.js?1" type="text/javascript"></script>
SEARCH;
$makehtmlflag = !empty($_G['setting']['makehtml']['flag']);
showformheader('article&operation=list');
showtableheader('article_list');
$subtitle = array('', 'article_title', 'article_category', 'article_username', 'article_dateline');
if($makehtmlflag) {
$subtitle[] = 'HTML';
}
$subtitle[] = 'operation';
showsubtitle($subtitle);
$multipage = '';
$count = C::t('portal_article_title')->fetch_all_by_sql($wheresql, '', 0, 0, 1);
if($count) {
$repairs = array();
$query = C::t('portal_article_title')->fetch_all_by_sql($wheresql, $ordersql, $start, $perpage);
foreach($query as $value) {
$htmlname = $value['htmldir'].$value['htmlname'].'.'.$_G['setting']['makehtml']['extendname'];
if($makehtmlflag && $value['htmlmade'] && !file_exists(DISCUZ_ROOT.'./'.$htmlname)) {
$value['htmlmade'] = 0;
$repairs[$value['aid']] = $value['aid'];
}
$tags = article_parse_tags($value['tag']);
$taghtml = '';
foreach($tags as $k=>$v) {
if($v) {
$taghtml .= ' [<a href="'.ADMINSCRIPT.'?action=article&operation=list&tag['.$k.']=1" style="color: #666">'.$article_tags[$k].'</a>] ';
}
}
$tablerow = array(
"<input type=\"checkbox\" class=\"checkbox\" name=\"ids[]\" value=\"{$value['aid']}\">",
"<a href=\"portal.php?mod=view&aid={$value['aid']}\" target=\"_blank\">{$value['title']}</a>".($taghtml ? $taghtml : ''),
'<a href="'.ADMINSCRIPT.'?action=article&operation=list&catid='.$value['catid'].'">'.$category[$value['catid']]['catname'].'</a>',
"<a href=\"".ADMINSCRIPT."?action=article&uid={$value['uid']}\">{$value['username']}</a>",
dgmdate($value['dateline']),
);
if($makehtmlflag) {
$tablerow[] = "<span id='mkhtml_{$value['aid']}' style='color:".($value['htmlmade'] ? "blue;'>".cplang('setting_functions_makehtml_made') : "red;'>".cplang('setting_functions_makehtml_dismake'))."</span>";
}
$tablerow[] = ($makehtmlflag ? ($category[$value['catid']]['fullfoldername'] ? "<a href='javascript:void(0);' onclick=\"make_html('portal.php?mod=view&aid={$value['aid']}', $('mkhtml_{$value['aid']}'))\">".cplang('setting_functions_makehtml_make')."</a>" : cplang('setting_functions_makehtml_make_has_no_foldername')) : '')
." <a href=\"portal.php?mod=portalcp&ac=article&aid={$value['aid']}\" target=\"_blank\">".cplang('edit')."</a>";
showtablerow('', array('class="td25"', 'width="480"', 'class="td28"'), $tablerow);
}
$multipage = multi($count, $perpage, $page, $mpurl);
if($repairs) {
C::t('portal_article_title')->repair_htmlmade($repairs);
}
}
$optypehtml = ''
.'<input type="hidden" name="hiddenpage" id="hiddenpage" value="'.$page.'"/><input type="hidden" name="hiddencatid" id="hiddencatid" value="'.$catid.'"/><input type="hidden" name="hiddenperpage" id="hiddenperpage" value="'.$perpage.'"/><input type="radio" name="optype" id="optype_trash" value="trash" class="radio" /><label for="optype_trash">'.cplang('article_optrash').'</label>&nbsp;&nbsp;'
.'<input type="radio" name="optype" id="optype_move" value="move" class="radio" /><label for="optype_move">'.cplang('article_opmove').'</label> '
.category_showselect('portal', 'tocatid', false)
.'&nbsp;&nbsp;';
showsubmit('', '', '', '<input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'ids\')" /><label for="chkall">'.cplang('select_all').'</label>&nbsp;&nbsp;'.$optypehtml.'<input type="submit" class="btn" name="articlesubmit" value="'.cplang('submit').'" />', $multipage);
showtablefooter();
showformfooter();
}
}
function showcategoryrow($key, $type = '', $last = '') {
global $category, $lang;
$forum = $forums[$key];
$showedforums[] = $key;
if($last == '') {
$return = '<tr class="hover"><td class="td25"><input type="text" class="txt" name="order['.$forum['fid'].']" value="'.$forum['displayorder'].'" /></td><td>';
if($type == 'group') {
$return .= '<div class="parentboard">';
} elseif($type == '') {
$return .= '<div class="board">';
} elseif($type == 'sub') {
$return .= '<div id="cb_'.$forum['fid'].'" class="childboard">';
}
$boardattr = '';
if(!$forum['status'] || $forum['password'] || $forum['redirect']) {
$boardattr = '<div class="boardattr">';
$boardattr .= $forum['status'] ? '' : $lang['forums_admin_hidden'];
$boardattr .= !$forum['password'] ? '' : ' '.$lang['forums_admin_password'];
$boardattr .= !$forum['redirect'] ? '' : ' '.$lang['forums_admin_url'];
$boardattr .= '</div>';
}
$return .= '<input type="text" class="txt" name="name['.$forum['fid'].']" value="'.dhtmlspecialchars($forum['name']).'" class="txt" />'.
($type == '' ? '<a href="###" onclick="addrowdirect = 1;addrow(this, 2, '.$forum['fid'].')" class="addchildboard">'.$lang['forums_admin_add_sub'].'</a>' : '').
'</div>'.$boardattr.
'</td><td>'.showforum_moderators($forum).'</td>
<td><a href="'.ADMINSCRIPT.'?action=forums&operation=edit&fid='.$forum['fid'].'" title="'.$lang['forums_edit_comment'].'" class="act">'.$lang['edit'].'</a>'.
($type != 'group' ? '<a href="'.ADMINSCRIPT.'?action=forums&operation=copy&source='.$forum['fid'].'" title="'.$lang['forums_copy_comment'].'" class="act">'.$lang['forums_copy'].'</a>' : '').
'<a href="'.ADMINSCRIPT.'?action=forums&operation=delete&fid='.$forum['fid'].'" title="'.$lang['forums_delete_comment'].'" class="act">'.$lang['delete'].'</a></td></tr>';
} else {
if($last == 'lastboard') {
$return = '<tr><td></td><td colspan="3"><div class="lastboard"><a href="###" onclick="addrow(this, 1, '.$forum['fid'].')" class="addtr">'.$lang['forums_admin_add_forum'].'</a></div></td></tr>';
} elseif($last == 'lastchildboard' && $type) {
$return = '<script type="text/JavaScript">$(\'cb_'.$type.'\').className = \'lastchildboard\';</script>';
} elseif($last == 'last') {
$return = '<tr><td></td><td colspan="3"><div><a href="###" onclick="addrow(this, 0)" class="addtr">'.$lang['forums_admin_add_category'].'</a></div></td></tr>';
}
}
return $return;
}
?>

View File

@@ -0,0 +1,193 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_attach.php 31441 2012-08-28 07:46:04Z monkey $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
$searchsubmit = $_GET['searchsubmit'];
if(!submitcheck('deletesubmit')) {
require_once libfile('function/forumlist');
$anchor = isset($_GET['anchor']) ? $_GET['anchor'] : '';
$anchor = in_array($anchor, array('search', 'admin')) ? $anchor : 'search';
shownav('topic', 'nav_attaches'.($operation ? '_'.$operation : ''));
showsubmenusteps('nav_attaches'.($operation ? '_'.$operation : ''), array(
array('search', !$searchsubmit),
array('admin', $searchsubmit),
));
showtips('attach_tips', 'attach_tips', $searchsubmit);
showtagheader('div', 'search', !$searchsubmit);
showformheader('attach'.($operation ? '&operation='.$operation : ''));
showtableheader();
showsetting('attach_nomatched', 'nomatched', 0, 'radio');
if($operation != 'group') {
showsetting('attach_forum', '', '', '<select name="inforum"><option value="all">&nbsp;&nbsp;>'.cplang('all').'</option><option value="">&nbsp;</option>'.forumselect(FALSE, 0, 0, TRUE).'</select>');
}
showsetting('attach_search_perpage', '', $_GET['perpage'], "<select name='perpage'><option value='20'>{$lang['perpage_20']}</option><option value='50'>{$lang['perpage_50']}</option><option value='100'>{$lang['perpage_100']}</option></select>");
showsetting('attach_sizerange', array('sizeless', 'sizemore'), array('', ''), 'range');
showsetting('attach_dlcountrange', array('dlcountless', 'dlcountmore'), array('', ''), 'range');
showsetting('attach_daysold', 'daysold', '', 'text');
showsetting('filename', 'filename', '', 'text');
showsetting('attach_keyword', 'keywords', '', 'text');
showsetting('attach_author', 'author', '', 'text');
showsubmit('searchsubmit', 'search');
showtablefooter();
showformfooter();
showtagfooter('div');
if(submitcheck('searchsubmit')) {
require_once libfile('function/attachment');
$operation == 'group' && $_GET['inforum'] = 'isgroup';
$inforum = $_GET['inforum'] != 'all' && $_GET['inforum'] != 'isgroup' ? intval($_GET['inforum']) : $_GET['inforum'];
$authorid = $_GET['author'] ? C::t('common_member')->fetch_uid_by_username($_GET['author']) : 0;
$authorid = $_GET['author'] && !$authorid ? C::t('common_member_archive')->fetch_uid_by_username($_GET['author']) : $authorid;
$attachments = '';
$attachuids = $attachusers = array();
$_GET['perpage'] = intval($_GET['perpage']) < 1 ? 20 : intval($_GET['perpage']);
$perpage = ($_GET['pp'] ? $_GET['pp'] : $_GET['perpage']) / 10;
$attachmentcount = 0;
for($attachi = 0;$attachi < 10;$attachi++) {
$attachmentarray = array();
$attachmentcount += C::t('forum_attachment')->fetch_all_for_manage($attachi, $inforum, $authorid, $_GET['filename'], $_GET['keywords'], $_GET['sizeless'], $_GET['sizemore'], $_GET['dlcountless'], $_GET['dlcountmore'], $_GET['daysold'], 1);
$query = C::t('forum_attachment')->fetch_all_for_manage($attachi, $inforum, $authorid, $_GET['filename'], $_GET['keywords'], $_GET['sizeless'], $_GET['sizemore'], $_GET['dlcountless'], $_GET['dlcountmore'], $_GET['daysold'], 0, (($page - 1) * $perpage), $perpage);
foreach($query as $attachment) {
$attachuids[$attachment['uid']] = $attachment['uid'];
$attachmentarray[] = $attachment;
}
$attachusers += C::t('common_member')->fetch_all($attachuids);
foreach($attachmentarray as $attachment) {
if(!$attachment['remote']) {
$matched = file_exists($_G['setting']['attachdir'].'/forum/'.$attachment['attachment']) ? '' : cplang('attach_lost');
$attachment['url'] = $_G['setting']['attachurl'].'forum/';
} else {
@set_time_limit(0);
if(@fclose(@fopen($_G['setting']['ftp']['attachurl'].'forum/'.$attachment['attachment'], 'r'))) {
$matched = '';
} else {
$matched = cplang('attach_lost');
}
$attachment['url'] = $_G['setting']['ftp']['attachurl'].'forum/';
}
$attachsize = sizecount($attachment['filesize']);
if(!$_GET['nomatched'] || ($_GET['nomatched'] && $matched)) {
$attachment['url'] = trim($attachment['url'], '/');
$attachments .= showtablerow('', array('class="td25"', 'title="'.$attachment['description'].'" class="td21"'), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"{$attachment['aid']}\" />",
$attachment['remote'] ? "<span class=\"diffcolor3\">{$attachment['filename']}" : $attachment['filename'],
$attachusers[$attachment['uid']]['username'],
"<a href=\"forum.php?mod=viewthread&tid={$attachment['tid']}\" target=\"_blank\">".cutstr($attachment['subject'], 20)."</a>",
$attachsize,
$attachment['downloads'],
$matched ? "<em class=\"error\">$matched<em>" : "<a href=\"forum.php?mod=attachment&aid=".aidencode($attachment['aid'])."&noupdate=yes\" target=\"_blank\" class=\"act nomargin\">{$lang['download']}</a>"
), TRUE);
}
}
}
$multipage = '<div class="cuspages right"><div class="pg">'.
($page > 1 ? '<a href="javascript:page('.($page-1).')" class="nxt">&lsaquo;&lsaquo;</a>' : '').
'<a href="javascript:page('.($page+1).')" class="nxt">&rsaquo;&rsaquo;</a>'.
'</div></div>';
echo <<<EOT
<script type="text/JavaScript">
function page(number) {
$('attachmentforum').page.value=number;
$('attachmentforum').searchsubmit.click();
}
</script>
EOT;
showtagheader('div', 'admin', $searchsubmit);
showformheader('attach'.($operation ? '&operation='.$operation : ''), '', 'attachmentforum');
showhiddenfields(array(
'page' => $page,
'nomatched' => $_GET['nomatched'],
'inforum' => $_GET['inforum'],
'sizeless' => $_GET['sizeless'],
'sizemore' => $_GET['sizemore'],
'dlcountless' => $_GET['dlcountless'],
'dlcountmore' => $_GET['dlcountmore'],
'daysold' => $_GET['daysold'],
'filename' => $_GET['filename'],
'keywords' => $_GET['keywords'],
'author' => $_GET['author'],
'pp' => $_GET['pp'] ? $_GET['pp'] : $_GET['perpage']
));
echo '<input type="submit" name="searchsubmit" value="'.cplang('submit').'" class="btn" style="display: none" />';
showformfooter();
showformheader('attach&frame=no'.($operation ? '&operation='.$operation : ''), 'target="attachmentframe"');
showboxheader();
showtableheader();
showsubtitle(array('', 'filename', 'author', 'attach_thread', 'size', 'attach_downloadnums', ''));
echo $attachments;
showsubmit('deletesubmit', 'submit', 'del', '<a href="###" onclick="$(\'admin\').style.display=\'none\';$(\'search\').style.display=\'\';$(\'attachmentforum\').pp.value=\'\';$(\'attachmentforum\').page.value=\'\';" class="act lightlink normal">'.cplang('research').'</a>', $multipage);
showtablefooter();
showboxfooter();
showformfooter();
echo '<iframe name="attachmentframe" style="display:none"></iframe>';
showtagfooter('div');
}
} else {
if($_GET['delete']) {
$tids = $pids = array();
for($attachi = 0;$attachi < 10;$attachi++) {
foreach(C::t('forum_attachment_n')->fetch_all_attachment($attachi, $_GET['delete']) as $attach) {
dunlink($attach);
$tids[$attach['tid']] = $attach['tid'];
$pids[$attach['pid']] = $attach['pid'];
}
C::t('forum_attachment_n')->delete_attachment($attachi, $_GET['delete']);
$attachtids = array();
foreach(C::t('forum_attachment_n')->fetch_all_by_id($attachi, 'tid', $tids) as $attach) {
unset($tids[$attach['tid']]);
}
if($tids) {
C::t('forum_thread')->update($tids, array('attachment' => 0));
}
$attachpids = array();
foreach(C::t('forum_attachment_n')->fetch_all_by_id($attachi, 'pid', $pids) as $attach) {
$attachpids[$attach['pid']] = $attach['pid'];
}
}
if($attachpids) {
$pids = array_diff($pids, $attachpids);
}
loadcache('posttableids');
$posttableids = $_G['cache']['posttableids'] ? $_G['cache']['posttableids'] : array('0');
foreach($posttableids as $id) {
C::t('forum_post')->update_post($id, $pids, array('attachment' => '0'));
}
$cpmsg = cplang('attach_edit_succeed');
} else {
$cpmsg = cplang('attach_edit_invalid');
}
echo "<script type=\"text/JavaScript\">alert('$cpmsg');parent.\$('attachmentforum').searchsubmit.click();</script>";
}
?>

View File

@@ -0,0 +1,372 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_block.php 29236 2012-03-30 05:34:47Z chenmengshu $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
$operation = in_array($operation, array('jscall', 'list', 'perm')) ? $operation : 'list';
shownav('portal', 'block');
loadcache('blockclass');
if($operation=='perm') {
$bid = intval($_GET['bid']);
if(!submitcheck('permsubmit')) {
loadcache('diytemplatename');
$block = C::t('common_block')->fetch($bid);
shownav('portal', 'block', 'block_perm');
showsubmenu(cplang('block_perm_edit').' - '.($block['name'] ? $block['name'] : cplang('block_name_null')));
showtips('block_perm_tips');
showformheader("block&operation=perm&bid=$bid");
$inheritance_checked = !$block['notinherited'] ? 'checked' : '';
showtableheader('<label><input class="checkbox" type="checkbox" name="inheritance" value="1" '.$inheritance_checked.'/>'.cplang('block_perm_inheritance').'</label>', 'fixpadding');
showsubtitle(array('', 'username',
'<input class="checkbox" type="checkbox" name="chkallmanage" onclick="checkAll(\'prefix\', this.form, \'allowmanage\', \'chkallmanage\')" id="chkallmanage" /><label for="chkallmanage">'.cplang('block_perm_manage').'</label>',
'<input class="checkbox" type="checkbox" name="chkallrecommend" onclick="checkAll(\'prefix\', this.form, \'allowrecommend\', \'chkallrecommend\')" id="chkallrecommend" /><label for="chkallrecommend">'.cplang('block_perm_recommend').'</label>',
'<input class="checkbox" type="checkbox" name="chkallneedverify" onclick="checkAll(\'prefix\', this.form, \'needverify\', \'chkallneedverify\')" id="chkallneedverify" /><label for="chkallneedverify">'.cplang('block_perm_needverify').'</label>',
'block_perm_inherited'
));
$block_per = C::t('common_block_permission')->fetch_all_by_bid($bid);
$members = C::t('common_member')->fetch_all(array_keys($block_per));
$line = '&minus;';
foreach($block_per as $uid => $value) {
if(!empty($value['inheritedtplname'])) {
showtablerow('', array('class="td25"'), array(
"",
"{$members[$uid]['username']}",
$value['allowmanage'] ? '&radic;' : $line,
$value['allowrecommend'] ? '&radic;' : $line,
$value['needverify'] ? '&radic;' : $line,
'<a href="'.ADMINSCRIPT.'?action=diytemplate&operation=perm&targettplname='.$value['inheritedtplname'].'">'.$_G['cache']['diytemplatename'][$value['inheritedtplname']].'</a>',
));
} else {
showtablerow('', array('class="td25"'), array(
"<input type=\"checkbox\" class=\"checkbox\" name=\"delete[$uid]\" value=\"$uid\" />
<input type=\"hidden\" name=\"perm[$uid][allowmanage]\" value=\"{$value['allowmanage']}\" />
<input type=\"hidden\" name=\"perm[$uid][allowrecommend]\" value=\"{$value['allowrecommend']}\" />
<input type=\"hidden\" name=\"perm[$uid][needverify]\" value=\"{$value['needverify']}\" />",
"{$members[$uid]['username']}",
"<input type=\"checkbox\" class=\"checkbox\" name=\"allowmanage[$uid]\" value=\"1\" ".($value['allowmanage'] ? 'checked' : '').' />',
"<input type=\"checkbox\" class=\"checkbox\" name=\"allowrecommend[$uid]\" value=\"1\" ".($value['allowrecommend'] ? 'checked' : '').' />',
"<input type=\"checkbox\" class=\"checkbox\" name=\"needverify[$uid]\" value=\"1\" ".($value['needverify'] ? 'checked' : '').' />',
$line,
));
}
}
showtablerow('', array('class="td25"'), array(
cplang('add_new'),
'<input type="text" class="txt" name="newuser" value="" size="20" />',
'<input type="checkbox" class="checkbox" name="newallowmanage" value="1" />',
'<input type="checkbox" class="checkbox" name="newallowrecommend" value="1" />',
'<input type="checkbox" class="checkbox" name="newneedverify" value="1" />',
'',
));
showsubmit('permsubmit', 'submit', 'del');
showtablefooter();
showformfooter();
} else {
if(!($block = C::t('common_block')->fetch($bid))) {
cpmsg('block_not_exists');
}
$users = array();
if(is_array($_GET['perm'])) {
foreach($_GET['perm'] as $uid => $value) {
$user = array();
if(empty($_GET['delete']) || !in_array($uid, $_GET['delete'])) {
$user = array();
$user['allowmanage'] = $_GET['allowmanage'][$uid] ? 1 : 0;
$user['allowrecommend'] = $_GET['allowrecommend'][$uid] ? 1 : 0;
$user['needverify'] = $_GET['needverify'][$uid] ? 1 : 0;
if($value['allowmanage'] != $user['allowmanage'] || $value['allowrecommend'] != $user['allowrecommend'] || $value['needverify'] != $user['needverify'] ) {
$user['uid'] = intval($uid);
$users[] = $user;
}
}
}
}
if(!empty($_GET['newuser'])) {
$uid = C::t('common_member')->fetch_uid_by_username($_GET['newuser']);
if($uid) {
$user['uid'] = $uid;
$user['allowmanage'] = $_GET['newallowmanage'] ? 1 : 0;
$user['allowrecommend'] = $_GET['newallowrecommend'] ? 1 : 0;
$user['needverify'] = $_GET['newneedverify'] ? 1 : 0;
$users[$user['uid']] = $user;
} else {
cpmsg_error($_GET['newuser'].cplang('block_has_no_allowauthorizedblock'));
}
}
require_once libfile('class/blockpermission');
$blockpermsission = & block_permission::instance();
if(!empty($users)) {
$blockpermsission->add_users_perm($bid, $users);
}
if(!empty($_GET['delete'])) {
$blockpermsission->delete_users_perm($bid, $_GET['delete']);
}
$notinherited = !$_POST['inheritance'] ? '1' : '0';
if($notinherited != $block['notinherited']) {
if($notinherited) {
$blockpermsission->delete_inherited_perm_by_bid($bid);
} else {
$blockpermsission->remake_inherited_perm($bid);
}
C::t('common_block')->update($bid, array('notinherited' => $notinherited));
}
cpmsg('block_perm_update_succeed', "action=block&operation=perm&bid=$bid", 'succeed');
}
} else {
if(submitcheck('deletesubmit')) {
if($_POST['ids']) {
C::t('common_block_item')->delete_by_bid($_POST['ids']);
C::t('common_block')->delete($_POST['ids']);
C::t('common_block_permission')->delete_by_bid_uid_inheritedtplname($_POST['ids']);
cpmsg('block_delete_succeed', 'action=block&operation=jscall', 'succeed');
} else {
cpmsg('block_choose_at_least_one_block', 'action=block&operation=jscall', 'error');
}
} elseif(submitcheck('clearsubmit')) {
include_once libfile('function/block');
block_clear();
cpmsg('block_clear_unused_succeed', 'action=block', 'succeed');
} else {
loadcache(array('diytemplatename'));
$searchctrl = '<span style="float: right; padding-right: 40px;">'
.'<a href="javascript:;" onclick="$(\'tb_search\').style.display=\'\';$(\'a_search_show\').style.display=\'none\';$(\'a_search_hide\').style.display=\'\';" id="a_search_show" style="display:none">'.cplang('show_search').'</a>'
.'<a href="javascript:;" onclick="$(\'tb_search\').style.display=\'none\';$(\'a_search_show\').style.display=\'\';$(\'a_search_hide\').style.display=\'none\';" id="a_search_hide">'.cplang('hide_search').'</a>'
.'</span>';
showsubmenu('block', array(
array('block_list', 'block', $operation=='list'),
array('block_jscall', 'block&operation=jscall', $operation=='jscall')
), $searchctrl);
$mpurl = ADMINSCRIPT.'?action=block&operation='.$operation;
$intkeys = array('bid');
$strkeys = array('blockclass');
$strkeys[] = 'targettplname';
$randkeys = array();
$likekeys = array('name');
$results = getwheres($intkeys, $strkeys, $randkeys, $likekeys);
foreach($likekeys as $k) {
$_GET[$k] = dhtmlspecialchars($_GET[$k]);
}
$wherearr = $results['wherearr'];
$mpurl .= '&'.implode('&', $results['urls']);
$wherearr[] = $operation=='jscall' ? "blocktype='1'" : "blocktype='0'";
if($_GET['permname']) {
$bids = '';
$uid = ($uid = C::t('common_member')->fetch_uid_by_username($_GET['permname'])) ? $uid : C::t('common_member_archive')->fetch_uid_by_username($_GET['permname']);
if($uid) {
$bids = array_keys(C::t('common_block_permission')->fetch_all_by_uid($uid));
}
if(($bids = dimplode($bids))) {
$wherearr[] = 'bid IN ('.$bids.')';
} else {
cpmsg_error($_GET['permname'].cplang('block_the_username_has_not_block'));
}
$mpurl .= '&permname='.$_GET['permname'];
}
$wheresql = empty($wherearr)?'1':implode(' AND ', $wherearr);
$wheresql = str_replace(array('bid', 'blockclass', ' name', 'blocktype', 'targettplname'), array('b.bid', 'b.blockclass', ' b.name', 'b.blocktype', 'tb.targettplname'), $wheresql);
$orders = getorders(array('bid', 'dateline'), 'bid');
$ordersql = $orders['sql'];
if($orders['urls']) $mpurl .= '&'.implode('&', $orders['urls']);
$orderby = array($_GET['orderby']=>' selected');
$ordersc = array($_GET['ordersc']=>' selected');
$perpage = empty($_GET['perpage'])?0:intval($_GET['perpage']);
if(!in_array($perpage, array(10,20,50,100))) $perpage = 20;
$perpages = array($perpage=>' selected');
$mpurl .= '&perpage='.$perpage;
$searchlang = array();
$keys = array('search', 'likesupport', 'lengthabove1', 'resultsort', 'defaultsort', 'orderdesc', 'orderasc', 'perpage_10', 'perpage_20', 'perpage_50', 'perpage_100',
'block_dateline', 'block_id', 'block_name', 'block_blockclass', 'block_add_jscall', 'block_choose_blockclass_to_add_jscall', 'block_diytemplate', 'block_permname', 'block_permname_tips');
foreach ($keys as $key) {
$searchlang[$key] = cplang($key);
}
$diytemplatename_sel = '<select name="targettplname" id="targettplname">';
$diytemplatename_sel .= '<option value="">'.cplang('diytemplate_name').'</option>';
foreach($_G['cache']['diytemplatename'] as $key=>$value) {
$selected = ($key == $_GET['targettplname'] ? ' selected' : '');
$diytemplatename_sel .= "<option value=\"$key\"$selected>$value</option>";
}
$diytemplatename_sel .= '</select>';
$blockclass_sel = '<select name="blockclass" id="blockclass">';
$blockclass_sel .= '<option value="">'.cplang('blockstyle_blockclass_sel').'</option>';
foreach($_G['cache']['blockclass'] as $key=>$value) {
foreach($value['subs'] as $subkey=>$subvalue) {
$selected = ($subkey == $_GET['blockclass'] ? ' selected' : '');
$blockclass_sel .= "<option value=\"$subkey\"$selected>{$subvalue['name']}</option>";
}
}
$blockclass_sel .= '</select>';
$addjscall = $operation == 'jscall' ? '<input type="button" class="btn" onclick="addjscall()" value="'.$searchlang['block_add_jscall'].'" />' : '';
$firstrow = "<th>{$searchlang['block_diytemplate']}</th><td>$diytemplatename_sel</td><th>{$searchlang['block_blockclass']}</th><td colspan=\"2\">$blockclass_sel $addjscall</td>";
$adminscript = ADMINSCRIPT;
echo <<<SEARCH
<script>disallowfloat = '{$_G['setting']['disallowfloat']}';</script>
<script type="text/javascript" src="{$_G['setting']['jspath']}portal.js?{$_G['style']['verhash']}"></script>
<div id="ajaxwaitid"></div>
<form method="get" autocomplete="off" action="$adminscript" id="tb_search">
<table cellspacing="3" cellpadding="3" class="tb tb2">
<tr>
$firstrow
</tr>
<tr>
<th>{$searchlang['block_id']}</th><td><input type="text" class="txt" name="bid" value="{$_GET['bid']}"></td>
<th>{$searchlang['block_name']}*</th><td><input type="text" class="txt" name="name" value="{$_GET['name']}">{$searchlang['lengthabove1']}&nbsp;&nbsp; *{$searchlang['likesupport']}</td>
</tr>
<tr>
<th>{$searchlang['resultsort']}</th>
<td>
<select name="orderby">
<option value="">{$searchlang['defaultsort']}</option>
<option value="dateline"{$orderby['dateline']}>{$searchlang['block_dateline']}</option>
</select>
<select name="ordersc">
<option value="desc"{$ordersc['desc']}>{$searchlang['orderdesc']}</option>
<option value="asc"{$ordersc['asc']}>{$searchlang['orderasc']}</option>
</select>
<select name="perpage">
<option value="10"{$perpages[10]}>{$searchlang['perpage_10']}</option>
<option value="20"{$perpages[20]}>{$searchlang['perpage_20']}</option>
<option value="50"{$perpages[50]}>{$searchlang['perpage_50']}</option>
<option value="100"{$perpages[100]}>{$searchlang['perpage_100']}</option>
</select>
<input type="hidden" name="action" value="block">
<input type="hidden" name="operation" value="$operation">
</td>
<th>{$searchlang['block_permname']}</th><td><input type="text" class="txt" name="permname" value="{$_GET['permname']}">{$searchlang['block_permname_tips']}
<input type="submit" name="searchsubmit" value="{$searchlang['search']}" class="btn"></td>
</tr>
</table>
</form>
<script type="text/javascript">
function addjscall() {
var blockclass = $('blockclass').value;
if(blockclass) {
showWindow('blockclass', 'portal.php?mod=portalcp&ac=block&op=block&blocktype=1&from=cp&classname=' + blockclass);
} else {
alert('{$searchlang['block_choose_blockclass_to_add_jscall']}');
}
}
</script>
SEARCH;
$start = ($page-1)*$perpage;
showformheader('block&operation='.$operation);
showtableheader();
$list = $diypage = array();
include_once libfile('function/block');
if($operation=='jscall') {
showsubtitle(array('', 'block_name', 'block_script', 'block_style', 'block_dateline', 'block_page', 'operation'));
$multipage = '';
if(($count = C::t('common_block')->count_by_admincpwhere($wheresql))) {
foreach(C::t('common_block')->fetch_all_by_admincpwhere($wheresql, $ordersql, $start, $perpage) as $value) {
if($value['targettplname']) {
$diyurl = block_getdiyurl($value['targettplname']);
$diyurl = $diyurl['url'];
$tplname = isset($_G['cache']['diytemplatename'][$value['targettplname']]) ? $_G['cache']['diytemplatename'][$value['targettplname']] : $value['targettplname'];
$diypage[$value['bid']][$value['targettplname']] = $diyurl ? '<a href="'.$diyurl.'" target="_blank">'.$tplname.'</a>' : $tplname;
}
$list[$value['bid']] = $value;
}
if($list) {
foreach($list as $bid => $value) {
$inpage = empty($diypage[$bid]) ? cplang('block_page_nopage') : implode('<br/>' ,$diypage[$bid]);
$theclass = block_getclass($value['blockclass'], true);
showtablerow('', array('class="td25"'), array(
"<input type=\"checkbox\" class=\"checkbox\" name=\"ids[]\" value=\"{$value['bid']}\">",
!empty($value['name']) ? $value['name'] : cplang('block_name_null'),
$theclass['script'][$value['script']],
$value['styleid'] ? $theclass['style'][$value['styleid']]['name'] : lang('portalcp', 'blockstyle_diy'),
!empty($value['dateline']) ? dgmdate($value['dateline']) : cplang('block_dateline_null'),
$inpage,
"<a href=\"portal.php?mod=portalcp&ac=block&op=block&bid={$value['bid']}&blocktype=1&from=cp\" target=\"_blank\" onclick=\"showWindow('showblock',this.href);return false;\">".cplang('block_setting')."</a> &nbsp;&nbsp".
"<a href=\"portal.php?mod=portalcp&ac=block&op=getblock&forceupdate=1&inajax=1&bid={$value['bid']}&from=cp\" onclick=\"ajaxget(this.href,'','','','',function(){location.reload();});return false;\">".cplang('block_update')."</a> &nbsp;&nbsp".
"<a href=\"portal.php?mod=portalcp&ac=block&op=data&bid={$value['bid']}&blocktype=1&from=cp\" target=\"_blank\" onclick=\"showWindow('showblock',this.href);return false;\">".cplang('block_data')."</a> &nbsp;&nbsp".
"<a href=\"javascript:;\" onclick=\"prompt('".cplang('block_copycode_message')."', '<!--{block/{$value['bid']}}-->')\">".cplang('block_copycode_inner')."</a> &nbsp;&nbsp".
"<a href=\"javascript:;\" onclick=\"prompt('".cplang('block_copycode_jsmessage')."', '&lt;script type=&quot;text/javascript&quot; src=&quot;{$_G['siteurl']}api.php?mod=js&bid={$value['bid']}&quot;&gt;&lt;/script&gt;')\">".cplang('block_copycode_outer')."</a>&nbsp;&nbsp;<a href=\"".ADMINSCRIPT."?action=block&operation=perm&bid={$value['bid']}\">".cplang('portalcategory_perm').'</a>'
));
}
}
$multipage = multi($count, $perpage, $page, $mpurl);
}
showsubmit('', '', '', '<input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'ids\')" /><label for="chkall">'.cplang('select_all').'</label>&nbsp;&nbsp;<input type="submit" class="btn" name="deletesubmit" value="'.cplang('block_delete').'" />', $multipage);
showtablefooter();
showformfooter();
} else {
showsubtitle(array('block_name', 'block_script', 'block_style', 'block_dateline', 'block_page', 'operation'));
$multipage = '';
if(($count = C::t('common_block')->count_by_admincpwhere($wheresql))) {
foreach(C::t('common_block')->fetch_all_by_admincpwhere($wheresql, $ordersql, $start, $perpage) as $value) {
if($value['targettplname']) {
$diyurl = block_getdiyurl($value['targettplname']);
$diyurl = $diyurl['url'];
$tplname = isset($_G['cache']['diytemplatename'][$value['targettplname']]) ? $_G['cache']['diytemplatename'][$value['targettplname']] : $value['targettplname'];
$diypage[$value['bid']][$value['targettplname']] = $diyurl ? '<a href="'.$diyurl.'" target="_blank">'.$tplname.'</a>' : $tplname;
}
$list[$value['bid']] = $value;
}
if($list) {
foreach($list as $bid => $value) {
$inpage = empty($diypage[$bid]) ? cplang('block_page_unused') : implode('<br/>' ,$diypage[$bid]);
$theclass = block_getclass($value['blockclass'], true);
showtablerow('', '', array(
$value['name'] ? $value['name'] : cplang('block_name_null'),
$theclass['script'][$value['script']],
$value['styleid'] ? $theclass['style'][$value['styleid']]['name'] : lang('portalcp', 'blockstyle_diy'),
!empty($value['dateline']) ? dgmdate($value['dateline']) : cplang('block_dateline_null'),
$inpage,
"<a href=\"portal.php?mod=portalcp&ac=block&op=block&bid={$value['bid']}&from=cp\" target=\"_blank\" onclick=\"showWindow('showblock',this.href);return false;\">".cplang('block_setting')."</a> &nbsp;&nbsp"
."<a href=\"portal.php?mod=portalcp&ac=block&op=data&bid={$value['bid']}&from=cp\" target=\"_blank\" onclick=\"showWindow('showblock',this.href);return false;\">".cplang('block_data')."</a> &nbsp;&nbsp"
.$diyop."&nbsp;&nbsp;<a href=\""
.ADMINSCRIPT."?action=block&operation=perm&bid={$value['bid']}\">".cplang('portalcategory_perm').'</a>'
));
}
}
$multipage = multi($count, $perpage, $page, $mpurl);
}
showsubmit('', '', '', '<input type="submit" class="btn" name="clearsubmit" value="'.cplang('block_clear_unused').'" />', $multipage);
showtablefooter();
showformfooter();
}
}
}
?>

View File

@@ -0,0 +1,334 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_blockstyle.php 32661 2013-02-28 06:29:46Z monkey $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
$operation = in_array($operation, array('add', 'edit', 'delete')) ? $operation : 'list';
loadcache('blockclass');
shownav('portal', 'blockstyle');
if($operation=='add' || $operation=='edit') {
if($operation=='edit') {
showsubmenu('blockstyle', array(
array('list', 'blockstyle', 0),
array('edit', 'blockstyle&operation=edit&blockclass='.$_GET['blockclass'].'&styleid='.$_GET['styleid'], 1)
));
} else {
showsubmenu('blockstyle', array(
array('list', 'blockstyle', 0),
array('add', 'blockstyle&operation=add', 1)
));
}
include_once libfile('function/block');
if(empty($_GET['blockclass'])) {
$blockclass_sel = '<select name="blockclass">';
$blockclass_sel .= '<option value="">'.cplang('blockstyle_blockclass_sel').'</option>';
foreach($_G['cache']['blockclass'] as $key=>$value) {
foreach($value['subs'] as $subkey=>$subvalue) {
$blockclass_sel .= "<option value=\"$subkey\">{$subvalue['name']}</option>";
}
}
$blockclass_sel .= '</select>';
$adminscript = ADMINSCRIPT;
$lang_blockclasssel = cplang('blockstyle_blockclass_sel');
$lang_submit = cplang('submit');
echo <<<BLOCKCLASSSEL
<form method="get" autocomplete="off" action="$adminscript">
<div style="margin-top:8px;">
<table class="tb tb2 nobottom nobdb" cellspacing="3" cellpadding="3">
<tr>
<th class="td27">$lang_blockclasssel</th>
</tr>
<tr>
<td class="vtop rowform">$blockclass_sel</td>
</tr>
<tr>
<td class="vtop rowform">
<input type="hidden" name="action" value="blockstyle" />
<input type="hidden" name="operation" value="add" />
<div class="fixsel"><input type="submit" value="$lang_submit" class="btn" /></div>
</td>
</tr>
</table>
</div>
</form>
BLOCKCLASSSEL;
} else {
showtips('blockstyle_add_tips');
if(submitcheck('stylesubmit')) {
$arr = array(
'name' => $_POST['name'],
'blockclass' => $_GET['blockclass'],
);
$_POST['template'] = $_POST['template'];
include_once libfile('function/block');
block_parse_template($_POST['template'], $arr);
if($_GET['styleid']) {
$styleid = intval($_GET['styleid']);
C::t('common_block_style')->update($styleid, $arr);
require_once libfile('function/block');
blockclass_cache();
cpmsg('blockstyle_edit_succeed', 'action=blockstyle&operation=edit&blockclass='.$_GET['blockclass'].'&styleid='.$styleid.'&preview='.($_POST['preview']?'1':'0'), 'succeed');
} else {
$styleid = C::t('common_block_style')->insert($arr, true);
$msg = 'blockstyle_create_succeed';
require_once libfile('function/block');
blockclass_cache();
cpmsg('blockstyle_create_succeed', 'action=blockstyle&operation=edit&blockclass='.$_GET['blockclass'].'&styleid='.$styleid.'&preview='.($_POST['preview']?'1':'0'), 'succeed');
}
}
if($_GET['styleid']) {
$_GET['styleid'] = intval($_GET['styleid']);
include_once libfile('function/block');
$thestyle = block_getstyle($_GET['styleid']);
if(!$thestyle) {
cpmsg('blockstyle_not_found!');
}
$thestyle['template'] = block_build_template($thestyle['template']);
$_GET['blockclass'] = $thestyle['blockclass'];
} else {
$_GET['styleid'] = 0;
$thestyle = array(
'template' => "<div class=\"module cl\">\n<ul>\n[loop]\n\t<li><a href=\"{url}\"{target}>{title}</a></li>\n[/loop]\n</ul>\n</div>"
);
}
$theclass = block_getclass($_GET['blockclass']);
if($preview) {
echo '<h4 style="margin-bottom:15px;">'.lang('preview').'</h4>'.$preview;
}
showformheader('blockstyle&operation='.$operation.'&blockclass='.$_GET['blockclass'].'&styleid='.$_GET['styleid']);
showtableheader('', 'nobottom');
if($_GET['styleid']) {
showtitle('blockstyle_add_editstyle');
} else {
showtitle('blockstyle_add_addstyle');
}
showsetting('blockstyle_name', 'name', $thestyle['name'], 'text');
showtablefooter();
$template = '';
foreach($theclass['fields'] as $key=>$value) {
if($value['name']) {
$template .= $value['name']. ': <a href="###" onclick="insertunit($(\'jstemplate\'), \'{'.$key.'}\')">{'.$key.'}</a>';
}
}
$template .= '<br />';
$template .= cplang('blockstyle_add_loop').': <a href="###" onclick="insertunit($(\'jstemplate\'), \'[loop]\n\n[/loop]\')">[loop]...[/loop]</a>';
$template .= cplang('blockstyle_add_order').': <a href="###" onclick="insertunit($(\'jstemplate\'), \'[order=N]\n\n[/order]\')">[order=N]...[/order]</a>';
$template .= cplang('blockstyle_add_index').': <a href="###" onclick="insertunit($(\'jstemplate\'), \'[index=N]\n\n[/index]\')">[index=N]...[/index]</a>';
$template .= cplang('blockstyle_add_urltitle').': <a href="###" onclick=\'insertunit($("jstemplate"), "<a href=\"{url}\"{target}>{title}</a>")\'>&lt;a href=...</a>';
$template .= cplang('blockstyle_add_picthumb').': <a href="###" onclick=\'insertunit($("jstemplate"), "<img src=\"{pic}\" width=\"{picwidth}\" height=\"{picheight}\" />")\'>&lt;img src=...&gt;</a>';
if(in_array($_GET['blockclass'], array('forum_thread', 'portal_article', 'group_thread'), true)) {
$template .= cplang('blockstyle_add_moreurl').': <a href="###" onclick="insertunit($(\'jstemplate\'), \'{moreurl}\')">{moreurl}</a>';
}
$template .= cplang('blockstyle_add_currentorder').': <a href="###" onclick="insertunit($(\'jstemplate\'), \'{currentorder}\')">{currentorder}</a>';
$template .= cplang('blockstyle_add_parity').': <a href="###" onclick="insertunit($(\'jstemplate\'), \'{parity}\')">{parity}</a>';
$template .= '</div><br />';
$template .= '<textarea cols="100" rows="5" id="jstemplate" name="template" style="width: 95%;" onkeyup="textareasize(this)" onkeydown="textareakey(this, event)">'.$thestyle['template'].'</textarea>';
$template .= '<input type="hidden" name="preview" value="0" /><input type="hidden" name="stylesubmit" value="1" />';
$template .= '<br /><!--input type="button" class="btn" onclick="this.form.preview=\'1\';this.form.submit()" value="'.$lang['preview'].'">&nbsp; &nbsp;--><input type="submit" class="btn" style="margin-left: 0px;" value="'.$lang['submit'].'"></div>';
echo '<div class="colorbox" style="padding-bottom: 10px;">';
echo '<div class="extcredits">';
echo $template;
echo '</div>';
showformfooter();
}
} elseif($operation=='delete') {
$_GET['styleid'] = intval($_GET['styleid']);
$thestyle = C::t('common_block_style')->fetch($_GET['styleid']);
if(empty($thestyle)) {
cpmsg('blockstyle_not_found', 'action=blockstyle', 'error');
}
$styles = array();
if(($styles = C::t('common_block_style')->fetch_all_by_blockclass($thestyle['blockclass']))) {
unset($styles[$_GET['styleid']]);
}
if(empty($styles)) {
cpmsg('blockstyle_should_be_kept', 'action=blockstyle', 'error');
}
if(submitcheck('deletesubmit')) {
$_POST['moveto'] = intval($_POST['moveto']);
$newstyle = C::t('common_block_style')->fetch($_POST['moveto']);
if($newstyle['blockclass'] != $thestyle['blockclass']) {
cpmsg('blockstyle_blockclass_not_match', 'action=blockstyle', 'error');
}
C::t('common_block')->update_by_styleid($styleid, array('styleid' => $_POST['moveto']));
C::t('common_block_style')->delete($_GET['styleid']);
require_once libfile('function/block');
blockclass_cache();
cpmsg('blockstyle_delete_succeed', 'action=blockstyle', 'succeed');
}
if(C::t('common_block')->fetch_by_styleid($_GET['styleid'])) {
showtips('blockstyle_delete_tips');
showformheader('blockstyle&operation=delete&styleid='.$_GET['styleid']);
showtableheader();
$movetoselect = '<select name="moveto">';
foreach($styles as $key=>$value) {
$movetoselect .= "<option value=\"$key\">{$value['name']}</option>";
}
$movetoselect .= '</select>';
showsetting('blockstyle_moveto', '', '', $movetoselect);
showsubmit('deletesubmit');
showtablefooter();
showformfooter();
} else {
C::t('common_block_style')->delete($_GET['styleid']);
require_once libfile('function/block');
blockclass_cache();
cpmsg('blockstyle_delete_succeed', 'action=blockstyle', 'succeed');
}
} else {
$_GET = $_GET + $_POST;
$searchctrl = '<span style="float: right; padding-right: 40px;">'
.'<a href="javascript:;" onclick="$(\'tb_search\').style.display=\'\';$(\'a_search_show\').style.display=\'none\';$(\'a_search_hide\').style.display=\'\';" id="a_search_show" style="display:none">'.cplang('show_search').'</a>'
.'<a href="javascript:;" onclick="$(\'tb_search\').style.display=\'none\';$(\'a_search_show\').style.display=\'\';$(\'a_search_hide\').style.display=\'none\';" id="a_search_hide">'.cplang('hide_search').'</a>'
.'</span>';
showsubmenu('blockstyle', array(
array('list', 'blockstyle', 1),
array('add', 'blockstyle&operation=add', 0)
), $searchctrl);
$mpurl = ADMINSCRIPT.'?action=blockstyle';
$intkeys = array('styleid');
$strkeys = array('blockclass');
$randkeys = array();
$likekeys = array('name', 'template');
$results = getwheres($intkeys, $strkeys, $randkeys, $likekeys);
foreach($likekeys as $k) {
$_GET[$k] = dhtmlspecialchars($_GET[$k]);
}
$wherearr = $results['wherearr'];
$mpurl .= '&'.implode('&', $results['urls']);
$wheresql = empty($wherearr)?'1':implode(' AND ', $wherearr);
$orders = getorders(array('blockclass'), 'styleid');
$ordersql = $orders['sql'];
if($orders['urls']) $mpurl .= '&'.implode('&', $orders['urls']);
$orderby = array($_GET['orderby']=>' selected');
$ordersc = array($_GET['ordersc']=>' selected');
$perpage = empty($_GET['perpage'])?0:intval($_GET['perpage']);
if(!in_array($perpage, array(10,20,50,100))) $perpage = 20;
$perpages = array($perpage=>' selected');
$mpurl .= '&perpage='.$perpage;
$searchlang = array();
$keys = array('search', 'likesupport', 'resultsort', 'defaultsort', 'orderdesc', 'orderasc', 'perpage_10', 'perpage_20', 'perpage_50', 'perpage_100',
'blockstyle_id', 'blockstyle_name', 'blockstyle_blockclass', 'blockstyle_template');
foreach ($keys as $key) {
$searchlang[$key] = cplang($key);
}
$blockclass_sel = '<select name="blockclass">';
$blockclass_sel .= '<option value="">'.cplang('blockstyle_blockclass_sel').'</option>';
foreach($_G['cache']['blockclass'] as $key=>$value) {
foreach($value['subs'] as $subkey=>$subvalue) {
$selected = (!empty($_GET['blockclass']) && $subkey == $_GET['blockclass'] ? ' selected' : '');
$blockclass_sel .= "<option value=\"$subkey\"$selected>{$subvalue['name']}</option>";
}
}
$blockclass_sel .= '</select>';
$adminscript = ADMINSCRIPT;
echo <<<SEARCH
<form method="post" autocomplete="off" action="$adminscript" id="tb_search">
<div class="dbox"><div class="boxbody">
<table cellspacing="3" cellpadding="3" class="tb tb2">
<tr>
<th>{$searchlang['blockstyle_id']}</th><td><input type="text" class="txt" name="styleid" value="{$_GET['styleid']}"></td>
<th>{$searchlang['blockstyle_name']}*</th><td><input type="text" class="txt" name="name" value="{$_GET['name']}">*{$searchlang['likesupport']}</td>
</tr>
<tr>
<th>{$searchlang['blockstyle_blockclass']}</th><td>$blockclass_sel</td>
<th>{$searchlang['blockstyle_template']}*</th><td><input type="text" name="template" value="{$_GET['template']}">*{$searchlang['likesupport']}</td>
</tr>
<tr>
<th>{$searchlang['resultsort']}</th>
<td colspan="3">
<select name="orderby">
<option value="styleid">{$searchlang['defaultsort']}</option>
<option value="blockclass"{$orderby['blockclass']}>{$searchlang['blockstyle_blockclass']}</option>
</select>
<select name="ordersc">
<option value="desc"{$ordersc['desc']}>{$searchlang['orderdesc']}</option>
<option value="asc"{$ordersc['asc']}>{$searchlang['orderasc']}</option>
</select>
<select name="perpage">
<option value="10"{$perpages[10]}>{$searchlang['perpage_10']}</option>
<option value="20"{$perpages[20]}>{$searchlang['perpage_20']}</option>
<option value="50"{$perpages[50]}>{$searchlang['perpage_50']}</option>
<option value="100"{$perpages[100]}>{$searchlang['perpage_100']}</option>
</select>
<input type="hidden" name="action" value="blockstyle">
<input type="submit" name="searchsubmit" value="{$searchlang['search']}" class="btn">
</td>
</tr>
</table>
</div></div>
</form>
SEARCH;
$start = ($page-1)*$perpage;
showformheader('blockstyle');
showboxheader('blockstyle_list');
showtableheader();
showsubtitle(array('blockstyle_name', 'blockstyle_blockclass', 'operation'));
$multipage = '';
if(($count = C::t('common_block_style')->count_by_where($wheresql))) {
include_once libfile('function/block');
foreach(C::t('common_block_style')->fetch_all_by_where($wheresql, $ordersql, $start, $perpage) as $value) {
$theclass = block_getclass($value['blockclass']);
list($c1, $c2) = explode('_', $value['blockclass']);
showtablerow('', array('class=""', 'class=""', 'class="td28"'), array(
$value['name'],
$theclass['name'],
"<a href=\"".ADMINSCRIPT."?action=blockstyle&operation=edit&blockclass={$value['blockclass']}&styleid={$value['styleid']}\">".cplang('blockstyle_edit')."</a>&nbsp;&nbsp;".
"<a href=\"".ADMINSCRIPT."?action=blockstyle&operation=delete&styleid={$value['styleid']}\">".cplang('blockstyle_delete')."</a>"
));
}
$multipage = multi($count, $perpage, $page, $mpurl);
}
showsubmit('', '', '', '', $multipage);
showtablefooter();
showboxfooter();
showformfooter();
}
?>

View File

@@ -0,0 +1,127 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_blockxml.php 25246 2011-11-02 03:34:53Z zhangguosheng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
$operation = in_array($operation, array('add', 'edit', 'update', 'delete')) ? $operation : 'list';
$signtypearr = array(array('',cplang('blockxml_signtype_no')), array('MD5',cplang('blockxml_signtype_md5')));
shownav('portal', 'blockxml');
if($operation == 'add') {
if(submitcheck('addsubmit')) {
require_once libfile('function/importdata');
import_block($_GET['xmlurl'], $_GET['clientid'], $_GET['key'], $_GET['signtype'], $_GET['ignoreversion']);
require_once libfile('function/block');
blockclass_cache();
cpmsg('blockxml_xmlurl_add_succeed', 'action=blockxml', 'succeed');
} else {
showsubmenu('blockxml', array(
array('list', 'blockxml', 0),
array('add', 'blockxml&operation=add', 1)
));
showtips('blockxml_tips');
showformheader('blockxml&operation=add');
showtableheader('blockxml_add');
showsetting('blockxml_xmlurl', 'xmlurl', '', 'text');
showsetting('blockxml_clientid', 'clientid', $blockxml['clientid'], 'text');
showsetting('blockxml_signtype', array('signtype', $signtypearr), $blockxml['signtype'], 'select');
showsetting('blockxml_xmlkey', 'key', $blockxml['key'], 'text');
echo '<tr><td colspan="2" class="rowform"><input class="checkbox" type="checkbox" name="ignoreversion" id="ignoreversion" value="1" /><label for="ignoreversion"> '.cplang('blockxml_import_ignore_version').'</label></td></tr>';
showsubmit('addsubmit');
showtablefooter();
showformfooter();
}
} elseif($operation == 'edit' && !empty($_GET['id'])) {
$id = intval($_GET['id']);
if(!($blockxml = C::t('common_block_xml')->fetch($id))) {
cpmsg('blockxml_xmlurl_notfound', '', 'error');
}
if(submitcheck('editsubmit')) {
require_once libfile('function/importdata');
import_block($_GET['xmlurl'], $_GET['clientid'], $_GET['key'], $_GET['signtype'], 1, $id);
require_once libfile('function/block');
blockclass_cache();
cpmsg('blockxml_xmlurl_update_succeed', 'action=blockxml', 'succeed');
} else {
showsubmenu('blockxml', array(
array('list', 'blockxml', 0),
array('add', 'blockxml&operation=add', 1)
));
showformheader('blockxml&operation=edit&id='.$id);
showtableheader(cplang('blockxml_edit').' - '.$blockxml['name']);
showsetting('blockxml_xmlurl', 'xmlurl', $blockxml['url'], 'text');
showsetting('blockxml_clientid', 'clientid', $blockxml['clientid'], 'text');
showsetting('blockxml_signtype', array('signtype', $signtypearr), $blockxml['signtype'], 'select');
showsetting('blockxml_xmlkey', 'key', $blockxml['key'], 'text');
showtablerow('', '', '<input class="checkbox" type="checkbox" name="ignoreversion" id="ignoreversion" value="1" /><label for="ignoreversion"> '.cplang('blockxml_import_ignore_version').'</label>');
showsubmit('editsubmit');
showtablefooter();
showformfooter();
}
} elseif($operation == 'update' && !empty($_GET['id'])) {
$id = intval($_GET['id']);
if(!($blockxml = C::t('common_block_xml')->fetch($id))) {
cpmsg('blockxml_xmlurl_notfound', '', 'error');
}
require_once libfile('function/importdata');
import_block($blockxml['url'], $blockxml['clientid'], $blockxml['key'], $blockxml['signtype'], 1, $id);
require_once libfile('function/block');
blockclass_cache();
cpmsg('blockxml_xmlurl_update_succeed', 'action=blockxml', 'succeed');
} elseif($operation == 'delete' && !empty($_GET['id'])) {
$id = intval($_GET['id']);
if(!empty($_GET['confirm'])) {
C::t('common_block_xml')->delete($id);
require_once libfile('function/block');
blockclass_cache();
cpmsg('blockxml_xmlurl_delete_succeed', 'action=blockxml', 'succeed');
} else {
cpmsg('blockxml_xmlurl_delete_confirm', 'action=blockxml&operation=delete&id='.$id.'&confirm=yes', 'form');
}
} else {
showsubmenu('blockxml', array(
array('list', 'blockxml', 1),
array('add', 'blockxml&operation=add', 0)
));
showtableheader('blockxml_list');
showsubtitle(array('blockxml_name', 'blockxml_xmlurl', 'operation'));
foreach(C::t('common_block_xml')->range() as $row) {
showtablerow('', array('class=""', 'class=""', 'class="td28"'), array(
$row['name'],
$row['url'],
"<a href=\"".ADMINSCRIPT."?action=blockxml&operation=update&id={$row['id']}\">".cplang('blockxml_update')."</a>&nbsp;&nbsp;".
"<a href=\"".ADMINSCRIPT."?action=blockxml&operation=edit&id={$row['id']}\">".cplang('edit')."</a>&nbsp;&nbsp;".
"<a href=\"".ADMINSCRIPT."?action=blockxml&operation=delete&id={$row['id']}\">".cplang('delete')."</a>&nbsp;&nbsp;"
));
}
showtablefooter();
showformfooter();
}
?>

View File

@@ -0,0 +1,317 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_blog.php 32130 2012-11-14 09:20:40Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
include_once libfile('function/portalcp');
cpheader();
$detail = $_GET['detail'];
$uid = $_GET['uid'];
$blogid = $_GET['blogid'];
$users = $_GET['users'];
$keywords = $_GET['keywords'];
$lengthlimit = $_GET['lengthlimit'];
$viewnum1 = $_GET['viewnum1'];
$viewnum2 = $_GET['viewnum2'];
$replynum1 = $_GET['replynum1'];
$replynum2 = $_GET['replynum2'];
$hot1 = $_GET['hot1'];
$hot2 = $_GET['hot2'];
$starttime = $_GET['starttime'];
$endtime = $_GET['endtime'];
$searchsubmit = $_GET['searchsubmit'];
$blogids = $_GET['blogids'];
$friend = $_GET['friend'];
$ip = $_GET['ip'];
$orderby = $_GET['orderby'];
$ordersc = $_GET['ordersc'];
$fromumanage = $_GET['fromumanage'] ? 1 : 0;
$muticondition = '';
$muticondition .= $uid ? '&uid='.$uid : '';
$muticondition .= $blogid ? '&blogid='.$blogid : '';
$muticondition .= $users ? '&users='.$users : '';
$muticondition .= $keywords ? '&keywords='.$keywords : '';
$muticondition .= $lengthlimit ? '&lengthlimit='.$lengthlimit : '';
$muticondition .= $viewnum1 ? '&viewnum1='.$viewnum1 : '';
$muticondition .= $viewnum2 ? '&viewnum2='.$viewnum2 : '';
$muticondition .= $replynum1 ? '&replynum1='.$replynum1 : '';
$muticondition .= $replynum2 ? '&replynum2='.$replynum2 : '';
$muticondition .= $hot1 ? '&hot1='.$hot1 : '';
$muticondition .= $hot2 ? '&hot2='.$hot2 : '';
$muticondition .= $starttime ? '&starttime='.$starttime : '';
$muticondition .= $endtime ? '&endtime='.$endtime : '';
$muticondition .= $friend ? '&friend='.$friend : '';
$muticondition .= $ip ? '&ip='.$ip : '';
$muticondition .= $orderby ? '&orderby='.$orderby : '';
$muticondition .= $ordersc ? '&ordersc='.$ordersc : '';
$muticondition .= $fromumanage ? '&fromumanage='.$fromumanage : '';
$muticondition .= $searchsubmit ? '&searchsubmit='.$searchsubmit : '';
$muticondition .= $_GET['search'] ? '&search='.$_GET['search'] : '';
$muticondition .= $detail ? '&detail='.$detail : '';
if(!submitcheck('blogsubmit')) {
if(empty($_GET['search'])) {
$newlist = 1;
$detail = 1;
}
if($fromumanage) {
$starttime = !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $starttime) ? '' : $starttime;
$endtime = $_G['adminid'] == 3 || !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $endtime) ? '' : $endtime;
} else {
$starttime = !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $starttime) ? dgmdate(TIMESTAMP - 86400 * 7, 'Y-n-j') : $starttime;
$endtime = $_G['adminid'] == 3 || !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $endtime) ? dgmdate(TIMESTAMP, 'Y-n-j') : $endtime;
}
shownav('topic', 'nav_blog');
showsubmenu('nav_blog', array(
array('newlist', 'blog', !empty($newlist)),
array('search', 'blog&search=true', empty($newlist)),
));
empty($newlist) && showsubmenusteps('', array(
array('blog_search', !$searchsubmit),
array('nav_blog', $searchsubmit)
));
if($muticondition) {
showtips('blog_tips');
}
$staticurl = STATICURL;
echo <<<EOT
<script type="text/javascript" src="{$staticurl}js/calendar.js"></script>
<script type="text/JavaScript">
function page(number) {
$('blogforum').page.value=number;
$('blogforum').searchsubmit.click();
}
</script>
EOT;
showtagheader('div', 'searchposts', !$searchsubmit && empty($newlist));
showformheader("blog".(!empty($_GET['search']) ? '&search=true' : ''), '', 'blogforum');
showhiddenfields(array('page' => $page, 'pp' => $_GET['pp'] ? $_GET['pp'] : $_GET['perpage']));
showtableheader();
showsetting('blog_search_detail', 'detail', $detail, 'radio');
showsetting('blog_search_perpage', '', $_GET['perpage'], "<select name='perpage'><option value='20'>{$lang['perpage_20']}</option><option value='50'>{$lang['perpage_50']}</option><option value='100'>{$lang['perpage_100']}</option></select>");
showsetting('resultsort', '', $orderby, "<select name='orderby'><option value=''>{$lang['defaultsort']}</option><option value='dateline'>{$lang['forums_edit_extend_order_starttime']}</option><option value='viewnum'>{$lang['blog_search_view']}</option><option value='replynum'>{$lang['blog_search_reply']}</option><option value='hot'>{$lang['blog_search_hot']}</option></select> ");
showsetting('', '', $ordersc, "<select name='ordersc'><option value='desc'>{$lang['orderdesc']}</option><option value='asc'>{$lang['orderasc']}</option></select>", '', 0, '', '', '', true);
showsetting('blog_search_uid', 'uid', $uid, 'text');
showsetting('blog_search_blogid', 'blogid', $blogid, 'text');
showsetting('blog_search_user', 'users', $users, 'text');
showsetting('blog_search_keyword', 'keywords', $keywords, 'text');
showsetting('blog_search_friend', '', $friend, "<select name='friend'><option value='0'>{$lang['setting_home_privacy_alluser']}</option><option value='1'>{$lang['setting_home_privacy_friend']}</option><option value='2'>{$lang['setting_home_privacy_specified_friend']}</option><option value='3'>{$lang['setting_home_privacy_self']}</option><option value='4'>{$lang['setting_home_privacy_password']}</option></select>");
showsetting('blog_search_ip', 'ip', $ip, 'text');
showsetting('blog_search_lengthlimit', 'lengthlimit', $lengthlimit, 'text');
showsetting('blog_search_view', array('viewnum1', 'viewnum2'), array('', ''), 'range');
showsetting('blog_search_reply', array('replynum1', 'replynum2'), array('', ''), 'range');
showsetting('blog_search_hot', array('hot1', 'hot2'), array('', ''), 'range');
showsetting('blog_search_time', array('starttime', 'endtime'), array($starttime, $endtime), 'daterange');
echo '<input type="hidden" name="fromumanage" value="'.$fromumanage.'">';
showsubmit('searchsubmit');
showtablefooter();
showformfooter();
showtagfooter('div');
} else {
if($_GET['blogids']) {
$blogids = authcode($_GET['blogids'], 'DECODE');
$blogidsadd = $blogids ? explode(',', $blogids) : $_GET['delete'];
include_once libfile('function/delete');
$deletecount = count(deleteblogs($blogidsadd));
$cpmsg = cplang('blog_succeed', array('deletecount' => $deletecount));
} else {
$blogs = $catids = array();
$selectblogids = !empty($_GET['ids']) && is_array($_GET['ids']) ? $_GET['ids'] : array();
if($selectblogids) {
$query = C::t('home_blog')->fetch_all_blog($selectblogids);
foreach($query as $value) {
$blogs[$value['blogid']] = $value;
$catids[] = intval($value['catid']);
}
}
if($blogs) {
$selectblogids = array_keys($blogs);
if($_POST['optype'] == 'delete') {
include_once libfile('function/delete');
$deletecount = count(deleteblogs($selectblogids));
$cpmsg = cplang('blog_succeed', array('deletecount' => $deletecount));
} elseif($_POST['optype'] == 'move') {
$tocatid = intval($_POST['tocatid']);
$catids[] = $tocatid;
$catids = array_merge($catids);
C::t('home_blog')->update($selectblogids, array('catid'=>$tocatid));
foreach($catids as $catid) {
$catid = intval($catid);
$cnt = C::t('home_blog')->count_by_catid($catid);
C::t('home_blog_category')->update($catid, array('num'=>$cnt));
}
$cpmsg = cplang('blog_move_succeed');
} else {
$cpmsg = cplang('blog_choose_at_least_one_operation');
}
} else {
$cpmsg = cplang('blog_choose_at_least_one_blog');
}
}
?>
<script type="text/JavaScript">alert('<?php echo $cpmsg;?>');parent.$('blogforum').searchsubmit.click();</script>
<?php
}
if(submitcheck('searchsubmit', 1) || $newlist) {
$blogids = $blogcount = '0';
$sql = $error = '';
$keywords = trim($keywords);
$users = trim($users);
$uids = array();
if($blogid != '') {
$blogid = explode(',', $blogid);
}
if($users != '') {
$uids = C::t('common_member')->fetch_all_uid_by_username(array_map('trim', explode(',', $users)));
if(!$uids) {
$uids = array(-1);
}
}
$uid = trim($uid, ', ');
if($uid != '') {
$uid = explode(',', $uid);
if($uids && $uids[0] != -1) {
$uids = array_intersect($uids, $uid);
} else {
$uids = $uid;
}
if(!$uids) {
$uids = array(-1);
}
}
if($starttime != '') {
$starttime = strtotime($starttime);
}
if($_G['adminid'] == 1 && $endtime != dgmdate(TIMESTAMP, 'Y-n-j')) {
if($endtime != '') {
$endtime = strtotime($endtime);
}
} else {
$endtime = TIMESTAMP;
}
if(($_G['adminid'] == 2 && $endtime - $starttime > 86400 * 16) || ($_G['adminid'] == 3 && $endtime - $starttime > 86400 * 8)) {
$error = 'blog_mod_range_illegal';
}
if(!$error) {
if($detail) {
$pagetmp = $page;
$_GET['perpage'] = intval($_GET['perpage']) < 1 ? 20 : intval($_GET['perpage']);
$perpage = $_GET['pp'] ? $_GET['pp'] : $_GET['perpage'];
do{
$query = C::t('home_blog')->fetch_all_by_search(1, $blogid, $uids, $starttime, $endtime, $hot1, $hot2, $viewnum1, $viewnum2, $replynum1, $replynum2, $friend, $ip, $keywords, $lengthlimit, $orderby, $ordersc, (($pagetmp - 1) * $perpage), $perpage, null, null, null, null, false, array(0, 1));
$pagetmp--;
} while(!count($query) && $pagetmp);
$blogs = '';
foreach($query as $blog) {
$blog['dateline'] = dgmdate($blog['dateline']);
$blog['subject'] = cutstr($blog['subject'], 30);
switch ($blog['friend']) {
case '0':
$privacy_name = $lang['setting_home_privacy_alluser'];
break;
case '1':
$privacy_name = $lang['setting_home_privacy_friend'];
break;
case '2':
$privacy_name = $lang['setting_home_privacy_specified_friend'];
break;
case '3':
$privacy_name = $lang['setting_home_privacy_self'];
break;
case '4':
$privacy_name = $lang['setting_home_privacy_password'];
break;
default:
$privacy_name = $lang['setting_home_privacy_alluser'];
}
$blog['friend'] = $blog['friend'] ? " <a href=\"".ADMINSCRIPT."?action=blog&friend={$blog['friend']}\">$privacy_name</a>" : $privacy_name;
$blogs .= showtablerow('', '', array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"ids[]\" value=\"{$blog['blogid']}\" />",
$blog['blogid'],
"<a href=\"home.php?mod=space&uid={$blog['uid']}\" target=\"_blank\">{$blog['username']}</a>",
"<a href=\"home.php?mod=space&uid={$blog['uid']}&do=blog&id={$blog['blogid']}\" target=\"_blank\">{$blog['subject']}</a>",
$blog['viewnum'],
$blog['replynum'],
$blog['hot'],
$blog['dateline'],
$blog['friend']
), TRUE);
}
$blogcount = C::t('home_blog')->count_all_by_search($blogid, $uids, $starttime, $endtime, $hot1, $hot2, $viewnum1, $viewnum2, $replynum1, $replynum2, $friend, $ip, $keywords, $lengthlimit, null, null, null, false, array(0, 1));
$multi = multi($blogcount, $perpage, $page, ADMINSCRIPT."?action=blog".($perpage ? '&perpage='.$perpage : '').$muticondition);
} else {
$blogcount = 0;
$query = C::t('home_blog')->fetch_all_by_search(2, $blogid, $uids, $starttime, $endtime, $hot1, $hot2, $viewnum1, $viewnum2, $replynum1, $replynum2, $friend, $ip, $keywords, $lengthlimit, null, null, 0, 0, null, null, null, null, false, array(0, 1));
foreach($query as $blog) {
$blogids .= ','.$blog['blogid'];
$blogcount++;
}
$multi = '';
}
if(!$blogcount) {
$error = 'blog_post_nonexistence';
}
}
showtagheader('div', 'postlist', $searchsubmit || $newlist);
showformheader('blog&frame=no', 'target="blogframe"');
if(!$muticondition) {
showtableheader(cplang('blog_new_result').' '.$blogcount, 'fixpadding');
} else {
showtableheader(cplang('blog_result').' '.$blogcount.(empty($newlist) ? ' <a href="###" onclick="$(\'searchposts\').style.display=\'\';$(\'postlist\').style.display=\'none\';$(\'blogforum\').pp.value=\'\';$(\'blogforum\').page.value=\'\';" class="act lightlink normal">'.cplang('research').'</a>' : ''), 'fixpadding');
}
if($error) {
echo "<tr><td class=\"lineheight\" colspan=\"15\">$lang[$error]</td></tr>";
} else {
if($detail) {
showsubtitle(array('', 'blogid', 'author', 'subject', 'view', 'reply', 'hot', 'time', 'privacy'));
echo $blogs;
$optypehtml = ''
.'<input type="radio" name="optype" id="optype_delete" value="delete" class="radio" /><label for="optype_delete">'.cplang('delete').'</label>&nbsp;&nbsp;'
;
$optypehtml .= '<input type="radio" name="optype" id="optype_move" value="move" class="radio" /><label for="optype_move">'.cplang('article_opmove').'</label> '
.category_showselect('blog', 'tocatid', false)
.'&nbsp;&nbsp;';
showsubmit('', '', '', '<input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'ids\')" /><label for="chkall">'.cplang('select_all').'</label>&nbsp;&nbsp;'.$optypehtml.'<input type="submit" class="btn" name="blogsubmit" value="'.cplang('submit').'" />', $multi);
} else {
showhiddenfields(array('blogids' => authcode($blogids, 'ENCODE')));
showsubmit('blogsubmit', 'delete', $detail ? 'del' : '', '', $multi);
}
}
showtablefooter();
showformfooter();
echo '<iframe name="blogframe" style="display:none;"></iframe>';
showtagfooter('div');
}
?>

View File

@@ -0,0 +1,213 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_blogcategory.php 26322 2011-12-09 02:20:12Z chenmengshu $
*/
if(!defined('IN_DISCUZ') || !defined('IN_DISCUZ')) {
exit('Access Denied');
}
cpheader();
$operation = $operation == 'delete' ? 'delete' : 'list';
loadcache('blogcategory');
$category = $_G['cache']['blogcategory'];
if($operation == 'list') {
if(!submitcheck('editsubmit')) {
shownav('portal', 'blogcategory');
showsubmenu('blogcategory', array(
array('list', 'blogcategory', 1)
));
showformheader('blogcategory');
showtableheader('', 'nobottom');
showsetting('system_category_stat', 'settingnew[blogcategorystat]', $_G['setting']['blogcategorystat'], 'radio', '', 1);
showsetting('system_category_required', 'settingnew[blogcategoryrequired]', $_G['setting']['blogcategoryrequired'], 'radio', '');
echo '<tr><td colspan="2">';
showtableheader();
showsubtitle(array('order', 'blogcategory_name', 'blogcategory_num', 'operation'));
foreach ($category as $key=>$value) {
if($value['level'] == 0) {
echo showcategoryrow($key, 0, '');
}
}
echo '<tr><td class="td25">&nbsp;</td><td colspan="3"><div><a class="addtr" onclick="addrow(this, 0, 0)" href="###">'.cplang('blogcategory_addcategory').'</a></div></td></tr>';
showtablefooter();
echo '</td></tr>';
showtablefooter();
showtableheader('', 'notop');
showsubmit('editsubmit');
showtablefooter();
showformfooter();
$langs = array();
$keys = array('blogcategory_addcategory', 'blogcategory_addsubcategory', 'blogcategory_addthirdcategory');
foreach ($keys as $key) {
$langs[$key] = cplang($key);
}
echo <<<SCRIPT
<script type="text/JavaScript">
var rowtypedata = [
[[1,'<input type="text" class="txt" name="neworder[{1}][]" value="0" />', 'td25'], [3, '<div class="parentboard"><input type="text" class="txt" value="{$lang['blogcategory_addcategory']}" name="newname[{1}][]"/></div>']],
[[1,'<input type="text" class="txt" name="neworder[{1}][]" value="0" />', 'td25'], [3, '<div class="board"><input type="text" class="txt" value="{$lang['blogcategory_addsubcategory']}" name="newname[{1}][]"/></div>']],
[[1,'<input type="text" class="txt" name="neworder[{1}][]" value="0" />', 'td25'], [3, '<div class="childboard"><input type="text" class="txt" value="{$lang['blogcategory_addthirdcategory']}" name="newname[{1}][]"/></div>']],
];
</script>
SCRIPT;
} else {
if($_POST['name']) {
foreach($_POST['name'] as $key=>$value) {
$sets = array();
$value = trim($value);
if($category[$key] && $category[$key]['catname'] != $value) {
$sets['catname'] = $value;
}
if($category[$key] && $category[$key]['displayorder'] != $_POST['order'][$key]) {
$sets['displayorder'] = $_POST['order'][$key] ? $_POST['order'][$key] : '0';
}
if($sets) {
C::t('home_blog_category')->update($key, $sets);
}
}
}
if($_POST['newname']) {
foreach ($_POST['newname'] as $upid=>$names) {
foreach ($names as $nameid=>$name) {
C::t('home_blog_category')->insert(array('upid' => $upid, 'catname' => trim($name), 'displayorder'=>intval($_POST['neworder'][$upid][$nameid])));
}
}
}
if($_POST['settingnew']) {
$_POST['settingnew'] = array_map('intval', $_POST['settingnew']);
C::t('common_setting')->update_batch($_POST['settingnew']);
updatecache('setting');
}
include_once libfile('function/cache');
updatecache('blogcategory');
cpmsg('blogcategory_update_succeed', 'action=blogcategory', 'succeed');
}
} elseif($operation == 'delete') {
if(!$_GET['catid'] || !$category[$_GET['catid']]) {
cpmsg('blogcategory_catgory_not_found', '', 'error');
}
if(!submitcheck('deletesubmit')) {
$blog_count = C::t('home_blog')->count_by_catid($_GET['catid']);
if(!$blog_count && empty($category[$_GET['catid']]['children'])) {
C::t('home_blog_category')->delete($_GET['catid']);
include_once libfile('function/cache');
updatecache('blogcategory');
cpmsg('blogcategory_delete_succeed', 'action=blogcategory', 'succeed');
}
shownav('portal', 'blogcategory');
showsubmenu('blogcategory', array(
array('list', 'blogcategory', 0),
array('delete', 'blogcategory&operation=delete&catid='.$_GET['catid'], 1)
));
showformheader('blogcategory&operation=delete&catid='.$_GET['catid']);
showtableheader();
if($category[$_GET['catid']]['children']) {
showsetting('blogcategory_subcategory_moveto', '', '',
'<input type="radio" name="subcat_op" value="trash" id="subcat_op_trash" checked="checked" />'.
'<label for="subcat_op_trash" />'.cplang('blogcategory_subcategory_moveto_trash').'</label>'.
'<input type="radio" name="subcat_op" value="parent" id="subcat_op_parent" checked="checked" />'.
'<label for="subcat_op_parent" />'.cplang('blogcategory_subcategory_moveto_parent').'</label>'
);
}
include_once libfile('function/portalcp');
showsetting('blogcategory_blog_moveto', '', '', category_showselect('blog', 'tocatid', false, $category[$_GET['catid']]['upid']));
showsubmit('deletesubmit');
showtablefooter();
showformfooter();
} else {
if($_POST['tocatid'] == $_GET['catid']) {
cpmsg('blogcategory_move_category_failed', 'action=blogcategory', 'error');
}
$delids = array($_GET['catid']);
if($category[$_GET['catid']]['children']) {
if($_POST['subcat_op'] == 'parent') {
$upid = intval($category[$_GET['catid']]['upid']);
C::t('home_blog_category')->update($category[$_GET['catid']]['children'], array('upid' => $upid));
} else {
$delids = array_merge($delids, $category[$_GET['catid']]['children']);
foreach ($category[$_GET['catid']]['children'] as $id) {
$value = $category[$id];
if($value['children']) {
$delids = array_merge($delids, $value['children']);
}
}
if(!$category[$_POST['tocatid']] || in_array($_POST['tocatid'], $delids)) {
cpmsg('blogcategory_move_category_failed', 'action=blogcategory', 'error');
}
}
}
if($delids) {
C::t('home_blog_category')->delete($delids);
C::t('home_blog')->update_by_catid($delids, array('catid'=>$_POST['tocatid']));
$num = C::t('home_blog')->count_by_catid($_POST['tocatid']);
C::t('home_blog_category')->update_num_by_catid($num, $_POST['tocatid'], false);
}
include_once libfile('function/cache');
updatecache('blogcategory');
cpmsg('blogcategory_delete_succeed', 'action=blogcategory', 'succeed');
}
}
function showcategoryrow($key, $level = 0, $last = '') {
global $_G;
loadcache('blogcategory');
$value = $_G['cache']['blogcategory'][$key];
$return = '';
include_once libfile('function/portalcp');
$value['num'] = category_get_num('blog', $key);
if($level == 2) {
$class = $last ? 'lastchildboard' : 'childboard';
$return = '<tr class="hover"><td class="td25"><input type="text" class="txt" name="order['.$value['catid'].']" value="'.$value['displayorder'].'" /></td><td><div class="'.$class.'">'.
'<input type="text" name="name['.$value['catid'].']" value="'.$value['catname'].'" class="txt" />'.
'</div>'.
'</td><td>'.$value['num'].'</td><td><a href="'.ADMINSCRIPT.'?action=blogcategory&operation=delete&catid='.$value['catid'].'">'.cplang('delete').'</a></td></tr>';
} elseif($level == 1) {
$return = '<tr class="hover"><td class="td25"><input type="text" class="txt" name="order['.$value['catid'].']" value="'.$value['displayorder'].'" /></td><td><div class="board">'.
'<input type="text" name="name['.$value['catid'].']" value="'.$value['catname'].'" class="txt" />'.
'<a class="addchildboard" onclick="addrowdirect = 1;addrow(this, 2, '.$value['catid'].')" href="###">'.cplang('blogcategory_addthirdcategory').'</a></div>'.
'</td><td>'.$value['num'].'</td><td><a href="'.ADMINSCRIPT.'?action=blogcategory&operation=delete&catid='.$value['catid'].'">'.cplang('delete').'</a></td></tr>';
for($i=0,$L=(is_array($value['children']) ? count($value['children']) : 0); $i<$L; $i++) {
$return .= showcategoryrow($value['children'][$i], 2, $i==$L-1);
}
} else {
$return = '<tr class="hover"><td class="td25"><input type="text" class="txt" name="order['.$value['catid'].']" value="'.$value['displayorder'].'" /></td><td><div class="parentboard">'.
'<input type="text" name="name['.$value['catid'].']" value="'.$value['catname'].'" class="txt" />'.
'</div>'.
'</td><td>'.$value['num'].'</td><td><a href="'.ADMINSCRIPT.'?action=blogcategory&operation=delete&catid='.$value['catid'].'">'.cplang('delete').'</a></td></tr>';
for($i=0,$L=(is_array($value['children']) ? count($value['children']) : 0); $i<$L; $i++) {
$return .= showcategoryrow($value['children'][$i], 1, '');
}
$return .= '<tr><td class="td25"></td><td colspan="3"><div class="lastboard"><a class="addtr" onclick="addrow(this, 1, '.$value['catid'].')" href="###">'.cplang('blogcategory_addsubcategory').'</a></div>';
}
return $return;
}
?>

View File

@@ -0,0 +1,307 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_blogrecyclebin.php 32130 2012-11-14 09:20:40Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
include_once libfile('function/portalcp');
cpheader();
$detail = $_GET['detail'];
$uid = $_GET['uid'];
$blogid = $_GET['blogid'];
$users = $_GET['users'];
$keywords = $_GET['keywords'];
$lengthlimit = $_GET['lengthlimit'];
$viewnum1 = $_GET['viewnum1'];
$viewnum2 = $_GET['viewnum2'];
$replynum1 = $_GET['replynum1'];
$replynum2 = $_GET['replynum2'];
$hot1 = $_GET['hot1'];
$hot2 = $_GET['hot2'];
$starttime = $_GET['starttime'];
$endtime = $_GET['endtime'];
$searchsubmit = $_GET['searchsubmit'];
$blogids = $_GET['blogids'];
$friend = $_GET['friend'];
$ip = $_GET['ip'];
$orderby = $_GET['orderby'];
$ordersc = $_GET['ordersc'];
$fromumanage = $_GET['fromumanage'] ? 1 : 0;
$muticondition = '';
$muticondition .= $uid ? '&uid='.$uid : '';
$muticondition .= $blogid ? '&blogid='.$blogid : '';
$muticondition .= $users ? '&users='.$users : '';
$muticondition .= $keywords ? '&keywords='.$keywords : '';
$muticondition .= $lengthlimit ? '&lengthlimit='.$lengthlimit : '';
$muticondition .= $viewnum1 ? '&viewnum1='.$viewnum1 : '';
$muticondition .= $viewnum2 ? '&viewnum2='.$viewnum2 : '';
$muticondition .= $replynum1 ? '&replynum1='.$replynum1 : '';
$muticondition .= $replynum2 ? '&replynum2='.$replynum2 : '';
$muticondition .= $hot1 ? '&hot1='.$hot1 : '';
$muticondition .= $hot2 ? '&hot2='.$hot2 : '';
$muticondition .= $starttime ? '&starttime='.$starttime : '';
$muticondition .= $endtime ? '&endtime='.$endtime : '';
$muticondition .= $friend ? '&friend='.$friend : '';
$muticondition .= $ip ? '&ip='.$ip : '';
$muticondition .= $orderby ? '&orderby='.$orderby : '';
$muticondition .= $ordersc ? '&ordersc='.$ordersc : '';
$muticondition .= $fromumanage ? '&fromumanage='.$fromumanage : '';
$muticondition .= $searchsubmit ? '&searchsubmit='.$searchsubmit : '';
$muticondition .= $_GET['search'] ? '&search='.$_GET['search'] : '';
$muticondition .= $detail ? '&detail='.$detail : '';
if(!submitcheck('blogsubmit')) {
if(empty($_GET['search'])) {
$newlist = 1;
$detail = 1;
}
if($fromumanage) {
$starttime = !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $starttime) ? '' : $starttime;
$endtime = $_G['adminid'] == 3 || !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $endtime) ? '' : $endtime;
} else {
$starttime = !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $starttime) ? dgmdate(TIMESTAMP - 86400 * 7, 'Y-n-j') : $starttime;
$endtime = $_G['adminid'] == 3 || !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $endtime) ? dgmdate(TIMESTAMP, 'Y-n-j') : $endtime;
}
shownav('topic', 'nav_blog_recycle_bin');
showsubmenu('nav_blog_recycle_bin', array(
array('bloglist', 'blogrecyclebin', !empty($newlist)),
array('search', 'blogrecyclebin&search=true', empty($newlist)),
));
empty($newlist) && showsubmenusteps('', array(
array('blog_search', !$searchsubmit),
array('nav_blog_recycle_bin', $searchsubmit)
));
if($muticondition) {
showtips('blog_tips');
}
$staticurl = STATICURL;
echo <<<EOT
<script type="text/javascript" src="{$staticurl}js/calendar.js"></script>
<script type="text/JavaScript">
function page(number) {
$('blogforum').page.value=number;
$('blogforum').searchsubmit.click();
}
</script>
EOT;
showtagheader('div', 'searchposts', !$searchsubmit && empty($newlist));
showformheader("blogrecyclebin".(!empty($_GET['search']) ? '&search=true' : ''), '', 'blogforum');
showhiddenfields(array('page' => $page, 'pp' => $_GET['pp'] ? $_GET['pp'] : $_GET['perpage']));
showtableheader();
showsetting('blog_search_detail', 'detail', $detail, 'radio');
showsetting('blog_search_perpage', '', $_GET['perpage'], "<select name='perpage'><option value='20'>{$lang['perpage_20']}</option><option value='50'>{$lang['perpage_50']}</option><option value='100'>{$lang['perpage_100']}</option></select>");
showsetting('resultsort', '', $orderby, "<select name='orderby'><option value=''>{$lang['defaultsort']}</option><option value='dateline'>{$lang['forums_edit_extend_order_starttime']}</option><option value='viewnum'>{$lang['blog_search_view']}</option><option value='replynum'>{$lang['blog_search_reply']}</option><option value='hot'>{$lang['blog_search_hot']}</option></select> ");
showsetting('', '', $ordersc, "<select name='ordersc'><option value='desc'>{$lang['orderdesc']}</option><option value='asc'>{$lang['orderasc']}</option></select>", '', 0, '', '', '', true);
showsetting('blog_search_uid', 'uid', $uid, 'text');
showsetting('blog_search_blogid', 'blogid', $blogid, 'text');
showsetting('blog_search_user', 'users', $users, 'text');
showsetting('blog_search_keyword', 'keywords', $keywords, 'text');
showsetting('blog_search_friend', '', $friend, "<select name='friend'><option value='0'>{$lang['setting_home_privacy_alluser']}</option><option value='1'>{$lang['setting_home_privacy_friend']}</option><option value='2'>{$lang['setting_home_privacy_specified_friend']}</option><option value='3'>{$lang['setting_home_privacy_self']}</option><option value='4'>{$lang['setting_home_privacy_password']}</option></select>");
showsetting('blog_search_ip', 'ip', $ip, 'text');
showsetting('blog_search_lengthlimit', 'lengthlimit', $lengthlimit, 'text');
showsetting('blog_search_view', array('viewnum1', 'viewnum2'), array('', ''), 'range');
showsetting('blog_search_reply', array('replynum1', 'replynum2'), array('', ''), 'range');
showsetting('blog_search_hot', array('hot1', 'hot2'), array('', ''), 'range');
showsetting('blog_search_time', array('starttime', 'endtime'), array($starttime, $endtime), 'daterange');
echo '<input type="hidden" name="fromumanage" value="'.$fromumanage.'">';
showsubmit('searchsubmit');
showtablefooter();
showformfooter();
showtagfooter('div');
} else {
if($_GET['blogids']) {
$blogids = authcode($_GET['blogids'], 'DECODE');
$blogidsadd = $blogids ? explode(',', $blogids) : $_GET['delete'];
include_once libfile('function/delete');
$deletecount = count(deleteblogs($blogidsadd, true));
$cpmsg = cplang('blog_succeed', array('deletecount' => $deletecount));
} else {
$blogs = $catids = array();
$selectblogids = !empty($_GET['ids']) && is_array($_GET['ids']) ? $_GET['ids'] : array();
if($selectblogids) {
$query = C::t('home_blog')->fetch_all_blog($selectblogids);
foreach($query as $value) {
$blogs[$value['blogid']] = $value;
$catids[] = intval($value['catid']);
}
}
if($blogs) {
$selectblogids = array_keys($blogs);
if($_POST['optype'] == 'delete') {
include_once libfile('function/delete');
$deletecount = count(deleteblogs($selectblogids, true));
$cpmsg = cplang('blog_succeed', array('deletecount' => $deletecount));
} elseif($_POST['optype'] == 'restore') {
$restore = C::t('home_blog')->update($selectblogids, array('status' => 0));
$cpmsg = cplang('blog_restore_succeed', array('restorecount' => $restore));
} else {
$cpmsg = cplang('blog_choose_at_least_one_operation');
}
} else {
$cpmsg = cplang('blog_choose_at_least_one_blog');
}
}
?>
<script type="text/JavaScript">alert('<?php echo $cpmsg;?>');parent.$('blogforum').searchsubmit.click();</script>
<?php
}
if(submitcheck('searchsubmit', 1) || $newlist) {
$blogids = $blogcount = '0';
$sql = $error = '';
$keywords = trim($keywords);
$users = trim($users);
$uids = array();
if($blogid != '') {
$blogid = explode(',', $blogid);
}
if($users != '') {
$uids = C::t('common_member')->fetch_all_uid_by_username(array_map('trim', explode(',', $users)));
if(!$uids) {
$uids = array(-1);
}
}
$uid = trim($uid, ', ');
if($uid != '') {
$uid = explode(',', $uid);
if($uids && $uids[0] != -1) {
$uids = array_intersect($uids, $uid);
} else {
$uids = $uid;
}
if(!$uids) {
$uids = array(-1);
}
}
if($starttime != '') {
$starttime = strtotime($starttime);
}
if($_G['adminid'] == 1 && $endtime != dgmdate(TIMESTAMP, 'Y-n-j')) {
if($endtime != '') {
$endtime = strtotime($endtime);
}
} else {
$endtime = TIMESTAMP;
}
if(($_G['adminid'] == 2 && $endtime - $starttime > 86400 * 16) || ($_G['adminid'] == 3 && $endtime - $starttime > 86400 * 8)) {
$error = 'blog_mod_range_illegal';
}
if(!$error) {
if($detail) {
$pagetmp = $page;
$_GET['perpage'] = intval($_GET['perpage']) < 1 ? 20 : intval($_GET['perpage']);
$perpage = $_GET['pp'] ? $_GET['pp'] : $_GET['perpage'];
do{
$query = C::t('home_blog')->fetch_all_by_search(1, $blogid, $uids, $starttime, $endtime, $hot1, $hot2, $viewnum1, $viewnum2, $replynum1, $replynum2, $friend, $ip, $keywords, $lengthlimit, $orderby, $ordersc, (($pagetmp - 1) * $perpage), $perpage, null, null, null, null, false, -1);
$pagetmp--;
} while(!count($query) && $pagetmp);
$blogs = '';
foreach($query as $blog) {
$blog['dateline'] = dgmdate($blog['dateline']);
$blog['subject'] = cutstr($blog['subject'], 30);
switch ($blog['friend']) {
case '0':
$privacy_name = $lang['setting_home_privacy_alluser'];
break;
case '1':
$privacy_name = $lang['setting_home_privacy_friend'];
break;
case '2':
$privacy_name = $lang['setting_home_privacy_specified_friend'];
break;
case '3':
$privacy_name = $lang['setting_home_privacy_self'];
break;
case '4':
$privacy_name = $lang['setting_home_privacy_password'];
break;
default:
$privacy_name = $lang['setting_home_privacy_alluser'];
}
$blog['friend'] = $blog['friend'] ? " <a href=\"".ADMINSCRIPT."?action=blog&friend={$blog['friend']}\">$privacy_name</a>" : $privacy_name;
$blogs .= showtablerow('', '', array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"ids[]\" value=\"{$blog['blogid']}\" />",
$blog['blogid'],
"<a href=\"home.php?mod=space&uid={$blog['uid']}\" target=\"_blank\">{$blog['username']}</a>",
"<a href=\"home.php?mod=space&uid={$blog['uid']}&do=blog&id={$blog['blogid']}\" target=\"_blank\">{$blog['subject']}</a>",
$blog['viewnum'],
$blog['replynum'],
$blog['hot'],
$blog['dateline'],
$blog['friend']
), TRUE);
}
$blogcount = C::t('home_blog')->count_all_by_search($blogid, $uids, $starttime, $endtime, $hot1, $hot2, $viewnum1, $viewnum2, $replynum1, $replynum2, $friend, $ip, $keywords, $lengthlimit, null, null, null, false, -1);
$multi = multi($blogcount, $perpage, $page, ADMINSCRIPT."?action=blogrecyclebin".($perpage ? '&perpage='.$perpage : '').$muticondition);
} else {
$blogcount = 0;
$query = C::t('home_blog')->fetch_all_by_search(2, $blogid, $uids, $starttime, $endtime, $hot1, $hot2, $viewnum1, $viewnum2, $replynum1, $replynum2, $friend, $ip, $keywords, $lengthlimit, null, null, 0, 0, null, null, null, null, false, -1);
foreach($query as $blog) {
$blogids .= ','.$blog['blogid'];
$blogcount++;
}
$multi = '';
}
if(!$blogcount) {
$error = 'blog_post_nonexistence';
}
}
showtagheader('div', 'postlist', $searchsubmit || $newlist);
showformheader('blogrecyclebin&frame=no', 'target="blogframe"');
if(!$muticondition) {
showtableheader(cplang('blog_new_result').' '.$blogcount, 'fixpadding');
} else {
showtableheader(cplang('blog_result').' '.$blogcount.(empty($newlist) ? ' <a href="###" onclick="$(\'searchposts\').style.display=\'\';$(\'postlist\').style.display=\'none\';$(\'blogforum\').pp.value=\'\';$(\'blogforum\').page.value=\'\';" class="act lightlink normal">'.cplang('research').'</a>' : ''), 'fixpadding');
}
if($error) {
echo "<tr><td class=\"lineheight\" colspan=\"15\">$lang[$error]</td></tr>";
} else {
if($detail) {
showsubtitle(array('', 'blogid', 'author', 'subject', 'view', 'reply', 'hot', 'time', 'privacy'));
echo $blogs;
$optypehtml = ''
.'<input type="radio" name="optype" id="optype_delete" value="delete" class="radio" /><label for="optype_delete">'.cplang('delete').'</label>&nbsp;&nbsp;'
.'<input type="radio" name="optype" id="optype_restore" value="restore" class="radio" /><label for="optype_restore">'.cplang('restore').'</label>&nbsp;&nbsp;'
;
showsubmit('', '', '', '<input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'ids\')" /><label for="chkall">'.cplang('select_all').'</label>&nbsp;&nbsp;'.$optypehtml.'<input type="submit" class="btn" name="blogsubmit" value="'.cplang('submit').'" />', $multi);
} else {
showhiddenfields(array('blogids' => authcode($blogids, 'ENCODE')));
showsubmit('blogsubmit', 'delete', $detail ? 'del' : '', '', $multi);
}
}
showtablefooter();
showformfooter();
echo '<iframe name="blogframe" style="display:none;"></iframe>';
showtagfooter('div');
}
?>

View File

@@ -0,0 +1,620 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_card.php 29335 2012-04-05 02:08:34Z cnteacher $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
if($operation != 'export') {
cpheader();
}
$operation = $_GET['operation'] ? $_GET['operation'] : 'set' ;
$card_setting = $_G['setting']['card'];
if($operation == 'set') {
$nav = 'config';
$submenu['set'] = 1;
} elseif ($operation == 'manage') {
$nav = 'admin';
$submenu['manage'] = 1;
} elseif ($operation == 'type') {
$nav = 'nav_card_type';
$submenu['type'] = 1;
} elseif ($operation == 'make') {
$nav = 'nav_card_make';
$submenu['make'] = 1;
} elseif ($operation == 'log') {
$nav = 'nav_card_log';
} else {
$nav = '';
}
if($nav != '') {
if(!submitcheck('cardsubmit', 1) || $operation == 'manage' || $operation == 'type') {
shownav('extended', 'nav_card', $nav);
showsubmenu('nav_card', array(
array('config', 'card', $submenu['set']),
array('admin', 'card&operation=manage', $submenu['manage']),
array('nav_card_type', 'card&operation=type', $submenu['type']),
array('nav_card_make', 'card&operation=make', $submenu['make']),
array(array('menu' => 'nav_card_log', 'submenu' => array(
array('nav_card_log_add', 'card&operation=log&do=add', $_GET['do'] == 'add'),
array('nav_card_log_del', 'card&operation=log&do=del', $_GET['do'] == 'del'),
array('nav_card_log_cron', 'card&operation=log&do=cron', $_GET['do'] == 'cron')
)), in_array($_GET['do'], array('add', 'del', 'cron')))
));
}
}
if($operation == 'set') {
if(!submitcheck('cardsubmit')) {
showformheader('card&operation=set&');
showtableheader();
showsetting('card_config_open', 'card_config_open', ($card_setting['open'] ? $card_setting['open'] : 0), 'radio');
showsubmit('cardsubmit');
showtablefooter();
showformfooter();
} else {
C::t('common_setting')->update_setting('card', array('open' => $_POST['card_config_open']));
updatecache('setting');
cpmsg('card_config_succeed', 'action=card&operation=set', 'succeed');
}
} elseif($operation == 'manage'){
if(submitcheck('cardsubmit')) {
if(is_array($_POST['delete'])) {
$delnum = C::t('common_card')->delete($_POST['delete']);
$card_info = serialize(array('num' => ($delnum ? $delnum : 0)));
$cardlog = array(
'uid' => $_G['uid'],
'cardrule' => '',
'info' => $card_info,
'dateline' => $_G['timestamp'],
'operation' => 3,
'username' => $_G['member']['username']
);
C::t('common_card_log')->insert($cardlog);
}
}
$sqladd = cardsql();
foreach($_GET AS $key => $val) {
if(strpos($key, 'srch_') !== false && $val) {
if(in_array($key, array('srch_username'))){
$val = rawurlencode($val);
}
$export_url[] = $key.'='.$val;
}
}
$perpage = max(20, empty($_GET['perpage']) ? 20 : intval($_GET['perpage']));
echo '<script type="text/javascript" src="' . STATICURL . 'js/calendar.js"></script>';
showtips('card_manage_tips');
$card_type_option = '';
foreach(C::t('common_card_type')->range(0, 0, 'ASC') as $result) {
$card_type[$result['id']] = $result;
$card_type_option .= "<option value=\"{$result['id']}\" ".($_GET['srch_card_type'] == $result['id'] ? 'selected' : '').">{$result['typename']}</option>";
}
showformheader('card', '', 'cdform', 'get');
showtableheader('', 'fixpadding');
showtablerow('', array('width="80"', 'width="160"', 'width=100'),
array(
cplang('card_number'), '<input type="text" name="srch_id" class="txt" value="'.$_GET['srch_id'].'" />',
cplang('card_log_price').cplang('between'), '<input type="text" name="srch_price_min" class="txt" value="'.($_GET['srch_price_min'] ? $_GET['srch_price_min'] : '').'" />- &nbsp;<input type="text" name="srch_price_max" class="txt" value="'.($_GET['srch_price_max'] ? $_GET['srch_price_max'] :'' ).'" />',
)
);
echo "<input type='hidden' name='action' value='card'><input type='hidden' name='operation' value='manage'>";
$extcredits_option = "<option value=''>".cplang('nolimit')."</option>";
foreach($_G['setting']['extcredits'] AS $key => $val) {
$extcredits_option .= "<option value='$key' ".($_GET['srch_extcredits'] == $key ? 'selected' : '').">{$val['title']}</option>";
}
foreach(array('1' => cplang('card_manage_status_1'), '2' => cplang('card_manage_status_2'), '9' => cplang('card_manage_status_9')) AS $key => $val) {
$status_option .= "<option value='{$key}' ".($_GET['srch_card_status'] == $key ? "selected" : '').">{$val}</option>";
}
showtablerow('', array(),
array(
cplang('card_extcreditsval'), '<input type="text" name="srch_extcreditsval" class="txt" style="width:42px;" value="'.$_GET['srch_extcreditsval'].'" /><select name="srch_extcredits">'.$extcredits_option.'</select>',
cplang('card_status'), "<select name='srch_card_status'><option value=''>".cplang('nolimit')."</option>".$status_option."</select>",
)
);
showtablerow('', array('class="td23"', 'class="td23"'),
array(
cplang('card_log_used_user'), '<input type="text" name="srch_username" class="txt" value="'.$_GET['srch_username'].'" />',
cplang('card_used_dateline'), '<input type="text" name="srch_useddateline_start" class="txt" value="'.$_GET['srch_useddateline_start'].'" onclick="showcalendar(event, this);" />- &nbsp;<input type="text" name="srch_useddateline_end" class="txt" value="'.$_GET['srch_useddateline_end'].'" onclick="showcalendar(event, this)" />',
)
);
$perpage_selected[$perpage] = "selected=selected";
showtablerow('', array(),
array(
cplang('card_type'), '<select name="srch_card_type"><option value="">'.cplang('nolimit').'</option><option value="0" '.($_GET['srch_card_type'] != '' && $_GET['srch_card_type'] == 0 ? 'selected' : '').'>'.cplang('card_type_default').'</option>'.$card_type_option.'</select>',
cplang('card_search_perpage'), '<select name="perpage" class="ps" onchange="this.form.submit();" ><option value="20" '.$perpage_selected[20].'>'.cplang('perpage_20').'</option><option value="50" '.$perpage_selected[50].'>'.cplang('perpage_50').'</option><option value="100" '.$perpage_selected[100].'>'.cplang('perpage_100').'</option></select>',
)
);
showtablerow('', array('width="40"', 'width="100"', 'width=50', 'width="260"'),
array(
'<input type="submit" name="srchbtn" class="btn" value="'.$lang['search'].'" />',''
)
);
showtablefooter();
showformfooter();
showformheader('card&operation=manage&');
showtableheader('card_manage_title');
showsubtitle(array('', cplang('card_number'), cplang('card_log_price'), cplang('card_extcreditsval'), cplang('card_type'), cplang('card_status'), cplang('card_log_used_user'), cplang('card_used_dateline'), cplang('card_make_cleardateline')/*, cplang('card_maketype')*/, cplang('card_maketime'), cplang('card_log_maker')));
$start_limit = ($page - 1) * $perpage;
$export_url[] = 'start='.$start_limit;
foreach ($_GET AS $key => $val) {
if(strpos($key, 'srch_') !== FALSE) {
$url_add .= '&'.$key.'='.$val;
}
}
$url = ADMINSCRIPT.'?action=card&operation=manage&page='.$page.'&perpage='.$perpage.$url_add;
$count = $sqladd ? C::t('common_card')->count_by_where($sqladd) : C::t('common_card')->count();
if($count) {
$multipage = multi($count, $perpage, $page, $url, 0, 3);
foreach(C::t('common_card')->fetch_all_by_where($sqladd, $start_limit, $perpage) as $result) {
$userlist[$result['makeruid']] = $result['makeruid'];
$userlist[$result['uid']] = $result['uid'];
$cardlist[] = $result;
}
if($userlist) {
$members = C::t('common_member')->fetch_all($userlist);
unset($userlist);
}
foreach($cardlist AS $key => $val) {
showtablerow('', array('class="smallefont"', '', '', '', '', '', '', '', '', '', '', ''), array(
'<input class="checkbox" type="checkbox" name="delete[]" value="'.$val['id'].'">',
$val['id'],
$val['price'].cplang('card_make_price_unit'),
$val['extcreditsval'].$_G['setting']['extcredits'][$val['extcreditskey']]['title'],
$card_type[$val['typeid']]['typename'] ? $card_type[$val['typeid']]['typename'] : cplang('card_type_default'),
cplang("card_manage_status_".$val['status']),
$val['uid'] ? "<a href='home.php?mod=space&uid={$val['uid']}' target='_blank'>".$members[$val['uid']]['username'] : ' -- ',
$val['useddateline'] ? dgmdate($val['useddateline']) : ' -- ',
$val['cleardateline'] ? dgmdate($val['cleardateline'], 'Y-m-d') : cplang('card_make_cleardateline_none'),
dgmdate($val['dateline'], 'u'),
"<a href='home.php?mod=space&uid={$val['makeruid']}' target='_blank'>".$members[$val['makeruid']]['username']."</a>"
));
}
echo '<input type="hidden" name="perpage" value="'.$perpage.'">';
showsubmit('cardsubmit', 'submit', 'del', '<a href="'.ADMINSCRIPT.'?action=card&operation=export&'.implode('&', $export_url).'" title="'.$lang['card_export_title'].'">'.$lang['card_export'].'</a>', $multipage, false);
}
showtablefooter();
showformfooter();
} elseif($operation == 'type') {
if(submitcheck('cardsubmit')) {
if(is_array($_POST['delete'])) {
C::t('common_card_type')->delete($_POST['delete']);
C::t('common_card')->update_by_typeid($_POST['delete'], array('typeid'=>1));
}
if(is_array($_POST['newtype'])) {
$_POST['newtype'] = dhtmlspecialchars(daddslashes($_POST['newtype']));
foreach($_POST['newtype'] AS $key => $val) {
if(trim($val)) {
C::t('common_card_type')->insert(array('typename' => trim($val)));
}
}
}
}
showtips('card_type_tips');
showformheader('card&operation=type&');
showtableheader();
showtablerow('class="header"', array('', ''), array(
cplang('delete'),
cplang('card_type'),
));
showtablerow('', '', array(
'<input class="checkbox" type="checkbox" value ="" disabled="disabled" >',
cplang('card_type_default'),
));
foreach(C::t('common_card_type')->range(0, 0, 'ASC') as $result) {
showtablerow('', '', array(
'<input class="checkbox" type="checkbox" name ="delete[]" value ="'.$result['id'].'" >',
$result['typename'],
));
}
echo <<<EOT
<script type="text/JavaScript">
var rowtypedata = [
[[1,''], [1,'<input type="text" class="txt" size="30" name="newtype[]">']],
];
</script>
EOT;
echo '<tr><td></td><td colspan="2"><div><a href="###" onclick="addrow(this, 0)" class="addtr">'.$lang['add_new'].'</a></div></td></tr>';
showsubmit('cardsubmit', 'submit', 'select_all');
showtablefooter();
showformfooter();
} elseif($operation == 'make') {
if(!submitcheck('cardsubmit', 1)) {
if($card_log = C::t('common_card_log')->fetch_by_operation(1)) {
$card_log['rule'] = dunserialize($card_log['cardrule']);
}
$card_type[] = array(0, cplang('card_type_default'));
foreach(C::t('common_card_type')->range(0, 0, 'ASC') as $result) {
$card_type[] = array($result['id'], $result['typename']);
}
echo '<script type="text/javascript" src="' . STATICURL . 'js/calendar.js"></script>';
showformheader('card&operation=make&');
showtips('card_make_tips');
showtableheader();
showsetting('card_make_rule', '', '', '<input type="text" name="rule" class="txt" value="'.($card_log['rule']['rule'] ? $card_log['rule']['rule'] : '').'" onkeyup="javascript:checkcardrule(this);"><br /><span id="cardrule_view" class="tips2" style="display:none;"></span>');
echo <<<EOT
<script type="text/javascript" charset="{$_G['charset']}">
function checkcardrule(obj) {
var chrLength = obj.value.length;
$('cardrule_view').style.display = "";
$('cardrule_view').innerHTML = "{$lang['card_number']}<strong>"+chrLength+"</strong>{$lang['card_number_unit']}";
}
</script>
EOT;
showsetting('card_type', array('typeid', $card_type), $card_log['rule']['typeid'], 'select');
showsetting('card_make_num', 'num', ($card_log['rule']['num'] ? $card_log['rule']['num'] : 1), 'text');
$extcredits_option = '';
foreach($_G['setting']['extcredits'] AS $key => $val) {
$extcredits_option .= "<option value='$key'".($card_log['rule']['extcreditskey'] == $key ? 'selected' : '').">{$val['title']}</option>";
}
showsetting('card_make_extcredits', '', '', '<select name="extcreditskey" style="width:80px;">'.$extcredits_option.'</select><input type="text" name="extcreditsval" value="'.($card_log['rule']['extcreditsval'] ? $card_log['rule']['extcreditsval'] : 1).'" class="txt" style="width:50px;">');
showsetting('card_make_price', 'price', ($card_log['rule']['price'] ? $card_log['rule']['price'] : 0), 'text');
showsetting('card_make_cleardateline', 'cleardateline', date("Y-m-d", $_G['timestamp']+31536000), 'calendar', '', 0, '');
showsetting('card_make_description', 'description', $card_log['description'] , 'text');
showsubmit('cardsubmit');
showtablefooter();
showformfooter();
} else {
$_GET['rule'] = rawurldecode(trim($_GET['rule']));
$_GET['num'] = intval($_GET['num']);
list($y, $m, $d) = explode("-", $_GET['cleardateline']);
$_GET['step'] = $_GET['step'] ? $_GET['step'] : 1;
$cleardateline = $_GET['cleardateline'] && $y && $m ? mktime(23, 59, 59, $m, $d, $y) : 0 ;
if($cleardateline < TIMESTAMP) {
cpmsg('card_make_cleardateline_early', '', 'error');
}
if(!$_GET['rule']) {
cpmsg('card_make_rule_empty', '', 'error');
}
if($_GET['num'] < 1) {
cpmsg('card_make_num_error', '', 'error');
}
include libfile("class/card");
$card = new card();
$checkrule = $card->checkrule($_GET['rule'], 1);
if($checkrule === -2) {
cpmsg('card_make_rule_error', '', 'error');
}
if($_GET['step'] == 1) {
$card_rule = serialize(array('rule' => $_GET['rule'], 'price' => $_GET['price'], 'extcreditskey' => $_GET['extcreditskey'], 'extcreditsval' => $_GET['extcreditsval'], 'num' => $_GET['num'], 'cleardateline' => $cleardateline, 'typeid' => $_GET['typeid']));
$cardlog = array(
'uid' => $_G['uid'],
'username' => $_G['member']['username'],
'cardrule' => $card_rule,
'dateline' => $_G['timestamp'],
'description' => $_GET['description'],
'operation' => 1,
);
$logid = C::t('common_card_log')->insert($cardlog, true);
}
$onepage_make = 500;
$_GET['logid'] = $logid ? $logid : $_GET['logid'];
if($_GET['num'] > $onepage_make) {
$step_num = ceil($_GET['num']/$onepage_make);
if($step_num > 1) {
if($_GET['step'] == $step_num) {
if($_GET['num'] % $onepage_make == 0) {
$makenum = $onepage_make;
} else {
$makenum = $_GET['num'] % $onepage_make;
}
} else {
$makenum = $onepage_make;
$nextstep = $_GET['step'] + 1;
}
}
} else {
$makenum = $_GET['num'];
}
$cardval = array(
'typeid' => $_GET['typeid'],
'price' => $_GET['price'],
'extcreditskey' => $_GET['extcreditskey'],
'extcreditsval' => $_GET['extcreditsval'],
'cleardateline' => $cleardateline
);
$card->make($_GET['rule'], $makenum, $cardval);
$_GET['succeed_num'] += $card->succeed;
$_GET['fail_num'] += $card->fail;
if($nextstep) {
$_GET['rule'] = rawurlencode($_GET['rule']);
$nextlink = "action=card&operation=make&rule={$_GET['rule']}&num={$_GET['num']}&price={$_GET['price']}&extcreditskey={$_GET['extcreditskey']}&extcreditsval={$_GET['extcreditsval']}&cleardateline={$_GET['cleardateline']}&step={$nextstep}&succeed_num={$_GET['succeed_num']}&fail_num={$_GET['fail_num']}&typeid={$_GET['typeid']}&logid={$_GET['logid']}&cardsubmit=yes";
cpmsg('card_make_step', $nextlink, 'loading', array('step' => $nextstep - 1, 'step_num' => $step_num, 'succeed_num' => $card->succeed, 'fail_num' => $card->fail));
} else {
$card_info = serialize(array('num' => $_GET['num'], 'succeed_num' => $_GET['succeed_num'], 'fail_num' => $_GET['fail_num']));
C::t('common_card_log')->update($_GET['logid'], array('info'=>$card_info));
if(ceil($_GET['num']*0.6) > $_GET['succeed_num']) {
cpmsg('card_make_rate_succeed', 'action=card&operation=make', 'succeed', array('succeed_num' => $_GET['succeed_num'], 'fail_num' => $_GET['fail_num']));
}
cpmsg('card_make_succeed', 'action=card&operation=manage', 'succeed', array('succeed_num' => $_GET['succeed_num'], 'fail_num' => $_GET['fail_num']));
}
}
} elseif($operation == 'log'){
showformheader('card&operation=log&');
showtableheader();
$perpage = max(20, empty($_GET['perpage']) ? 20 : intval($_GET['perpage']));
$start_limit = ($page - 1) * $perpage;
$do = in_array($_GET['do'], array('add', 'task', 'del', 'cron')) ? $_GET['do'] : 'add';
$operation = 0;
switch($do) {
case 'add':
$operation = 1;
break;
case 'task':
$operation = 2;
break;
case 'del':
$operation = 3;
break;
case 'cron':
$operation = 9;
break;
}
if($do == 'add' || $do == 'task') {
$showtabletitle = array(
cplang('time'),
cplang('card_log_operation'),
cplang('card_log_user'),
cplang('card_log_rule'),
cplang('card_log_add_info'),
cplang('card_log_description')
);
} elseif($do == 'del') {
$showtabletitle = array(
cplang('time'),
cplang('card_log_operation'),
cplang('card_log_user'),
cplang('card_log_del_info')
);
} elseif($do == 'cron') {
$showtabletitle = array(
cplang('time'),
cplang('card_log_operation'),
cplang('card_log_cron_info')
);
}
showtablerow('class="header"', array('class="td21"','class="td23"','class="td23"','class="td21"','class="td23"'), $showtabletitle);
$count = C::t('common_card_log')->count_by_operation($operation);
if($count) {
$url = ADMINSCRIPT."?action=card&operation=log&do=".$do."&page=".$page.'&perpage='.$perpage;
$multipage = multi($count, $perpage, $page, $url, 0, 3);
foreach(C::t('common_card_log')->fetch_all_by_operation($operation, $start_limit, $perpage) as $result) {
$result['info_arr'] = dunserialize($result['info']);
if($result['operation'] == 1 || $result['operation'] == 2) {
$result['cardrule_arr'] = dunserialize($result['cardrule']);
$showrule = array(
$result['cardrule_arr']['rule'],
cplang('card_log_price').' : '.$result['cardrule_arr']['price'].cplang('card_make_price_unit'),
cplang('card_log_make_num').' : '.$result['cardrule_arr']['num'],
cplang('card_extcreditsval').' : '.$result['cardrule_arr']['extcreditsval'].$_G['setting']['extcredits'][$result['cardrule_arr']['extcreditskey']]['title'],
cplang('card_make_cleardateline').' : '.($result['cardrule_arr']['cleardateline'] ? dgmdate($result['cardrule_arr']['cleardateline'], 'Y-m-d H:i') : cplang('card_make_cleardateline_none')),
);
$showinfo = array(
cplang('succeed_num').' : '.$result['info_arr']['succeed_num'],
cplang('fail_num').' : '.$result['info_arr']['fail_num']
);
$showtablerow = array(
dgmdate($result['dateline']),
$result['operation'] == 1 ? cplang('card_log_operation_add') : cplang('card_log_operation_task'),
$result['username'],
implode("<br />", $showrule),
implode("<br />", $showinfo),
$result['description']
);
} elseif ($result['operation'] == 3 || $result['operation'] == 9) {
$showinfo =array(
cplang('card_log_num').$result['info_arr']['num'],
);
$showtablerow = $result['operation'] == 3 ? array(
dgmdate($result['dateline']),
cplang('card_log_operation_del'),
$result['username'],
implode("<br />", $showinfo),
) : array(
dgmdate($result['dateline']),
cplang('card_log_operation_cron'),
implode("<br />", $showinfo),
);
}
showtablerow('', array('class="smallefont"'), $showtablerow);
}
} else {
}
showsubmit('', '', '', '', $multipage);
showtablefooter();
showformfooter();
} elseif ($operation == 'export'){
$sqladd = cardsql();
$_GET['start'] = intval($_GET['start']);
$count = $sqladd ? C::t('common_card')->count_by_where($sqladd) : C::t('common_card')->count();
if($count) {
$cardtype = C::t('common_card_type')->range();
$count = min(10000, $count);
foreach(C::t('common_card')->fetch_all_by_where($sqladd, $_GET['start'], $count) as $result) {
$userlist[$result['uid']] = $result['uid'];
$userlist[$result['makeruid']] = $result['makeruid'];
$result['extcreditsval'] = $result['extcreditsval'].$_G['setting']['extcredits'][$result['extcreditskey']]['title'];
unset($result['extcreditskey']);
unset($result['maketype']);
$cardlist[] = $result;
}
if($userlist) {
$members = C::t('common_member')->fetch_all($userlist);
unset($userlist);
}
foreach($cardlist AS $key => $val) {
foreach($val as $skey => $sval) {
$sval = preg_replace('/\s+/', ' ', $sval);
if($skey == 'id' && !$title['id']) { $title['id'] = cplang('card_number'); }
if($skey == 'typeid') {
if(!$title['typeid']) {
$title['typeid'] = cplang("card_type");
}
$sval = $sval != 0 ? $cardtype[$sval]['typename'] : cplang('card_type_default');
}
if(in_array($skey, array('uid', 'makeruid'))) {
if($skey == 'makeruid' && !$title['makeruid']) {
$title['makeruid'] = cplang("card_log_maker");
}
if($skey == 'uid' && !$title['uid']) {
$title['uid'] = cplang("card_log_used_user");
}
$sval = $members[$sval]['username'];
}
if($skey == 'price') {
if(!$title['price']) {
$title['price'] = cplang('card_log_price');
}
$sval = $sval.cplang("card_make_price_unit");
}
if($skey == 'extcreditsval') {
if(!$title['extcreditsval']) {
$title['extcreditsval'] = cplang('card_extcreditsval');
}
}
if($skey == 'status') {
if(!$title['status']) {
$title['status'] = cplang('card_status');
}
$sval = cplang("card_manage_status_".$sval);
}
if(in_array($skey, array('dateline', 'cleardateline', 'useddateline'))) {
if($skey == 'dateline' && !$title['dateline']) {
$title['dateline'] = cplang('card_maketime');
}
if($skey == 'cleardateline' && !$title['cleardateline']) {
$title['cleardateline'] = cplang('card_make_cleardateline');
}
if($skey == 'useddateline' && !$title['useddateline']) {
$title['useddateline'] = cplang('card_used_dateline');
}
$sval = $sval ? date("Y-m-d", $sval) : '';
}
$detail .= strlen($sval) > 11 && is_numeric($sval) ? '['.$sval.'],' : $sval.',';
}
$detail = $detail."\n";
}
}
$title = is_array($title) ? $title : array($title);
$detail = implode(',', $title)."\n".$detail;
$filename = 'card_'.date('Ymd', TIMESTAMP).'.csv';
ob_end_clean();
header('Content-Encoding: none');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.$filename);
header('Pragma: no-cache');
header('Expires: 0');
if($_G['charset'] != 'gbk') {
$detail = diconv($detail, $_G['charset'], 'GBK');
}
echo $detail;
exit();
} else {
cpmsg('action_noaccess', '', 'error');
}
function cardsql() {
$_GET = daddslashes($_GET);
$_GET['srch_id'] = trim($_GET['srch_id']);
$_GET['srch_price_max'] = intval($_GET['srch_price_max']);
$_GET['srch_price_min'] = intval($_GET['srch_price_min']);
$_GET['srch_useddateline'] = trim($_GET['srch_useddateline']);
$_GET['srch_username'] = trim($_GET['srch_username']);
$_GET['srch_extcredits'] = trim($_GET['srch_extcredits']);
$_GET['srch_extcreditsval'] = intval($_GET['srch_extcreditsval']) > 0 ? intval($_GET['srch_extcreditsval']) : '' ;
$_GET['srch_username'] = trim($_GET['srch_username']);
$_GET['srch_useddateline_start'] = trim($_GET['srch_useddateline_start']);
$_GET['srch_useddateline_end'] = trim($_GET['srch_useddateline_end']);
$sqladd = '';
if($_GET['srch_id']) {
$sqladd .= " AND id LIKE '%{$_GET['srch_id']}%' ";
}
if($_GET['srch_card_type'] != '') {
$sqladd .= " AND typeid = '{$_GET['srch_card_type']}'";
}
if($_GET['srch_price_min'] && !$_GET['srch_price_max']) {
$sqladd .= " AND price = '{$_GET['srch_price_min']}'";
} elseif($_GET['srch_price_max'] && !$_GET['srch_price_min']) {
$sqladd .= " AND price = '{$_GET['srch_price_max']}'";
} elseif($_GET['srch_price_min'] && $_GET['srch_price_max']) {
$sqladd .= " AND price between '{$_GET['srch_price_min']}' AND '{$_GET['srch_price_max']}'";
}
if($_GET['srch_extcredits']) {
$sqladd .= " AND extcreditskey = '{$_GET['srch_extcredits']}'";
}
if($_GET['srch_extcreditsval']) {
$sqladd .= " AND extcreditsval = '{$_GET['srch_extcreditsval']}'";
}
if($_GET['srch_username']) {
$uid = ($uid = C::t('common_member')->fetch_uid_by_username($_GET['srch_username'])) ? $uid : C::t('common_member_archive')->fetch_uid_by_username($_GET['srch_username']);
$sqladd .= " AND uid = '{$uid}'";
}
if($_GET['srch_card_status']) {
$sqladd .= " AND status = '{$_GET['srch_card_status']}'";
}
if($_GET['srch_useddateline_start'] || $_GET['srch_useddateline_end']) {
if($_GET['srch_useddateline_start']) {
list($y, $m, $d) = explode("-", $_GET['srch_useddateline_start']);
$sqladd .= " AND useddateline >= '".mktime('0', '0', '0', $m, $d, $y)."' ";
}
if($_GET['srch_useddateline_end']) {
list($y, $m, $d) = explode("-", $_GET['srch_useddateline_end']);
$sqladd .= " AND useddateline <= '".mktime('23', '59', '59', $m, $d, $y)."' AND useddateline <> 0 ";
}
}
return $sqladd ? ' 1 '.$sqladd : '';
}
?>

View File

@@ -0,0 +1,699 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_checktools.php 36334 2017-01-03 01:32:35Z nemohou $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
if(!isfounder()) cpmsg('noaccess_isfounder', '', 'error');
if($operation == 'filecheck') {
$homecheck = !empty($_GET['homecheck']);
if(!$homecheck) {
$step = max(1, intval($_GET['step']));
shownav('tools', 'nav_filecheck');
showsubmenusteps('nav_filecheck', array(
array('nav_filecheck_confirm', $step == 1),
array('nav_filecheck_verify', $step == 2),
array('nav_filecheck_completed', $step == 3)
));
} else {
define('FOOTERDISABLED', true);
$step = 3;
}
if($step == 1) {
cpmsg(cplang('filecheck_tips_step1'), 'action=checktools&operation=filecheck&step=2', 'button', '', FALSE);
} elseif($step == 2) {
cpmsg(cplang('filecheck_verifying'), "action=checktools&operation=filecheck&step=3", 'loading', '', FALSE);
} elseif($step == 3) {
if(!$discuzfiles = @file('./source/admincp/discuzfiles.md5')) {
if(!$homecheck) {
cpmsg('filecheck_nofound_md5file', '', 'error');
} else {
ajaxshowheader();
ajaxshowfooter();
}
}
$md5data = $md5datanew = $addlist = $dellist = $modifylist = $showlist = array();
$cachelist = checkcachefiles('data/sysdata/');
checkfiles('./', '', 0);
checkfiles('config/', '', 1, 'config_global.php,config_ucenter.php');
checkfiles('data/', '\.xml', 0);
checkfiles('data/', '\.htm', 0);
checkfiles('data/log/', '\.htm', 0);
checkfiles('data/plugindata/', '\.htm', 0);
checkfiles('data/download/', '\.htm', 0);
checkfiles('data/addonmd5/', '\.htm', 0);
checkfiles('data/avatar/', '\.htm', 0);
checkfiles('data/cache/', '\.htm', 0);
checkfiles('data/ipdata/', '\.htm|\.dat', 0);
checkfiles('data/template/', '\.htm', 0);
checkfiles('data/threadcache/', '\.htm', 0);
checkfiles('template/', '');
checkfiles('api/', '');
checkfiles('source/', '', 1, 'discuzfiles.md5,plugin');
checkfiles('static/', '');
checkfiles('archiver/', '');
checkfiles('uc_client/', '\.php|\.htm', 0);
checkfiles('uc_client/data/', '\.htm');
checkfiles('uc_client/control/', '\.php|\.htm');
checkfiles('uc_client/model/', '\.php|\.htm');
checkfiles('uc_client/lib/', '\.php|\.htm');
checkfiles('uc_server/', '\.php|\.htm|\.txt|\.xml', 0);
checkfiles('uc_server/data/', '\.htm');
checkfiles('uc_server/api/', '\.php|\.htm');
checkfiles('uc_server/control/', '\.php|\.htm|\.md5');
checkfiles('uc_server/model/', '\.php|\.htm');
checkfiles('uc_server/lib/', '\.php|\.htm');
checkfiles('uc_server/plugin/', '\.php|\.htm|\.xml');
checkfiles('uc_server/upgrade/', '\.php');
checkfiles('uc_server/images/', '\..+?');
checkfiles('uc_server/js/', '\.js|\.htm');
checkfiles('uc_server/release/', '\.php');
checkfiles('uc_server/view/', '\.php|\.htm');
C::t('common_cache')->insert(array(
'cachekey' => 'checktools_filecheck',
'cachevalue' => serialize(array('dateline' => $_G['timestamp'])),
'dateline' => $_G['timestamp'],
), false, true);
foreach($discuzfiles as $line) {
$file = trim(substr($line, 34));
$md5datanew[$file] = substr($line, 0, 32);
if($md5datanew[$file] != $md5data[$file]) {
$modifylist[$file] = $md5data[$file];
}
$md5datanew[$file] = $md5data[$file];
}
$weekbefore = TIMESTAMP - 604800;
$md5data = is_array($md5data) ? $md5data : array();
$md5datanew = is_array($md5datanew) ? $md5datanew : array();
$addlist = array_merge(array_diff_assoc($md5data, $md5datanew), is_array($cachelist[2]) ? $cachelist[2] : array());
$dellist = array_diff_assoc($md5datanew, $md5data);
$modifylist = array_merge(array_diff_assoc($modifylist, $dellist), is_array($cachelist[1]) ? $cachelist[1] : array());
$showlist = array_merge($md5data, $md5datanew, $cachelist[0]);
$doubt = 0;
$dirlist = $dirlog = array();
foreach($showlist as $file => $md5) {
$dir = dirname($file);
if(is_array($modifylist) && array_key_exists($file, $modifylist)) {
$fileststus = 'modify';
} elseif(is_array($dellist) && array_key_exists($file, $dellist)) {
$fileststus = 'del';
} elseif(is_array($addlist) && array_key_exists($file, $addlist)) {
$fileststus = 'add';
} else {
$filemtime = @filemtime($file);
if($filemtime > $weekbefore) {
$fileststus = 'doubt';
$doubt++;
} else {
$fileststus = '';
}
}
if(file_exists($file)) {
$filemtime = @filemtime($file);
$fileststus && $dirlist[$fileststus][$dir][basename($file)] = array(number_format(filesize($file)).' Bytes', dgmdate($filemtime));
} else {
$fileststus && $dirlist[$fileststus][$dir][basename($file)] = array('', '');
}
}
$modifiedfiles = count($modifylist);
$deletedfiles = count($dellist);
$unknownfiles = count($addlist);
$doubt = intval($doubt);
C::t('common_cache')->insert(array(
'cachekey' => 'checktools_filecheck_result',
'cachevalue' => serialize(array($modifiedfiles, $deletedfiles, $unknownfiles, $doubt)),
'dateline' => $_G['timestamp'],
), false, true);
if($homecheck) {
ajaxshowheader();
echo "<div><em class=\"".($modifiedfiles ? 'edited' : 'correct')."\">{$lang['filecheck_modify']}<span class=\"bignum\">$modifiedfiles</span></em>".
"<em class=\"".($deletedfiles ? 'del' : 'correct')."\">{$lang['filecheck_delete']}<span class=\"bignum\">$deletedfiles</span></em>".
"<em class=\"unknown\">{$lang['filecheck_unknown']}<span class=\"bignum\">$unknownfiles</span></em>".
"<em class=\"unknown\">{$lang['filecheck_doubt']}<span class=\"bignum\">$doubt</span></em></div><p>".
$lang['filecheck_last_homecheck'].': '.dgmdate(TIMESTAMP, 'u').' <a href="'.ADMINSCRIPT.'?action=checktools&operation=filecheck&step=3">['.$lang['filecheck_view_list'].']</a></p>';
ajaxshowfooter();
}
$result = $resultjs = '';
$dirnum = 0;
foreach($dirlist as $status => $filelist) {
$dirnum++;
$class = $status == 'modify' ? 'edited' : ($status == 'del' ? 'del' : 'unknown');
$result .= '<tbody id="status_'.$status.'" style="display:'.($status != 'modify' ? 'none' : '').'">';
foreach($filelist as $dir => $files) {
$result .= '<tr><td colspan="4"><div class="ofolder">'.$dir.'</div><div class="margintop marginbot">';
foreach($files as $filename => $file) {
$result .= '<tr><td><em class="files bold">'.$filename.'</em></td><td style="text-align: right">'.$file[0].'&nbsp;&nbsp;</td><td>'.$file[1].'</td><td><em class="'.$class.'">&nbsp;</em></td></tr>';
}
}
$result .= '</tbody>';
$resultjs .= '$(\'status_'.$status.'\').style.display=\'none\';';
}
$result .= '<script>function showresult(o) {'.$resultjs.'$(\'status_\' + o).style.display=\'\';}</script>';
showtips('filecheck_tips');
showboxheader('filecheck_completed');
echo "<div>".
"<em class=\"edited\">{$lang['filecheck_modify']}: $modifiedfiles</em> ".($modifiedfiles > 0 ? "<a href=\"###\" onclick=\"showresult('modify')\">[{$lang['view']}]</a> " : '').
" &nbsp; <em class=\"del\">{$lang['filecheck_delete']}: $deletedfiles</em> ".($deletedfiles > 0 ? "<a href=\"###\" onclick=\"showresult('del')\">[{$lang['view']}]</a> " : '').
" &nbsp; <em class=\"unknown\">{$lang['filecheck_unknown']}: $unknownfiles</em> ".($unknownfiles > 0 ? "<a href=\"###\" onclick=\"showresult('add')\">[{$lang['view']}]</a> " : '').
($doubt > 0 ? "&nbsp;&nbsp;&nbsp;&nbsp;<em class=\"unknown\">{$lang['filecheck_doubt']}: $doubt</em> <a href=\"###\" onclick=\"showresult('doubt')\">[{$lang['view']}]</a> " : '').
"</div></div><div class=\"boxbody\">";
showtableheader();
showsubtitle(array('filename', '', 'lastmodified', ''));
echo $result;
showtablefooter();
showboxfooter();
}
} elseif($operation == 'hookcheck') {
$step = max(1, intval($_GET['step']));
shownav('tools', 'nav_hookcheck');
showsubmenusteps('nav_hookcheck', array(
array('nav_hookcheck_confirm', $step == 1),
array('nav_hookcheck_verify', $step == 2),
array('nav_hookcheck_completed', $step == 3)
));
showtips('hookcheck_tips');
if($step == 1) {
$styleselect = "<br><br><select name=\"styleid\">";
foreach(C::t('common_style')->fetch_all_data() as $style) {
$styleselect .= "<option value=\"{$style['styleid']}\" ".
($style['styleid'] == $_G['setting']['styleid'] ? 'selected="selected"' : NULL).
">{$style['name']}</option>\n";
}
$styleselect .= '</select>';
cpmsg(cplang('hookcheck_tips_step1', array('template' => $styleselect)), 'action=checktools&operation=hookcheck&step=2', 'form', '', FALSE);
} elseif($step == 2) {
cpmsg(cplang('hookcheck_verifying'), "action=checktools&operation=hookcheck&step=3&styleid={$_POST['styleid']}", 'loading', '', FALSE);
} elseif($step == 3) {
if(!$discuzfiles = @file('./source/admincp/discuzhook.dat')) {
cpmsg('filecheck_nofound_md5file', '', 'error');
}
$discuzhookdata = $hookdata = array();
$discuzhookdata_hook = array();
$styleid = intval($_GET['styleid']);
if(!$styleid) {
$styleid = $_G['setting']['styleid'];
}
$style = C::t('common_style')->fetch_by_styleid($styleid);
checkhook(substr($style['directory'], 2).'/', '\.htm|\.php', 1);
foreach($discuzfiles as $line) {
list($file, $hook) = explode(' *', trim($line));
if($hook) {
$discuzhookdata[$file][$hook][] = $hook;
$discuzhookdata_hook[$file][] = $hook;
}
}
$diffhooklist = $difffilelist = array();
$diffnum = 0;
foreach($discuzhookdata as $file => $hook) {
$dir = dirname($file);
$filen = str_replace('template/default/', substr($style['directory'], 2).'/', $file);
if(isset($hookdata[$filen])) {
foreach($hook as $k => $hookarr) {
$hooknum = empty($hookarr) ? 0 : count($hookarr);
$hookdatanum = empty($hookdata[$filen][$k]) ? 0 : count($hookdata[$filen][$k]);
if(($diff = $hooknum - $hookdatanum) > 0) {
for($i = 0; $i < $diff; $i++) {
$diffhooklist[$file][] = $k;
}
}
}
if(!empty($diffhooklist[$file])) {
$difffilelist[$dir][] = $file;
$diffnum++;
}
}
}
foreach($difffilelist as $dir => $files) {
$dir = str_replace('template/default/', substr($style['directory'], 2).'/', $dir);
$result .= '<tbody><tr><td class="td30"><a href="javascript:;" onclick="toggle_group(\'dir_'.$dir.'\')" id="a_dir_'.$dir.'">[-]</a></td><td colspan="3"><div class="ofolder">'.$dir.'</div></td></tr></tbody>';
$result .= '<tbody id="dir_'.$dir.'">';
foreach($files as $file) {
$result .= '<tr><td></td><td><em class="files bold">'.basename($file).'</em></td><td>';
foreach($discuzhookdata_hook[$file] as $hook) {
$result .= '<p>'.dhtmlspecialchars($hook).'</p>';
}
$result .= '</td><td>';
foreach($diffhooklist[$file] as $hook) {
$result .= '<p>'.dhtmlspecialchars($hook).'</p>';
}
$result .= '</td></tr>';
}
$result .= '</tbody>';
}
if($diffnum > 20) {
$result .= '<script type="text/javascript">hide_all_hook(\'dir_\', \'tbody\');</script>';
}
if($diffnum) {
showformheader('forums');
showtableheader('hookcheck_completed');
showtablerow('', 'colspan="4"', "<div class=\"margintop marginbot\">".
'<a href="javascript:;" onclick="show_all_hook(\'dir_\', \'tbody\')">'.$lang['show_all'].'</a> | <a href="javascript:;" onclick="hide_all_hook(\'dir_\', \'tbody\')">'.$lang['hide_all'].'</a>'.
" &nbsp; <em class=\"del\">{$lang['hookcheck_delete']}: $diffnum</em> ".
"</div>");
showsubtitle(array('', 'filename', 'hookcheck_discuzhook', 'hookcheck_delhook'));
echo $result;
showtablefooter();
showformfooter();
} else {
cpmsg('hookcheck_nodelhook', '', 'succeed', '', FALSE);
}
}
} elseif($operation == 'replacekey') {
$step = max(1, intval($_GET['step']));
shownav('tools', 'nav_replacekey');
showsubmenusteps('nav_replacekey', array(
array('nav_replacekey_confirm', $step == 1),
array('nav_replacekey_verify', $step == 2),
array('nav_replacekey_completed', $step == 3)
));
showtips('replacekey_tips');
if($step == 1) {
cpmsg(cplang('replacekey_tips_step1'), 'action=checktools&operation=replacekey&step=2', 'form', '', FALSE);
} elseif($step == 2) {
cpmsg(cplang('replacekey_tips_step2'), "action=checktools&operation=replacekey&step=3", 'loading', '', FALSE);
} elseif($step == 3) {
if(!is_writeable('./config/config_global.php')) {
cpmsg('replacekey_must_write_config', '', 'error');
}
$oldauthkey = $_G['config']['security']['authkey'];
$newauthkey = generate_key(64);
$configfile = trim(file_get_contents(DISCUZ_ROOT.'./config/config_global.php'));
$configfile = substr($configfile, -2) == '?>' ? substr($configfile, 0, -2) : $configfile;
$configfile = str_replace($oldauthkey, $newauthkey, $configfile);
if(file_put_contents(DISCUZ_ROOT.'./config/config_global.php', trim($configfile)) === false) {
cpmsg('replacekey_must_write_config', '', 'error');
}
$ecdata = authcode($_G['setting']['ec_contract'], 'DECODE', $oldauthkey);
$ecdata = authcode($ecdata, 'ENCODE', $newauthkey);
C::t('common_setting')->update('ec_contract', $ecdata);
$ftpdata = $_G['setting']['ftp'];
$ftppasswd = authcode($ftpdata['password'], 'DECODE', md5($oldauthkey));
$ftpdata['password'] = authcode($ftppasswd, 'ENCODE', md5($newauthkey));
C::t('common_setting')->update('ftp', $ftpdata);
updatecache('setting');
cpmsg('replacekey_succeed', '', 'succeed', '', FALSE);
}
} elseif($operation == 'ftpcheck') {
$alertmsg = '';
$testcontent = md5('Discuz!' . random(64));
$testfile = 'test/discuztest.txt';
$attach_dir = $_G['setting']['attachdir'];
@mkdir($attach_dir.'test', 0777);
if(file_put_contents($attach_dir.'/'.$testfile, $testcontent) === false) {
$alertmsg = cplang('setting_attach_remote_wtferr');
}
if(!$alertmsg) {
$settingnew = $_GET['settingnew'];
$settings['ftp'] = C::t('common_setting')->fetch_setting('ftp', true);
$settings['ftp']['password'] = authcode($settings['ftp']['password'], 'DECODE', md5($_G['config']['security']['authkey']));
$pwlen = strlen($settingnew['ftp']['password']);
if($settingnew['ftp']['password'][0] == $settings['ftp']['password'][0] && $settingnew['ftp']['password'][$pwlen - 1] == $settings['ftp']['password'][strlen($settings['ftp']['password']) - 1] && substr($settingnew['ftp']['password'], 1, $pwlen - 2) == '********') {
$settingnew['ftp']['password'] = $settings['ftp']['password'];
}
$settingnew['ftp']['password'] = authcode($settingnew['ftp']['password'], 'ENCODE', md5($_G['config']['security']['authkey']));
$settingnew['ftp']['attachurl'] .= substr($settingnew['ftp']['attachurl'], -1, 1) != '/' ? '/' : '';
$_G['setting']['ftp'] = $settingnew['ftp'];
ftpcmd('upload', $testfile);
$ftp = ftpcmd('object');
if(ftpcmd('error')) {
$alertmsg = cplang('setting_attach_remote_'.ftpcmd('error'));
}
if(!$alertmsg) {
$str = getremotefile($_G['setting']['ftp']['attachurl'].$testfile);
if($str !== $testcontent) {
$alertmsg = cplang('setting_attach_remote_geterr');
}
}
if(!$alertmsg) {
ftpcmd('delete', $testfile);
ftpcmd('delete', 'test/index.htm');
$ftp->ftp_rmdir('test');
$str = getremotefile($_G['setting']['ftp']['attachurl'].$testfile);
if($str === $testcontent) {
$alertmsg = cplang('setting_attach_remote_delerr');
}
@unlink($attach_dir.'/'.$testfile);
@rmdir($attach_dir.'test');
}
}
if(!$alertmsg) {
$alertmsg = cplang('setting_attach_remote_ok');
}
echo '<script language="javascript">alert(\''.str_replace('\'', '\\\'', $alertmsg).'\');parent.$(\'cpform\').action=\''.ADMINSCRIPT.'?action=setting&edit=yes\';parent.$(\'cpform\').target=\'_self\'</script>';
} elseif($operation == 'mailcheck') {
$oldmail = dunserialize($_G['setting']['mail']);
$settingnew = $_GET['settingnew'];
$oldsmtp = $settingnew['mail']['mailsend'] == 3 ? $settingnew['mail']['smtp'] : $settingnew['mail']['esmtp'];
$deletesmtp = $settingnew['mail']['mailsend'] != 1 ? ($settingnew['mail']['mailsend'] == 3 ? $settingnew['mail']['smtp']['delete'] : $settingnew['mail']['esmtp']['delete']) : array();
$settingnew['mail']['smtp'] = array();
foreach($oldsmtp as $id => $value) {
if((empty($deletesmtp) || !in_array($id, $deletesmtp)) && !empty($value['server']) && !empty($value['port'])) {
$passwordmask = $oldmail['smtp'][$id]['auth_password'] ? $oldmail['smtp'][$id]['auth_password'][0].'********'.substr($oldmail['smtp'][$id]['auth_password'], -2) : '';
$value['auth_password'] = $value['auth_password'] == $passwordmask ? $oldmail['smtp'][$id]['auth_password'] : $value['auth_password'];
$settingnew['mail']['smtp'][] = $value;
}
}
if(!empty($_GET['newsmtp'])) {
foreach($_GET['newsmtp']['server'] as $id => $smtp) {
if(!empty($smtp) && !empty($_GET['newsmtp']['port'][$id])) {
$settingnew['mail']['smtp'][] = array(
'server' => $smtp,
'port' => $_GET['newsmtp']['port'][$id] ? intval($_GET['newsmtp']['port'][$id]) : 25,
'auth' => $_GET['newsmtp']['auth'][$id] ? 1 : 0,
'from' => $_GET['newsmtp']['from'][$id],
'auth_username' => $_GET['newsmtp']['auth_username'][$id],
'auth_password' => $_GET['newsmtp']['auth_password'][$id],
'precedence' => $_GET['newsmtp']['precedence'][$id]
);
}
}
}
$_G['setting']['mail'] = serialize($settingnew['mail']);
$test_to = $_GET['test_to'];
$test_from = $_GET['test_from'];
$date = date('Y-m-d H:i:s');
$alertmsg = '';
$title = $lang['setting_mailcheck_title_'.$settingnew['mail']['mailsend']];
$message = $lang['setting_mailcheck_message_'.$settingnew['mail']['mailsend']].' '.$test_from.$lang['setting_mailcheck_date'].' '.$date;
$_G['setting']['bbname'] = $lang['setting_mail_check_method_1'];
include libfile('function/mail');
$succeed = sendmail($test_to, $title.' @ '.$date, $_G['setting']['bbname']."\n\n\n$message", $test_from);
$_G['setting']['bbname'] = $lang['setting_mail_check_method_2'];
$succeed = sendmail($test_to, $title.' @ '.$date, $_G['setting']['bbname']."\n\n\n$message", $test_from);
if($succeed) {
$alertmsg = $lang['setting_mail_check_success_1']."$title @ $date".$lang['setting_mail_check_success_2'];
} else {
$alertmsg = $lang['setting_mail_check_error'].$alertmsg;
}
echo '<script language="javascript">alert(\''.str_replace(array('\'', "\n", "\r"), array('\\\'', '\n', ''), $alertmsg).'\');parent.$(\'cpform\').action=\''.ADMINSCRIPT.'?action=setting&edit=yes\';parent.$(\'cpform\').target=\'_self\';parent.$(\'cpform\').operation.value=\'mail\';</script>';
} elseif($operation == 'imagepreview') {
$settingnew = $_GET['settingnew'];
if(!empty($_GET['previewthumb'])) {
$_G['setting']['imagelib'] = $settingnew['imagelib'];
$_G['setting']['thumbwidth'] = $settingnew['thumbwidth'];
$_G['setting']['thumbheight'] = $settingnew['thumbheight'];
$_G['setting']['thumbquality'] = $settingnew['thumbquality'];
require_once libfile('class/image');
@unlink(DISCUZ_ROOT.$_G['setting']['attachdir'].'./temp/watermark_temp1.jpg');
@unlink(DISCUZ_ROOT.$_G['setting']['attachdir'].'./temp/watermark_temp2.jpg');
$image = new image;
$r = 0;
if(!($r = $image->Thumb(DISCUZ_ROOT.'./static/image/admincp/watermarkpreview.jpg', 'temp/watermark_temp1.jpg', $_G['setting']['thumbwidth'], $_G['setting']['thumbheight'], 1))) {
$r = $image->error();
}
$sizetarget1 = $image->imginfo['size'];
$image->Thumb(DISCUZ_ROOT.'./static/image/admincp/watermarkpreview.jpg', 'temp/watermark_temp2.jpg', $_G['setting']['thumbwidth'], $_G['setting']['thumbheight'], 2);
$sizetarget2 = $image->imginfo['size'];
if($r > 0) {
showsubmenu('imagepreview_thumb');
$sizesource = filesize(DISCUZ_ROOT.'./static/image/admincp/watermarkpreview.jpg');
echo '<img src="data/attachment/temp/watermark_temp1.jpg?'.random(5).'"><br /><br />'.
$lang['imagepreview_imagesize_source'].' '.number_format($sizesource).' Bytes &nbsp;&nbsp;'.
$lang['imagepreview_imagesize_target'].' '.number_format($sizetarget1).' Bytes ('.
(sprintf("%2.1f", $sizetarget1 / $sizesource * 100)).'%)<br /><br />';
echo '<img src="data/attachment/temp/watermark_temp2.jpg?'.random(5).'"><br /><br />'.
$lang['imagepreview_imagesize_source'].' '.number_format($sizesource).' Bytes &nbsp;&nbsp;'.
$lang['imagepreview_imagesize_target'].' '.number_format($sizetarget2).' Bytes ('.
(sprintf("%2.1f", $sizetarget2 / $sizesource * 100)).'%)';
} else {
cpmsg('imagepreview_errorcode_'.$r, '', 'error');
}
} else {
$type = $_GET['type'];
$status = dunserialize($_G['setting']['watermarkstatus']);
$status = is_array($status) ? $status : array();
if(!array_key_exists($type, $status) || !$status[$type]) {
cpmsg('watermarkpreview_error', '', 'error');
}
require_once libfile('class/image');
@unlink(DISCUZ_ROOT.'./data/attachment/temp/watermark_temp3.jpg');
$image = new image;
if(!($r = $image->Watermark(DISCUZ_ROOT.'./static/image/admincp/watermarkpreview.jpg', 'temp/watermark_temp3.jpg', $type))) {
$r = $image->error();
}
if($r > 0) {
showsubmenu('imagepreview_watermark');
$sizesource = filesize('static/image/admincp/watermarkpreview.jpg');
$sizetarget = $image->imginfo['size'];
echo '<img src="data/attachment/temp/watermark_temp3.jpg?'.random(5).'"><br /><br />'.
$lang['imagepreview_imagesize_source'].' '.number_format($sizesource).' Bytes &nbsp;&nbsp;'.
$lang['imagepreview_imagesize_target'].' '.number_format($sizetarget).' Bytes ('.
(sprintf("%2.1f", $sizetarget / $sizesource * 100)).'%)';
} else {
cpmsg('imagepreview_errorcode_'.$r, '', 'error');
}
}
} elseif($operation == 'rewrite') {
$rule = array();
$rewritedata = rewritedata();
$rule['{apache1}'] = $rule['{apache2}'] = $rule['{iis}'] = $rule['{iis7}'] = $rule['{nginx}'] = $rule['{lighttpd}'] = $rule['{caddy}'] = '';
foreach($rewritedata['rulesearch'] as $k => $v) {
if(!is_array($_G['setting']['rewritestatus']) || !in_array($k, $_G['setting']['rewritestatus'])) {
continue;
}
$v = empty($_G['setting']['rewriterule'][$k]) ? $v : $_G['setting']['rewriterule'][$k];
$pvmaxv = count($rewritedata['rulevars'][$k]) + 2;
$vkeys = array_keys($rewritedata['rulevars'][$k]);
$rewritedata['rulereplace'][$k] = pvsort($vkeys, $v, $rewritedata['rulereplace'][$k]);
$v = str_replace($vkeys, $rewritedata['rulevars'][$k], addcslashes($v, '?*+^$.[]()|'));
$rulepath = $k != 'forum_archiver' ? '' : 'archiver/';
$rule['{apache1}'] .= "\t".'RewriteCond %{QUERY_STRING} ^(.*)$'."\n\t".'RewriteRule ^(.*)/'.$rulepath.$v.'$ $1/'.$rulepath.pvadd($rewritedata['rulereplace'][$k])."&%1\n";
$rule['{apache2}'] .= 'RewriteCond %{QUERY_STRING} ^(.*)$'."\n".'RewriteRule ^'.$rulepath.$v.'$ '.$rulepath.$rewritedata['rulereplace'][$k]."&%1\n";
$rule['{iis}'] .= 'RewriteRule ^(.*)/'.$rulepath.$v.'(\?(.*))*$ $1/'.$rulepath.addcslashes(pvadd($rewritedata['rulereplace'][$k]).'&$'.($pvmaxv + 1), '.?')."\n";
$rule['{iis7}'] .= "\t\t".'&lt;rule name="'.$k.'"&gt;'."\n\t\t\t".'&lt;match url="^(.*/)*'.$rulepath.str_replace('\.', '.', $v).'\?*(.*)$" /&gt;'."\n\t\t\t".'&lt;action type="Rewrite" url="{R:1}/'.str_replace(array('&', 'page\%3D'), array('&amp;amp;', 'page%3D'), $rulepath.addcslashes(pvadd($rewritedata['rulereplace'][$k], array('{R:', '}')).'&{R:'.$pvmaxv.'}', '?')).'" /&gt;'."\n\t\t".'&lt;/rule&gt;'."\n";
$rule['{nginx}'] .= 'rewrite ^([^\.]*)/'.$rulepath.$v.'$ $1/'.$rulepath.stripslashes(pvadd($rewritedata['rulereplace'][$k]))." last;\n";
$rule['{lighttpd}'] .= '"(.*)/'.$rulepath.$v.'\?*(.*)$" =&gt; "$1/'.$rulepath.pvadd($rewritedata['rulereplace'][$k]).'&$'.$pvmaxv.'",'."\n";
$rule['{caddy}'] .= '@'.$k.' path_regexp '.$k.' ^(.*)/'.$rulepath.$v."$\n".'rewrite @'.$k.' {re.'.$k.'.1}/'.$rulepath.pvadd($rewritedata['rulereplace'][$k], array('{re.'.$k.'.', '}')).'&{query}'."\n";
}
$rule['{nginx}'] .= "if (!-e \$request_filename) {\n\treturn 404;\n}";
$rule['{siteroot}'] = !empty($_G['siteroot']) ? $_G['siteroot'] : '/';
echo str_replace(array_keys($rule), $rule, cplang('rewrite_message'));
} elseif($operation == 'robots') {
if($do == 'output') {
$robots = implode('', file(DISCUZ_ROOT.'./source/admincp/robots.txt'));
$robots = str_replace('{path}', $_G['siteroot'], $robots);
$robots = str_replace('{ver}', $_G['setting']['version'], $robots);
ob_end_clean();
dheader('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
dheader('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
dheader('Cache-Control: no-cache, must-revalidate');
dheader('Pragma: no-cache');
dheader('Content-Encoding: none');
dheader('Content-Length: '.strlen($robots));
dheader('Content-Disposition: attachment; filename=robots.txt');
dheader('Content-Type: text/plain');
echo $robots;
define('FOOTERDISABLED' , 1);
exit();
}
cpmsg('robots_output', 'action=checktools&operation=robots&do=output&frame=no', 'download', array('siteurl' => dhtmlspecialchars($_G['scheme'].'://'.$_SERVER['HTTP_HOST'].'/')));
}
function pvsort($key, $v, $s) {
$r = '/';
$p = '';
foreach($key as $k) {
$r .= $p.preg_quote($k);
$p = '|';
}
$r .= '/';
preg_match_all($r, $v, $a);
$a = $a[0];
$a = array_flip($a);
foreach($a as $key => $value) {
$s = str_replace($key, '$'.($value + 1), $s);
}
return $s;
}
function pvadd($s, $t = array()) {
$s = str_replace(array('$3', '$2', '$1'), array('~4', '~3', '~2'), $s);
if(!$t) {
return str_replace(array('~4', '~3', '~2'), array('$4', '$3', '$2'), $s);
} else {
return str_replace(array('~4', '~3', '~2'), array($t[0].'4'.$t[1], $t[0].'3'.$t[1], $t[0].'2'.$t[1]), $s);
}
}
function checkfiles($currentdir, $ext = '', $sub = 1, $skip = '') {
global $md5data;
$dir = @opendir(DISCUZ_ROOT.$currentdir);
$exts = '/('.$ext.')$/i';
$skips = explode(',', $skip);
if($dir == false) {
return;
}
while($entry = @readdir($dir)) {
$file = $currentdir.$entry;
if($entry != '.' && $entry != '..' && (($ext && preg_match($exts, $entry) || !$ext) || $sub && is_dir($file)) && !in_array($entry, $skips)) {
if($sub && is_dir($file)) {
checkfiles($file.'/', $ext, $sub, $skip);
} else {
if(is_dir($file)) {
$md5data[$file] = md5($file);
} else {
$md5data[$file] = md5_file($file);
}
}
}
}
}
function checkcachefiles($currentdir) {
global $_G;
$dir = opendir($currentdir);
$exts = '/\.php$/i';
$showlist = $modifylist = $addlist = array();
while($entry = readdir($dir)) {
$file = $currentdir.$entry;
if($entry != '.' && $entry != '..' && preg_match($exts, $entry)) {
$fp = fopen($file, "rb");
$cachedata = fread($fp, filesize($file));
fclose($fp);
if(preg_match("/^<\?php\n\/\/Discuz! cache file, DO NOT modify me!\n\/\/Identify: (\w+)\n\n(.+?)\?>$/s", $cachedata, $match)) {
$showlist[$file] = $md5 = $match[1];
$cachedata = $match[2];
if(md5($entry.$cachedata.$_G['config']['security']['authkey']) != $md5) {
$modifylist[$file] = $md5;
}
} else {
$showlist[$file] = '';
}
}
}
return array($showlist, $modifylist, $addlist);
}
function checkmailerror($type, $error) {
global $alertmsg;
$alertmsg .= !$alertmsg ? $error : '';
}
function getremotefile($file) {
global $_G;
@set_time_limit(0);
$file = $file.'?'.TIMESTAMP.rand(1000, 9999);
if(strpos($file, 'ftp://') === 0) {
$str = file_get_contents($file);
} else {
$str = dfsockopen($file);
}
return $str;
}
function checkhook($currentdir, $ext = '', $sub = 1, $skip = '') {
global $hooks, $hookdata;
$dir = opendir($currentdir);
$exts = '/('.$ext.')$/i';
$skips = explode(',', $skip);
while($entry = readdir($dir)) {
$file = $currentdir.$entry;
if($entry != '.' && $entry != '..' && (preg_match($exts, $entry) || $sub && is_dir($file)) && !in_array($entry, $skips)) {
if($sub && is_dir($file)) {
checkhook($file.'/', $ext, $sub, $skip);
} else {
$data = file_get_contents($file);
$hooks = array();
preg_replace_callback("/\{hook\/(\w+?)(\s+(.+?))?\}/i", 'checkhook_callback_findhook_13', $data);
if($hooks) {
foreach($hooks as $v) {
if(preg_match('/\.php$/', $file)) {
$file = substr($file, 0, -4).'.htm';
}
$hookdata[$file][$v][] = $v;
}
}
}
}
}
}
function checkhook_callback_findhook_13($matches) {
return findhook($matches[1], $matches[3]);
}
function findhook($hookid, $key) {
global $hooks;
if($key) {
$key = ' '.$key;
}
$hooks[] = '<!--{hook/'.$hookid.$key.'}-->';
}
function generate_key($length = 32) {
$random = secrandom($length);
$info = md5($_SERVER['SERVER_SOFTWARE'].$_SERVER['SERVER_NAME'].$_SERVER['SERVER_ADDR'].$_SERVER['SERVER_PORT'].$_SERVER['HTTP_USER_AGENT'].time());
$return = '';
for($i=0; $i<$length; $i++) {
$return .= $random[$i].$info[$i];
}
return $return;
}

View File

@@ -0,0 +1,130 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_click.php 25246 2011-11-02 03:34:53Z zhangguosheng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
$operation = $operation ? $operation : '';
cpheader();
if(empty($operation)) {
$idtype = in_array($_GET['idtype'], array('blogid', 'picid', 'aid')) ? trim($_GET['idtype']) : 'blogid';
if(!submitcheck('clicksubmit')) {
shownav('style', 'click_edit');
showsubmenu('nav_click', array(
array('click_edit_blogid', 'click&idtype=blogid', $idtype == 'blogid' ? 1 : 0),
array('click_edit_picid', 'click&idtype=picid', $idtype == 'picid' ? 1 : 0),
array('click_edit_aid', 'click&idtype=aid', $idtype == 'aid' ? 1 : 0),
));
showtips('click_edit_tips');
showformheader('click&idtype='.$idtype);
showtableheader();
showtablerow('', array('class="td25"', 'class="td28"', 'class="td25"', 'class="td25"', '', '', '', 'class="td23"', 'class="td25"'), array(
'',
cplang('display_order'),
'',
cplang('available'),
cplang('name'),
cplang('click_edit_image'),
cplang('click_edit_type'),
));
print <<<EOF
<script type="text/JavaScript">
var rowtypedata = [
[
[1,'', 'td25'],
[1,'<input type="text" class="txt" name="newdisplayorder[]" size="3">', 'td28'],
[1,'', 'td25'],
[1,'<input type="checkbox" name="newavailable[]" value="1">', 'td25'],
[1,'<input type="text" class="txt" name="newname[]" size="10">'],
[1,'<input type="text" class="txt" name="newicon[]" size="20">'],
[1,'', 'td23']
]
];
</script>
EOF;
foreach(C::t('home_click')->fetch_all_by_idtype($idtype) as $click) {
$checkavailable = $click['available'] ? 'checked' : '';
$click['idtype'] = cplang('click_edit_'.$click['idtype']);
$iconurl = preg_match('/^https?:\/\//is', $click['icon']) ? $click['icon'] : STATICURL . 'image/click/' . $click['icon'];
showtablerow('', array('class="td25"', 'class="td28"', 'class="td25"', 'class="td25"', '', '', '', 'class="td23"', 'class="td25"'), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"{$click['clickid']}\">",
"<input type=\"text\" class=\"txt\" size=\"3\" name=\"displayorder[{$click['clickid']}]\" value=\"{$click['displayorder']}\">",
"<img src=\"$iconurl\">",
"<input class=\"checkbox\" type=\"checkbox\" name=\"available[{$click['clickid']}]\" value=\"1\" $checkavailable>",
"<input type=\"text\" class=\"txt\" size=\"10\" name=\"name[{$click['clickid']}]\" value=\"{$click['name']}\">",
"<input type=\"text\" class=\"txt\" size=\"20\" name=\"icon[{$click['clickid']}]\" value=\"{$click['icon']}\">",
$click['idtype']
));
}
echo '<tr><td></td><td colspan="8"><div><a href="###" onclick="addrow(this, 0)" class="addtr">'.$lang['click_edit_addnew'].'</a></div></td></tr>';
showsubmit('clicksubmit', 'submit', 'del');
showtablefooter();
showformfooter();
} else {
$ids = array();
if(is_array($_GET['delete'])) {
foreach($_GET['delete'] as $id) {
$ids[] = $id;
}
if($ids) {
C::t('home_click')->delete($ids, true);
}
}
if(is_array($_GET['name'])) {
foreach($_GET['name'] as $id => $val) {
$id = intval($id);
$updatearr = array(
'name' => dhtmlspecialchars($_GET['name'][$id]),
'icon' => $_GET['icon'][$id],
'idtype' => $idtype,
'available' => intval($_GET['available'][$id]),
'displayorder' => intval($_GET['displayorder'][$id]),
);
C::t('home_click')->update($id, $updatearr);
}
}
if(is_array($_GET['newname'])) {
foreach($_GET['newname'] as $key => $value) {
if($value != '' && $_GET['newicon'][$key] != '') {
$data = array(
'name' => dhtmlspecialchars($value),
'icon' => $_GET['newicon'][$key],
'idtype' => $idtype,
'available' => intval($_GET['newavailable'][$key]),
'displayorder' => intval($_GET['newdisplayorder'][$key])
);
C::t('home_click')->insert($data);
}
}
}
$keys = $ids = $_G['cache']['click'] = array();
foreach(C::t('home_click')->fetch_all_by_available() as $value) {
if(!isset($_G['cache']['click'][$value['idtype']]) || count($_G['cache']['click'][$value['idtype']]) < 8) {
$keys[$value['idtype']] = $keys[$value['idtype']] ? ++$keys[$value['idtype']] : 1;
$_G['cache']['click'][$value['idtype']][$keys[$value['idtype']]] = $value;
} else {
$ids[] = $value['clickid'];
}
}
if($ids) {
C::t('home_click')->update($ids, array('available'=>0), true);
}
updatecache('click');
cpmsg('click_edit_succeed', 'action=click&idtype='.$idtype, 'succeed');
}
}
?>

View File

@@ -0,0 +1,312 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_cloudaddons.php 36311 2016-12-19 01:47:34Z nemohou $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
require_once libfile('function/cloudaddons');
cpheader();
if(!$admincp->isfounder) {
cpmsg('noaccess_isfounder', '', 'error');
}
if(!$operation || in_array($operation, array('plugins', 'templates'))) {
cloudaddons_check();
shownav('cloudaddons');
$extra = '';
if(empty($_GET['frame'])) {
parse_str($_SERVER['QUERY_STRING'], $query);
$query['frame'] = 'no';
$query_sting_tmp = http_build_query($query);
$url = ADMINSCRIPT.'?'.$query_sting_tmp;
echo '<script type="text/javascript">top.location.href=\''.$url.'\';</script>';
} else {
if(!empty($operation)) {
$extra .= '&view='.rawurlencode($operation);
}elseif(!empty($_GET['id'])) {
$extra .= '&mod=app&ac=item&id='.rawurlencode($_GET['id']);
}
if(!empty($_GET['from'])) {
$extra .= '&from='.rawurlencode($_GET['from']);
}
if(!empty($_GET['extra'])) {
$extra .= '&'.addslashes($_GET['extra']);
}
$url = cloudaddons_url($extra);
echo '<script type="text/javascript">location.href=\''.$url.'\';</script>';
}
} elseif($operation == 'download') {
$step = intval($_GET['step']);
$addoni = intval($_GET['i']);
if(!$_GET['md5hash'] || md5($_GET['addonids'].md5(cloudaddons_getuniqueid().$_GET['timestamp'])) != $_GET['md5hash']) {
cpmsg('cloudaddons_validator_error', '', 'error');
}
$addonids = explode(',', $_GET['addonids']);
list($_GET['key'], $_GET['type'], $_GET['rid']) = explode('.', isset($addonids[$addoni]) ? $addonids[$addoni] : $addonids[0]);
if($step == 0) {
cpmsg('cloudaddons_downloading', "action=cloudaddons&operation=download&addonids={$_GET['addonids']}&i=$addoni&step=1&md5hash=".$_GET['md5hash'].'&timestamp='.$_GET['timestamp'], 'loading', array('addonid' => $_GET['key'].'.'.$_GET['type']), '<div>0%</div>', FALSE);
} elseif($step == 1) {
$packnum = isset($_GET['num']) ? $_GET['num'] : 0;
$tmpdir = DISCUZ_ROOT.'./data/download/'.$_GET['rid'];
$end = '';
$md5tmp = DISCUZ_ROOT.'./data/download/'.$_GET['rid'].'.md5';
if($packnum) {
list($md5total, $md5s) = dunserialize(implode('', @file($md5tmp)));
dmkdir($tmpdir, 0777, false);
} else {
dir_clear($tmpdir);
@unlink($md5tmp);
dmkdir($tmpdir, 0777, false);
$md5total = '';
$md5s = array();
}
$data = cloudaddons_open('&mod=app&ac=download&rid='.$_GET['rid'].'&packnum='.$packnum.'&downloadts='.$_GET['timestamp'], '', 999);
if(empty($data)){
cpmsg('cloudaddons_downloading', "action=cloudaddons&operation=download&addonids={$_GET['addonids']}&i=$addoni&step=1&md5hash=".$_GET['md5hash'].'&timestamp='.$_GET['timestamp'].'&num='.$packnum, 'loading', array('addonid' => $_GET['key'].'.'.$_GET['type']), '<div></div>', FALSE);
exit;
}
$_GET['importtxt'] = $data;
$array = getimportdata('Discuz! File Pack');
if(!$array['Status']) {
list($_cur, $_max) = explode('/', $array['part']);
$percent = intval($_cur/$_max * 100);
if($array['type'] != $_GET['type'] || $array['key'] != $_GET['key'] || !$array['files']) {
dir_clear($tmpdir);
@unlink($md5tmp);
cloudaddons_faillog($_GET['rid'], 100);
cpmsg('cloudaddons_download_error', '', 'error', array('ErrorCode' => 100));
}
foreach($array['files'] as $file => $data) {
$filename = $tmpdir.'/'.$file.'._addons_';
$dirname = dirname($filename);
dmkdir($dirname, 0777, false);
$fp = fopen($filename, !$data['Part'] ? 'w' : 'a');
if(!$fp) {
dir_clear($tmpdir);
@unlink($md5tmp);
cloudaddons_faillog($_GET['rid'], 101);
cpmsg('cloudaddons_download_write_error', '', 'error');
}
fwrite($fp, gzuncompress(base64_decode($data['Data'])));
fclose($fp);
if($data['MD5']) {
$md5total .= $data['MD5'];
$md5s[$filename] = $data['MD5'];
}
}
if(file_put_contents($md5tmp, serialize(array($md5total, $md5s))) === false) {
dir_clear($tmpdir);
@unlink($md5tmp);
cloudaddons_faillog($_GET['rid'], 101);
cpmsg('cloudaddons_download_write_md5_error', '', 'error');
}
} elseif($array['Status'] == 'Error') {
dir_clear($tmpdir);
@unlink($md5tmp);
cloudaddons_faillog($_GET['rid'], $array['ErrorCode']);
cpmsg('cloudaddons_install_error', '', 'error', array('ErrorCode' => $array['ErrorCode']));
} else {
foreach($md5s as $file => $md5) {
if($md5 != md5_file($file)) {
dir_clear($tmpdir);
@unlink($md5tmp);
cloudaddons_faillog($_GET['rid'], 102);
cpmsg('cloudaddons_download_error', '', 'error', array('ErrorCode' => 102));
}
}
@unlink($md5tmp);
$end = rawurlencode(cloudaddons_http_build_query($array));
}
if(!$end) {
$packnum++;
cpmsg('cloudaddons_downloading', "action=cloudaddons&operation=download&addonids={$_GET['addonids']}&i=$addoni&step=1&md5hash=".$_GET['md5hash'].'&timestamp='.$_GET['timestamp'].'&num='.$packnum, 'loading', array('addonid' => $_GET['key'].'.'.$_GET['type']), '<div>'.$percent.'%</div>', FALSE);
} else {
if($md5total !== '' && md5($md5total) !== cloudaddons_md5($_GET['key'].'_'.$_GET['rid'].(!empty($array['MD5Key']) ? '_'.$array['MD5Key'] : ''))) {
dir_clear($tmpdir);
@unlink($md5tmp);
cloudaddons_faillog($_GET['rid'], 105);
cpmsg('cloudaddons_download_error', '', 'error', array('ErrorCode' => 105));
}
cpmsg('cloudaddons_installing', "action=cloudaddons&operation=download&addonids={$_GET['addonids']}&i=$addoni&end=$end&step=2&md5hash=".$_GET['md5hash'].'&timestamp='.$_GET['timestamp'], 'loading', array('addonid' => $_GET['key'].'.'.$_GET['type']), FALSE);
}
} elseif($step == 2) {
$tmpdir = DISCUZ_ROOT.'./data/download/'.$_GET['rid'];
if(!file_exists($tmpdir)) {
dir_clear($tmpdir);
cloudaddons_faillog($_GET['rid'], 103);
cpmsg('cloudaddons_download_error', '', 'error', array('ErrorCode' => 103));
}
$typedir = array(
'plugin' => 'source/plugin',
'template' => 'template',
'pack' => '.',
);
if(!$typedir[$_GET['type']]) {
dir_clear($tmpdir);
cloudaddons_faillog($_GET['rid'], 104);
cpmsg('cloudaddons_download_error', '', 'error', array('ErrorCode' => 104));
}
if($_GET['type'] != 'pack') {
$descdir = DISCUZ_ROOT.$typedir[$_GET['type']].'/';
$subdir = $_GET['key'];
} else {
$descdir = DISCUZ_ROOT;
$subdir = '';
}
$unwriteabledirs = cloudaddons_dirwriteable($descdir, $subdir, $tmpdir);
if($unwriteabledirs) {
if(!submitcheck('settingsubmit')) {
shownav('cloudaddons', 'cloudaddons_ftp_setting');
showsubmenu('cloudaddons_ftp_setting');
showtips(cplang('cloudaddons_unwriteabledirs', array('basedir' => $typedir[$_GET['type']] != '.' ? $typedir[$_GET['type']] : '/', 'unwriteabledirs' => implode(', ', $unwriteabledirs))));
siteftp_form("cloudaddons&operation=download&addonids={$_GET['addonids']}&i=$addoni&end=".rawurlencode($_GET['end'])."&step=2&md5hash=".$_GET['md5hash'].'&timestamp='.$_GET['timestamp']);
exit;
} else {
siteftp_check($_GET['siteftp'], $typedir[$_GET['type']]);
}
}
$descdir .= $subdir;
cloudaddons_comparetree($tmpdir, $descdir, $tmpdir, $_GET['key'].'.'.$_GET['type'], 1);
if(!empty($_G['treeop']['oldchange']) && empty($_GET['confirmed'])) {
cpmsg('cloudaddons_install_files_changed', '', 'form', array('files' => implode('<br />', $_G['treeop']['oldchange'])));
}
cloudaddons_copytree($tmpdir, $descdir);
cloudaddons_savemd5($_GET['key'].'.'.$_GET['type'], $_GET['end'], $_G['treeop']['md5']);
cloudaddons_deltree($tmpdir);
if(count($addonids) - 1 > $addoni) {
$addoni++;
cpmsg('cloudaddons_downloading', "action=cloudaddons&operation=download&addonids={$_GET['addonids']}&i=$addoni&step=1&md5hash=".$_GET['md5hash'].'&timestamp='.$_GET['timestamp'], 'loading', array('addonid' => $_GET['key'].'.'.$_GET['type']), FALSE);
}
$extra = currentlang();
$extra = $extra ? '_'.$extra : '';
$batch = array();
foreach ($addonids as $addonid) {
list($key, $type, $rid) = explode('.', $addonid);
cloudaddons_downloadlog($key.'.'.$type);
if(empty($batch[$key.'.'.$type][1])) {
if($type == 'plugin') {
$entrytitle = $importtxt = '';
$plugindir = DISCUZ_ROOT.'./source/plugin/'.$key;
if(file_exists($plugindir.'/discuz_plugin_'.$key.$extra.'.xml')) {
$importtxt = @implode('', file($plugindir.'/discuz_plugin_'.$key.$extra.'.xml'));
} elseif(file_exists($plugindir.'/discuz_plugin_'.$key.'.xml')) {
$importtxt = @implode('', file($plugindir.'/discuz_plugin_'.$key.'.xml'));
}
if(!empty($importtxt)) {
$pluginarray = getimportdata('Discuz! Plugin', 0, 1);
if(!empty($pluginarray['plugin']['name'])) {
$entrytitle = dhtmlspecialchars($pluginarray['plugin']['name'].' '.$pluginarray['plugin']['version']);
}
}
$plugin = C::t('common_plugin')->fetch_by_identifier($key);
if(!$plugin['pluginid']) {
$batch[$key.'.'.$type] = array(
ADMINSCRIPT.'?action=plugins&operation=import&dir='.$key,
$lang['plugins_config_install'].' '.$entrytitle,
);
} else {
if ($pluginarray['plugin']['version'] != $plugin['version']) {
$batch[$key.'.'.$type] = array(
ADMINSCRIPT.'?action=plugins&operation=upgrade&pluginid='.$plugin['pluginid'],
$lang['plugins_config_upgrade'].' '.$entrytitle,
);
}
}
} elseif($type == 'template') {
$pluginarray = array();
$entrytitle = $importtxt = '';
$templatedir = DISCUZ_ROOT.'./template/'.$key;
$searchdir = dir($templatedir);
while($searchentry = $searchdir->read()) {
if(substr($searchentry, 0, 13) == 'discuz_style_' && fileext($searchentry) == 'xml') {
$importtxt = @implode('', file($templatedir.'/'.$searchentry));
if(!empty($importtxt)) {
break;
}
}
}
if(!empty($importtxt)) {
$stylearray = getimportdata('Discuz! Style');
if(!empty($stylearray['tplname'])) {
$entrytitle = dhtmlspecialchars($stylearray['tplname']);
}
}
$batch[$key.'.'.$type] = array(
ADMINSCRIPT.'?action=styles&operation=import&dir='.$key,
$entrytitle,
);
} else {
cloudaddons_validator($key.'.pack');
cloudaddons_installlog($key.'.pack');
if(file_exists(DISCUZ_ROOT.'./data/addonpack/'.$key.'.php')) {
$batch[$key.'.'.$type] = array(
$_G['siteurl'].'data/addonpack/'.$key.'.php',
$key.'.'.$type,
);
}
}
}
}
if(count($batch) > 1) {
$message = '';
foreach ($batch as $k => $v) {
$message .= '<p class="margintop"><a href="'.$v[0].'&frames=yes" onclick="return removelink(this);" target="_blank">'.($v[1] ? $v[1] : $k).'</a></p>';
}
echo '<div class="infobox"><h4 class="infotitle2">'.cplang('cloudaddons_batch_succeed').'<br /><br /><div id="addonlist">'.$message.'</div></h4></div>
<script type="text/javascript">
function removelink(obj){
if(document.getElementById(\'addonlist\').children.length > 1){
obj.parentNode.remove();
}else{
obj.target = \'_top\';
}
return true;
}
</script>
';
exit;
} elseif(count($batch) == 1) {
$v = reset($batch);
dheader('location: '.$v[0]);
} else {
list($_GET['key'], $_GET['type'], $_GET['rid']) = explode('.', $addonids[0]);
if($_GET['type'] == 'plugin') {
dheader('location: '.ADMINSCRIPT.'?action=plugins&operation=upgrade&pluginid='.$plugin['pluginid']);
} else {
cpmsg('cloudaddons_pack_installed', '', 'succeed');
}
}
}
}
function dir_clear($dir) {
if($directory = @dir($dir)) {
while($entry = $directory->read()) {
if($entry == '.' || $entry == '..') {
continue;
}
$filename = $dir.'/'.$entry;
if(is_file($filename)) {
@unlink($filename);
} else {
dir_clear($filename);
}
}
$directory->close();
@rmdir($dir);
}
}
?>

View File

@@ -0,0 +1,260 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_collection.php 32581 2013-02-22 04:03:45Z chenmengshu $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
$operation = in_array($operation, array('admin', 'comment', 'recommend')) ? $operation : 'admin';
$current = array($operation => 1);
$fromumanage = $_GET['fromumanage'] ? 1 : 0;
shownav('global', 'collection');
showsubmenu('collection', array(
array('collection_admin', 'collection&operation=admin', $current['admin']),
array('collection_comment', 'collection&operation=comment', $current['comment']),
array('collection_recommend', 'collection&operation=recommend', $current['recommend'])
));
echo '<script src="' . STATICURL . 'js/calendar.js"></script>';
if($operation == 'comment') {
$tagarray = array();
if(submitcheck('submit') && !empty($_GET['cidarray']) && is_array($_GET['cidarray']) && count($_GET['cidarray']) && !empty($_GET['operate_type'])) {
$class_tag = new tag();
$cidarray = array();
$operate_type = $_GET['operate_type'];
$cidarray = $_GET['cidarray'];
if($operate_type == 'delete') {
require_once libfile('function/delete');
$cidlist = C::t('forum_collectioncomment')->fetch_all($cidarray);
C::t('forum_collectioncomment')->delete_by_cid_ctid($cidarray);
foreach($cidlist as $uniquecid) {
$decreasnum[$uniquecid['ctid']]++;
}
foreach($decreasnum as $ctid => $num) {
C::t('forum_collection')->update_by_ctid($ctid, 0, 0, -$num);
}
}
cpmsg('collection_admin_updated', 'action=collection&operation=comment&searchsubmit=yes&perpage='.$_GET['perpage'].'&page='.$_GET['page'], 'succeed');
}
if(!submitcheck('searchsubmit', 1)) {
showformheader('collection&operation=comment');
showtableheader();
showsetting('collection_ctid', 'comment_ctid', $comment_ctid, 'text');
showsetting('collection_comment_message', 'comment_message', $comment_message, 'text');
showsetting('collection_comment_cid', 'comment_cid', $comment_cid, 'text');
showsetting('collection_comment_username', 'comment_username', $comment_username, 'text');
showsetting('collection_comment_uid', 'comment_uid', $comment_uid, 'text');
showsetting('collection_comment_rate', 'comment_rate', $comment_rate, 'text');
showsetting('collection_comment_useip', 'comment_useip', $comment_useip, 'text');
if(!$fromumanage) {
empty($_GET['starttime']) && $_GET['starttime'] = date('Y-m-d', time() - 86400 * 30);
}
echo '<input type="hidden" name="fromumanage" value="'.$fromumanage.'">';
showsetting('threads_search_time', array('starttime', 'endtime'), array($_GET['starttime'], $_GET['endtime']), 'daterange');
showsetting('feed_search_perpage', '', $_GET['perpage'], "<select name='perpage'><option value='20'>{$lang['perpage_20']}</option><option value='50'>{$lang['perpage_50']}</option><option value='100'>{$lang['perpage_100']}</option></select>");
showsubmit('searchsubmit');
showtablefooter();
showformfooter();
showtagfooter('div');
} else {
$comment_message = trim($_GET['comment_message']);
$comment_cid = dintval($_GET['comment_cid']);
$comment_ctid = dintval($_GET['comment_ctid']);
$comment_uid = dintval($_GET['comment_uid']);
$comment_username = trim($_GET['comment_username']);
$comment_useip = trim($_GET['comment_useip']);
$comment_rate = dintval($_GET['comment_rate']);
$starttime = $_GET['starttime'] ? strtotime($_GET['starttime']) : '';
$endtime = $_GET['endtime'] ? strtotime($_GET['endtime']) : '';
$ppp = $_GET['perpage'];
$startlimit = ($page - 1) * $ppp;
$multipage = '';
$totalcount = C::t('forum_collectioncomment')->fetch_all_for_search($comment_cid, $comment_ctid, $comment_username, $comment_uid, $comment_useip, $comment_rate, $comment_message, $starttime, $endtime, -1);
$multipage = multi($totalcount, $ppp, $page, ADMINSCRIPT."?action=collection&operation=comment&searchsubmit=yes&comment_message=$comment_message&comment_cid=$comment_cid&comment_username=$comment_username&comment_uid=$comment_uid&comment_ctid=$comment_ctid&comment_useip=$comment_useip&comment_rate=$comment_rate&starttime=$starttime&endtime=$endtime&perpage=$ppp");
$collectioncomment = C::t('forum_collectioncomment')->fetch_all_for_search($comment_cid, $comment_ctid, $comment_username, $comment_uid, $comment_useip, $comment_rate, $comment_message, $starttime, $endtime, $startlimit, $ppp);
showformheader('collection&operation=comment');
showtableheader(cplang('collection_comment_result').' '.$totalcount.' <a href="###" onclick="location.href=\''.ADMINSCRIPT.'?action=collection&operation=comment\';" class="act lightlink normal">'.cplang('research').'</a>', 'nobottom');
showhiddenfields(array('page' => $_GET['page'], 'tagname' => $tagname, 'status' => $status, 'perpage' => $ppp));
showsubtitle(array('', 'collection_comment_message', 'collection_comment_cid', 'collection_name', 'collection_comment_username', 'collection_comment_useip', 'collection_comment_ratenum', 'collection_date'));
foreach($collectioncomment as $uniquecomment) {
$ctidarray[$uniquecomment['ctid']] = 1;
}
$ctidarray = array_keys($ctidarray);
$collectiondata = C::t('forum_collection')->fetch_all($ctidarray);
foreach($collectioncomment as $uniquecomment) {
if($uniquecomment['rate'] == 0) $uniquecomment['rate'] = '-';
showtablerow('', array('class="td25"', 'width=400', ''), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"cidarray[]\" value=\"{$uniquecomment['cid']}\" />",
$uniquecomment['message'],
$uniquecomment['cid'],
"<a href='forum.php?mod=collection&action=view&ctid={$uniquecomment['ctid']}' target='_blank'>{$collectiondata[$uniquecomment['ctid']]['name']}</a>",
"<a href='home.php?mod=space&uid={$uniquecomment['uid']}' target='_blank'>{$uniquecomment['username']}</a>",
$uniquecomment['useip'],
$uniquecomment['rate'],
dgmdate($uniquecomment['dateline']),
));
}
showtablerow('', array('class="td25" colspan="3"'), array('<input name="chkall" id="chkall" type="checkbox" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'cidarray\', \'chkall\')" /><label for="chkall">'.cplang('select_all').'</label>'));
showtablerow('', array('class="td25"', 'colspan="2"'), array(
cplang('operation'),
'<input class="radio" type="radio" name="operate_type" value="delete"> '.cplang('delete').' '
));
showsubmit('submit', 'submit', '', '', $multipage);
showtablefooter();
showformfooter();
}
} elseif($operation == 'admin') {
$tagarray = array();
if(submitcheck('submit') && !empty($_GET['ctidarray']) && is_array($_GET['ctidarray']) && count($_GET['ctidarray']) && !empty($_GET['operate_type'])) {
$class_tag = new tag();
$ctidarray = array();
$operate_type = $_GET['operate_type'];
$ctidarray = $_GET['ctidarray'];
if($operate_type == 'delete') {
require_once libfile('function/delete');
foreach($ctidarray as $ctid) {
deletecollection($ctid);
}
}
cpmsg('collection_admin_updated', 'action=collection&operation=admin&searchsubmit=yes&perpage='.$_GET['perpage'].'&page='.$_GET['page'], 'succeed');
}
if(!submitcheck('searchsubmit', 1)) {
showformheader('collection&operation=admin');
showtableheader();
showsetting('collection_name', 'collection_name', $collection_name, 'text');
showsetting('collection_ctid', 'collection_ctid', $collection_ctid, 'text');
showsetting('collection_username', 'collection_username', $collection_username, 'text');
showsetting('collection_uid', 'collection_uid', $collection_uid, 'text');
showsetting('feed_search_perpage', '', $_GET['perpage'], "<select name='perpage'><option value='20'>{$lang['perpage_20']}</option><option value='50'>{$lang['perpage_50']}</option><option value='100'>{$lang['perpage_100']}</option></select>");
showsubmit('searchsubmit');
showtablefooter();
showformfooter();
showtagfooter('div');
} else {
$collection_name = trim($_GET['collection_name']);
$collection_ctid = dintval($_GET['collection_ctid']);
$collection_username = trim($_GET['collection_username']);
$collection_uid = dintval($_GET['collection_uid']);
$ppp = $_GET['perpage'];
$startlimit = ($page - 1) * $ppp;
$multipage = '';
$totalcount = C::t('forum_collection')->fetch_all_for_search($collection_name, $collection_ctid, $collection_username, $collection_uid, -1);
$multipage = multi($totalcount, $ppp, $page, ADMINSCRIPT."?action=collection&operation=admin&searchsubmit=yes&collection_name=$collection_name&collection_ctid=$collection_ctid&collection_username=$collection_username&collection_uid=$collection_uid&perpage=$ppp&status=$status");
$collection = C::t('forum_collection')->fetch_all_for_search($collection_name, $collection_ctid, $collection_username, $collection_uid, $startlimit, $ppp);
showformheader('collection&operation=admin');
showtableheader(cplang('collection_result').' '.$totalcount.' <a href="###" onclick="location.href=\''.ADMINSCRIPT.'?action=collection&operation=admin\';" class="act lightlink normal">'.cplang('research').'</a>', 'nobottom');
showhiddenfields(array('page' => $_GET['page'], 'collection_name' => $collection_name, 'collection_ctid' => $collection_ctid, 'perpage' => $ppp));
showsubtitle(array('', 'collection_name', 'collection_username', 'collection_date', 'collection_recommend'));
foreach($collection as $uniquecollection) {
showtablerow('', array('class="td25"', 'width=400', ''), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"ctidarray[]\" value=\"{$uniquecollection['ctid']}\" />",
"<a href='forum.php?mod=collection&action=view&ctid={$uniquecollection['ctid']}' target='_blank'>{$uniquecollection['name']}</a>",
"<a href='home.php?mod=space&uid={$uniquecollection['uid']}' target='_blank'>{$uniquecollection['username']}</a>",
dgmdate($uniquecollection['dateline']),
"<a href='".ADMINSCRIPT."?action=collection&operation=recommend&recommentctid={$uniquecollection['ctid']}'>".cplang('collection_recommend')."</a>",
));
}
showtablerow('', array('class="td25" colspan="3"'), array('<input name="chkall" id="chkall" type="checkbox" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'ctidarray\', \'chkall\')" /><label for="chkall">'.cplang('select_all').'</label>'));
showtablerow('', array('class="td25"', 'colspan="2"'), array(
cplang('operation'),
'<input class="radio" type="radio" name="operate_type" value="delete"> '.cplang('delete').' '
));
showsubmit('submit', 'submit', '', '', $multipage);
showtablefooter();
showformfooter();
}
} elseif($operation == 'recommend') {
if(is_numeric($_GET['recommentctid'])) {
$collectiondata = C::t('forum_collection')->fetch($_GET['recommentctid']);
if($collectiondata['ctid']) {
$collectionrecommend = $_G['setting']['collectionrecommend'] ? dunserialize($_G['setting']['collectionrecommend']) : array();
$collectionrecommend['ctids'][$collectiondata['ctid']] = 0;
$collectionrecommend['ctids'] = removeNonExistsCollection($collectionrecommend['ctids']);
$collectionrecommend['adminrecommend'] = count($collectionrecommend['ctids']);
asort($collectionrecommend['ctids']);
$data = array('collectionrecommendnum' => $collectionrecommend['autorecommend']+$collectionrecommend['adminrecommend'], 'collectionrecommend' => $collectionrecommend);
C::t('common_setting')->update_batch($data);
updatecache('setting');
savecache('collection_index', array());
}
cpmsg('collection_admin_updated', 'action=collection&operation=recommend', 'succeed');
}
if(!submitcheck('submit', 1)) {
$ctidarray = array();
$collectionrecommend = dunserialize($_G['setting']['collectionrecommend']);
showformheader('collection&operation=recommend');
showtableheader(cplang('collection_recommend_settings'), 'nobottom');
showsetting('collection_recommend_index_autonumber', 'settingnew[autorecommend]', $collectionrecommend['autorecommend'] ? $collectionrecommend['autorecommend'] : 0, 'text');
showtableheader(cplang('collection_recommend_existed'), 'nobottom');
showhiddenfields(array('page' => $_GET['page'], 'tagname' => $tagname, 'status' => $status, 'perpage' => $ppp));
showsubtitle(array('', 'collection_name', 'collection_username', 'collection_threadnum', 'collection_commentnum', 'collection_date', 'display_order'));
if($collectionrecommend['ctids']) {
$collectiondata = C::t('forum_collection')->fetch_all(array_keys($collectionrecommend['ctids']));
foreach($collectiondata as $collection) {
showtablerow('', array('class="td25"', 'width=400', ''), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"ctidarray[]\" value=\"{$collection['ctid']}\" />",
"<a href='forum.php?mod=collection&action=view&ctid={$collection['ctid']}' target='_blank'>{$collection['name']}</a>",
"<a href='home.php?mod=space&uid={$collection['uid']}' target='_blank'>{$collection['username']}</a>",
$collection['threadnum'],
$collection['commentnum'],
dgmdate($collection['dateline']),
"<input class=\"txt\" type=\"text\" name=\"ctidorder[{$collection['ctid']}]\" value=\"{$collectionrecommend['ctids'][$collection['ctid']]}\" />",
));
}
} else {
showtablerow('', array('class="td25" colspan="7" align="center"', ''), array(
cplang('collection_recommend_tips'),
));
}
showtablerow('', array('class="td25" colspan="7"'), array('<input name="chkall" id="chkall" type="checkbox" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'ctidarray\', \'chkall\')" /><label for="chkall"> '.cplang('select_all').'</label>'));
showtablerow('', array('class="td25"', 'colspan="2"'), array(
cplang('operation'),
'<input class="checkbox" type="checkbox" name="operate_type" id="operate_type" value="delete"><label for="operate_type"> '.cplang('delete').'</label> '
));
showsubmit('submit', 'submit', '', '');
showtablefooter();
showformfooter();
} else {
$collectionrecommend = $_G['setting']['collectionrecommend'] ? dunserialize($_G['setting']['collectionrecommend']) : array();
foreach($collectionrecommend['ctids'] as $rCtid=>&$rCollection) {
if($_GET['operate_type'] == 'delete' && in_array($rCtid, $_GET['ctidarray'])) {
unset($collectionrecommend['ctids'][$rCtid]);
continue;
}
$rCollection = $_GET['ctidorder'][$rCtid];
}
$collectionrecommend['ctids'] = is_array($collectionrecommend['ctids']) ? removeNonExistsCollection($collectionrecommend['ctids']) : array();
$collectionrecommend['autorecommend'] = intval($_GET['settingnew']['autorecommend']);
$collectionrecommend['adminrecommend'] = count($collectionrecommend['ctids']);
asort($collectionrecommend['ctids']);
$data = array('collectionrecommendnum' => $collectionrecommend['autorecommend']+$collectionrecommend['adminrecommend'], 'collectionrecommend' => $collectionrecommend);
C::t('common_setting')->update_batch($data);
updatecache('setting');
savecache('collection_index', array());
cpmsg('collection_admin_updated', 'action=collection&operation=recommend', 'succeed');
}
}
function removeNonExistsCollection($collectionrecommend) {
$tmpcollection = C::t('forum_collection')->fetch_all(array_keys($collectionrecommend));
foreach($collectionrecommend as $ctid=>$setcollection) {
if(!$tmpcollection[$ctid]) {
unset($collectionrecommend[$ctid]);
}
}
return $collectionrecommend;
}
?>

View File

@@ -0,0 +1,378 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_comment.php 28774 2012-03-12 10:09:50Z chenmengshu $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
$detail = $_GET['detail'];
$idtype = $_GET['idtype'];
$id = $_GET['id'];
$author = $_GET['author'];
$authorid = $_GET['authorid'];
$uid = $_GET['uid'];
$message = $_GET['message'];
$ip = $_GET['ip'];
$users = $_GET['users'];
$starttime = $_GET['starttime'];
$endtime = $_GET['endtime'];
$searchsubmit = $_GET['searchsubmit'];
$cids = $_GET['cids'];
$page = max(1, $_GET['page']);
$fromumanage = $_GET['fromumanage'] ? 1 : 0;
cpheader();
if(empty($operation)) {
if(!submitcheck('commentsubmit')) {
if($fromumanage) {
$starttime = !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $starttime) ? '' : $starttime;
$endtime = $_G['adminid'] == 3 || !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $endtime) ? '' : $endtime;
} else {
$starttime = !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $starttime) ? dgmdate(TIMESTAMP - 86400 * 7, 'Y-n-j') : $starttime;
$endtime = $_G['adminid'] == 3 || !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $endtime) ? dgmdate(TIMESTAMP, 'Y-n-j') : $endtime;
}
shownav('topic', 'nav_comment');
showsubmenu('nav_comment', array(
array('comment_comment', 'comment', 1),
array('comment_article_comment', 'comment&operation=article', 0),
array('comment_topic_comment', 'comment&operation=topic', 0)
));
showtips('comment_tips');
$staticurl = STATICURL;
echo <<<EOT
<script type="text/javascript" src="{$staticurl}js/calendar.js"></script>
<script type="text/JavaScript">
function page(number) {
$('commentforum').page.value=number;
$('commentforum').searchsubmit.click();
}
</script>
EOT;
showtagheader('div', 'searchposts', !$searchsubmit);
showformheader("comment", '', 'commentforum');
showhiddenfields(array('page' => $page, 'pp' => $_GET['pp'] ? $_GET['pp'] : $_GET['perpage']));
showtableheader();
showsetting('comment_search_detail', 'detail', $detail, 'radio');
showsetting('comment_search_perpage', '', $_GET['perpage'], "<select name='perpage'><option value='20'>{$lang['perpage_20']}</option><option value='50'>{$lang['perpage_50']}</option><option value='100'>{$lang['perpage_100']}</option></select>");
showsetting('comment_idtype', array('idtype', array(
array('', $lang['all']),
array('uid', $lang['comment_uid']),
array('blogid', $lang['comment_blogid']),
array('picid', $lang['comment_picid']),
array('sid', $lang['comment_sid']),
)), 'comment_idtype', 'select');
showsetting('comment_search_id', 'id', $id, 'text');
showsetting('comment_search_author', 'author', $author, 'text');
showsetting('comment_search_authorid', 'authorid', $authorid, 'text');
showsetting('comment_search_uid', 'uid', $uid, 'text');
showsetting('comment_search_message', 'message', $message, 'text');
showsetting('comment_search_ip', 'ip', $ip, 'text');
showsetting('comment_search_time', array('starttime', 'endtime'), array($starttime, $endtime), 'daterange');
echo '<input type="hidden" name="fromumanage" value="'.$fromumanage.'">';
showsubmit('searchsubmit');
showtablefooter();
showformfooter();
showtagfooter('div');
} else {
$cids = authcode($cids, 'DECODE');
$cidsadd = $cids ? explode(',', $cids) : $_GET['delete'];
include_once libfile('function/delete');
$deletecount = count(deletecomments($cidsadd));
$cpmsg = cplang('comment_succeed', array('deletecount' => $deletecount));
?>
<script type="text/JavaScript">alert('<?php echo $cpmsg;?>');parent.$('commentforum').searchsubmit.click();</script>
<?php
}
if(submitcheck('searchsubmit', 1)) {
$comments = $commentcount = '0';
$sql = $error = '';
$authorids = array();
$author = trim($author);
if($id !='') {
$id = explode(',', $id);
}
if($author != '') {
$authorids = C::t('common_member')->fetch_all_uid_by_username(array_map('trim', explode(',', $author)));
if (!$authorids) {
$authorids = array(-1);
}
}
$authorid = trim($authorid, ', ');
if($authorid != '') {
if (!$authorids) {
$authorids = explode(',', $authorid);
} else {
$authorids = array_intersect($authorids, explode(',', $authorid));
}
if (!$authorids) {
$authorids = array(-1);
}
}
if($_G['adminid'] == 1 && $endtime != dgmdate(TIMESTAMP, 'Y-n-j')) {
if($endtime != '') {
$endtime = strtotime($endtime);
}
} else {
$endtime = TIMESTAMP;
}
if(($_G['adminid'] == 2 && $endtime - $starttime > 86400 * 16) || ($_G['adminid'] == 3 && $endtime - $starttime > 86400 * 8)) {
$error = 'comment_mod_range_illegal';
}
$uid = trim($uid, ', ');
if($uid !='') {
$uid = explode(',', $uid);
}
if(!$error) {
if($commentcount = C::t('home_comment')->fetch_all_search(3, $id, $authorids, $uid, $ip, $message, $idtype, $starttime, $endtime)) {
if($detail) {
$_GET['perpage'] = intval($_GET['perpage']) < 1 ? 20 : intval($_GET['perpage']);
$perpage = $_GET['pp'] ? $_GET['pp'] : $_GET['perpage'];
$query = C::t('home_comment')->fetch_all_search(1, $id, $authorids, $uid, $ip, $message, $idtype, $starttime, $endtime, (($page - 1) * $perpage), $perpage);
$comments = '';
foreach ($query as $comment) {
$comment['dateline'] = dgmdate($comment['dateline']);
switch($comment['idtype']) {
case 'picid':
$address = "<a href=\"home.php?mod=space&uid={$comment['uid']}&do=album&picid={$comment['id']}\" target=\"_blank\">{$comment['message']}</a>";
break;
case 'uid':
$address = "<a href=\"home.php?mod=space&uid={$comment['uid']}&do=wall\" target=\"_blank\">{$comment['message']}</a>";
break;
case 'sid':
$address = "<a href=\"home.php?mod=space&uid=1&do=share&id={$comment['id']}\" target=\"_blank\">{$comment['message']}</a>";
break;
case 'blogid':
$address = "<a href=\"home.php?mod=space&uid={$comment['uid']}&do=blog&id={$comment['id']}\" target=\"_blank\">{$comment['message']}</a>";
break;
}
$comments .= showtablerow('', '', array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"{$comment['cid']}\" />",
$address,
"<a href=\"home.php?mod=space&uid={$comment['uid']}\" target=\"_blank\">{$comment['author']}</a>",
$comment['ip'],
$comment['idtype'],
$comment['dateline']
), TRUE);
}
$multi = multi($commentcount, $perpage, $page, ADMINSCRIPT."?action=comment");
$multi = preg_replace("/href=\"".ADMINSCRIPT."\?action=comment&amp;page=(\d+)\"/", "href=\"javascript:page(\\1)\"", $multi);
$multi = str_replace("window.location='".ADMINSCRIPT."?action=comment&amp;page='+this.value", "page(this.value)", $multi);
} else {
$query = C::t('home_comment')->fetch_all_search(2, $id, $authorids, $uid, $ip, $message, $idtype, $starttime, $endtime);
foreach ($query as $comment) {
$cids .= ','.$comment['cid'];
}
}
} else
$error = 'comment_post_nonexistence';
}
showtagheader('div', 'postlist', $searchsubmit);
showformheader('comment&frame=no', 'target="commentframe"');
showhiddenfields(array('cids' => authcode($cids, 'ENCODE')));
showtableheader(cplang('comment_result').' '.$commentcount.' <a href="###" onclick="$(\'searchposts\').style.display=\'\';$(\'postlist\').style.display=\'none\';$(\'commentforum\').pp.value=\'\';$(\'commentforum\').page.value=\'\';" class="act lightlink normal">'.cplang('research').'</a>', 'fixpadding');
if($error) {
echo "<tr><td class=\"lineheight\" colspan=\"15\">$lang[$error]</td></tr>";
} else {
if($detail) {
showsubtitle(array('', 'message', 'author', 'ip', 'comment_idtype', 'time'));
echo $comments;
}
}
showsubmit('commentsubmit', 'delete', $detail ? 'del' : '', '', $multi);
showtablefooter();
showformfooter();
echo '<iframe name="commentframe" style="display:none"></iframe>';
showtagfooter('div');
}
}
if($operation == 'article' || $operation == 'topic') {
$aid = $_GET['aid'];
$subject = $_GET['subject'];
$idtype = $operation == 'article' ? 'aid' : 'topicid';
$tablename = $idtype == 'aid' ? 'portal_article_title' : 'portal_topic';
if(!submitcheck('articlesubmit')) {
$starttime = !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $starttime) ? dgmdate(TIMESTAMP - 86400 * 7, 'Y-n-j') : $starttime;
$endtime = $_G['adminid'] == 3 || !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $endtime) ? dgmdate(TIMESTAMP, 'Y-n-j') : $endtime;
shownav('topic', 'nav_comment');
showsubmenu('nav_comment', array(
array('comment_comment', 'comment', 0),
array('comment_article_comment', 'comment&operation=article', $operation == 'article' ? 1 : 0),
array('comment_topic_comment', 'comment&operation=topic', $operation == 'topic' ? 1 : 0)
));
showtips('comment_'.$operation.'_tips');
$staticurl = STATICURL;
echo <<<EOT
<script type="text/javascript" src="{$staticurl}js/calendar.js"></script>
<script type="text/JavaScript">
function page(number) {
$('articleforum').page.value=number;
$('articleforum').searchsubmit.click();
}
</script>
EOT;
showtagheader('div', 'searchposts', !$searchsubmit);
showformheader("comment&operation=$operation", '', 'articleforum');
showhiddenfields(array('page' => $page, 'pp' => $_GET['pp'] ? $_GET['pp'] : $_GET['perpage']));
showtableheader();
showsetting('comment_search_perpage', '', $_GET['perpage'], "<select name='perpage'><option value='20'>{$lang['perpage_20']}</option><option value='50'>{$lang['perpage_50']}</option><option value='100'>{$lang['perpage_100']}</option></select>");
showsetting("comment_{$operation}_subject", 'subject', $subject, 'text');
showsetting("comment_{$operation}_id", 'aid', $aid, 'text');
showsetting('comment_search_message', 'message', $message, 'text');
showsetting('comment_search_author', 'author', $author, 'text');
showsetting('comment_search_authorid', 'authorid', $authorid, 'text');
showsetting('comment_search_time', array('starttime', 'endtime'), array($starttime, $endtime), 'daterange');
showsubmit('searchsubmit');
showtablefooter();
showformfooter();
showtagfooter('div');
} else {
$commentnum = array();
foreach(C::t('portal_comment')->fetch_all($_GET['delete']) as $value) {
$commentnum[$value['idtype']][$value['id']] = $value['id'];
}
if($commentnum['aid']) {
C::t('portal_article_count')->increase($commentnum['aid'], array('commentnum' => -1));
} elseif($commentnum['topicid']) {
C::t('portal_topic')->increase($commentnum['topicid'], array('commentnum' => -1));
}
C::t('portal_comment')->delete($_GET['delete']);
$cpmsg = cplang('comment_article_delete');
?>
<script type="text/JavaScript">alert('<?php echo $cpmsg;?>');parent.$('articleforum').searchsubmit.click();</script>
<?php
}
if(submitcheck('searchsubmit')) {
$comments = $commentcount = '0';
$sql = $error = '';
$author = trim($author);
$queryAId = $aid ? array($aid) : array();
if($subject != '') {
$ids = array();
$query = C::t($tablename)->fetch_all_by_title($idtype, $subject);
foreach($query as $value) {
$ids[] = intval($value[$idtype]);
}
$queryAId = array_merge($queryAId, $ids);
}
$queryAuthorIDs = $authorid ? array($authorid) : array();
if($author != '') {
$authorids = C::t('common_member')->fetch_all_uid_by_username(array_map('trim', explode(',', $author)));
$queryAuthorIDs = array_merge($queryAuthorIDs, $authorids);
}
if($starttime != '0') {
$starttime = strtotime($starttime);
}
$sqlendtime = '';
if($_G['adminid'] == 1 && $endtime != dgmdate(TIMESTAMP, 'Y-n-j')) {
if($endtime != '0') {
$sqlendtime = $endtime = strtotime($endtime);
}
} else {
$endtime = TIMESTAMP;
}
if(($_G['adminid'] == 2 && $endtime - $starttime > 86400 * 16) || ($_G['adminid'] == 3 && $endtime - $starttime > 86400 * 8)) {
$error = 'comment_mod_range_illegal';
}
if(!$error) {
$commentcount = C::t('portal_comment')->count_all_by_search($queryAId, $queryAuthorIDs, $starttime, $sqlendtime, $idtype, $message);
if($commentcount) {
$_GET['perpage'] = intval($_GET['perpage']) < 1 ? 20 : intval($_GET['perpage']);
$perpage = $_GET['pp'] ? $_GET['pp'] : $_GET['perpage'];
$query = C::t('portal_comment')->fetch_all_by_search($queryAId, $queryAuthorIDs, $starttime, $sqlendtime, $idtype, $message, (($page - 1) * $perpage), $perpage);
$comments = '';
$mod = $idtype == 'aid' ? 'view' : 'topic';
foreach($query as $comment) {
$comment['dateline'] = dgmdate($comment['dateline']);
$comments .= showtablerow('', '', array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"{$comment['cid']}\" />",
"<a href=\"portal.php?mod=$mod&$idtype={$comment['id']}\" target=\"_blank\">{$comment['title']}</a>",
$comment['message'],
"<a href=\"home.php?mod=space&uid={$comment['uid']}\" target=\"_blank\">{$comment['username']}</a>",
$comment['dateline']
), TRUE);
}
$multi = multi($commentcount, $perpage, $page, ADMINSCRIPT."?action=comment&operation=$operation");
$multi = preg_replace("/href=\"".ADMINSCRIPT."\?action=comment&operation=$operation&amp;page=(\d+)\"/", "href=\"javascript:page(\\1)\"", $multi);
$multi = str_replace("window.location='".ADMINSCRIPT."?action=comment&amp;operation=$operation&amp;page='+this.value", "page(this.value)", $multi);
} else {
$error = 'comment_post_nonexistence';
}
}
showtagheader('div', 'postlist', $searchsubmit);
showformheader('comment&operation='.$operation.'&frame=no', 'target="articleframe"');
showtableheader(cplang('comment_result').' '.$commentcount.' <a href="###" onclick="$(\'searchposts\').style.display=\'\';$(\'postlist\').style.display=\'none\';$(\'articleforum\').pp.value=\'\';$(\'articleforum\').page.value=\'\';" class="act lightlink normal">'.cplang('research').'</a>', 'fixpadding');
if($error) {
echo "<tr><td class=\"lineheight\" colspan=\"15\">$lang[$error]</td></tr>";
} else {
showsubtitle(array('', 'article_title', 'message', 'author', 'time'));
echo $comments;
}
showsubmit('articlesubmit', 'delete', 'del', '', $multi);
showtablefooter();
showformfooter();
echo '<iframe name="articleframe" style="display:none"></iframe>';
showtagfooter('div');
}
}
?>

View File

@@ -0,0 +1,529 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_counter.php 33048 2013-04-12 08:50:27Z zhangjie $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
$pertask = isset($_GET['pertask']) ? intval($_GET['pertask']) : 100;
$current = isset($_GET['current']) && $_GET['current'] > 0 ? intval($_GET['current']) : 0;
$next = $current + $pertask;
if(submitcheck('forumsubmit', 1)) {
$nextlink = "action=counter&current=$next&pertask=$pertask&forumsubmit=yes";
$processed = 0;
$queryf = C::t('forum_forum')->fetch_all_fids(1, '', '', $current, $pertask);
foreach($queryf as $forum) {
$processed = 1;
$threads = $posts = 0;
$threadtables = array('0');
$archive = 0;
foreach(C::t('forum_forum_threadtable')->fetch_all_by_fid($forum['fid']) as $data) {
if($data['threadtableid']) {
$threadtables[] = $data['threadtableid'];
}
}
$threadtables = array_unique($threadtables);
foreach($threadtables as $tableid) {
$data = C::t('forum_thread')->count_posts_by_fid($forum['fid'], $tableid);
$threads += $data['threads'];
$posts += $data['posts'];
if($data['threads'] == 0 && $tableid != 0) {
C::t('forum_forum_threadtable')->delete_threadtable($forum['fid'], $tableid);
}
if($data['threads'] > 0 && $tableid != 0) {
$archive = 1;
}
}
C::t('forum_forum')->update($forum['fid'], array('archive' => $archive));
$thread = C::t('forum_thread')->fetch_by_fid_displayorder($forum['fid']);
$subject = cutstr($thread['subject'], 80);
$lastpost = "{$thread['tid']}\t{$subject}\t{$thread['lastpost']}\t{$thread['lastposter']}";
C::t('forum_forum')->update($forum['fid'], array('threads' => $threads, 'posts' => $posts, 'lastpost' => $lastpost));
}
if($processed) {
cpmsg("{$lang['counter_forum']}: ".cplang('counter_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
} else {
C::t('forum_forum')->clear_forum_counter_for_group();
cpmsg('counter_forum_succeed', 'action=counter', 'succeed');
}
} elseif(submitcheck('digestsubmit', 1)) {
if(!$current) {
C::t('common_member_count')->clear_digestposts();
$current = 0;
}
$nextlink = "action=counter&current=$next&pertask=$pertask&digestsubmit=yes";
$processed = 0;
$membersarray = $postsarray = array();
foreach(C::t('forum_thread')->fetch_all_by_digest_displayorder(0, '<>', 0, '>=', $current, $pertask) as $thread) {
$processed = 1;
$membersarray[$thread['authorid']]++;
}
$threadtableids = C::t('common_setting')->fetch_setting('threadtableids', true);
foreach($threadtableids as $tableid) {
if(!$tableid) {
continue;
}
foreach(C::t('forum_thread')->fetch_all_by_digest_displayorder(0, '<>', 0, '>=', $current, $pertask, $tableid) as $thread) {
$processed = 1;
$membersarray[$thread['authorid']] ++;
}
}
foreach($membersarray as $uid => $posts) {
$postsarray[$posts][] = $uid;
}
unset($membersarray);
foreach($postsarray as $posts => $uids) {
C::t('common_member_count')->increase($uids, array('digestposts' => $posts));
}
if($processed) {
cpmsg("{$lang['counter_digest']}: ".cplang('counter_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
} else {
cpmsg('counter_digest_succeed', 'action=counter', 'succeed');
}
} elseif(submitcheck('membersubmit', 1)) {
$nextlink = "action=counter&current=$next&pertask=$pertask&membersubmit=yes";
$processed = 0;
$threadtableids = C::t('common_setting')->fetch_setting('threadtableids', true);
$queryt = C::t('common_member')->range($current, $pertask);
foreach($queryt as $mem) {
$processed = 1;
$postcount = 0;
loadcache('posttable_info');
if(!empty($_G['cache']['posttable_info']) && is_array($_G['cache']['posttable_info'])) {
foreach($_G['cache']['posttable_info'] as $key => $value) {
$postcount += C::t('forum_post')->count_by_authorid($key, $mem['uid']);
}
} else {
$postcount += C::t('forum_post')->count_by_authorid(0, $mem['uid']);
}
$postcount += C::t('forum_postcomment')->count_by_authorid($mem['uid']);
$threadcount = C::t('forum_thread')->count_by_authorid($mem['uid']);
foreach($threadtableids as $tableid) {
if(!$tableid) {
continue;
}
$threadcount += C::t('forum_thread')->count_by_authorid($mem['uid'], $tableid);
}
C::t('common_member_count')->update($mem['uid'], array('posts' => $postcount, 'threads' => $threadcount));
}
if($processed) {
cpmsg("{$lang['counter_member']}: ".cplang('counter_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
} else {
cpmsg('counter_member_succeed', 'action=counter', 'succeed');
}
} elseif(submitcheck('threadsubmit', 1)) {
$nextlink = "action=counter&current=$next&pertask=$pertask&threadsubmit=yes";
$processed = 0;
foreach(C::t('forum_thread')->fetch_all_by_displayorder(0, '>=', $current, $pertask) as $threads) {
$processed = 1;
$replynum = C::t('forum_post')->count_visiblepost_by_tid($threads['tid']);
$replynum--;
$lastpost = C::t('forum_post')->fetch_visiblepost_by_tid('tid:'.$threads['tid'], $threads['tid'], 0, 1);
if($threads['replies'] != $replynum || $threads['lastpost'] != $lastpost['dateline'] || $threads['lastposter'] != $lastpost['author']) {
if(empty($threads['author'])) {
$lastpost['author'] = '';
}
$updatedata = array(
'replies' => $replynum,
'lastpost' => $lastpost['dateline'],
'lastposter' => $lastpost['author']
);
C::t('forum_thread')->update($threads['tid'], $updatedata, true, true);
}
}
if($processed) {
cpmsg("{$lang['counter_thread']}: ".cplang('counter_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
} else {
cpmsg('counter_thread_succeed', 'action=counter', 'succeed');
}
} elseif(submitcheck('movedthreadsubmit', 1)) {
$nextlink = "action=counter&current=$next&pertask=$pertask&movedthreadsubmit=yes";
$processed = 0;
$tids = array();
$updateclosed = array();
foreach(C::t('forum_thread')->fetch_all_movedthread($current, $pertask) as $thread) {
$processed = 1;
if($thread['isgroup'] && $thread['status'] == 3) {
$updateclosed[] = $thread['tid'];
} elseif($thread['threadexists']) {
$tids[] = $thread['tid'];
}
}
if($tids) {
C::t('forum_thread')->delete_by_tid($tids, true);
}
if($updateclosed) {
C::t('forum_thread')->update($updateclosed, array('closed' => ''));
}
if($processed) {
cpmsg(cplang('counter_moved_thread').': '.cplang('counter_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
} else {
cpmsg('counter_moved_thread_succeed', 'action=counter', 'succeed');
}
} elseif(submitcheck('specialarrange', 1)) {
$cursort = empty($_GET['cursort']) ? 0 : intval($_GET['cursort']);
$changesort = isset($_GET['changesort']) && empty($_GET['changesort']) ? 0 : 1;
$processed = 0;
$fieldtypes = array('number' => 'bigint(20)', 'text' => 'mediumtext', 'radio' => 'smallint(6)', 'checkbox' => 'mediumtext', 'textarea' => 'mediumtext', 'select' => 'smallint(6)', 'calendar' => 'mediumtext', 'email' => 'mediumtext', 'url' => 'mediumtext', 'image' => 'mediumtext');
$optionvalues = array();
$optionvalues = $sortids = array();
foreach(C::t('forum_typevar')->fetch_all_by_search_optiontype(1, array('checkbox', 'radio', 'select', 'number')) as $row) {
$optionvalues[$row['sortid']][$row['identifier']] = $row['type'];
$optionids[$row['sortid']][$row['optionid']] = $row['identifier'];
$searchs[$row['sortid']][$row['optionid']] = $row['search'];
$sortids[] = $row['sortid'];
}
$sortids = array_unique($sortids);
sort($sortids);
if($sortids[$cursort] && $optionvalues[$sortids[$cursort]]) {
$processed = 1;
$sortid = $sortids[$cursort];
$options = $optionvalues[$sortid];
$search = $searchs[$sortid];
$dbcharset = $_G['config']['db'][1]['dbcharset'];
$dbcharset = empty($dbcharset) ? str_replace('-', '', CHARSET) : $dbcharset;
$fields = "tid mediumint(8) UNSIGNED NOT NULL DEFAULT '0',fid smallint(6) UNSIGNED NOT NULL DEFAULT '0',KEY (fid)";
C::t('forum_optionvalue')->create($sortid, $fields, $dbcharset);
if($changesort) {
C::t('forum_optionvalue')->truncate_by_sortid($sortid);
}
$opids = array_keys($optionids[$sortid]);
$tables = C::t('forum_optionvalue')->showcolumns($sortid);
foreach($optionids[$sortid] as $optionid => $identifier) {
if(!$tables[$identifier] && (in_array($options[$identifier], array('checkbox', 'radio', 'select', 'number')) || $search[$optionid])) {
$fieldname = $identifier;
if(in_array($options[$identifier], array('radio'))) {
$fieldtype = 'smallint(6) UNSIGNED NOT NULL DEFAULT \'0\'';
} elseif(in_array($options[$identifier], array('number', 'range'))) {
$fieldtype = 'int(10) UNSIGNED NOT NULL DEFAULT \'0\'';
} elseif($options[$identifier] == 'select') {
$fieldtype = 'varchar(50) NOT NULL';
} else {
$fieldtype = 'mediumtext NOT NULL';
}
C::t('forum_optionvalue')->alter($sortid, "ADD $fieldname $fieldtype");
if(in_array($options[$identifier], array('radio', 'select', 'number'))) {
C::t('forum_optionvalue')->alter($sortid, "ADD INDEX ($fieldname)");
}
}
}
$inserts = array();
$typeoptionvararr = C::t('forum_typeoptionvar')->fetch_all_by_search($sortid, null, null, $opids);
if($typeoptionvararr) {
$tids = array();
foreach($typeoptionvararr as $value) {
$tids[$value['tid']] = $value['tid'];
}
$tids = C::t('forum_thread')->fetch_all($tids);
foreach($typeoptionvararr as $row) {
$row['fid'] = $tids[$row['tid']]['fid'];
$opname = $optionids[$sortid][$row['optionid']];
if(empty($inserts[$row['tid']])) {
$inserts[$row['tid']]['tid'] = $row['tid'];
$inserts[$row['tid']]['fid'] = $row['fid'];
}
$inserts[$row['tid']][$opname] = addslashes($row['value']);
}
unset($tids, $typeoptionvararr);
}
if($inserts) {
foreach($inserts as $tid => $fieldval) {
$rfields = array();
$ikey = $ival = '';
foreach($fieldval as $ikey => $ival) {
$rfields[] = "`$ikey`='$ival'";
}
C::t('forum_optionvalue')->insert_optionvalue($sortid, "SET ".implode(',', $rfields), true);
}
}
$cursort ++;
$changesort = 1;
}
$nextlink = "action=counter&changesort=$changesort&cursort=$cursort&specialarrange=yes";
if($processed) {
cpmsg('counter_special_arrange', $nextlink, 'loading', array('cursort' => $cursort, 'sortids' => count($sortids)));
} else {
cpmsg('counter_special_arrange_succeed', 'action=counter', 'succeed');
}
$nextlink = "action=counter&current=$next&pertask=$pertask&membersubmit=yes";
$processed = 0;
$queryt = C::t('common_member')->range($current, $pertask);
foreach($queryt as $mem) {
$processed = 1;
$postcount = 0;
loadcache('posttable_info');
if(!empty($_G['cache']['posttable_info']) && is_array($_G['cache']['posttable_info'])) {
foreach($_G['cache']['posttable_info'] as $key => $value) {
$postcount += C::t('forum_post')->count_by_authorid($key, $mem['uid']);
}
} else {
$postcount += C::t('forum_post')->count_by_authorid(0, $mem['uid']);
}
$postcount += C::t('forum_postcomment')->count_by_authorid($mem['uid']);
$threadcount = C::t('forum_thread')->count_by_authorid($mem['uid']);
C::t('common_member_count')->update($mem['uid'], array('posts' => $postcount, 'threads' => $threadcount));
}
if($processed) {
cpmsg("{$lang['counter_member']}: ".cplang('counter_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
} else {
cpmsg('counter_member_succeed', 'action=counter', 'succeed');
}
} elseif(submitcheck('groupmembernum', 1)) {
$nextlink = "action=counter&current=$next&pertask=$pertask&groupmembernum=yes";
$processed = 0;
$query = C::t('forum_forum')->fetch_all_fid_for_group($current, $pertask, 1);
foreach($query as $group) {
$processed = 1;
$membernum = C::t('forum_groupuser')->fetch_count_by_fid($group['fid']);
C::t('forum_forumfield')->update($group['fid'], array('membernum' => $membernum));
}
if($processed) {
cpmsg("{$lang['counter_groupmember_num']}: ".cplang('counter_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
} else {
cpmsg('counter_groupmember_num_succeed', 'action=counter', 'succeed');
}
} elseif(submitcheck('groupmemberpost', 1)) {
$nextlink = "action=counter&current=$next&pertask=$pertask&groupmemberpost=yes";
$processed = 0;
$queryf = C::t('forum_forum')->fetch_all_fid_for_group($current, $pertask, 1);
foreach($queryf as $group) {
$processed = 1;
$mreplies_array = array();
loadcache('posttableids');
$posttables = empty($_G['cache']['posttableids']) ? array(0) : $_G['cache']['posttableids'];
foreach($posttables as $posttableid) {
$mreplieslist = C::t('forum_post')->count_group_authorid_by_fid($posttableid, $group['fid']);
if($mreplieslist) {
foreach($mreplieslist as $mreplies) {
$mreplies_array[$mreplies['authorid']] = $mreplies_array[$mreplies['authorid']] + $mreplies['num'];
}
}
}
unset($mreplieslist);
foreach($mreplies_array as $authorid => $num) {
C::t('forum_groupuser')->update_for_user($authorid, $group['fid'], null, $num);
}
foreach(C::t('forum_thread')->count_group_thread_by_fid($group['fid']) as $mthreads) {
C::t('forum_groupuser')->update_for_user($mthreads['authorid'], $group['fid'], $mthreads['num']);
}
}
if($processed) {
cpmsg("{$lang['counter_groupmember_post']}: ".cplang('counter_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
} else {
cpmsg('counter_groupmember_post_succeed', 'action=counter', 'succeed');
}
} elseif(submitcheck('groupnum', 1)) {
$nextlink = "action=counter&current=$next&pertask=$pertask&groupnum=yes";
$processed = 0;
$queryf = C::t('forum_forum')->fetch_all_fid_for_group($current, $pertask);
foreach($queryf as $group) {
$processed = 1;
$groupnum = C::t('forum_forum')->fetch_groupnum_by_fup($group['fid']);
C::t('forum_forumfield')->update($group['fid'], array('groupnum' => intval($groupnum)));
}
if($processed) {
cpmsg("{$lang['counter_groupnum']}: ".cplang('counter_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
} else {
updatecache('grouptype');
cpmsg('counter_groupnum_succeed', 'action=counter', 'succeed');
}
} elseif(submitcheck('blogreplynum', 1)) {
$nextlink = "action=counter&current=$next&pertask=$pertask&blogreplynum=yes";
if(blog_replynum_stat($current, $pertask)) {
cpmsg("{$lang['counter_blog_replynum']}: ".cplang('counter_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
} else {
cpmsg('counter_blog_replynum_succeed', 'action=counter', 'succeed');
}
} elseif(submitcheck('friendnum', 1)) {
$nextlink = "action=counter&current=$next&pertask=$pertask&friendnum=yes";
if(space_friendnum_stat($current, $pertask)) {
cpmsg("{$lang['counter_friendnum']}: ".cplang('counter_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
} else {
cpmsg('counter_friendnum_succeed', 'action=counter', 'succeed');
}
} elseif(submitcheck('albumpicnum', 1)) {
$nextlink = "action=counter&current=$next&pertask=$pertask&albumpicnum=yes";
if(album_picnum_stat($current, $pertask)) {
cpmsg("{$lang['counter_album_picnum']}: ".cplang('counter_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
} else {
cpmsg('counter_album_picnum_succeed', 'action=counter', 'succeed');
}
} elseif(submitcheck('setthreadcover', 1)) {
$fid = intval($_GET['fid']);
$allthread = intval($_GET['allthread']);
if(empty($fid)) {
cpmsg('counter_thread_cover_fiderror', 'action=counter', 'error');
}
$nextlink = "action=counter&current=$next&pertask=$pertask&setthreadcover=yes&fid=$fid&allthread=$allthread";
$starttime = strtotime($_GET['starttime']);
$endtime = strtotime($_GET['endtime']);
$timesql = '';
if($starttime) {
$timesql .= " AND lastpost > $starttime";
$nextlink .= '&starttime='.$_GET['starttime'];
}
if($endtime) {
$timesql .= " AND lastpost < $endtime";
$nextlink .= '&endtime='.$_GET['endtime'];
}
$processed = 0;
$foruminfo = C::t('forum_forum')->fetch_info_by_fid($fid);
if(empty($foruminfo['picstyle'])) {
cpmsg('counter_thread_cover_fidnopicstyle', 'action=counter', 'error');
}
if($_G['setting']['forumpicstyle']) {
$_G['setting']['forumpicstyle'] = dunserialize($_G['setting']['forumpicstyle']);
empty($_G['setting']['forumpicstyle']['thumbwidth']) && $_G['setting']['forumpicstyle']['thumbwidth'] = 203;
empty($_G['setting']['forumpicstyle']['thumbheight']) && $_G['setting']['forumpicstyle']['thumbheight'] = 0;
} else {
$_G['setting']['forumpicstyle'] = array('thumbwidth' => 203, 'thumbheight' => 0);
}
require_once libfile('function/post');
$coversql = empty($allthread) ? 'AND cover=\'0\'' : '';
$cover = empty($allthread) ? 0 : null;
$_G['forum']['ismoderator'] = 1;
foreach(C::t('forum_thread')->fetch_all_by_fid_cover_lastpost($fid, $cover, $starttime, $endtime, $current, $pertask) as $thread) {
$processed = 1;
$pid = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid'], 0);
$pid = $pid['pid'];
setthreadcover($pid);
}
if($processed) {
cpmsg("{$lang['counter_thread_cover']}: ".cplang('counter_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
} else {
cpmsg('counter_thread_cover_succeed', 'action=counter', 'succeed');
}
} else {
shownav('tools', 'nav_updatecounters');
showsubmenu('nav_updatecounters');
showtips('counter_tips');
showformheader('counter');
showtableheader();
showsubtitle(array('', 'counter_amount'));
showhiddenfields(array('pertask' => ''));
showtablerow('', array('class="td31 bold"'), array(
"{$lang['counter_forum']}:",
'<input name="pertask1" type="text" class="txt" value="15" /><input type="submit" class="btn" name="forumsubmit" onclick="this.form.pertask.value=this.form.pertask1.value" value="'.$lang['submit'].'" />'
));
showtablerow('', array('class="td31 bold"'), array(
"{$lang['counter_digest']}:",
'<input name="pertask2" type="text" class="txt" value="1000" /><input type="submit" class="btn" name="digestsubmit" onclick="this.form.pertask.value=this.form.pertask2.value" value="'.$lang['submit'].'" />'
));
showtablerow('', array('class="td31 bold"'), array(
"{$lang['counter_member']}:",
'<input name="pertask3" type="text" class="txt" value="1000" /><input type="submit" class="btn" name="membersubmit" onclick="this.form.pertask.value=this.form.pertask3.value" value="'.$lang['submit'].'" />'
));
showtablerow('', array('class="td31 bold"'), array(
"{$lang['counter_thread']}:",
'<input name="pertask4" type="text" class="txt" value="500" /><input type="submit" class="btn" name="threadsubmit" onclick="this.form.pertask.value=this.form.pertask4.value" value="'.$lang['submit'].'" />'
));
showtablerow('', array('class="td31 bold"'), array(
"{$lang['counter_special']}:",
'<input name="pertask7" type="text" class="txt" value="1" disabled/><input type="submit" class="btn" name="specialarrange" onclick="this.form.pertask.value=this.form.pertask7.value" value="'.$lang['submit'].'" />'
));
showtablerow('', array('class="td31 bold"'), array(
"{$lang['counter_groupnum']}:",
'<input name="pertask8" type="text" class="txt" value="10" /><input type="submit" class="btn" name="groupnum" onclick="this.form.pertask.value=this.form.pertask8.value" value="'.$lang['submit'].'" />'
));
showtablerow('', array('class="td31 bold"'), array(
"{$lang['counter_groupmember_num']}:",
'<input name="pertask9" type="text" class="txt" value="100" /><input type="submit" class="btn" name="groupmembernum" onclick="this.form.pertask.value=this.form.pertask9.value" value="'.$lang['submit'].'" />'
));
showtablerow('', array('class="td31 bold"'), array(
"{$lang['counter_groupmember_post']}:",
'<input name="pertask10" type="text" class="txt" value="100" /><input type="submit" class="btn" name="groupmemberpost" onclick="this.form.pertask.value=this.form.pertask10.value" value="'.$lang['submit'].'" />'
));
showtablerow('', array('class="td31 bold"'), array(
"{$lang['counter_blog_replynum']}:",
'<input name="pertask11" type="text" class="txt" value="100" /><input type="submit" class="btn" name="blogreplynum" onclick="this.form.pertask.value=this.form.pertask11.value" value="'.$lang['submit'].'" />'
));
showtablerow('', array('class="td31 bold"'), array(
"{$lang['counter_friendnum']}:",
'<input name="pertask12" type="text" class="txt" value="100" /><input type="submit" class="btn" name="friendnum" onclick="this.form.pertask.value=this.form.pertask12.value" value="'.$lang['submit'].'" />'
));
showtablerow('', array('class="td31 bold"'), array(
"{$lang['counter_album_picnum']}:",
'<input name="pertask13" type="text" class="txt" value="100" /><input type="submit" class="btn" name="albumpicnum" onclick="this.form.pertask.value=this.form.pertask13.value" value="'.$lang['submit'].'" />'
));
showtablerow('', array('class="td31 bold"'), array(
"{$lang['counter_thread_cover']}:",
'<script type="text/javascript" src="' . STATICURL . 'js/calendar.js"></script><input name="pertask14" type="text" class="txt" value="100" /> '.$lang['counter_forumid'].': <input type="text" class="txt marginleft10" name="fid" value="" size="10">&nbsp;<input type="checkbox" class="checkbox" value="1" name="allthread">'.$lang['counter_have_cover'].'<br><input type="text" onclick="showcalendar(event, this)" value="" name="starttime" class="txt"> -- <input type="text" onclick="showcalendar(event, this)" value="" name="endtime" class="txt marginleft10">('.$lang['counter_thread_cover_settime'].') &nbsp;&nbsp;<input type="submit" class="btn" name="setthreadcover" onclick="this.form.pertask.value=this.form.pertask14.value" value="'.$lang['submit'].'" />'
));
showtablefooter();
showformfooter();
}
function runuchcount($start, $perpage) {
}
?>

View File

@@ -0,0 +1,218 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_credits.php 32527 2013-02-05 09:56:25Z monkey $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
$operation = $operation ? $operation : 'list';
if($operation == 'list') {
$rules = array();
foreach(C::t('common_credit_rule')->fetch_all_rule() as $value) {
$rules[$value['rid']] = $value;
}
if(!submitcheck('rulesubmit')) {
$anchor = in_array($_GET['anchor'], array('base', 'policytable', 'edit')) ? $_GET['anchor'] : 'base';
$current = array($anchor => 1);
showsubmenu('setting_credits', array(
array('setting_credits_base', 'setting&operation=credits&anchor=base', $current['base']),
array('setting_credits_policy', 'credits&operation=list&anchor=policytable', $current['policytable']),
));
showformheader("credits&operation=list");
showboxheader('setting_credits_policy', 'nobottom', 'id="policytable"'.($anchor != 'policytable' ? ' style="display: none"' : ''));
showtableheader();
echo '<tr class="header"><th class="td28 nowrap">'.$lang['setting_credits_policy_name'].'</th><th class="td28 nowrap">'.$lang['setting_credits_policy_cycletype'].'</th><th class="td28 nowrap">'.$lang['setting_credits_policy_rewardnum'].'</th>';
for($i = 1; $i <= 8; $i++) {
if($_G['setting']['extcredits'][$i]) {
echo "<th class=\"td25\" id=\"policy$i\" ".($_G['setting']['extcredits'][$i] ? '' : 'disabled')." valign=\"top\">".$_G['setting']['extcredits'][$i]['title']."</th>";
}
}
echo '<th class="td25">&nbsp;</th></tr>';
foreach($rules as $rid => $rule) {
$tdarr = array($rule['rulename'], $rule['rid'] ? $lang['setting_credits_policy_cycletype_'.$rule['cycletype']] : 'N/A', $rule['rid'] && $rule['cycletype'] ? $rule['rewardnum'] : 'N/A');
for($i = 1; $i <= 8; $i++) {
if($_G['setting']['extcredits'][$i]) {
array_push($tdarr, '<input name="credit['.$rule['rid'].']['.$i.']" class="txt" value="'.$rule['extcredits'.$i].'" />');
}
}
$opstr = '<a href="'.ADMINSCRIPT.'?action=credits&operation=edit&rid='.$rule['rid'].'" title="" class="act">'.$lang['edit'].'</a>';
array_push($tdarr, $opstr);
showtablerow('', array_fill(0, count($_G['setting']['extcredits']) + 4, 'class="td25"'), $tdarr);
}
showtablerow('', 'class="lineheight" colspan="9"', $lang['setting_credits_policy_comment']);
showtablefooter();
showboxfooter();
showtableheader('', 'nobottom', '');
showsetting('setting_credits_policy_mobile', 'settingnew[creditspolicymobile]', $_G['setting']['creditspolicymobile'], 'text');
showsubmit('rulesubmit');
showtablefooter();
showformfooter();
} else {
foreach($_GET['credit'] as $rid => $credits) {
$rule = array();
for($i = 1; $i <= 8; $i++) {
if($_G['setting']['extcredits'][$i]) {
$rule['extcredits'.$i] = $credits[$i];
}
}
C::t('common_credit_rule')->update($rid, $rule);
}
$settings = array(
'creditspolicymobile' => $_GET['settingnew']['creditspolicymobile'],
);
C::t('common_setting')->update_batch($settings);
updatecache(array('setting', 'creditrule'));
cpmsg('credits_update_succeed', 'action=credits&operation=list&anchor=policytable', 'succeed');
}
} elseif($operation == 'edit') {
$rid = intval($_GET['rid']);
$fid = intval($_GET['fid']);
if($rid) {
$globalrule = $ruleinfo = C::t('common_credit_rule')->fetch($rid);
if($fid) {
$query = C::t('forum_forum')->fetch_info_by_fid($fid);
$forumname = $query['name'];
$policy = $query['creditspolicy'] ? dunserialize($query['creditspolicy']) : array();
if(isset($policy[$ruleinfo['action']])) {
$ruleinfo = $policy[$ruleinfo['action']];
}
}
}
if(!submitcheck('rulesubmit')) {
if(!$rid) {
$ruleinfo['rulename'] = $lang['credits_edit_lowerlimit'];
}
if(!$fid) {
shownav('global', 'credits_edit');
showsubmenu("{$lang['credits_edit']} - {$ruleinfo['rulename']}");
} else {
if(!in_array($fid, explode(',', $globalrule['fids']))) {
for($i = 1; $i <= 8; $i++) {
$ruleinfo['extcredits'.$i] = '';
}
}
shownav('forum', 'forums_edit');
showsubmenu("$forumname - {$lang['credits_edit']} - {$ruleinfo['rulename']}");
showtips('forums_edit_tips');
}
showformheader("credits&operation=edit&rid=$rid&".($fid ? "fid=$fid" : ''));
$extra = '';
if($fid) {
$actives = $checkarr = array();
$usecustom = in_array($fid, explode(',', $globalrule['fids'])) ? 1 : 0;
$actives[$usecustom] = ' class="checked"';
$checkarr[$usecustom] = ' checked';
showtableheader('', 'nobottom');
$str = <<<EOF
<ul onmouseover="altStyle(this);">
<li$actives[1]><input type="radio" onclick="$('edit').style.display = '';" $checkarr[1] value="1" name="rule[usecustom]" class="radio">&nbsp;{$lang['yes']}</li>
<li$actives[0]><input type="radio" onclick="$('edit').style.display = 'none';" $checkarr[0] value="0" name="rule[usecustom]" class="radio">&nbsp;{$lang['no']}</li>
</ul>
EOF;
showsetting('setting_credits_use_custom_credit', 'usecustom', $usecustom, $str);
showtablefooter();
$extra = !$usecustom ? ' style="display:none;" ' : '';
}
showtips('setting_credits_policy_comment');
showtableheader('credits_edit', 'nobottom', 'id="edit"'.$extra);
if($rid) {
showsetting('setting_credits_policy_cycletype', array('rule[cycletype]', array(
array(0, $lang['setting_credits_policy_cycletype_0'], array('cycletimetd' => 'none', 'rewardnumtd' => 'none')),
array(1, $lang['setting_credits_policy_cycletype_1'], array('cycletimetd' => 'none', 'rewardnumtd' => '')),
array(2, $lang['setting_credits_policy_cycletype_2'], array('cycletimetd' => '', 'rewardnumtd' => '')),
array(3, $lang['setting_credits_policy_cycletype_3'], array('cycletimetd' => '', 'rewardnumtd' => '')),
array(4, $lang['setting_credits_policy_cycletype_4'], array('cycletimetd' => 'none', 'rewardnumtd' => '')),
)), $ruleinfo['cycletype'], 'mradio');
showtagheader('tbody', 'cycletimetd', in_array($ruleinfo['cycletype'], array(2, 3)), 'sub');
showsetting('credits_edit_cycletime', 'rule[cycletime]', $ruleinfo['cycletime'], 'text');
showtagfooter('tbody');
showtagheader('tbody', 'rewardnumtd', in_array($ruleinfo['cycletype'], array(1, 2, 3, 4)), 'sub');
showsetting('credits_edit_rewardnum', 'rule[rewardnum]', $ruleinfo['rewardnum'], 'text');
showtagfooter('tbody');
}
for($i = 1; $i <= 8; $i++) {
if($_G['setting']['extcredits'][$i]) {
if($rid) {
showsetting("extcredits{$i}(".$_G['setting']['extcredits'][$i]['title'].')', "rule[extcredits{$i}]", $ruleinfo['extcredits'.$i], 'text', '', 0, $fid ? '('.$lang['credits_edit_globalrule'].':'.$globalrule['extcredits'.$i].')' : '');
} else {
showsetting("extcredits{$i}(".$_G['setting']['extcredits'][$i]['title'].')', "rule[extcredits{$i}]", $_G['setting']['creditspolicy']['lowerlimit'][$i], 'text');
}
}
}
showtablefooter();
showtableheader('', 'nobottom');
showsubmit('rulesubmit');
showtablefooter();
showformfooter();
} else {
$rid = $_GET['rid'];
$rule = $_GET['rule'];
if($rid) {
if(!$rule['cycletype']) {
$rule['cycletime'] = 0;
$rule['rewardnum'] = 1;
}
$havecredit = $rule['usecustom'] ? true : false;
for($i = 1; $i <= 8; $i++) {
if(!$_G['setting']['extcredits'][$i]) {
$rule['extcredits'.$i] = 0;
}
}
foreach($rule as $key => $val) {
$rule[$key] = intval($val);
}
if($fid) {
$fids = $globalrule['fids'] ? explode(',', $globalrule['fids']) : array();
if($havecredit) {
$rule['rid'] = $rid;
$rule['fid'] = $fid;
$rule['rulename'] = $ruleinfo['rulename'];
$rule['action'] = $ruleinfo['action'];
$policy[$ruleinfo['action']] = $rule;
if(!in_array($fid, $fids)) {
$fids[] = $fid;
}
} else {
if($rule['cycletype'] != 0 && ($rule['cycletype'] == 4 && !$rule['rewardnum'])) {
require_once DISCUZ_ROOT.'./source/class/class_credit.php';
credit::deletelogbyfid($rid, $fid);
}
unset($policy[$ruleinfo['action']]);
if(in_array($fid, $fids)) {
unset($fids[array_search($fid, $fids)]);
}
}
C::t('forum_forumfield')->update($fid, array('creditspolicy' => serialize($policy)));
C::t('common_credit_rule')->update($rid, array('fids' => implode(',', $fids)));
updatecache('creditrule');
cpmsg('credits_update_succeed', 'action=forums&operation=edit&anchor=credits&fid='.$fid, 'succeed');
} else {
C::t('common_credit_rule')->update($rid, $rule);
}
updatecache('creditrule');
} else {
$lowerlimit['creditspolicy']['lowerlimit'] = array();
for($i = 1; $i <= 8; $i++) {
if($_G['setting']['extcredits'][$i]) {
$lowerlimit['creditspolicy']['lowerlimit'][$i] = (float)$rule['extcredits'.$i];
}
}
C::t('common_setting')->update_setting('creditspolicy', $lowerlimit['creditspolicy']);
updatecache(array('setting', 'creditrule'));
}
cpmsg('credits_update_succeed', 'action=credits&operation=list&anchor=policytable', 'succeed');
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,162 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_district.php 26298 2011-12-08 03:58:22Z chenmengshu $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
shownav('global', 'district');
$values = array(intval($_GET['countryid']), intval($_GET['pid']), intval($_GET['cid']), intval($_GET['did']));
$elems = array($_GET['country'], $_GET['province'], $_GET['city'], $_GET['district']);
$level = 0;
$upids = array(0);
$theid = 0;
for($i=0;$i<4;$i++) {
if(!empty($values[$i])) {
$theid = intval($values[$i]);
$upids[] = $theid;
$level++;
} else {
for($j=$i; $j<4; $j++) {
$values[$j] = '';
}
break;
}
}
if(submitcheck('editsubmit')) {
$delids = array();
foreach(C::t('common_district')->fetch_all_by_upid($theid) as $value) {
$usetype = 0;
if($_POST['birthcity'][$value['id']] && $_POST['residecity'][$value['id']]) {
$usetype = 3;
} elseif($_POST['birthcity'][$value['id']]) {
$usetype = 1;
} elseif($_POST['residecity'][$value['id']]) {
$usetype = 2;
}
if(!isset($_POST['district'][$value['id']])) {
$delids[] = $value['id'];
} elseif($_POST['district'][$value['id']] != $value['name'] || $_POST['displayorder'][$value['id']] != $value['displayorder'] || $usetype != $value['usetype']) {
C::t('common_district')->update($value['id'], array('name'=>$_POST['district'][$value['id']], 'displayorder'=>$_POST['displayorder'][$value['id']], 'usetype'=>$usetype));
}
}
if($delids) {
$ids = $delids;
for($i=$level; $i<4; $i++) {
$ids = array();
foreach(C::t('common_district')->fetch_all_by_upid($delids) as $value) {
$value['id'] = intval($value['id']);
$delids[] = $value['id'];
$ids[] = $value['id'];
}
if(empty($ids)) {
break;
}
}
C::t('common_district')->delete($delids);
}
if(!empty($_POST['districtnew'])) {
$inserts = array();
$displayorder = '';
foreach($_POST['districtnew'] as $key => $value) {
$displayorder = trim($_POST['districtnew_order'][$key]);
$value = trim($value);
if(!empty($value)) {
C::t('common_district')->insert(array('name' => $value, 'level' => $level, 'upid' => $theid, 'displayorder' => $displayorder));
}
}
}
cpmsg('setting_district_edit_success', 'action=district&countryid='.$values[0].'&pid='.$values[1].'&cid='.$values[2].'&did='.$values[3], 'succeed');
} else {
showsubmenu('district');
showtips('district_tips');
showformheader('district&countryid='.$values[0].'&pid='.$values[1].'&cid='.$values[2].'&did='.$values[3]);
showboxheader();
showtableheader();
$options = array(0=>array(), 1=>array(), 2=>array(), 3=>array());
$thevalues = array();
foreach(C::t('common_district')->fetch_all_by_upid($upids) as $value) {
$options[$value['level']][] = array($value['id'], $value['name']);
if($value['upid'] == $theid) {
$thevalues[] = array($value['id'], $value['name'], $value['displayorder'], $value['usetype']);
}
}
$names = array('country', 'province', 'city', 'district');
for($i=0; $i<4;$i++) {
$elems[$i] = !empty($elems[$i]) ? $elems[$i] : $names[$i];
}
$html = '';
for($i=0;$i<4;$i++) {
$jscall = ($i == 0 ? 'this.form.province.value=\'\';this.form.city.value=\'\';this.form.district.value=\'\';' : '')."refreshdistrict('$elems[0]', '$elems[1]', '$elems[2]', '$elems[3]')";
$html .= '<select name="'.$elems[$i].'" id="'.$elems[$i].'" onchange="'.$jscall.'">';
$html .= '<option value="">'.lang('spacecp', 'district_level_'.$i).'</option>';
foreach($options[$i] as $option) {
$selected = $option[0] == $values[$i] ? ' selected="selected"' : '';
$html .= '<option value="'.$option[0].'"'.$selected.'>'.$option[1].'</option>';
}
$html .= '</select>&nbsp;&nbsp;';
}
echo cplang('district_choose').' &nbsp; '.$html;
showsubtitle($values[0] ? array('', 'display_order', 'name', 'operation') : array('', 'display_order', 'name', 'district_birthcity', 'district_residecity', 'operation'));
foreach($thevalues as $value) {
$valarr = array();
$valarr[] = '';
$valarr[] = '<input type="text" id="displayorder_'.$value[0].'" class="txt" name="displayorder['.$value[0].']" value="'.$value[2].'"/>';
$valarr[] = '<p id="p_'.$value[0].'"><input type="text" id="input_'.$value[0].'" class="txt" name="district['.$value[0].']" value="'.$value[1].'"/></p>';
if(!$values[0]) {
$valarr[] = '<input type="checkbox" name="birthcity['.$value[0].']" value="1" class="checkbox"'.($value[3] && in_array($value[3], array(1,3)) ? ' checked="checked" ':'').' />';
$valarr[] = '<input type="checkbox" name="residecity['.$value[0].']" value="1" class="checkbox"'.($value[3] && in_array($value[3], array(2,3)) ? ' checked="checked" ':'').' />';
}
$valarr[] = '<a href="javascript:;" onclick="deletedistrict('.$value[0].');return false;">'.cplang('delete').'</a>';
showtablerow('id="td_'.$value[0].'"', array('', 'class="td25"','','','',''), $valarr);
}
showtablerow('', array('colspan=2'), array(
'<div><a href="javascript:;" onclick="addrow(this, 0, 1);return false;" class="addtr">'.cplang('add').'</a></div>'
));
showsubmit('editsubmit', 'submit');
$adminurl = ADMINSCRIPT.'?action=district';
echo <<<SCRIPT
<script type="text/javascript">
var rowtypedata = [
[[1,'', ''],[1,'<input type="text" class="txt" name="districtnew_order[]" value="0" />', 'td25'],[2,'<input type="text" class="txt" name="districtnew[]" value="" />', '']],
];
function refreshdistrict(country, province, city, district) {
location.href = "$adminurl"
+"&country="+country+"&province="+province+"&city="+city+"&district="+district
+"&countryid="+$(country).value+"&pid="+$(province).value + "&cid="+$(city).value+"&did="+$(district).value;
}
function editdistrict(did) {
$('input_' + did).style.display = "block";
$('span_' + did).style.display = "none";
}
function deletedistrict(did) {
var elem = $('p_' + did);
elem.parentNode.removeChild(elem);
var elem = $('td_' + did);
elem.parentNode.removeChild(elem);
}
</script>
SCRIPT;
showtablefooter();
showboxfooter();
showformfooter();
}
?>

View File

@@ -0,0 +1,294 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_diytemplate.php 29236 2012-03-30 05:34:47Z chenmengshu $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
$operation = in_array($operation, array('edit', 'perm')) ? $operation : 'list';
shownav('portal', 'diytemplate');
if($operation == 'list') {
$searchctrl = '<span style="float: right; padding-right: 40px;">'
.'<a href="javascript:;" onclick="$(\'tb_search\').style.display=\'\';$(\'a_search_show\').style.display=\'none\';$(\'a_search_hide\').style.display=\'\';" id="a_search_show" style="display:none">'.cplang('show_search').'</a>'
.'<a href="javascript:;" onclick="$(\'tb_search\').style.display=\'none\';$(\'a_search_show\').style.display=\'\';$(\'a_search_hide\').style.display=\'none\';" id="a_search_hide">'.cplang('hide_search').'</a>'
.'</span>';
showsubmenu('diytemplate', array(
array('list', 'diytemplate', 1),
), $searchctrl);
$intkeys = array('uid', 'closed');
$strkeys = array();
$randkeys = array();
$likekeys = array('targettplname', 'primaltplname', 'username', 'name');
$results = getwheres($intkeys, $strkeys, $randkeys, $likekeys);
foreach($likekeys as $k) {
$_GET[$k] = dhtmlspecialchars($_GET[$k]);
}
$wherearr = $results['wherearr'];
$mpurl = ADMINSCRIPT.'?action=diytemplate';
$mpurl .= '&'.implode('&', $results['urls']);
$wherearr[] = " primaltplname NOT LIKE 'portal/list%' ";
$wherearr[] = " primaltplname NOT LIKE 'portal/portal_topic_content%' ";
if($_GET['permname']) {
$tpls = '';
$member = C::t('common_member')->fetch_by_username($_GET['permname']);
if($member && $member['adminid'] != 1) {
$tpls = array_keys(C::t('common_template_permission')->fetch_all_by_uid($member['uid']));
if(($tpls = dimplode($tpls))) {
$wherearr[] = 'targettplname IN ('.$tpls.')';
} else {
cpmsg_error($_GET['permname'].cplang('diytemplate_the_username_has_not_template'));
}
}
$mpurl .= '&permname='.$_GET['permname'];
}
$wheresql = empty($wherearr)?'':implode(' AND ', $wherearr);
$orders = getorders(array('dateline','targettplname'), 'dateline');
$ordersql = $orders['sql'];
if($orders['urls']) $mpurl .= '&'.implode('&', $orders['urls']);
$orderby = array($_GET['orderby']=>' selected');
$ordersc = array($_GET['ordersc']=>' selected');
$perpage = empty($_GET['perpage'])?0:intval($_GET['perpage']);
if(!in_array($perpage, array(10,20,50,100))) $perpage = 20;
$perpages = array($perpage=>' selected');
$searchlang = array();
$keys = array('search', 'likesupport', 'resultsort', 'defaultsort', 'orderdesc', 'orderasc', 'perpage_10', 'perpage_20', 'perpage_50', 'perpage_100',
'diytemplate_name', 'diytemplate_dateline', 'diytemplate_targettplname', 'diytemplate_primaltplname', 'diytemplate_uid', 'diytemplate_username',
'nolimit', 'no', 'yes', 'diytemplate_permname', 'diytemplate_permname_tips');
foreach ($keys as $key) {
$searchlang[$key] = cplang($key);
}
$adminscript = ADMINSCRIPT;
echo <<<SEARCH
<form method="get" autocomplete="off" action="$adminscript" id="tb_search">
<table cellspacing="3" cellpadding="3" class="tb tb2">
<tr>
<th>{$searchlang['diytemplate_name']}*</th><td><input type="text" class="txt" name="name" value="{$_GET['name']}"></td>
<th>{$searchlang['diytemplate_targettplname']}*</th><td><input type="text" class="txt" name="targettplname" value="{$_GET['targettplname']}"></td>
<th>{$searchlang['diytemplate_primaltplname']}*</th><td><input type="text" class="txt" name="primaltplname" value="{$_GET['primaltplname']}"> *{$searchlang['likesupport']}</td>
</tr>
<tr>
<th>{$searchlang['diytemplate_uid']}</th><td><input type="text" class="txt" name="uid" value="{$_GET['uid']}"></td>
<th>{$searchlang['diytemplate_username']}*</th><td><input type="text" class="txt" name="username" value="{$_GET['username']}" colspan="2"></td>
</tr>
<tr>
<th>{$searchlang['resultsort']}</th>
<td colspan="3">
<select name="orderby">
<option value="">{$searchlang['defaultsort']}</option>
<option value="dateline"{$orderby['dateline']}>{$searchlang['diytemplate_dateline']}</option>
<option value="targettplname"{$orderby['targettplname']}>{$searchlang['diytemplate_targettplname']}</option>
</select>
<select name="ordersc">
<option value="desc"{$ordersc['desc']}>{$searchlang['orderdesc']}</option>
<option value="asc"{$ordersc['asc']}>{$searchlang['orderasc']}</option>
</select>
<select name="perpage">
<option value="10"{$perpages[10]}>{$searchlang['perpage_10']}</option>
<option value="20"{$perpages[20]}>{$searchlang['perpage_20']}</option>
<option value="50"{$perpages[50]}>{$searchlang['perpage_50']}</option>
<option value="100"{$perpages[100]}>{$searchlang['perpage_100']}</option>
</select>
<input type="hidden" name="action" value="diytemplate">
</td>
<th>{$searchlang['diytemplate_permname']}</th>
<td><input type="text" class="txt" name="permname" value="{$_GET['permname']}"> {$searchlang['diytemplate_permname_tips']}
<input type="submit" name="searchsubmit" value="{$searchlang['search']}" class="btn"></td>
</tr>
</table>
</form>
SEARCH;
$start = ($page-1)*$perpage;
$mpurl .= '&perpage='.$perpage;
$perpages = array($perpage => ' selected');
showformheader('diytemplate');
showtableheader('diytemplate_list');
showsubtitle(array('diytemplate_name', 'diytemplate_targettplname', 'diytemplate_primaltplname', 'username', 'diytemplate_dateline', 'operation'));
$multipage = '';
if(($count = C::t('common_diy_data')->count_by_where($wheresql))) {
loadcache('diytemplatename');
require_once libfile('function/block');
foreach(C::t('common_diy_data')->fetch_all_by_where($wheresql, $ordersql, $start, $perpage) as $value) {
$value['name'] = $_G['cache']['diytemplatename'][$value['targettplname']];
$value['dateline'] = $value['dateline'] ? dgmdate($value['dateline']) : '';
$diyurl = block_getdiyurl($value['targettplname']);
$diytitle = cplang($diyurl['flag'] ? 'diytemplate_share' : 'diytemplate_alone');
showtablerow('', array('class=""', 'class=""', 'class="td28"'), array(
"<a href=\"{$diyurl['url']}\" title=\"$diytitle\" target=\"_blank\">{$value['name']}</a>",
'<span title="'.cplang('diytemplate_path').'./data/diy/'.$value['targettplname'].'.htm">'.$value['targettplname'].'</span>',
'<span title="'.cplang('diytemplate_path').$_G['style']['tpldir'].'/'.$value['primaltplname'].'.htm">'.$value['primaltplname'].'</span>',
"<a href=\"home.php?mod=space&uid={$value['uid']}&do=profile\" target=\"_blank\">{$value['username']}</a>",
$value['dateline'],
'<a href="'.ADMINSCRIPT.'?action=diytemplate&operation=edit&targettplname='.$value['targettplname'].'&tpldirectory='.$value['tpldirectory'].'">'.cplang('edit').'</a> '.
'<a href="'.ADMINSCRIPT.'?action=diytemplate&operation=perm&targettplname='.$value['targettplname'].'&tpldirectory='.$value['tpldirectory'].'">'.cplang('diytemplate_perm').'</a>',
));
}
$multipage = multi($count, $perpage, $page, $mpurl);
}
showsubmit('', '', '', '', $multipage);
showtablefooter();
showformfooter();
} elseif($operation == 'edit') {
loadcache('diytemplatename');
$targettplname = $_GET['targettplname'];
$tpldirectory = $_GET['tpldirectory'];
$diydata = C::t('common_diy_data')->fetch_diy($targettplname, $tpldirectory);
if(empty($diydata)) { cpmsg_error('diytemplate_targettplname_error', dreferer());}
if(!submitcheck('editsubmit')) {
if(empty($diydata['name'])) $diydata['name'] = $_G['cache']['diytemplatename'][$diydata['targettplname']];
shownav('portal', 'diytemplate', $diydata['name']);
showsubmenu(cplang('diytemplate_edit').' - '.$diydata['name'], array(
array('list', 'diytemplate', 0),
array('edit', 'diytemplate&operation=edit&targettplname='.$_GET['targettplname']."&tpldirectory=$tpldirectory", 1)
));
showformheader("diytemplate&operation=edit&targettplname=$targettplname&tpldirectory=$tpldirectory");
showtableheader();
showtitle('edit');
showsetting('diytemplate_name', 'name', $diydata['name'],'text');
showsetting('diytemplate_targettplname', '', '',cplang('diytemplate_path').'./data/diy/'.$diydata['targettplname'].'.htm');
showsetting('diytemplate_primaltplname', '', '',cplang('diytemplate_path').$_G['style']['tpldir'].'/'.$diydata['primaltplname'].'.htm');
showsetting('diytemplate_username', '', '',$diydata['username']);
showsetting('diytemplate_dateline', '', '',$diydata['dateline'] ? dgmdate($diydata['dateline']) : '');
showsubmit('editsubmit');
showtablefooter();
showformfooter();
} else {
$editdiydata = array('name'=>$_GET['name']);
C::t('common_diy_data')->update_diy($targettplname, $tpldirectory, $editdiydata);
include_once libfile('function/cache');
updatecache('diytemplatename');
cpmsg('diytemplate_edit_succeed', 'action=diytemplate', 'succeed');
}
} elseif($operation=='perm') {
loadcache('diytemplatename');
$targettplname = $_GET['targettplname'];
$tpldirectory = $_GET['tpldirectory'];
$diydata = C::t('common_diy_data')->fetch_diy($targettplname, $tpldirectory);
if(empty($diydata)) { cpmsg_error('diytemplate_targettplname_error', dreferer());}
if(!submitcheck('permsubmit')) {
shownav('portal', 'diytemplate', 'diytemplate_perm');
showsubmenu(cplang('diytemplate_perm_edit').' - '.($diydata['name'] ? cplang($diydata['name']) : $_G['cache']['diytemplatename'][$diydata['targettplname']]));
showtips('diytemplate_perm_tips');
showformheader("diytemplate&operation=perm&targettplname=$targettplname&tpldirectory=$tpldirectory");
showtableheader('', 'fixpadding');
showsubtitle(array('', 'username',
'<input class="checkbox" type="checkbox" name="chkallmanage" onclick="checkAll(\'prefix\', this.form, \'allowmanage\', \'chkallmanage\')" id="chkallmanage" /><label for="chkallmanage">'.cplang('block_perm_manage').'</label>',
'<input class="checkbox" type="checkbox" name="chkallrecommend" onclick="checkAll(\'prefix\', this.form, \'allowrecommend\', \'chkallrecommend\')" id="chkallrecommend" /><label for="chkallrecommend">'.cplang('block_perm_recommend').'</label>',
'<input class="checkbox" type="checkbox" name="chkallneedverify" onclick="checkAll(\'prefix\', this.form, \'needverify\', \'chkallneedverify\')" id="chkallneedverify" /><label for="chkallneedverify">'.cplang('block_perm_needverify').'</label>',
'block_perm_inherited'
));
$allpermission = C::t('common_template_permission')->fetch_all_by_targettplname($targettplname);
$allusername = C::t('common_member')->fetch_all_username_by_uid(array_keys($allpermission));
$line = '&minus;';
foreach($allpermission as $uid => $value) {
if(!empty($value['inheritedtplname'])) {
showtablerow('', array('class="td25"'), array(
"",
"$allusername[$uid]",
$value['allowmanage'] ? '&radic;' : $line,
$value['allowrecommend'] ? '&radic;' : $line,
$value['needverify'] ? '&radic;' : $line,
'<a href="'.ADMINSCRIPT.'?action=diytemplate&operation=perm&targettplname='.$value['inheritedtplname'].'">'.$_G['cache']['diytemplatename'][$value['inheritedtplname']].'</a>',
));
} else {
showtablerow('', array('class="td25"'), array(
"<input type=\"checkbox\" class=\"checkbox\" name=\"delete[{$value['uid']}]\" value=\"{$value['uid']}\" />
<input type=\"hidden\" name=\"perm[{$value['uid']}][allowmanage]\" value=\"{$value['allowmanage']}\" />
<input type=\"hidden\" name=\"perm[{$value['uid']}][allowrecommend]\" value=\"{$value['allowrecommend']}\" />
<input type=\"hidden\" name=\"perm[{$value['uid']}][needverify]\" value=\"{$value['needverify']}\" />",
"$allusername[$uid]",
"<input type=\"checkbox\" class=\"checkbox\" name=\"allowmanage[{$value['uid']}]\" value=\"1\" ".($value['allowmanage'] ? 'checked' : '').' />',
"<input type=\"checkbox\" class=\"checkbox\" name=\"allowrecommend[{$value['uid']}]\" value=\"1\" ".($value['allowrecommend'] ? 'checked' : '').' />',
"<input type=\"checkbox\" class=\"checkbox\" name=\"needverify[{$value['uid']}]\" value=\"1\" ".($value['needverify'] ? 'checked' : '').' />',
$line,
));
}
}
showtablerow('', array('class="td25"'), array(
cplang('add_new'),
'<input type="text" class="txt" name="newuser" value="" size="20" />',
'<input type="checkbox" class="checkbox" name="newallowmanage" value="1" />',
'<input type="checkbox" class="checkbox" name="newallowrecommend" value="1" />',
'<input type="checkbox" class="checkbox" name="newneedverify" value="1" />',
'',
));
showsubmit('permsubmit', 'submit', 'del');
showtablefooter();
showformfooter();
} else {
$users = array();
if(!empty($_GET['newuser'])) {
$uid = C::t('common_member')->fetch_uid_by_username($_GET['newuser']);
if($uid) {
$user = array();
$user['uid'] = $uid;
$user['allowmanage'] = $_GET['newallowmanage'] ? 1 : 0;
$user['allowrecommend'] = $_GET['newallowrecommend'] ? 1 : 0;
$user['needverify'] = $_GET['newneedverify'] ? 1 : 0;
$users[] = $user;
} else {
cpmsg_error($_GET['newuser'].cplang('block_has_no_allowauthorizedblock'), dreferer());
}
}
if(is_array($_GET['perm'])) {
foreach($_GET['perm'] as $uid => $value) {
if(empty($_GET['delete']) || !in_array($uid, $_GET['delete'])) {
$user = array();
$user['allowmanage'] = $_GET['allowmanage'][$uid] ? 1 : 0;
$user['allowrecommend'] = $_GET['allowrecommend'][$uid] ? 1 : 0;
$user['needverify'] = $_GET['needverify'][$uid] ? 1 : 0;
if($value['allowmanage'] != $user['allowmanage'] || $value['allowrecommend'] != $user['allowrecommend'] || $value['needverify'] != $user['needverify'] ) {
$user['uid'] = intval($uid);
$users[] = $user;
}
}
}
}
if(!empty($users) || $_GET['delete']) {
require_once libfile('class/blockpermission');
$tplpermsission = & template_permission::instance();
if($_GET['delete']) {
$tplpermsission->delete_users($targettplname ,$_GET['delete']);
}
if(!empty($users)) {
$tplpermsission->add_users($targettplname, $users);
}
}
cpmsg('diytemplate_perm_update_succeed', "action=diytemplate&operation=perm&targettplname=$targettplname&tpldirectory=$tpldirectory", 'succeed');
}
}
?>

View File

@@ -0,0 +1,181 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_doing.php 27696 2012-02-10 03:39:50Z svn_project_zhangjie $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
$detail = $_GET['detail'];
$users = $_GET['users'];
$userip = $_GET['userip'];
$keywords = $_GET['keywords'];
$lengthlimit = $_GET['lengthlimit'];
$starttime = $_GET['starttime'];
$endtime = $_GET['endtime'];
$searchsubmit = $_GET['searchsubmit'];
$doids = $_GET['doids'];
$fromumanage = $_GET['fromumanage'] ? 1 : 0;
cpheader();
if(!submitcheck('doingsubmit')) {
if(empty($_GET['search'])) {
$newlist = 1;
$detail = 1;
}
if($fromumanage) {
$starttime = !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $starttime) ? '' : $starttime;
$endtime = $_G['adminid'] == 3 || !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $endtime) ? '' : $endtime;
} else {
$starttime = !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $starttime) ? dgmdate(TIMESTAMP - 86400 * 7, 'Y-n-j') : $starttime;
$endtime = $_G['adminid'] == 3 || !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $endtime) ? dgmdate(TIMESTAMP, 'Y-n-j') : $endtime;
}
shownav('topic', 'nav_doing');
showsubmenu('nav_doing', array(
array('newlist', 'doing', !empty($newlist)),
array('search', 'doing&search=true', empty($newlist)),
));
empty($newlist) && showsubmenusteps('', array(
array('doing_search', !$searchsubmit),
array('nav_doing', $searchsubmit)
));
if(empty($newlist)) {
$search_tips = 1;
showtips('doing_tips');
}
$staticurl = STATICURL;
echo <<<EOT
<script type="text/javascript" src="{$staticurl}js/calendar.js"></script>
<script type="text/JavaScript">
function page(number) {
$('doingforum').page.value=number;
$('doingforum').searchsubmit.click();
}
</script>
EOT;
showtagheader('div', 'searchposts', !$searchsubmit && empty($newlist));
showformheader("doing".(!empty($_GET['search']) ? '&search=true' : ''), '', 'doingforum');
showhiddenfields(array('page' => $page, 'pp' => $_GET['pp'] ? $_GET['pp'] : $_GET['perpage']));
showtableheader();
showsetting('doing_search_detail', 'detail', $detail, 'radio');
showsetting('doing_search_perpage', '', $_GET['perpage'], "<select name='perpage'><option value='20'>{$lang['perpage_20']}</option><option value='50'>{$lang['perpage_50']}</option><option value='100'>{$lang['perpage_100']}</option></select>");
showsetting('doing_search_user', 'users', $users, 'text');
showsetting('doing_search_ip', 'userip', $userip, 'text');
showsetting('doing_search_keyword', 'keywords', $keywords, 'text');
showsetting('doing_search_lengthlimit', 'lengthlimit', $lengthlimit, 'text');
showsetting('doing_search_time', array('starttime', 'endtime'), array($starttime, $endtime), 'daterange');
echo '<input type="hidden" name="fromumanage" value="'.$fromumanage.'">';
showsubmit('searchsubmit');
showtablefooter();
showformfooter();
showtagfooter('div');
} else {
$doids = authcode($doids, 'DECODE');
$doidsadd = $doids ? explode(',', $doids) : $_GET['delete'];
include_once libfile('function/delete');
$deletecount = count(deletedoings($doidsadd));
$cpmsg = cplang('doing_succeed', array('deletecount' => $deletecount));
?>
<script type="text/JavaScript">alert('<?php echo $cpmsg;?>');parent.$('doingforum').searchsubmit.click();</script>
<?php
}
if(submitcheck('searchsubmit', 1) || $newlist) {
$doids = $doingcount = '0';
$sql = $error = '';
$keywords = trim($keywords);
$users = trim($users);
if($users != '') {
$uids = C::t('common_member')->fetch_all_uid_by_username(array_map('trim', explode(',', $users)));
if(!$uids) {
$uids = array(-1);
}
}
if(($_G['adminid'] == 2 && $endtime - $starttime > 86400 * 16) || ($_G['adminid'] == 3 && $endtime - $starttime > 86400 * 8)) {
$error = 'prune_mod_range_illegal';
}
if(!($_G['adminid'] == 1 && $endtime != dgmdate(TIMESTAMP, 'Y-n-j'))) {
$endtime = TIMESTAMP;
}
if(!$error) {
if($detail) {
$_GET['perpage'] = intval($_GET['perpage']) < 1 ? 20 : intval($_GET['perpage']);
$perpage = $_GET['pp'] ? $_GET['pp'] : $_GET['perpage'];
$query = C::t('home_doing')->fetch_all_search((($page - 1) * $perpage), $perpage, 1, $uids, $userip, $keywords, $lengthlimit, $starttime, $endtime);
$doings = '';
foreach ($query as $doing) {
$doing['dateline'] = dgmdate($doing['dateline']);
$doings .= showtablerow('', '', array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"{$doing['doid']}\" />",
"<a href=\"home.php?mod=space&uid={$doing['uid']}\" target=\"_blank\">{$doing['username']}</a>",
$doing['message'],
$doing['ip'],
$doing['dateline']
), TRUE);
}
$doingcount = C::t('home_doing')->fetch_all_search((($page - 1) * $perpage), $perpage, 3, $uids, $userip, $keywords, $lengthlimit, $starttime, $endtime);
$multi = multi($doingcount, $perpage, $page, ADMINSCRIPT."?action=doing");
$multi = preg_replace("/href=\"".ADMINSCRIPT."\?action=doing&amp;page=(\d+)\"/", "href=\"javascript:page(\\1)\"", $multi);
$multi = str_replace("window.location='".ADMINSCRIPT."?action=doing&amp;page='+this.value", "page(this.value)", $multi);
} else {
$doingcount = 0;
$query = C::t('home_doing')->fetch_all_search((($page - 1) * $perpage), $perpage, 2, $uids, $userip, $keywords, $lengthlimit, $starttime, $endtime);
foreach ($query as $doing) {
$doids .= ','.$doing['doid'];
$doingcount++;
}
$multi = '';
}
if(!$doingcount) {
$error = 'doing_post_nonexistence';
}
}
showtagheader('div', 'postlist', $searchsubmit || $newlist);
showformheader('doing&frame=no', 'target="doingframe"');
showhiddenfields(array('doids' => authcode($doids, 'ENCODE')));
if(!$search_tips) {
showtableheader(cplang('doing_new_result').' '.$doingcount, 'fixpadding');
} else {
showtableheader(cplang('doing_result').' '.$doingcount.(empty($newlist) ? ' <a href="###" onclick="$(\'searchposts\').style.display=\'\';$(\'postlist\').style.display=\'none\';$(\'doingforum\').pp.value=\'\';$(\'doingforum\').page.value=\'\';" class="act lightlink normal">'.cplang('research').'</a>' : ''), 'fixpadding');
}
if($error) {
echo "<tr><td class=\"lineheight\" colspan=\"15\">$lang[$error]</td></tr>";
} else {
if($detail) {
showsubtitle(array('', 'author', 'message', 'ip', 'time'));
echo $doings;
}
}
showsubmit('doingsubmit', 'delete', $detail ? 'del' : '', '', $multi);
showtablefooter();
showformfooter();
echo '<iframe name="doingframe" style="display:none"></iframe>';
showtagfooter('div');
}
?>

View File

@@ -0,0 +1,171 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_domain.php 32699 2013-03-01 02:54:05Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
$operation = in_array($operation, array('global', 'app', 'root')) ? $operation : 'global';
$current = array($operation => 1);
shownav('global', 'setting_domain');
showsubmenu('setting_domain', array(
array('setting_domain_base', 'domain', $current['global']),
array('setting_domain_app', 'domain&operation=app', $current['app']),
array('setting_domain_root', 'domain&operation=root', $current['root']),
));
$navs = $_G['setting']['navs'];
if($operation == 'app') {
if(!submitcheck('submit')) {
$appkeyarr = array(
'portal' => $navs[1]['navname'],
'forum' => $navs[2]['navname'],
'group' => $navs[3]['navname'],
'home' => $lang['nav_home'],
'mobile' => $lang['mobile'],
'default' => $lang['default']
);
showtips('setting_domain_app_tips');
showformheader('domain&operation=app');
showboxheader();
showtableheader();
showsubtitle(array('name', 'setting_domain_app_domain'));
$app = array();
$hiddenarr = array();
foreach($appkeyarr as $key => $desc) {
if(in_array($key, array('portal', 'group')) && !helper_access::check_module($key) || ($key == 'home' && !helper_access::check_module('feed'))) {
$hiddenarr["appnew[$key]"] = '';
} else {
showtablerow('', array('class="td25"', ''), array(
$desc,
"<input type=\"text\" class=\"txt\" style=\"width:50%;\" name=\"appnew[$key]\" value=\"".$_G['setting']['domain']['app'][$key]."\">".($key == 'mobile' ? cplang('setting_domain_app_mobile_tips') : '')
));
}
}
showsubmit('submit');
showtablefooter();
showboxfooter();
showhiddenfields($hiddenarr);
showformfooter();
} else {
$olddomain = $_G['setting']['domain']['app'];
$_G['setting']['domain']['app'] = array();
$appset = false;
foreach($_GET['appnew'] as $appkey => $domain) {
$domain = strtolower($domain);
if(!empty($domain) && !preg_match('/^((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}$/', $domain)) {
cpmsg('setting_domain_http_error', '', 'error');
}
if(!empty($domain) && in_array($domain, $_G['setting']['domain']['app'])) {
cpmsg('setting_domain_repeat_error', '', 'error');
}
if($appkey != 'default' && $domain) {
$appset = true;
}
$_G['setting']['domain']['app'][$appkey] = $domain;
}
if($appset && !$_G['setting']['domain']['app']['default']) {
cpmsg('setting_domain_need_default_error', '', 'error');
}
if($_GET['appnew']['mobile'] != $olddomain['mobile']) {
C::t('common_nav')->update_by_identifier('mobile', array('url' => (!$_GET['appnew']['mobile'] ? 'forum.php?mobile=yes' : $_G['scheme'].'://'.$_GET['appnew']['mobile'])));
}
C::t('common_setting')->update_setting('domain',$_G['setting']['domain']);
updatecache('setting');
cpmsg('setting_update_succeed', 'action=domain&operation=app', 'succeed');
}
} elseif($operation == 'root') {
$roottype = array(
'home' => $lang['domain_home'],
'group' => $navs[3]['navname'],
'forum' => $lang['domain_forum'],
'topic' => $lang['domain_topic'],
'channel' => $lang['channel'],
);
if(!submitcheck('submit')) {
showtips('setting_domain_root_tips');
showformheader('domain&operation=root');
showboxheader();
showtableheader();
showsubtitle(array('name', 'setting_domain_app_domain'));
$hiddenarr = array();
foreach($roottype as $type => $desc) {
if(in_array($type, array('topic', 'channel')) && !helper_access::check_module('portal') || ($type == 'home' && !$_G['setting']['homepagestyle']) || ($type == 'group' && !helper_access::check_module('group'))) {
$hiddenarr["domainnew[$type]"] = '';
} else {
$domainroot = $_G['setting']['domain']['root'][$type];
showtablerow('', array('class="td25"', ''), array(
$desc,
"<input type=\"text\" class=\"txt\" style=\"width:50%;\" name=\"domainnew[$type]\" value=\"$domainroot\">"
));
}
}
showsubmit('submit');
showtablefooter();
showboxfooter();
showhiddenfields($hiddenarr);
showformfooter();
} else {
$oldroot = $_G['setting']['domain']['root'];
$_G['setting']['domain']['root'] = array();
foreach($_GET['domainnew'] as $idtype => $domain) {
$domain = strtolower($domain);
if(!empty($domain) && !preg_match('/^((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}$/', $domain)) {
cpmsg('setting_domain_http_error', '', 'error');
}
if($_G['setting']['domain']['root'][$idtype] != $domain) {
$updatetype = $idtype == 'forum' ? array('forum', 'channel') : $idtype;
C::t('common_domain')->update_by_idtype($updatetype, array('domainroot' => $domain));
}
$_G['setting']['domain']['root'][$idtype] = $domain;
}
C::t('common_setting')->update_setting('domain', $_G['setting']['domain']);
updatecache('setting');
cpmsg('setting_update_succeed', 'action=domain&operation=root', 'succeed');
}
} else {
if(!submitcheck('domainsubmit')) {
showtips('setting_domain_base_tips');
showformheader("domain");
showtableheader();
if($_G['setting']['homepagestyle']) {
showsetting('setting_domain_allow_space', 'settingnew[allowspacedomain]', $_G['setting']['allowspacedomain'], 'radio');
} else {
showhiddenfields(array('settingnew[allowspacedomain]' => 0));
}
if(helper_access::check_module('group')) {
showsetting('setting_domain_allow_group', 'settingnew[allowgroupdomain]', $_G['setting']['allowgroupdomain'], 'radio');
} else {
showhiddenfields(array('settingnew[allowgroupdomain]' => 0));
}
showsetting('setting_domain_hold_domain', 'settingnew[holddomain]', $_G['setting']['holddomain'], 'text');
showsubmit('domainsubmit');
showtablefooter();
showformfooter();
} else {
$settings = $_GET['settingnew'];
$settings['allowspacedomain'] = (float)$settings['allowspacedomain'];
$settings['allowgroupdomain'] = (float)$settings['allowgroupdomain'];
if($settings) {
C::t('common_setting')->update_batch($settings);
updatecache('setting');
}
cpmsg('setting_update_succeed', 'action=domain', 'succeed');
}
}
?>

View File

@@ -0,0 +1,918 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_ec.php 30969 2012-07-04 10:18:10Z monkey $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
if(!defined('APPTYPEID')) {
define('APPTYPEID', 2);
}
$checktype = $_GET['checktype'];
cpheader();
if($operation == 'alipay') {
$alipaysettings = C::t('common_setting')->fetch_setting('ec_alipay', true);
if(!empty($checktype)) {
if($checktype == 'credit') {
$return_url = $_G['siteurl'] . 'home.php?mod=spacecp&ac=credit';
$pay_url = payment::create_order('payment_credit', $lang['ec_alipay_checklink_credit'], $lang['ec_alipay_checklink_credit'], 1, $return_url);
ob_end_clean();
dheader('location: ' . $pay_url);
}
exit;
}
if(!submitcheck('alipaysubmit')) {
shownav('extended', 'nav_ec');
showsubmenu('nav_ec', array(
array('nav_ec_config', 'setting&operation=ec', 0),
array('nav_ec_qpay', 'ec&operation=qpay', 0),
array('nav_ec_wechat', 'ec&operation=wechat', 0),
array('nav_ec_alipay', 'ec&operation=alipay', 1),
array('nav_ec_credit', 'ec&operation=credit', 0),
array('nav_ec_orders', 'ec&operation=orders', 0),
array('nav_ec_tradelog', 'tradelog', 0),
array('nav_ec_inviteorders', 'ec&operation=inviteorders', 0),
array('nav_ec_paymentorders', 'ec&operation=paymentorders', 0),
array('nav_ec_transferorders', 'ec&operation=transferorders', 0),
));
showtips('ec_alipay_tips');
showformheader('ec&operation=alipay');
showtableheader('', 'nobottom');
showtitle('ec_alipay');
showtagheader('tbody', 'alipay_setting', true);
showsetting('ec_alipay_on', 'settingsnew[on]', $alipaysettings['on'], 'radio');
$check = array();
$alipaysettings['ec_alipay_sign_mode'] ? $check['true'] = "checked" : $check['false'] = "checked";
$alipaysettings['ec_alipay_sign_mode'] ? $check['false'] = '' : $check['true'] = '';
$check['hidden1'] = ' onclick="$(\'sign_model_01\').style.display = \'none\';$(\'sign_model_02\').style.display = \'\';"';
$check['hidden0'] = ' onclick="$(\'sign_model_01\').style.display = \'\';$(\'sign_model_02\').style.display = \'none\';"';
$html = '<ul onmouseover="altStyle(this);">' .
'<li' . ($check['false'] ? ' class="checked"' : '') . '><input class="radio" type="radio" name="settingsnew[ec_alipay_sign_mode]" value="0" ' . $check['false'] . $check['hidden0'] . '>&nbsp;' . lang('admincp', 'ec_alipay_sign_mode_01') . '</li>' .
'<li' . ($check['true'] ? ' class="checked"' : '') . '><input class="radio" type="radio" name="settingsnew[ec_alipay_sign_mode]" value="1" ' . $check['true'] . $check['hidden1'] . '>&nbsp;' . lang('admincp', 'ec_alipay_sign_mode_02') . '</li>' .
'</ul>';
showsetting('ec_alipay_sign_mode', '', '', $html);
showtagfooter('tbody');
showtagheader('tbody', 'sign_model_01', !$alipaysettings['ec_alipay_sign_mode']);
showsetting('ec_alipay_appid', 'settingsnew[mode_a_appid]', $alipaysettings['mode_a_appid'], 'text');
$alipay_securitycodemask = $alipaysettings['mode_a_app_private_key'] ? substr($alipaysettings['mode_a_app_private_key'], 0, 40) . '********' . substr($alipaysettings['mode_a_app_private_key'], -40) : '';
showsetting('ec_alipay_app_private_key', 'settingsnew[mode_a_app_private_key]', $alipay_securitycodemask, 'textarea');
$alipay_securitycodemask = $alipaysettings['mode_a_alipay_public_key'] ? substr($alipaysettings['mode_a_alipay_public_key'], 0, 40) . '********' . substr($alipaysettings['mode_a_alipay_public_key'], -40) : '';
showsetting('ec_alipay_public_key', 'settingsnew[mode_a_alipay_public_key]', $alipay_securitycodemask, 'textarea');
showtagfooter('tbody');
showtagheader('tbody', 'sign_model_02', $alipaysettings['ec_alipay_sign_mode']);
showsetting('ec_alipay_appid', 'settingsnew[mode_b_appid]', $alipaysettings['mode_b_appid'], 'text');
$alipay_securitycodemask = $alipaysettings['mode_b_app_private_key'] ? $alipaysettings['mode_b_app_private_key'][0] . '********' . substr($alipaysettings['mode_b_app_private_key'], -4) : '';
showsetting('ec_alipay_app_private_key', 'settingsnew[mode_b_app_private_key]', $alipay_securitycodemask, 'textarea', '', 0, lang('admincp', 'ec_alipay_app_private_key_b_comment'));
$alipay_securitycodemask = $alipaysettings['mode_b_app_cert'] ? substr($alipaysettings['mode_b_app_cert'], 0, 40) . '********' . substr($alipaysettings['mode_b_app_cert'], -40) : '';
showsetting('ec_alipay_app_cert', 'settingsnew[mode_b_app_cert]', $alipay_securitycodemask, 'textarea');
$alipay_securitycodemask = $alipaysettings['mode_b_alipay_cert'] ? substr($alipaysettings['mode_b_alipay_cert'], 0, 40) . '********' . substr($alipaysettings['mode_b_alipay_cert'], -40) : '';
showsetting('ec_alipay_alipay_cert', 'settingsnew[mode_b_alipay_cert]', $alipay_securitycodemask, 'textarea');
$alipay_securitycodemask = $alipaysettings['mode_b_alipay_root_cert'] ? substr($alipaysettings['mode_b_alipay_root_cert'], 0, 40) . '********' . substr($alipaysettings['mode_b_alipay_root_cert'], -40) : '';
showsetting('ec_alipay_alipay_root_cert', 'settingsnew[mode_b_alipay_root_cert]', $alipay_securitycodemask, 'textarea');
showtagfooter('tbody');
showsetting('ec_alipay_check', '', '',
'<a href="' . ADMINSCRIPT . '?action=ec&operation=alipay&checktype=credit" target="_blank">' . $lang['ec_alipay_checklink_credit'] . '</a><br />'
);
showtableheader('', 'notop');
showsubmit('alipaysubmit');
showtablefooter();
showformfooter();
} else {
$settingsnew = $_GET['settingsnew'];
foreach($settingsnew as $name => $value) {
if($value == $alipaysettings[$name] || strpos($value, '********') !== false) {
continue;
}
$value = daddslashes($value);
$alipaysettings[$name] = $value;
}
C::t('common_setting')->update_setting('ec_alipay', $alipaysettings);
updatecache('setting');
cpmsg('alipay_succeed', 'action=ec&operation=alipay', 'succeed');
}
} elseif($operation == 'wechat') {
$wechatsettings = C::t('common_setting')->fetch_setting('ec_wechat', true);
if(!empty($checktype)) {
if($checktype == 'credit') {
$return_url = $_G['siteurl'] . 'home.php?mod=spacecp&ac=credit';
$pay_url = payment::create_order('payment_credit', $lang['ec_alipay_checklink_credit'], $lang['ec_alipay_checklink_credit'], 1, $return_url);
ob_end_clean();
dheader('location: ' . $pay_url);
}
exit;
}
if(!submitcheck('wechatsubmit')) {
shownav('extended', 'nav_ec');
showsubmenu('nav_ec', array(
array('nav_ec_config', 'setting&operation=ec', 0),
array('nav_ec_qpay', 'ec&operation=qpay', 0),
array('nav_ec_wechat', 'ec&operation=wechat', 1),
array('nav_ec_alipay', 'ec&operation=alipay', 0),
array('nav_ec_credit', 'ec&operation=credit', 0),
array('nav_ec_orders', 'ec&operation=orders', 0),
array('nav_ec_tradelog', 'tradelog', 0),
array('nav_ec_inviteorders', 'ec&operation=inviteorders', 0),
array('nav_ec_paymentorders', 'ec&operation=paymentorders', 0),
array('nav_ec_transferorders', 'ec&operation=transferorders', 0)
));
showtips('ec_wechat_tips');
showformheader('ec&operation=wechat');
showtableheader('', 'nobottom');
showtitle('ec_wechat');
showtagheader('tbody', 'alipay_wechat', true);
showsetting('ec_wechat_on', 'settingsnew[on]', $wechatsettings['on'], 'radio');
$wxpayment = payment::get('wechat');
$check = array();
$wechatsettings['ec_wechat_version'] ? $check['true'] = "checked" : $check['false'] = "checked";
$wechatsettings['ec_wechat_version'] ? $check['false'] = '' : $check['true'] = '';
$check['hidden1'] = ' onclick="$(\'api_version_2\').style.display = \'none\';$(\'api_version_3\').style.display = \'\';"';
$check['hidden0'] = ' onclick="$(\'api_version_2\').style.display = \'\';$(\'api_version_3\').style.display = \'none\';"';
$html = '<ul onmouseover="altStyle(this);"><li' . ($check['false'] ? ' class="checked"' : '') . '><input class="radio" type="radio" name="settingsnew[ec_wechat_version]" value="0" ' . $check['false'] . $check['hidden0'] . '>&nbsp;' . $lang['ec_wechat_version_2'] . '</li>';
if($wxpayment->v3_wechat_support()) {
$html .= '<li' . ($check['true'] ? ' class="checked"' : '') . '><input class="radio" type="radio" name="settingsnew[ec_wechat_version]" value="1" ' . $check['true'] . $check['hidden1'] . '>&nbsp;' . $lang['ec_wechat_version_3'] . '</li>';
} else {
$html .= '<li style="margin-left: 5px; color: red;">' . $lang['ec_wechat_version_3'] . '(' . $lang['ec_wechat_php_version_low'] . ')</li>';
}
$html .= '</ul>';
showsetting('ec_wechat_version', '', '', $html);
showsetting('ec_wechat_appid', 'settingsnew[appid]', $wechatsettings['appid'], 'text');
$wechat_securitycodemask = $wechatsettings['appsecret'] ? $wechatsettings['appsecret'][0] . '********' . substr($wechatsettings['appsecret'], -4) : '';
showsetting('ec_wechat_appsecret', 'settingsnew[appsecret]', $wechat_securitycodemask, 'text');
showsetting('ec_wechat_mch_id', 'settingsnew[mch_id]', $wechatsettings['mch_id'], 'text');
showtagfooter('tbody');
showtagheader('tbody', 'api_version_2', !$wechatsettings['ec_wechat_version']);
$wechat_securitycodemask = $wechatsettings['v1_key'] ? $wechatsettings['v1_key'][0] . '********' . substr($wechatsettings['v1_key'], -4) : '';
showsetting('ec_wechat_v1_key', 'settingsnew[v1_key]', $wechat_securitycodemask, 'text');
showsetting('ec_wechat_v1_cert', 'settingsnew[v1_cert_path]', $wechatsettings['v1_cert_path'], 'text', '', 0, lang('admincp', 'ec_wechat_v1_cert_comment', array('randomstr' => random(10))));
showtagfooter('tbody');
showtagheader('tbody', 'api_version_3', $wechatsettings['ec_wechat_version']);
$wechat_securitycodemask = $wechatsettings['v3_key'] ? $wechatsettings['v3_key'][0] . '********' . substr($wechatsettings['v3_key'], -4) : '';
showsetting('ec_wechat_v3_key', 'settingsnew[v3_key]', $wechat_securitycodemask, 'text');
$wechat_securitycodemask = $wechatsettings['v3_private_key'] ? substr($wechatsettings['v3_private_key'], 0, 40) . '********' . substr($wechatsettings['v3_private_key'], -40) : '';
showsetting('ec_wechat_v3_private_key', 'settingsnew[v3_private_key]', $wechat_securitycodemask, 'textarea');
$wechat_securitycodemask = $wechatsettings['v3_serial_no'] ? $wechatsettings['v3_serial_no'][0] . '********' . substr($wechatsettings['v3_serial_no'], -4) : '';
showsetting('ec_wechat_v3_serial_no', 'settingsnew[v3_serial_no]', $wechat_securitycodemask, 'text');
showtagfooter('tbody');
showsetting('ec_wechat_check', '', '',
'<a href="' . ADMINSCRIPT . '?action=ec&operation=wechat&checktype=credit" target="_blank">' . $lang['ec_wechat_checklink_credit'] . '</a><br />'
);
showtableheader('', 'notop');
showsubmit('wechatsubmit');
showtablefooter();
showformfooter();
} else {
$settingsnew = $_GET['settingsnew'];
foreach($settingsnew as $name => $value) {
if($value == $wechatsettings[$name] || strpos($value, '********') !== false) {
continue;
}
$value = daddslashes($value);
$wechatsettings[$name] = $value;
}
C::t('common_setting')->update_setting('ec_wechat', $wechatsettings);
updatecache('setting');
if($wechatsettings['ec_wechat_version'] && $wechatsettings['appid'] && $wechatsettings['mch_id'] && $wechatsettings['v3_key'] && $wechatsettings['v3_private_key'] && $wechatsettings['v3_serial_no']) {
$payment = payment::get('wechat');
$result = $payment->v3_wechat_certificates();
if($result['code'] == 200) {
$wechatsettings['v3_certificates'] = $result['data'];
}
C::t('common_setting')->update_setting('ec_wechat', $wechatsettings);
updatecache('setting');
}
cpmsg('wechat_succeed', 'action=ec&operation=wechat', 'succeed');
}
} elseif($operation == 'qpay') {
$qpaysettings = C::t('common_setting')->fetch_setting('ec_qpay', true);
if(!empty($checktype)) {
if($checktype == 'credit') {
$return_url = $_G['siteurl'] . 'home.php?mod=spacecp&ac=credit';
$pay_url = payment::create_order('payment_credit', $lang['ec_alipay_checklink_credit'], $lang['ec_alipay_checklink_credit'], 1, $return_url);
ob_end_clean();
dheader('location: ' . $pay_url);
}
exit;
}
if(!submitcheck('qpaysubmit')) {
shownav('extended', 'nav_ec');
showsubmenu('nav_ec', array(
array('nav_ec_config', 'setting&operation=ec', 0),
array('nav_ec_qpay', 'ec&operation=qpay', 1),
array('nav_ec_wechat', 'ec&operation=wechat', 0),
array('nav_ec_alipay', 'ec&operation=alipay', 0),
array('nav_ec_credit', 'ec&operation=credit', 0),
array('nav_ec_orders', 'ec&operation=orders', 0),
array('nav_ec_tradelog', 'tradelog', 0),
array('nav_ec_inviteorders', 'ec&operation=inviteorders', 0),
array('nav_ec_paymentorders', 'ec&operation=paymentorders', 0),
array('nav_ec_transferorders', 'ec&operation=transferorders', 0)
));
showtips('ec_qpay_tips');
showformheader('ec&operation=qpay');
showtableheader('', 'nobottom');
showtitle('ec_qpay');
showtagheader('tbody', 'alipay_wechat', true);
showsetting('ec_qpay_on', 'settingsnew[on]', $qpaysettings['on'], 'radio');
showsetting('ec_qpay_jsapi', 'settingsnew[jsapi]', $qpaysettings['jsapi'], 'radio');
showsetting('ec_qpay_appid', 'settingsnew[appid]', $qpaysettings['appid'], 'text');
showsetting('ec_qpay_mch_id', 'settingsnew[mch_id]', $qpaysettings['mch_id'], 'text');
showsetting('ec_qpay_op_user_id', 'settingsnew[op_user_id]', $qpaysettings['op_user_id'], 'text');
$qpay_securitycodemask = $qpaysettings['op_user_passwd'] ? $qpaysettings['op_user_passwd'][0] . '********' . substr($qpaysettings['op_user_passwd'], -4) : '';
showsetting('ec_qpay_op_user_passwd', 'settingsnew[op_user_passwd]', $qpay_securitycodemask, 'text');
showtagfooter('tbody');
showtagheader('tbody', 'api_version_2', true);
$qpay_securitycodemask = $qpaysettings['v1_key'] ? $qpaysettings['v1_key'][0] . '********' . substr($qpaysettings['v1_key'], -4) : '';
showsetting('ec_qpay_v1_key', 'settingsnew[v1_key]', $qpay_securitycodemask, 'text');
showsetting('ec_qpay_v1_cert', 'settingsnew[v1_cert_path]', $qpaysettings['v1_cert_path'], 'text', '', 0, lang('admincp', 'ec_qpay_v1_cert_comment', array('randomstr' => random(10))));
showtagfooter('tbody');
showsetting('ec_qpay_check', '', '',
'<a href="' . ADMINSCRIPT . '?action=ec&operation=qpay&checktype=credit" target="_blank">' . $lang['ec_qpay_checklink_credit'] . '</a><br />'
);
showtableheader('', 'notop');
showsubmit('qpaysubmit');
showtablefooter();
showformfooter();
} else {
$settingsnew = $_GET['settingsnew'];
foreach($settingsnew as $name => $value) {
if($value == $qpaysettings[$name] || strpos($value, '********') !== false) {
continue;
}
$value = daddslashes($value);
if($name == 'op_user_passwd') {
$value = md5($value);
}
$qpaysettings[$name] = $value;
}
C::t('common_setting')->update_setting('ec_qpay', $qpaysettings);
updatecache('setting');
cpmsg('qpay_succeed', 'action=ec&operation=qpay', 'succeed');
}
} elseif($operation == 'paymentorders') {
shownav('extended', 'nav_ec');
showsubmenu('nav_ec', array(
array('nav_ec_config', 'setting&operation=ec', 0),
array('nav_ec_qpay', 'ec&operation=qpay', 0),
array('nav_ec_wechat', 'ec&operation=wechat', 0),
array('nav_ec_alipay', 'ec&operation=alipay', 0),
array('nav_ec_credit', 'ec&operation=credit', 0),
array('nav_ec_orders', 'ec&operation=orders', 0),
array('nav_ec_tradelog', 'tradelog', 0),
array('nav_ec_inviteorders', 'ec&operation=inviteorders', 0),
array('nav_ec_paymentorders', 'ec&operation=paymentorders', 1),
array('nav_ec_transferorders', 'ec&operation=transferorders', 0)
));
if(submitcheck('querysubmit')) {
$order_id = intval($_GET['order_id']);
$channel = daddslashes($_GET['channel']);
$result = payment::query_order($channel, $order_id);
if($result['code'] == 200) {
cpmsg('payment_succeed', $_G['siteurl'] . ADMINSCRIPT . '?action=ec&operation=paymentorders', 'succeed');
} else {
cpmsg($result['message'], $_G['siteurl'] . ADMINSCRIPT . '?action=ec&operation=paymentorders', 'error');
}
} elseif($_GET['op'] == 'retry') {
$order_id = intval($_GET['order_id']);
$order = C::t('common_payment_order')->fetch($order_id);
$result = payment::retry_callback_order($order);
if($result['code'] == 200) {
cpmsg('payment_succeed', $_G['siteurl'] . ADMINSCRIPT . '?action=ec&operation=paymentorders', 'succeed');
} else {
cpmsg($result['message'], $_G['siteurl'] . ADMINSCRIPT . '?action=ec&operation=paymentorders', 'error');
}
} elseif($_GET['op'] == 'query') {
$order_id = intval($_GET['order_id']);
$order = C::t('common_payment_order')->fetch($order_id);
$channels = payment::channels();
$user = getuserbyuid($order['uid']);
showformheader('ec&operation=paymentorders');
showhiddenfields(array('order_id' => $order['id']));
showtableheader('ec_paymentorders_detail');
showsetting('ec_paymentorders_no', '', '', $order['out_biz_no']);
showsetting('ec_paymentorders_type', '', '', $order['type_name']);
showsetting('ec_paymentorders_desc', '', '', $order['subject'] . ($order['description'] ? '<br/>' . $order['description'] : ''));
showsetting('ec_paymentorders_user', '', '', $user['username'] . ' (' . $order['uid'] . ')' . '<br/>' . $order['clientip'] . ':' . $order['remoteport']);
showsetting('ec_paymentorders_amount', '', '', number_format($order['amount'] / 100, 2, '.', ','));
showsetting('ec_orders_submitdate', '', '', dgmdate($order['dateline']));
$channelradios = '<ul onmouseover="altStyle(this);">';
$channelindex = 0;
foreach($channels as $index => $channel) {
$channelradios .= '<li'.($channelindex === 0 ? ' class="checked"' : '').'><input class="radio" type="radio" name="channel" '.($channelindex === 0 ? 'checked' : '').' value="' . $channel['id'] . '">&nbsp;' . $channel['title'] . '</li>';
$channelindex++;
}
$channelradios .= '</ul>';
showsetting('ec_paymentorders_channel', '', '', $channelradios);
showtablefooter();
showsubmit('querysubmit', 'ec_paymentorders_op_status', '', $lang['ec_paymentorders_query_submit_tips']);
showtablefooter();
showformfooter();
} else {
$start_limit = ($page - 1) * $_G['tpp'];
echo '<style type="text/css">.order-status-0 td { color: #555; } .order-status-1 td { color: green; } .order-status-1 td a { color: #fe8080; } .order-status-2 td, .order-status-2 td a { color: #ccc; } .order-status-3 td { color: red; }</style>';
echo '<script src="static/js/calendar.js" type="text/javascript"></script>';
$queryparams = array(
'out_biz_no' => daddslashes($_GET['out_biz_no']),
'user' => daddslashes($_GET['user']),
'type' => daddslashes($_GET['type']),
'channel' => daddslashes($_GET['channel']),
'status' => daddslashes($_GET['status']),
'starttime' => daddslashes($_GET['starttime']),
'endtime' => daddslashes($_GET['endtime']),
);
$types = C::t('common_payment_order')->fetch_type_all();
$typeoptions = array();
$typeoptions[] = '<option value="">' . $lang['all'] . '</option>';
foreach($types as $k => $v) {
$typeoptions[] = "<option value=\"{$k}\"" . ($k == $queryparams['type'] ? ' selected' : '') . ">{$v}</option>";
}
showformheader('ec&operation=paymentorders');
showtableheader('ec_paymentorders_search');
showtablerow('', array(
'style="width:100px"', 'style="width:200px"',
'style="width:100px"', 'style="width:200px"',
'style="width:100px"', ''
),
array(
lang('admincp', 'ec_orders_search_id'), '<input type="text" class="txt" name="out_biz_no" value="' . $queryparams['out_biz_no'] . '" />',
lang('admincp', 'ec_paymentorders_user'), '<input type="text" class="txt" name="user" value="' . $queryparams['user'] . '" />',
lang('admincp', 'ec_paymentorders_type'), '<select name="type">' . implode('', $typeoptions) . '</select>',
)
);
$channels = payment::channels();
$channeloptions = array();
$channeloptions[] = '<option value="">' . $lang['all'] . '</option>';
foreach($channels as $channel) {
$channeloptions[] = '<option value="' . $channel['id'] . '"' . ($queryparams['channel'] == $channel['id'] ? ' selected' : '') . '>' . $channel['title'] . '</option>';
}
$statusoptions = array();
$statusoptions[] = '<option value="">' . $lang['all'] . '</option>';
$statusoptions[] = '<option value="0"' . ($queryparams['status'] === '0' ? ' selected' : '') . '>' . $lang['ec_paymentorders_status_0'] . '</option>';
$statusoptions[] = '<option value="1"' . ($queryparams['status'] === '1' ? ' selected' : '') . '>' . $lang['ec_paymentorders_status_1'] . '</option>';
$statusoptions[] = '<option value="2"' . ($queryparams['status'] === '2' ? ' selected' : '') . '>' . $lang['ec_paymentorders_status_2'] . '</option>';
showtablerow('', array(),
array(
lang('admincp', 'ec_paymentorders_channel'), '<select name="channel">' . implode('', $channeloptions) . '</select>',
lang('admincp', 'ec_paymentorders_status'), '<select name="status">' . implode('', $statusoptions) . '</select>',
lang('admincp', 'ec_paymentorders_date'), '<input type="text" class="txt" name="starttime" value="' . $queryparams['starttime'] . '" style="width: 108px;" onclick="showcalendar(event, this)"> - <input type="text" class="txt" name="endtime" value="' . $queryparams['endtime'] . '" style="width: 108px;" onclick="showcalendar(event, this)">',
)
);
showtablefooter();
showtableheader('', 'notop');
showsubmit('searchsubmit');
showtablefooter();
if($queryparams['user']) {
if(preg_match('/^\d+$/', $queryparams['user'])) {
$queryparams['uid'] = $queryparams['user'];
} else {
$user = C::t('common_member')->fetch_uid_by_username($queryparams['user']);
if($user) {
$queryparams['uid'] = $user['uid'];
} else {
$queryparams['uid'] = -1;
}
}
}
$ordercount = C::t('common_payment_order')->count_by_search($queryparams['uid'], $queryparams['type'], $queryparams['starttime'], $queryparams['endtime'], $queryparams['out_biz_no'], $queryparams['channel'], $queryparams['status']);
$multipage = multi($ordercount, $_G['tpp'], $page, ADMINSCRIPT . "?action=ec&operation=paymentorders&" . http_build_query($queryparams));
$tdstyles = array(
'style="width: 220px;"',
'style="width: 100px; text-align: center"',
'',
'style="width: 120px;"',
'style="width: 100px; text-align: center"',
'style="width: 120px; text-align: right"',
'style="width: 100px; text-align: center"',
'style="width: 100px; text-align: right"',
'style="width: 100px; text-align: right"',
'style="width: 110px; text-align: right"'
);
showtableheader('result');
showsubtitle(array('ec_paymentorders_no', 'ec_paymentorders_type', 'ec_paymentorders_desc', 'ec_paymentorders_buyer', 'ec_paymentorders_channel', 'ec_paymentorders_amount', 'ec_paymentorders_status', 'ec_orders_submitdate', 'ec_orders_confirmdate', ''), 'header', $tdstyles);
if($ordercount > 0) {
$order_list = C::t('common_payment_order')->fetch_all_by_search($queryparams['uid'], $queryparams['type'], $queryparams['starttime'], $queryparams['endtime'], $queryparams['out_biz_no'], $queryparams['channel'], $queryparams['status'], $start_limit, $_G['tpp']);
$refund_list = C::t('common_payment_refund')->sum_by_orders(array_keys($order_list));
foreach($order_list as $order) {
$user = getuserbyuid($order['uid']);
if(!$order['status'] && $order['expire_time'] < time()) {
$order['status'] = 2;
} elseif($order['status'] == 1 && $refund_list[$order['id']]) {
$order['status'] = 3;
$order['refund_amount'] = $refund_list[$order['id']]['amount'];
}
$amountstr = number_format($order['amount'] / 100, 2, '.', ',');
if($order['status'] == 3) {
$amountstr .= '<br/>' . $lang['ec_paymentorders_refund_amount'] . ': ' . number_format($order['refund_amount'] / 100, 2, '.', ',');
}
$operations = '';
if(in_array($order['status'], array(0, 2))) {
$operations .= '<a href="' . ADMINSCRIPT . '?action=ec&operation=paymentorders&op=query&order_id=' . $order['id'] . '">' . $lang['ec_paymentorders_op_status'] . '</a>';
} elseif($order['status'] == 1 && !$order['callback_status']) {
$operations = '<a href="' . ADMINSCRIPT . '?action=ec&operation=paymentorders&op=retry&order_id=' . $order['id'] . '">'.$lang['ec_paymentorders_callback_tips'].'</a>';
}
showtablerow('class="order-status-' . $order['status'] . '"', $tdstyles, array(
$order['out_biz_no'],
$order['type_name'],
$order['subject'] . ($order['description'] ? '<br/>' . $order['description'] : ''),
$user['username'] . ' (' . $order['uid'] . ')' . '<br/>' . $order['clientip'] . ':' . $order['remoteport'],
$channels[$order['channel']]['title'],
$amountstr,
$lang['ec_paymentorders_status_' . $order['status']],
dgmdate($order['dateline']),
$order['payment_time'] ? dgmdate($order['payment_time']) : 'N/A',
$operations
));
}
showsubmit('', '', '', '', $multipage);
} else {
showtablerow('', array('class="center" colspan="25"'), array($lang['ec_paymentorders_no_data']));
}
showtablefooter();
showformfooter();
}
} elseif($operation == 'transferorders') {
shownav('extended', 'nav_ec');
showsubmenu('nav_ec', array(
array('nav_ec_config', 'setting&operation=ec', 0),
array('nav_ec_qpay', 'ec&operation=qpay', 0),
array('nav_ec_wechat', 'ec&operation=wechat', 0),
array('nav_ec_alipay', 'ec&operation=alipay', 0),
array('nav_ec_credit', 'ec&operation=credit', 0),
array('nav_ec_orders', 'ec&operation=orders', 0),
array('nav_ec_tradelog', 'tradelog', 0),
array('nav_ec_inviteorders', 'ec&operation=inviteorders', 0),
array('nav_ec_paymentorders', 'ec&operation=paymentorders', 0),
array('nav_ec_transferorders', 'ec&operation=transferorders', 1)
));
if($_GET['op'] == 'query') {
$transfer_no = daddslashes($_GET['transfer_no']);
$result = payment::transfer_status($transfer_no);
if($result['code'] == 200) {
cpmsg('payment_transfer_succeed', $_G['siteurl'] . ADMINSCRIPT . '?action=ec&operation=transferorders&out_biz_no=' . $transfer_no, 'succeed');
} else {
cpmsg($result['message'], $_G['siteurl'] . ADMINSCRIPT . '?action=ec&operation=transferorders&out_biz_no=' . $transfer_no, 'error');
}
} elseif($_GET['op'] == 'retry') {
$order_id = intval($_GET['order_id']);
$order = C::t('common_payment_transfer')->fetch($order_id);
$result = payment::transfer($order['channel'], $order['out_biz_no'], $order['amount'], $order['uid'], $order['realname'], $order['account'], $order['subject'], $order['description']);
if($result['code'] == 200) {
cpmsg('payment_transfer_succeed', $_G['siteurl'] . ADMINSCRIPT . '?action=ec&operation=transferorders&out_biz_no=' . $order['out_biz_no'], 'succeed');
} else {
cpmsg($result['message'], $_G['siteurl'] . ADMINSCRIPT . '?action=ec&operation=transferorders&out_biz_no=' . $order['out_biz_no'], 'error');
}
} else {
$start_limit = ($page - 1) * $_G['tpp'];
echo '<style type="text/css">.order-status-1 td { color: #555; } .order-status-2 td { color: green; } .order-status-3 td { color: red; }</style>';
echo '<script src="static/js/calendar.js" type="text/javascript"></script>';
$queryparams = array(
'out_biz_no' => daddslashes($_GET['out_biz_no']),
'user' => daddslashes($_GET['user']),
'channel' => daddslashes($_GET['channel']),
'status' => daddslashes($_GET['status']),
'starttime' => daddslashes($_GET['starttime']),
'endtime' => daddslashes($_GET['endtime']),
);
showformheader('ec&operation=transferorders');
showtableheader('ec_transferorders_search');
showtablerow('', array(),
array(
lang('admincp', 'ec_orders_search_id'), '<input type="text" class="txt" name="out_biz_no" value="' . $queryparams['out_biz_no'] . '" />',
lang('admincp', 'ec_transferorders_user'), '<input type="text" class="txt" name="user" value="' . $queryparams['user'] . '" />',
)
);
$channels = payment::channels();
$channeloptions = array();
$channeloptions[] = '<option value="">' . $lang['all'] . '</option>';
foreach($channels as $channel) {
$channeloptions[] = '<option value="' . $channel['id'] . '"' . ($queryparams['channel'] == $channel['id'] ? ' selected' : '') . '>' . $channel['title'] . '</option>';
}
$statusoptions = array();
$statusoptions[] = '<option value="">' . $lang['all'] . '</option>';
$statusoptions[] = '<option value="0"' . ($queryparams['status'] === '1' ? ' selected' : '') . '>' . $lang['ec_transferorders_status_1'] . '</option>';
$statusoptions[] = '<option value="1"' . ($queryparams['status'] === '2' ? ' selected' : '') . '>' . $lang['ec_transferorders_status_2'] . '</option>';
$statusoptions[] = '<option value="2"' . ($queryparams['status'] === '3' ? ' selected' : '') . '>' . $lang['ec_transferorders_status_3'] . '</option>';
showtablerow('', array(
'style="width:100px"', 'style="width:200px"',
'style="width:100px"', 'style="width:200px"',
'style="width:100px"', ''
),
array(
lang('admincp', 'ec_transferorders_channel'), '<select name="channel">' . implode('', $channeloptions) . '</select>',
lang('admincp', 'ec_paymentorders_status'), '<select name="status">' . implode('', $statusoptions) . '</select>',
lang('admincp', 'ec_paymentorders_date'), '<input type="text" class="txt" name="starttime" value="' . $queryparams['starttime'] . '" style="width: 108px;" onclick="showcalendar(event, this)"> - <input type="text" class="txt" name="endtime" value="' . $queryparams['endtime'] . '" style="width: 108px;" onclick="showcalendar(event, this)">',
)
);
showtablefooter();
showtableheader('', 'notop');
showsubmit('searchsubmit');
showtablefooter();
if($queryparams['user']) {
if(preg_match('/^\d+$/', $queryparams['user'])) {
$queryparams['uid'] = $queryparams['user'];
} else {
$user = C::t('common_member')->fetch_uid_by_username($queryparams['user']);
if($user) {
$queryparams['uid'] = $user['uid'];
} else {
$queryparams['uid'] = -1;
}
}
}
$ordercount = C::t('common_payment_transfer')->count_by_search($queryparams['uid'], $queryparams['starttime'], $queryparams['endtime'], $queryparams['out_biz_no'], $queryparams['channel'], $queryparams['status']);
$multipage = multi($ordercount, $_G['tpp'], $page, ADMINSCRIPT . "?action=ec&operation=transferorders&" . http_build_query($queryparams));
$tdstyles = array(
'style="width: 220px;"',
'style="width: 100px; text-align: center"',
'style="width: 100px; text-align: center"',
'',
'style="width: 130px; text-align: right"',
'style="width: 100px; text-align: center"',
'',
'style="width: 100px; text-align: right"',
'style="width: 100px; text-align: right"',
'style="width: 25px; text-align: right"'
);
showtableheader('result');
showsubtitle(array('ec_paymentorders_no', 'ec_transferorders_user', 'ec_transferorders_channel', 'ec_transferorders_desc', 'ec_paymentorders_amount', 'ec_paymentorders_status', 'ec_transferorders_error', 'ec_orders_submitdate', 'ec_orders_confirmdate', ''), 'header', $tdstyles);
if($ordercount > 0) {
$order_list = C::t('common_payment_transfer')->fetch_all_by_search($queryparams['uid'], $queryparams['type'], $queryparams['starttime'], $queryparams['endtime'], $queryparams['out_biz_no'], $queryparams['channel'], $queryparams['status'], $start_limit, $_G['tpp']);
foreach($order_list as $order) {
$user = getuserbyuid($order['uid']);
if($order['status'] == 1) {
$operations = '<a href="' . ADMINSCRIPT . '?action=ec&operation=transferorders&op=query&transfer_no=' . $order['out_biz_no'] . '">' . $lang['ec_paymentorders_op_status'] . '</a>';
} elseif($order['status'] == 3) {
$operations = '<a href="' . ADMINSCRIPT . '?action=ec&operation=transferorders&op=retry&order_id=' . $order['id'] . '">' . $lang['ec_transferorders_op_retry'] . '</a>';
}
showtablerow('class="order-status-' . $order['status'] . '"', $tdstyles, array(
$order['out_biz_no'],
$user['username'] . ' (' . $order['uid'] . ')' . '<br/>' . $order['clientip'] . ':' . $order['remoteport'],
$channels[$order['channel']]['title'],
$order['subject'] . ($order['description'] ? '<br/>' . $order['description'] : ''),
number_format($order['amount'] / 100, 2, '.', ','),
$lang['ec_transferorders_status_' . $order['status']],
$order['status'] == 3 ? $order['error'] : '',
dgmdate($order['dateline']),
$order['trade_time'] ? dgmdate($order['trade_time']) : 'N/A',
$operations
));
}
showsubmit('', '', '', '', $multipage);
} else {
showtablerow('', array('class="center" colspan="25"'), array($lang['ec_transferorders_no_data']));
}
showtablefooter();
showformfooter();
}
} elseif($operation == 'orders') {
$orderurl = array(
'alipay' => 'https://www.alipay.com/trade/query_trade_detail.htm?trade_no=',
'tenpay' => 'https://www.tenpay.com/med/tradeDetail.shtml?trans_id=',
);
if(!$_G['setting']['creditstrans'] || !$_G['setting']['ec_ratio']) {
cpmsg('orders_disabled', '', 'error');
}
if(!submitcheck('ordersubmit')) {
echo '<script type="text/javascript" src="' . STATICURL . 'js/calendar.js"></script>';
shownav('extended', 'nav_ec');
showsubmenu('nav_ec', array(
array('nav_ec_config', 'setting&operation=ec', 0),
array('nav_ec_qpay', 'ec&operation=qpay', 0),
array('nav_ec_wechat', 'ec&operation=wechat', 0),
array('nav_ec_alipay', 'ec&operation=alipay', 0),
array('nav_ec_credit', 'ec&operation=credit', 0),
array('nav_ec_orders', 'ec&operation=orders', 1),
array('nav_ec_tradelog', 'tradelog', 0),
array('nav_ec_inviteorders', 'ec&operation=inviteorders', 0),
array('nav_ec_paymentorders', 'ec&operation=paymentorders', 0),
array('nav_ec_transferorders', 'ec&operation=transferorders', 0)
));
showtips('ec_orders_tips');
showtagheader('div', 'ordersearch', !submitcheck('searchsubmit', 1));
showformheader('ec&operation=orders');
showtableheader('ec_orders_search');
showsetting('ec_orders_search_status', array('orderstatus', array(
array('', $lang['ec_orders_search_status_all']),
array(1, $lang['ec_orders_search_status_pending']),
array(2, $lang['ec_orders_search_status_auto_finished']),
array(3, $lang['ec_orders_search_status_manual_finished'])
)), intval($orderstatus), 'select');
showsetting('ec_orders_search_id', 'orderid', $orderid, 'text');
showsetting('ec_orders_search_users', 'users', $users, 'text');
showsetting('ec_orders_search_buyer', 'buyer', $buyer, 'text');
showsetting('ec_orders_search_admin', 'admin', $admin, 'text');
showsetting('ec_orders_search_submit_date', array('sstarttime', 'sendtime'), array($sstarttime, $sendtime), 'daterange');
showsetting('ec_orders_search_confirm_date', array('cstarttime', 'cendtime'), array($cstarttime, $cendtime), 'daterange');
showsubmit('searchsubmit');
showtablefooter();
showformfooter();
showtagfooter('div');
if(submitcheck('searchsubmit', 1)) {
$start_limit = ($page - 1) * $_G['tpp'];
$ordercount = C::t('forum_order')->count_by_search(null, $_GET['orderstatus'], $_GET['orderid'], null, ($_GET['users'] ? explode(',', str_replace(' ', '', $_GET['users'])) : null), $_GET['buyer'], $_GET['admin'], strtotime($_GET['sstarttime']), strtotime($_GET['sendtime']), strtotime($_GET['cstarttime']), strtotime($_GET['cendtime']));
$multipage = multi($ordercount, $_G['tpp'], $page, ADMINSCRIPT."?action=ec&operation=orders&searchsubmit=yes&orderstatus={$_GET['orderstatus']}&orderid={$_GET['orderid']}&users={$_GET['users']}&buyer={$_GET['buyer']}&admin={$_GET['admin']}&sstarttime={$_GET['sstarttime']}&sendtime={$_GET['sendtime']}&cstarttime={$_GET['cstarttime']}&cendtime={$_GET['cendtime']}");
showtagheader('div', 'orderlist', true);
showformheader('ec&operation=orders');
showtableheader('result');
showsubtitle(array('', 'ec_orders_id', 'ec_orders_status', 'ec_orders_buyer', 'ec_orders_amount', 'ec_orders_price', 'ec_orders_submitdate', 'ec_orders_confirmdate'));
foreach(C::t('forum_order')->fetch_all_by_search(null, $_GET['orderstatus'], $_GET['orderid'], null, ($_GET['users'] ? explode(',', str_replace(' ', '', $_GET['users'])) : null), $_GET['buyer'], $_GET['admin'], strtotime($_GET['sstarttime']), strtotime($_GET['sendtime']), strtotime($_GET['cstarttime']), strtotime($_GET['cendtime']), $start_limit, $_G['tpp']) as $order) {
switch($order['status']) {
case 1: $order['orderstatus'] = $lang['ec_orders_search_status_pending']; break;
case 2: $order['orderstatus'] = '<b>'.$lang['ec_orders_search_status_auto_finished'].'</b>'; break;
case 3: $order['orderstatus'] = '<b>'.$lang['ec_orders_search_status_manual_finished'].'</b><br />(<a href="home.php?mod=space&username='.rawurlencode($order['admin']).'" target="_blank">'.$order['admin'].'</a>)'; break;
}
$order['submitdate'] = dgmdate($order['submitdate']);
$order['confirmdate'] = $order['confirmdate'] ? dgmdate($order['confirmdate']) : 'N/A';
list($orderid, $apitype) = explode("\t", $order['buyer']);
$apitype = $apitype ? $apitype : 'alipay';
$orderid = '<a href="'.$orderurl[$apitype].$orderid.'" target="_blank">'.$orderid.'</a>';
showtablerow('', '', array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"validate[]\" value=\"{$order['orderid']}\" ".($order['status'] != 1 ? 'disabled' : '').">",
"{$order['orderid']}<br />$orderid",
$order['orderstatus'],
"<a href=\"home.php?mod=space&uid={$order['uid']}\" target=\"_blank\">{$order['username']}</a>",
"{$_G['setting']['extcredits'][$_G['setting']['creditstrans']]['title']} {$order['amount']} {$_G['setting']['extcredits'][$_G['setting']['creditstrans']]['unit']}",
"{$lang['rmb']} {$order['price']} {$lang['rmb_yuan']}",
$order['submitdate'],
$order['confirmdate']
));
}
showsubmit('ordersubmit', 'submit', '<input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'validate\')" /><label for="chkall">'.cplang('ec_orders_validate').'</label>', '<a href="#" onclick="$(\'orderlist\').style.display=\'none\';$(\'ordersearch\').style.display=\'\';">'.cplang('research').'</a>', $multipage);
showtablefooter();
showformfooter();
showtagfooter('div');
}
} else {
$numvalidate = 0;
if($_GET['validate']) {
$orderids = array();
$confirmdate = dgmdate(TIMESTAMP);
foreach(C::t('forum_order')->fetch_all_order($_GET['validate'], '1') as $order) {
updatemembercount($order['uid'], array($_G['setting']['creditstrans'] => $order['amount']));
$orderids[] = $order['orderid'];
$submitdate = dgmdate($order['submitdate']);
notification_add($order['uid'], 'system', 'addfunds', array(
'orderid' => $order['orderid'],
'price' => $order['price'],
'from_id' => 0,
'from_idtype' => 'buycredit',
'value' => $_G['setting']['extcredits'][$_G['setting']['creditstrans']]['title'].' '.$order['amount'].' '.$_G['setting']['extcredits'][$_G['setting']['creditstrans']]['unit']
), 1);
}
if($orderids) {
C::t('forum_order')->update($orderids, array('status' => '3', 'admin' => $_G['username'], 'confirmdate' => $_G['timestamp']));
}
}
cpmsg('orders_validate_succeed', "action=ec&operation=orders&searchsubmit=yes&orderstatus={$_GET['orderstatus']}&orderid={$_GET['orderid']}&users={$_GET['users']}&buyer={$_GET['buyer']}&admin={$_GET['admin']}&sstarttime={$_GET['sstarttime']}&sendtime={$_GET['sendtime']}&cstarttime={$_GET['cstarttime']}&cendtime={$_GET['cendtime']}", 'succeed');
}
} elseif($operation == 'credit') {
$defaultrank = array(
1 => 4,
2 => 11,
3 => 41,
4 => 91,
5 => 151,
6 => 251,
7 => 501,
8 => 1001,
9 => 2001,
10 => 5001,
11 => 10001,
12 => 20001,
13 => 50001,
14 => 100001,
15 => 200001
);
if(!submitcheck('creditsubmit')) {
$ec_credit = C::t('common_setting')->fetch_setting('ec_credit', true);
$ec_credit = $ec_credit ? $ec_credit : array(
'maxcreditspermonth' => '6',
'rank' => $defaultrank
);
shownav('extended', 'nav_ec');
showsubmenu('nav_ec', array(
array('nav_ec_config', 'setting&operation=ec', 0),
array('nav_ec_qpay', 'ec&operation=qpay', 0),
array('nav_ec_wechat', 'ec&operation=wechat', 0),
array('nav_ec_alipay', 'ec&operation=alipay', 0),
array('nav_ec_credit', 'ec&operation=credit', 1),
array('nav_ec_orders', 'ec&operation=orders', 0),
array('nav_ec_tradelog', 'tradelog', 0),
array('nav_ec_inviteorders', 'ec&operation=inviteorders', 0),
array('nav_ec_paymentorders', 'ec&operation=paymentorders', 0),
array('nav_ec_transferorders', 'ec&operation=transferorders', 0)
));
showtips('ec_credit_tips');
showformheader('ec&operation=credit');
showtableheader('ec_credit', 'nobottom');
showsetting('ec_credit_maxcreditspermonth', 'ec_creditnew[maxcreditspermonth]', $ec_credit['maxcreditspermonth'], 'text');
showtablefooter('</tbody>');
showtableheader('ec_credit_rank', 'notop fixpadding');
showsubtitle(array('ec_credit_rank', 'ec_credit_between', 'ec_credit_sellericon', 'ec_credit_buyericon'));
$staticurl = STATICURL;
foreach($ec_credit['rank'] as $rank => $mincredits) {
showtablerow('', '', array(
$rank,
'<input type="text" class="txt" size="6" name="ec_creditnew[rank]['.$rank.']" value="'.$mincredits.'" /> ~ '.$ec_credit['rank'][$rank + 1],
"<img src=\"{$staticurl}image/traderank/seller/$rank.gif\" border=\"0\">",
"<img src=\"{$staticurl}image/traderank/buyer/$rank.gif\" border=\"0\">"
));
}
showsubmit('creditsubmit');
showtablefooter();
showformfooter();
} else {
$ec_creditnew = $_GET['ec_creditnew'];
$ec_creditnew['maxcreditspermonth'] = intval($ec_creditnew['maxcreditspermonth']);
if(is_array($ec_creditnew['rank'])) {
foreach($ec_creditnew['rank'] as $rank => $mincredits) {
$mincredits = intval($mincredits);
if($rank == 1 && $mincredits <= 0) {
cpmsg('ecommerce_invalidcredit', '', 'error');
} elseif($rank > 1 && $mincredits <= $ec_creditnew['rank'][$rank - 1]) {
cpmsg('ecommerce_must_larger', '', 'error', array('rank' => $rank));
}
$ec_creditnew['rank'][$rank] = $mincredits;
}
} else {
$ec_creditnew['rank'] = $defaultrank;
}
C::t('common_setting')->update_setting('ec_credit', $ec_creditnew);
updatecache('setting');
cpmsg('ec_credit_succeed', 'action=ec&operation=credit', 'succeed');
}
} elseif($operation == 'inviteorders') {
if(!submitcheck('ordersubmit')) {
$start_limit = ($page - 1) * $_G['tpp'];
$orderurl = array(
'alipay' => 'https://www.alipay.com/trade/query_trade_detail.htm?trade_no=',
'tenpay' => 'https://www.tenpay.com/med/tradeDetail.shtml?trans_id=',
);
shownav('extended', 'nav_ec');
showsubmenu('nav_ec', array(
array('nav_ec_config', 'setting&operation=ec', 0),
array('nav_ec_qpay', 'ec&operation=qpay', 0),
array('nav_ec_wechat', 'ec&operation=wechat', 0),
array('nav_ec_alipay', 'ec&operation=alipay', 0),
array('nav_ec_credit', 'ec&operation=credit', 0),
array('nav_ec_orders', 'ec&operation=orders', 0),
array('nav_ec_tradelog', 'tradelog', 0),
array('nav_ec_inviteorders', 'ec&operation=inviteorders', 1),
array('nav_ec_paymentorders', 'ec&operation=paymentorders', 0),
array('nav_ec_transferorders', 'ec&operation=transferorders', 0)
));
$ordercount = C::t('forum_order')->count_by_search(0, $_GET['orderstatus'], $_GET['orderid'], $_GET['email']);
$multipage = multi($ordercount, $_G['tpp'], $page, ADMINSCRIPT."?action=ec&operation=inviteorders&orderstatus={$_GET['orderstatus']}&orderid={$_GET['orderid']}&email={$_GET['email']}");
showtagheader('div', 'orderlist', TRUE);
showformheader('ec&operation=inviteorders');
showtableheader('ec_inviteorders_search');
$_G['showsetting_multirow'] = 1;
showsetting('ec_orders_search_status', array('orderstatus', array(
array('', $lang['ec_orders_search_status_all']),
array(1, $lang['ec_orders_search_status_pending']),
array(2, $lang['ec_orders_search_status_auto_finished'])
)), intval($_GET['orderstatus']), 'select');
showsetting('ec_orders_search_id', 'orderid', $_GET['orderid'], 'text');
showsetting('ec_orders_search_email', 'email', $_GET['email'], 'text');
showsubmit('searchsubmit', 'submit');
showtablefooter();
showtableheader('result');
showsubtitle(array('', 'ec_orders_id', 'ec_inviteorders_status', 'ec_inviteorders_buyer', 'ec_orders_amount', 'ec_orders_price', 'ec_orders_submitdate', 'ec_orders_confirmdate'));
foreach(C::t('forum_order')->fetch_all_by_search(0, $_GET['orderstatus'], $_GET['orderid'], $_GET['email'], null, null, null, null, null, null, null, $start_limit, $_G['tpp']) as $order) {
switch($order['status']) {
case 1: $order['orderstatus'] = $lang['ec_orders_search_status_pending']; break;
case 2: $order['orderstatus'] = '<b>'.$lang['ec_orders_search_status_auto_finished'].'</b>'; break;
case 3: $order['orderstatus'] = '<b>'.$lang['ec_orders_search_status_manual_finished'].'</b><br />(<a href="home.php?mod=space&username='.rawurlencode($order['admin']).'" target="_blank">'.$order['admin'].'</a>)'; break;
}
$order['submitdate'] = dgmdate($order['submitdate']);
$order['confirmdate'] = $order['confirmdate'] ? dgmdate($order['confirmdate']) : 'N/A';
list($orderid, $apitype) = explode("\t", $order['buyer']);
$apitype = $apitype ? $apitype : 'alipay';
$orderid = '<a href="'.$orderurl[$apitype].$orderid.'" target="_blank">'.$orderid.'</a>';
showtablerow('', '', array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"validate[]\" value=\"{$order['orderid']}\" ".($order['status'] != 1 ? 'disabled' : '').">",
"{$order['orderid']}<br />$orderid",
$order['orderstatus'],
"{$order['email']}<br>{$order['ip']}",
$order['amount'],
"{$lang['rmb']} {$order['price']} {$lang['rmb_yuan']}",
$order['submitdate'],
$order['confirmdate']
));
}
showtablerow('', array('colspan="7"'), array($multipage));
showsubmit('ordersubmit', 'ec_orders_validate', '<input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'validate\')" />');
showtablefooter();
showformfooter();
showtagfooter('div');
} else {
if($_GET['validate']) {
if(C::t('forum_order')->fetch_all_order($_GET['validate'], '1')) {
C::t('forum_order')->update($_GET['validate'], array('status' => '3', 'admin' => $_G['username'], 'confirmdate' => $_G['timestamp']));
}
}
cpmsg('orders_validate_succeed', "action=ec&operation=inviteorders&orderstatus={$_GET['orderstatus']}&orderid={$_GET['orderid']}&email={$_GET['email']}", 'succeed');
}
}
?>

View File

@@ -0,0 +1,170 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_faq.php 25246 2011-11-02 03:34:53Z zhangguosheng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
$operation = $operation ? $operation : 'list';
if($operation == 'list') {
if(!submitcheck('faqsubmit')) {
shownav('extended', 'faq');
showsubmenu('faq');
showformheader('faq&operation=list');
showtableheader();
echo '<tr><th class="td25"></th><th class="td25"><strong>'.$lang['display_order'].'</stong></th><th class="td25"><strong>'.$lang['faq_thread'].'</strong></th><th></th></tr>';
$faqparent = $faqsub = array();
$faqlists = $faqselect = '';
foreach(C::t('forum_faq')->fetch_all_by_fpid() as $faq) {
if(empty($faq['fpid'])) {
$faqparent[$faq['id']] = $faq;
$faqselect .= "<option value=\"{$faq['id']}\">{$faq['title']}</option>";
} else {
$faqsub[$faq['fpid']][] = $faq;
}
}
foreach($faqparent as $parent) {
$disabled = !empty($faqsub[$parent['id']]) ? 'disabled' : '';
showtablerow('', array('', 'class="td23 td28"'), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"{$parent['id']}\" $disabled>",
"<input type=\"text\" class=\"txt\" size=\"3\" name=\"displayorder[{$parent['id']}]\" value=\"{$parent['displayorder']}\">",
"<div class=\"parentnode\"><input type=\"text\" class=\"txt\" size=\"30\" name=\"title[{$parent['id']}]\" value=\"".dhtmlspecialchars($parent['title'])."\"></div>",
"<a href=\"".ADMINSCRIPT."?action=faq&operation=detail&id={$parent['id']}\" class=\"act\">".$lang['detail']."</a>"
));
if(!empty($faqsub[$parent['id']])) {
foreach($faqsub[$parent['id']] as $sub) {
showtablerow('', array('', 'class="td23 td28"'), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"{$sub['id']}\">",
"<input type=\"text\" class=\"txt\" size=\"3\" name=\"displayorder[{$sub['id']}]\" value=\"{$sub['displayorder']}\">",
"<div class=\"node\"><input type=\"text\" class=\"txt\" size=\"30\" name=\"title[{$sub['id']}]\" value=\"".dhtmlspecialchars($sub['title'])."\"></div>",
"<a href=\"".ADMINSCRIPT."?action=faq&operation=detail&id={$sub['id']}\" class=\"act\">".$lang['detail']."</a>"
));
}
}
echo '<tr><td></td><td></td><td colspan="2"><div class="lastnode"><a href="###" onclick="addrow(this, 1, '.$parent['id'].')" class="addtr">'.cplang('faq_additem').'</a></div></td></tr>';
}
echo '<tr><td></td><td></td><td colspan="2"><div><a href="###" onclick="addrow(this, 0, 0)" class="addtr">'.cplang('faq_addcat').'</a></div></td></tr>';
echo <<<EOT
<script type="text/JavaScript">
var rowtypedata = [
[[1,''], [1,'<input name="newdisplayorder[]" value="" size="3" type="text" class="txt">', 'td25'], [1, '<input name="newtitle[]" value="" size="30" type="text" class="txt">'], [1, '<input type="hidden" name="newfpid[]" value="0" />']],
[[1,''], [1,'<input name="newdisplayorder[]" value="" size="3" type="text" class="txt">', 'td25'], [1, '<div class=\"node\"><input name="newtitle[]" value="" size="30" type="text" class="txt"></div>'], [1, '<input type="hidden" name="newfpid[]" value="{1}" />']]
];
</script>
EOT;
showsubmit('faqsubmit', 'submit', 'del');
showtablefooter();
showformfooter();
} else {
if($_GET['delete']) {
C::t('forum_faq')->delete($_GET['delete']);
}
if(is_array($_GET['title'])) {
foreach($_GET['title'] as $id => $val) {
C::t('forum_faq')->update($id, array(
'displayorder' => $_GET['displayorder'][$id],
'title' => $_GET['title'][$id]
));
}
}
if(is_array($_GET['newtitle'])) {
foreach($_GET['newtitle'] as $k => $v) {
$v = trim($v);
if($v) {
C::t('forum_faq')->insert(array(
'fpid' => intval($_GET['newfpid'][$k]),
'displayorder' => intval($_GET['newdisplayorder'][$k]),
'title' => $v
));
}
}
}
cpmsg('faq_list_update', 'action=faq&operation=list', 'succeed');
}
} elseif($operation == 'detail') {
$id = $_GET['id'];
if(!submitcheck('detailsubmit')) {
$faq = C::t('forum_faq')->fetch($id);
if(!$faq) {
cpmsg('faq_nonexistence', '', 'error');
}
foreach(C::t('forum_faq')->fetch_all_by_fpid(0) as $parent) {
$faqselect .= "<option value=\"{$parent['id']}\" ".($faq['fpid'] == $parent['id'] ? 'selected' : '').">{$parent['title']}</option>";
}
shownav('extended', 'faq');
showsubmenu('faq');
showformheader("faq&operation=detail&id=$id");
showtableheader();
showtitle('faq_edit');
showsetting('faq_title', 'titlenew', $faq['title'], 'text');
if(!empty($faq['fpid'])) {
showsetting('faq_sortup', '', '', '<select name="fpidnew"><option value=\"\">'.$lang['none'].'</option>'.$faqselect.'</select>');
showsetting('faq_identifier', 'identifiernew', $faq['identifier'], 'text');
showsetting('faq_keywords', 'keywordnew', $faq['keyword'], 'text');
showsetting('faq_content', 'messagenew', $faq['message'], 'textarea');
}
showsubmit('detailsubmit');
showtablefooter();
showformfooter();
} else {
if(!$_GET['titlenew']) {
cpmsg('faq_no_title', '', 'error');
}
if(!empty($_GET['identifiernew'])) {
if(C::t('forum_faq')->check_identifier($_GET['identifiernew'], $id)) {
cpmsg('faq_identifier_invalid', '', 'error');
}
}
if(strlen($_GET['keywordnew']) > 50) {
cpmsg('faq_keyword_toolong', '', 'error');
}
$fpidnew = $_GET['fpidnew'] ? intval($_GET['fpidnew']) : 0;
$titlenew = trim($_GET['titlenew']);
$messagenew = trim($_GET['messagenew']);
$identifiernew = trim($_GET['identifiernew']);
$keywordnew = trim($_GET['keywordnew']);
C::t('forum_faq')->update($id, array(
'fpid' => $fpidnew,
'identifier' => $identifiernew,
'keyword' => $keywordnew,
'title' => $titlenew,
'message' => $messagenew,
));
cpmsg('faq_list_update', 'action=faq&operation=list', 'succeed');
}
}
?>

View File

@@ -0,0 +1,341 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_feed.php 31634 2012-09-17 06:43:39Z monkey $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
$operation = $operation ? $operation : 'search';
shownav('topic', 'nav_feed');
$anchor = in_array($operation, array('search', 'global')) ? $operation : 'search';
$current = array($anchor => 1);
showsubmenu('nav_feed', array(
array('nav_feed', 'feed', $current['search']),
array('feed_global', 'feed&operation=global', $current['global']),
));
if($operation == 'global') {
if(!submitcheck('globalsubmit')) {
$feedid = intval($_GET['feedid']);
$feed = array();
if($feedid) {
$feed = C::t('home_feed')->fetch_feed('', '', '', $feedid);
if($feed['uid']) {
require_once libfile('function/feed');
$feed = mkfeed($feed);
}
$feed['body_template'] = dhtmlspecialchars($feed['body_template']);
$feed['body_general'] = dhtmlspecialchars($feed['body_general']);
$feed['dateline'] = dgmdate($feed['dateline'], 'Y-m-d H:i');
}
if(empty($feed['dateline'])) {
$feed['dateline'] = dgmdate($_G['timestamp'], 'Y-m-d H:i');
}
showformheader('feed&operation=global', $feed['uid'] ? '' : 'onsubmit="edit_save();"');
echo '<script type="text/javascript" src="'.STATICURL.'image/editor/editor_function.js"></script>';
echo "<input type=\"hidden\" name=\"feednew[feedid]\" value=\"{$feed['feedid']}\" /><input type=\"hidden\" name=\"{feednew['feeduid']}\" value=\"{$feed['uid']}\" />";
showtableheader();
if(empty($feed['uid'])) {
showsetting('feed_global_title', 'feednew[title_template]', $feed['title_template'], 'text');
$src = 'home.php?mod=editor&charset='.CHARSET.'&allowhtml=1&doodle=0';
print <<<EOF
<tr><td>{$lang['message']}</td><td></td></tr>
<tr>
<td colspan="2">
<textarea class="userData" name="feednew[body_template]" id="uchome-ttHtmlEditor" style="height:100%;width:100%;display:none;border:0px" onkeydown="textareakey(this, event)">{$feed['body_template']}</textarea>
<iframe src="$src" name="uchome-ifrHtmlEditor" id="uchome-ifrHtmlEditor" scrolling="no" border="0" frameborder="0" style="width:100%;border: 1px solid #C5C5C5;" height="400"></iframe>
<td>
</tr>
EOF;
showsetting('feed_global_body_general', 'feednew[body_general]', $feed['body_general'], 'text');
} else {
print <<<EOF
<tr><td class="td27">{$lang['feed_global_title']}</td><td></td></tr>
<tr class="noborder"><td colspan="2">{$feed['title_template']}&nbsp;<td></tr>
<tr><td class="td27">{$lang['message']}</td><td></td></tr>
<tr class="noborder"><td colspan="2">{$feed['body_template']}&nbsp;<td></tr>
<tr><td class="td27">{$lang['feed_global_body_general']}</td><td></td></tr>
<tr class="noborder"><td colspan="2">{$feed['body_general']}&nbsp;<td></tr>
EOF;
}
showsetting('feed_global_image_1', 'feednew[image_1]', $feed['image_1'], 'text');
showsetting('feed_global_image_1_link', 'feednew[image_1_link]', $feed['image_1_link'], 'text');
showsetting('feed_global_image_2', 'feednew[image_2]', $feed['image_2'], 'text');
showsetting('feed_global_image_2_link', 'feednew[image_2_link]', $feed['image_2_link'], 'text');
showsetting('feed_global_image_3', 'feednew[image_3]', $feed['image_3'], 'text');
showsetting('feed_global_image_3_link', 'feednew[image_3_link]', $feed['image_3_link'], 'text');
showsetting('feed_global_image_4', 'feednew[image_4]', $feed['image_4'], 'text');
showsetting('feed_global_image_4_link', 'feednew[image_4_link]', $feed['image_4_link'], 'text');
showsetting('feed_global_dateline', 'feednew[dateline]', $feed['dateline'], 'text');
if($feed['id']) {
showsetting('feed_global_hot', 'feednew[hot]', $feed['hot'], 'text');
}
showsubmit('globalsubmit');
showtablefooter();
showformfooter();
} else {
$feednew = getgpc('feednew');
$feedid = intval($feednew['feedid']);
if(empty($feednew['feeduid']) || empty($feedid)) {
$setarr = array(
'title_template' => trim($feednew['title_template']),
'body_template' => trim($feednew['body_template'])
);
if(empty($setarr['title_template']) && empty($setarr['body_template'])) {
cpmsg('sitefeed_error', '', 'error');
}
} else {
$setarr = array();
}
$feednew['dateline'] = trim($feednew['dateline']);
if($feednew['dateline']) {
require_once libfile('function/home');
$newtimestamp = strtotime($feednew['dateline']);
if($newtimestamp > $_G['timestamp']) {
$_G['timestamp'] = $newtimestamp;
}
}
if(empty($feedid)) {
$_G['uid'] = 0;
require_once libfile('function/feed');
$feedid = feed_add('sitefeed',
trim($feednew['title_template']),array(),
trim($feednew['body_template']),array(),
trim($feednew['body_general']),
array(trim($feednew['image_1']),trim($feednew['image_2']),trim($feednew['image_3']),trim($feednew['image_4'])),
array(trim($feednew['image_1_link']),trim($feednew['image_2_link']),trim($feednew['image_3_link']),trim($feednew['image_4_link'])),
'','','',1
);
} else {
if(empty($feednew['feeduid'])) {
$setarr['body_general'] = trim($feednew['body_general']);
}
$setarr['image_1'] = trim($feednew['image_1']);
$setarr['image_1_link'] = trim($feednew['image_1_link']);
$setarr['image_2'] = trim($feednew['image_2']);
$setarr['image_2_link'] = trim($feednew['image_2_link']);
$setarr['image_3'] = trim($feednew['image_3']);
$setarr['image_3_link'] = trim($feednew['image_3_link']);
$setarr['image_4'] = trim($feednew['image_4']);
$setarr['image_4_link'] = trim($feednew['image_4_link']);
$setarr['dateline'] = $newtimestamp;
$setarr['hot'] = intval($feednew['hot']);
C::t('home_feed')->update_feed('', $setarr, '', '', $feedid);
}
cpmsg('feed_global_add_success', '', 'succeed');
}
} else {
$detail = $_GET['detail'];
$uid = $_GET['uid'];
$users = $_GET['users'];
$feedid = $_GET['feedid'];
$icon = $_GET['icon'];
$hot1 = $_GET['hot1'];
$hot2 = $_GET['hot2'];
$starttime = $_GET['starttime'];
$endtime = $_GET['endtime'];
$searchsubmit = $_GET['searchsubmit'];
$feedids = $_GET['feedids'];
$fromumanage = $_GET['fromumanage'] ? 1 : 0;
showtips('feed_tips');
if(!submitcheck('feedsubmit')) {
if($fromumanage) {
$starttime = !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $starttime) ? '' : $starttime;
$endtime = $_G['adminid'] == 3 || !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $endtime) ? '' : $endtime;
} else {
$starttime = !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $starttime) ? dgmdate(TIMESTAMP - 86400 * 7, 'Y-n-j') : $starttime;
$endtime = $_G['adminid'] == 3 || !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $endtime) ? dgmdate(TIMESTAMP, 'Y-n-j') : $endtime;
}
$staticurl = STATICURL;
echo <<<EOT
<script type="text/javascript" src="{$staticurl}js/calendar.js"></script>
<script type="text/JavaScript">
function page(number) {
$('feedforum').page.value=number;
$('feedforum').searchsubmit.click();
}
</script>
EOT;
showtagheader('div', 'searchposts', !$searchsubmit);
showformheader("feed", '', 'feedforum');
showhiddenfields(array('page' => $page, 'pp' => $_GET['pp'] ? $_GET['pp'] : $_GET['perpage']));
showtableheader();
showsetting('feed_search_detail', 'detail', $detail, 'radio');
showsetting('feed_search_perpage', '', $_GET['perpage'], "<select name='perpage'><option value='20'>{$lang['perpage_20']}</option><option value='50'>{$lang['perpage_50']}</option><option value='100'>{$lang['perpage_100']}</option></select>");
$selected[$icon] = $icon ? 'selected="selected"' : '';
showsetting('feed_search_icon', '', $icon, "<select name='icon'><option value=''>{$lang['all']}</option><option value='blog' {$selected['blog']}>{$lang['feed_blog']}</option>
<option value='thread' {$selected['thread']}>{$lang['feed_thread']}</option><option value='album' {$selected['album']}>{$lang['feed_album']}</option><option value='doing' {$selected['doing']}>{$lang['doing']}</option>
<option value='share' {$selected['share']}>{$lang['shares']}</option><option value='friend' {$selected['friend']}>{$lang['feed_friend']}</option><option value='poll' {$selected['poll']}>{$lang['feed_poll']}</option>
<option value='comment' {$selected['comment']}>{$lang['feed_comment']}</option><option value='click' {$selected['click']}>{$lang['feed_click']}</option>
<option value='show' {$selected['show']}>{$lang['feed_show']}</option><option value='profile' {$selected['profile']}>{$lang['feed_profile']}</option><option value='sitefeed' {$selected['sitefeed']}>{$lang['feed_sitefeed']}</option></select>");
showsetting('feed_search_uid', 'uid', $uid, 'text');
showsetting('feed_search_user', 'users', $users, 'text');
showsetting('feed_search_feedid', 'feedid', $feedid, 'text');
showsetting('feed_search_hot', array('hot1', 'hot2'), array('', ''), 'range');
showsetting('feed_search_time', array('starttime', 'endtime'), array($starttime, $endtime), 'daterange');
echo '<input type="hidden" name="fromumanage" value="'.$fromumanage.'">';
showsubmit('searchsubmit');
showtablefooter();
showformfooter();
showtagfooter('div');
} else {
$feedids = authcode($feedids, 'DECODE');
$feedidsadd = $feedids ? explode(',', $feedids) : $_GET['delete'];
include_once libfile('function/delete');
$deletecount = count(deletefeeds($feedidsadd));
$cpmsg = cplang('feed_succeed', array('deletecount' => $deletecount));
?>
<script type="text/JavaScript">alert('<?php echo $cpmsg;?>');parent.$('feedforum').searchsubmit.click();</script>
<?php
}
if(submitcheck('searchsubmit', 1)) {
$feedids = $feedcount = '0';
$sql = $error = '';
$users = trim($users);
if($users != '') {
$uids = array(-1);
$query = C::t('home_feed')->fetch_uid_by_username(explode(',', $users));
$uids = array_keys($query) + $uids;
}
if($icon != '') {
$feedarr = C::t('home_feed')->fetch_icon_by_icon($icon);
$icon = $feedarr['icon'];
if($icon == '') {
$icon = '-1';
}
}
if($starttime != '') {
$starttime = strtotime($starttime);
}
if($_G['adminid'] == 1 && $endtime != dgmdate(TIMESTAMP, 'Y-n-j')) {
if($endtime != '') {
$endtime = strtotime($endtime);
}
} else {
$endtime = TIMESTAMP;
}
if($feedid != '') {
$feedids = array(-1);
$query = C::t('home_feed')->fetch_feedid_by_feedid(explode(',', $feedid));
$feedids = array_keys($query) + $feedids;
}
if($uid != '') {
$query = C::t('home_feed')->fetch_uid_by_uid(explode(',', $uid));
if(!$uids) {
$uids = array_keys($query);
} else {
$uids = array_intersect(array_keys($query), $uids);
}
if(!$uids) {
$uids = array(-1);
}
}
if(($_G['adminid'] == 2 && $endtime - $starttime > 86400 * 16) || ($_G['adminid'] == 3 && $endtime - $starttime > 86400 * 8)) {
$error = 'feed_mod_range_illegal';
}
if(!$error) {
if($detail) {
$_GET['perpage'] = intval($_GET['perpage']) < 1 ? 20 : intval($_GET['perpage']);
$perpage = $_GET['pp'] ? $_GET['pp'] : $_GET['perpage'];
$query = C::t('home_feed')->fetch_all_by_search(1, $uids, $icon, $starttime, $endtime, $feedids, $hot1, $hot2, (($page - 1) * $perpage), $perpage);
$feeds = '';
include_once libfile('function/feed');
foreach ($query as $feed) {
$feed['dateline'] = dgmdate($feed['dateline']);
$feed = mkfeed($feed);
$feeds .= showtablerow('', array('style="width:20px;"', 'style="width:260px;"', '', 'style="width:120px;"', 'style="width:60px;"'), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"{$feed['feedid']}\" />",
$feed['title_template'],
$feed['body_template'],
$feed['dateline'],
'<a href="'.ADMINSCRIPT.'?action=feed&operation=global&feedid='.$feed['feedid'].'">'.$lang['edit'].'</a>'
), TRUE);
}
$feedcount = C::t('home_feed')->fetch_all_by_search(3, $uids, $icon, $starttime, $endtime, $feedids, $hot1, $hot2);
$multi = multi($feedcount, $perpage, $page, ADMINSCRIPT."?action=feed");
$multi = preg_replace("/href=\"".ADMINSCRIPT."\?action=feed&amp;page=(\d+)\"/", "href=\"javascript:page(\\1)\"", $multi);
$multi = str_replace("window.location='".ADMINSCRIPT."?action=feed&amp;page='+this.value", "page(this.value)", $multi);
} else {
$feedcount = 0;
$query = C::t('home_feed')->fetch_all_by_search(2, $uids, $icon, $starttime, $endtime, $feedids, $hot1, $hot2);
foreach ($query as $feed) {
$feedids .= ','.$feed['feedid'];
$feedcount++;
}
$multi = '';
}
if(!$feedcount) {
$error = 'feed_post_nonexistence';
}
}
showtagheader('div', 'postlist', $searchsubmit);
showformheader('feed&frame=no', 'target="feedframe"');
showhiddenfields(array('feedids' => authcode($feedids, 'ENCODE')));
showtableheader(cplang('feed_result').' '.$feedcount.' <a href="###" onclick="$(\'searchposts\').style.display=\'\';$(\'postlist\').style.display=\'none\';$(\'feedforum\').pp.value=\'\';$(\'feedforum\').page.value=\'\';" class="act lightlink normal">'.cplang('research').'</a>', 'fixpadding');
if($error) {
echo "<tr><td class=\"lineheight\" colspan=\"15\">$lang[$error]</td></tr>";
} else {
if($detail) {
showsubtitle(array('', 'feed_title', 'feed_body', 'time', ''));
echo $feeds;
}
}
showsubmit('feedsubmit', 'delete', $detail ? 'del' : '', '', $multi);
showtablefooter();
showformfooter();
echo '<iframe name="feedframe" style="display:none"></iframe>';
showtagfooter('div');
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,471 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_founder.php 33912 2013-08-30 06:00:06Z nemohou $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
if(empty($admincp) || !is_object($admincp) || !$admincp->isfounder) {
exit('Access Denied');
}
if($operation == 'perm') {
$do = !in_array(getgpc('do'), array('group', 'member', 'gperm', 'notifyusers')) ? 'member' : getgpc('do');
shownav('founder', 'menu_founder_perm');
if($do == 'group') {
$id = intval(getgpc('id'));
if(!$id) {
foreach(C::t('common_admincp_group')->range() as $group) {
$groups[$group['cpgroupid']] = $group['cpgroupname'];
}
if(!submitcheck('submit')) {
showsubmenu('menu_founder_perm', array(
array('nav_founder_perm_member', 'founder&operation=perm&do=member', 0),
array('nav_founder_perm_group', 'founder&operation=perm&do=group', 1),
array('nav_founder_perm_notifyusers', 'founder&operation=perm&do=notifyusers', 0),
));
showformheader('founder&operation=perm&do=group');
showtableheader();
showsubtitle(array('', 'founder_cpgroupname', ''));
foreach($groups as $id => $group) {
showtablerow('style="height:20px"', array('class="td25"', 'class="td24"'), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"$id\">",
"<input type=\"text\" class=\"txtnobd\" onblur=\"this.className='txtnobd'\" onfocus=\"this.className='txt'\" size=\"15\" name=\"name[$id]\" value=\"$group\">",
'<a href="'.ADMINSCRIPT.'?action=founder&operation=perm&do=group&id='.$id.'">'.cplang('edit').'</a>'
));
}
showtablerow('style="height:20px"', array(), array(cplang('add_new'), '<input class="txt" type="text" name="newcpgroupname" value="" />', ''));
showsubmit('submit', 'submit', 'del');
showtablefooter();
showformfooter();
} else {
if(!empty($_GET['newcpgroupname'])) {
if(C::t('common_admincp_group')->fetch_by_cpgroupname($_GET['newcpgroupname'])) {
cpmsg('founder_perm_group_name_duplicate', '', 'error', array('name' => $_GET['newcpgroupname']));
}
C::t('common_admincp_group')->insert(array('cpgroupname' => strip_tags($_GET['newcpgroupname'])));
}
if(!empty($_GET['delete'])) {
C::t('common_admincp_perm')->delete_by_cpgroupid_perm($_GET['delete']);
C::t('common_admincp_member')->update_cpgroupid_by_cpgroupid($_GET['delete'], array('cpgroupid' => 0));
C::t('common_admincp_group')->delete($_GET['delete']);
}
if(!empty($_GET['name'])) {
foreach($_GET['name'] as $id => $name) {
if($groups[$id] != $name) {
$cpgroupid = ($cpgroup = C::t('common_admincp_group')->fetch_by_cpgroupname($name)) ? $cpgroup['cpgroupid'] : 0;
if($cpgroupid && $_GET['name'][$cpgroupid] == $groups[$cpgroupid]) {
cpmsg('founder_perm_group_name_duplicate', '', 'error', array('name' => $name));
}
C::t('common_admincp_group')->update($id, array('cpgroupname' => $name));
}
}
}
cpmsg('founder_perm_group_update_succeed', 'action=founder&operation=perm&do=group', 'succeed');
}
} else {
if(!submitcheck('submit')) {
showpermstyle();
$perms = array();
foreach(C::t('common_admincp_perm')->fetch_all_by_cpgroupid($id) as $perm) {
$perms[] = $perm['perm'];
}
$cpgroupname = ($cpgroup = C::t('common_admincp_group')->fetch($id)) ? $cpgroup['cpgroupname'] : '';
$data = getactionarray();
$grouplist = '';
foreach(C::t('common_admincp_group')->range() as $ggroup) {
$grouplist .= '<a href="###" onclick="location.href=\''.ADMINSCRIPT.'?action=founder&operation=perm&do=group&switch=yes&id='.$ggroup['cpgroupid'].'&scrolltop=\'+document.documentElement.scrollTop"'.($_GET['id'] == $ggroup['cpgroupid'] ? ' class="current"' : '').'>'.$ggroup['cpgroupname'].'</a>';
}
$grouplist = '<span id="cpgselect" class="right popupmenu_dropmenu" onmouseover="showMenu({\'ctrlid\':this.id,\'pos\':\'34\'});$(\'cpgselect_menu\').style.top=(parseInt($(\'cpgselect_menu\').style.top)-document.documentElement.scrollTop)+\'px\'">'.cplang('founder_group_switch').'<em>&nbsp;&nbsp;</em></span>'.
'<div id="cpgselect_menu" class="popupmenu_popup" style="display:none">'.$grouplist.'</div>';
showsubmenu('menu_founder_groupperm', array(array()), $grouplist, array('group' => $cpgroupname));
showformheader('founder&operation=perm&do=group&id='.$id);
showboxheader('', '', '', 1);
foreach($data['cats'] as $topkey) {
if(!$data['actions'][$topkey]) {
continue;
}
$checkedall = true;
$row = '<div class="boxbody drow clp" id="perms_'.$topkey.'">';
foreach($data['actions'][$topkey] as $k => $item) {
if(!$item) {
continue;
}
$checked = is_array($perms) ? in_array($item[1], $perms) : false;
if(!$checked) {
$checkedall = false;
}
$row .= $item[1] ? '<div class="item'.($checked ? ' checked' : '').'"><a class="right" title="'.cplang('config').'" href="'.ADMINSCRIPT.'?frames=yes&action=founder&operation=perm&do=gperm&gset='.$topkey.'_'.$k.'" target="_blank">&nbsp;</a><label class="txt"><input name="permnew[]" value="'.$item[1].'" class="checkbox" type="checkbox" '.($checked ? 'checked="checked" ' : '').' onclick="checkclk(this)" />'.cplang($item[0]).'</label></div>' : '';
}
$row .= '</div>';
if($topkey != 'setting') {
showboxtitle('<label><input class="checkbox" type="checkbox" onclick="permcheckall(this, \'perms_'.$topkey.'\')" '.($checkedall ? 'checked="checked" ' : '').'/> '.cplang('header_'.$topkey).'</label>');
} else {
showboxtitle('founder_perm_setting');
}
echo $row;
}
showsubmit('submit');
showboxfooter(1);
showformfooter();
if(!empty($_GET['switch'])) {
echo '<script type="text/javascript">showMenu({\'ctrlid\':\'cpgselect\',\'pos\':\'34\'});</script>';
}
} else {
C::t('common_admincp_perm')->delete_by_cpgroupid_perm($id);
if($_GET['permnew']) {
foreach($_GET['permnew'] as $perm) {
C::t('common_admincp_perm')->insert(array('cpgroupid' => $id, 'perm' => $perm));
}
}
cpmsg('founder_perm_groupperm_update_succeed', 'action=founder&operation=perm&do=group', 'succeed');
}
}
} elseif($do == 'member') {
$founders = $_G['config']['admincp']['founder'] !== '' ? explode(',', str_replace(' ', '', addslashes($_G['config']['admincp']['founder']))) : array();
if($founders) {
$founderexists = true;
$fuid = $fuser = array();
foreach($founders as $founder) {
if(is_numeric($founder)) {
$fuid[] = $founder;
} else {
$fuser[] = $founder;
}
}
$founders = array();
if($fuid) {
$founders = $founders + C::t('common_member')->fetch_all($fuid, false, 0);
}
if($fuser) {
$founders = $founders + C::t('common_member')->fetch_all_by_username($fuser);
}
} else {
$founderexists = false;
$founders = C::t('common_member')->fetch_all_by_adminid(1);
}
$id = empty($_GET['id']) ? 0 : $_GET['id'];
if(!$id) {
if(!submitcheck('submit')) {
showsubmenu('menu_founder_perm', array(
array('nav_founder_perm_member', 'founder&operation=perm&do=member', 1),
array('nav_founder_perm_group', 'founder&operation=perm&do=group', 0),
array('nav_founder_perm_notifyusers', 'founder&operation=perm&do=notifyusers', 0),
));
$groupselect = '<select name="newcpgroupid"><option value="0">'.cplang('founder_master').'</option>';
$groups = array();
foreach(C::t('common_admincp_group')->range() as $group) {
$groupselect .= '<option value="'.$group['cpgroupid'].'">'.$group['cpgroupname'].'</option>';
$groups[$group['cpgroupid']] = $group['cpgroupname'];
}
$groupselect .= '</select>';
$members = $adminmembers = array();
$adminmembers = C::t('common_admincp_member')->range();
foreach ($adminmembers as $adminmember) {
$adminmembers[$adminmember['uid']] = $adminmember;
}
foreach($founders as $uid => $founder) {
$members[$uid] = array('uid' => $uid, 'username' => $founder['username'], 'cpgroupname' => cplang('founder_admin'));
}
if($adminmembers) {
foreach(C::t('common_member')->fetch_all(array_keys($adminmembers), false, 0) as $member) {
if(isset($members[$member['uid']])) {
C::t('common_admincp_member')->delete($member['uid']);
continue;
}
$member['cpgroupname'] = !empty($adminmembers[$member['uid']]['cpgroupid']) ? $groups[$adminmembers[$member['uid']]['cpgroupid']] : cplang('founder_master');
if(!$founderexists && in_array($member['uid'], array_keys($founders))) {
$member['cpgroupname'] = cplang('founder_admin');
}
$members[$member['uid']] = $member;
}
}
if(!$founderexists) {
showtips(cplang('home_security_nofounder').cplang('home_security_founder'));
} else {
showtips('home_security_founder');
}
showformheader('founder&operation=perm&do=member');
showtableheader();
showsubtitle(array('', 'founder_username', 'founder_usergname', ''));
foreach($members as $id => $member) {
$isfounder = array_key_exists($id, $founders);
showtablerow('style="height:20px"', array('class="td25"', 'class="td24"', 'class="td24"'), array(
!$isfounder || isset($adminmembers[$member['uid']]['cpgroupid']) ? "<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"$id]\">" : '',
"<a href=\"home.php?mod=space&uid={$member['uid']}\" target=\"_blank\">{$member['username']}</a>",
$member['cpgroupname'],
!$isfounder && $adminmembers[$member['uid']]['cpgroupid'] ? '<a href="'.ADMINSCRIPT.'?action=founder&operation=perm&do=member&id='.$id.'">'.cplang('edit').'</a>' : ''
));
}
showtablerow('style="height:20px"', array('class="td25"', 'class="td24"', 'class="td24"'), array(cplang('add_new'), '<input class="txt" type="text" name="newcpusername" value="" />', $groupselect, ''));
showsubmit('submit', 'submit', 'del');
showtablefooter();
showformfooter();
} else {
if(!empty($_GET['newcpusername'])) {
$newcpuid = C::t('common_member')->fetch_uid_by_username($_GET['newcpusername']);
if(!$newcpuid) {
cpmsg('founder_perm_member_noexists', '', 'error', array('name' => $_GET['newcpusername']));
}
if(C::t('common_admincp_member')->count_by_uid($newcpuid) || array_key_exists($newcpuid, $founders)) {
cpmsg('founder_perm_member_duplicate', '', 'error', array('name' => $_GET['newcpusername']));
}
C::t('common_admincp_member')->insert(array('uid' => $newcpuid, 'cpgroupid' => $_GET['newcpgroupid']));
}
if(!empty($_GET['delete'])) {
C::t('common_admincp_member')->delete($_GET['delete']);
}
updatecache('founder');
cpmsg('founder_perm_member_update_succeed', 'action=founder&operation=perm&do=member', 'succeed');
}
} else {
if(!submitcheck('submit')) {
$member = C::t('common_admincp_member')->fetch($id);
if(!$member) {
cpmsg('founder_perm_member_noexists', '', 'error');
}
$user = getuserbyuid($id);
$username = $user['username'];
$cpgroupid = empty($_GET['cpgroupid']) ? $member['cpgroupid'] : $_GET['cpgroupid'];
$member['customperm'] = empty($_GET['cpgroupid']) || $_GET['cpgroupid'] == $member['cpgroupid'] ? dunserialize($member['customperm']) : array();
$perms = array();
foreach(C::t('common_admincp_perm')->fetch_all_by_cpgroupid($cpgroupid) as $perm) {
$perms[] = $perm['perm'];
}
$data = getactionarray();
$groupselect = '<select name="cpgroupidnew" onchange="location.href=\''.ADMINSCRIPT.'?action=founder&operation=perm&do=member&id='.$id.'&cpgroupid=\' + this.value">';
foreach(C::t('common_admincp_group')->range() as $group) {
$groupselect .= '<option value="'.$group['cpgroupid'].'"'.($group['cpgroupid'] == $cpgroupid ? ' selected="selected"' : '').'>'.$group['cpgroupname'].'</option>';
}
$groupselect .= '</select>';
showpermstyle();
showsubmenu('menu_founder_memberperm', array(array()), '', array('username' => $username));
showformheader('founder&operation=perm&do=member&id='.$id);
showtableheader();
showsetting('founder_usergname', '', '', $groupselect);
showtablefooter();
showtableheader();
foreach($data['cats'] as $topkey) {
if(!$data['actions'][$topkey]) {
continue;
}
$checkedall = true;
$row = '<tr><td class="vtop" id="perms_'.$topkey.'">';
foreach($data['actions'][$topkey] as $item) {
if(!$item) {
continue;
}
$checked = is_array($perms) ? in_array($item[1], $perms) : false;
$customchecked = is_array($member['customperm']) ? in_array($item[1], $member['customperm']) : false;
$extra = $checked ? ($customchecked ? '' : 'checked="checked" ').' onclick="checkclk(this)"' : 'disabled="disabled" ';
if(!$checked || $customchecked) {
$checkedall = false;
}
$row .= '<div class="item'.($checked && !$customchecked ? ' checked' : '').'"><label class="txt"><input name="permnew[]" value="'.$item[1].'" class="checkbox" type="checkbox" '.$extra.'/>'.cplang($item[0]).'</label></div>';
}
$row .= '</td></tr>';
if($topkey != 'setting') {
showtitle('<input class="checkbox" type="checkbox" onclick="permcheckall(this, \'perms_'.$topkey.'\')" '.($checkedall ? 'checked="checked" ' : '').'/> '.cplang('header_'.$topkey).'</label>');
} else {
showtitle('founder_perm_setting');
}
echo $row;
}
showsubmit('submit');
showtablefooter();
showformfooter();
} else {
$_permnew = !empty($_GET['permnew']) ? $_GET['permnew'] : array();
$cpgroupidnew = $_GET['cpgroupidnew'];
$dbperms = C::t('common_admincp_perm')->fetch_all_by_cpgroupid($cpgroupidnew);
$perms = array();
foreach($dbperms as $dbperm) {
$perms[] = $dbperm['perm'];
}
$customperm = serialize(array_diff($perms, $_permnew));
C::t('common_admincp_member')->update($id, array('cpgroupid' => $cpgroupidnew, 'customperm' => $customperm));
cpmsg('founder_perm_member_update_succeed', 'action=founder&operation=perm&do=member', 'succeed');
}
}
} elseif($do == 'gperm' && !empty($_GET['gset'])) {
$gset = $_GET['gset'];
list($topkey, $k) = explode('_', $gset);
$data = getactionarray();
$gset = $data['actions'][$topkey][$k];
if(!$gset) {
cpmsg('undefined_action', '', 'error');
}
if(!submitcheck('submit')) {
$allperms = C::t('common_admincp_perm')->fetch_all_by_perm($gset[1]);
$groups = C::t('common_admincp_group')->range();
showsubmenu('menu_founder_permgrouplist', array(array()), '', array('perm' => cplang($gset[0])));
showformheader('founder&operation=perm&do=gperm&gset='.$_GET['gset']);
showtableheader();
showsubtitle(array('', 'founder_usergname'));
foreach($groups as $id => $group) {
showtablerow('style="height:20px"', array('class="td25"', ''), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"permnew[]\" ".($allperms[$group['cpgroupid']]['perm'] ? 'checked="checked"' : '')." value=\"$id\">",
$group['cpgroupname']
));
}
showsubmit('submit');
showtablefooter();
showformfooter();
} else {
foreach(C::t('common_admincp_group')->range() as $group) {
if(in_array($group['cpgroupid'], $_GET['permnew'])) {
C::t('common_admincp_perm')->insert(array('cpgroupid' => $group['cpgroupid'], 'perm' => $gset[1]), false, true);
} else {
C::t('common_admincp_perm')->delete_by_cpgroupid_perm($group['cpgroupid'], $gset[1]);
}
}
cpmsg('founder_perm_gperm_update_succeed', 'action=founder&operation=perm', 'succeed');
}
} elseif($do == 'notifyusers') {
$notifyusers = dunserialize($_G['setting']['notifyusers']);
$notifytypes = explode(',', $_G['setting']['adminnotifytypes']);
if(!submitcheck('submit')) {
showpermstyle();
showsubmenu('menu_founder_perm', array(
array('nav_founder_perm_member', 'founder&operation=perm&do=member', 0),
array('nav_founder_perm_group', 'founder&operation=perm&do=group', 0),
array('nav_founder_perm_notifyusers', 'founder&operation=perm&do=notifyusers', 1),
));
showtips('founder_notifyusers_tips');
showformheader('founder&operation=perm&do=notifyusers');
showtableheader();
showsubtitle(array('', 'username', '', 'founder_notifyusers_types'));
foreach($notifyusers as $uid => $user) {
$types = '';
foreach($notifytypes as $key => $typename) {
$checked = $user['types'][$key] ? ' checked' : '';
if(substr($typename, 0, 7) == 'verify_') {
$i = substr($typename, -1, 1);
if($_G['setting']['verify'][$i]['available']) {
$tname = $_G['setting']['verify'][$i]['title'];
} else {
continue;
}
} else {
$tname = cplang('founder_notidyusers_'.$typename);
}
$types .= "<div class=\"item$checked\"><label class=\"txt\"><input class=\"checkbox\" onclick=\"checkclk(this)\" type=\"checkbox\" name=\"notifytypes_{$uid}[{$typename}]\" value=\"1\"$checked>".$tname.'</label></div>';
}
showtablerow('style="height:20px"', array('class="td25"', 'class="td24"', 'class="td25"', 'class="vtop"'), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"$uid\">",
"<input type=\"hidden\" class=\"txtnobd\" name=\"name[$uid]\" value=\"{$user['username']}\">{$user['username']}",
'<input name="chkall_'.$uid.'" id="chkall_'.$uid.'" type="checkbox" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'notifytypes_'.$uid.'\', \'chkall_'.$uid.'\', 1)" />'.cplang('select_all'),
$types
));
}
showtablerow('style="height:20px"', array('', 'colspan="3"'), array(cplang('add_new'), '<input class="txt" type="text" name="newusername" value="" />'));
showsubmit('submit', 'submit', 'del');
showtablefooter();
showformfooter();
} else {
$newnotifyusers = array();
if($_GET['name']) {
foreach($_GET['name'] as $uid => $username) {
if($_GET['delete'] && in_array($uid, $_GET['delete'])) {
continue;
}
$types = '';
foreach($notifytypes as $typename) {
$types .= intval($_GET['notifytypes_'.$uid][$typename]);
}
$newnotifyusers[$uid] = array('username' => $username, 'types' => $types);
}
}
if($_GET['newusername']) {
$newusername = addslashes($_GET['newusername']);
$newuid = C::t('common_member')->fetch_uid_by_username($newusername);
if($newuid) {
$newnotifyusers[$newuid] = array('username' => $newusername, 'types' => '');
}
}
C::t('common_setting')->update_setting('notifyusers', $newnotifyusers);
updatecache('setting');
cpmsg('founder_perm_notifyusers_succeed', 'action=founder&operation=perm&do=notifyusers', 'succeed');
}
}
}
function getactionarray() {
$isfounder = false;
require './source/admincp/admincp_menu.php';
require './source/admincp/admincp_perm.php';
unset($menu['cloud'][0]);
unset($topmenu['index'], $menu['index']);
$actioncat = $actionarray = array();
$actioncat[] = 'setting';
$actioncat = array_merge($actioncat, array_keys($topmenu));
$actionarray['setting'][] = array('founder_perm_allowpost', '_allowpost');
foreach($menu as $tkey => $items) {
foreach($items as $item) {
$actionarray[$tkey][] = $item;
}
}
return array('actions' => $actionarray, 'cats' => $actioncat);
}
function showpermstyle() {
$staticurl = STATICURL;
echo <<<EOF
<style>
.item{ float: left; width: 180px; line-height: 25px; margin-left: 5px; border-right: 1px #deeffb dotted; }
.vtop .right, .item .right{ padding: 0 10px; line-height: 22px; background: url('{$staticurl}/image/admincp/bg_repno.gif') no-repeat -286px -145px; font-weight: normal;margin-right:10px; }
.vtop a:hover.right, .item a:hover.right { text-decoration:none; }
</style>
<script type="text/JavaScript">
function permcheckall(obj, perms, t) {
var t = !t ? 0 : t;
var checkboxs = $(perms).getElementsByTagName('INPUT');
for(var i = 0; i < checkboxs.length; i++) {
var e = checkboxs[i];
if(e.type == 'checkbox') {
if(!t) {
if(!e.disabled) {
e.checked = obj.checked;
}
} else {
if(obj != e) {
e.style.visibility = obj.checked ? 'hidden' : 'visible';
}
}
e.parentNode.parentNode.className = e.checked ? 'item checked' : 'item';
}
}
}
function checkclk(obj) {
var obj = obj.parentNode.parentNode;
obj.className = obj.className == 'item' ? 'item checked' : 'item';
}
</script>
EOF;
}

View File

@@ -0,0 +1,42 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_grid.php 31813 2012-10-11 08:13:23Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
if(!submitcheck('gridssubmit')) {
$grid = C::t('common_setting')->fetch_setting('grid', true);
shownav('forum', 'forums_grid');
showsubmenu('forums_grid');
showtips('forums_grid_tips');
showformheader('grid');
showtableheader('');
showsetting('forums_grid_show_grid', 'grid[showgrid]', $grid['showgrid'], 'radio', '', 1);
showsetting('forums_grid_style_type', array(0 => 'grid[gridtype]', array(array('0', $lang['forums_grid_style_image']), array(1, $lang['forums_grid_style_text']))), $grid['gridtype'], 'select');
showsetting('forums_grid_text_length', 'grid[textleng]', $grid['textleng'], 'text');
include_once libfile('function/forumlist');
$forumselect = '<select name="grid[fids][]" multiple="multiple" size="10"><option value="0"'.(in_array(0, $grid['fids']) ? ' selected' : '').'>'.$lang['all'].'</option>'.forumselect(FALSE, 0, $grid['fids'], TRUE).'</select>';
showsetting('forums_grid_data_source', '', '', $forumselect);
showsetting('forums_grid_high_light', 'grid[highlight]', $grid['highlight'], 'radio');
showsetting('forums_grid_target_blank', 'grid[targetblank]', $grid['targetblank'], 'radio');
showsetting('forums_grid_show_tips', 'grid[showtips]', $grid['showtips'], 'radio');
showsetting('forums_grid_cache_life', 'grid[cachelife]', $grid['cachelife'], 'text');
showtagfooter('tbody');
showsubmit('gridssubmit');
showtablefooter();
showformfooter();
} else {
$_POST['grid']['fids'] = in_array(0, $_POST['grid']['fids']) ? array(0) : $_POST['grid']['fids'];
C::t('common_setting')->update_setting('grid', $_POST['grid']);
updatecache('setting');
C::t('common_syscache')->delete_syscache('grids');
cpmsg('setting_update_succeed', 'action=grid', 'succeed');
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,573 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_index.php 36306 2016-12-16 08:12:49Z nemohou $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
$sensitivedirs = array('./', './uc_server/', './ucenter/');
foreach ($sensitivedirs as $sdir) {
if(@file_exists(DISCUZ_ROOT.$sdir.'install/index.php') && !DISCUZ_DEBUG) {
@unlink(DISCUZ_ROOT.$sdir.'install/index.php');
if(@file_exists(DISCUZ_ROOT.$sdir.'install/index.php')) {
dexit('Please delete '.$sdir.'install/index.php via FTP!');
}
}
}
@include_once DISCUZ_ROOT.'./source/discuz_version.php';
require_once libfile('function/attachment');
require_once libfile('function/discuzcode');
if(submitcheck('notesubmit', 1)) {
if(!empty($_GET['noteid']) && is_numeric($_GET['noteid'])) {
C::t('common_adminnote')->delete_note($_GET['noteid'], (isfounder() ? '' : $_G['username']));
}
if(!empty($_GET['newmessage'])) {
$newaccess = 0;
$_GET['newexpiration'] = TIMESTAMP + (intval($_GET['newexpiration']) > 0 ? intval($_GET['newexpiration']) : 30) * 86400;
$_GET['newmessage'] = nl2br(dhtmlspecialchars($_GET['newmessage']));
$data = array(
'admin' => $_G['username'],
'access' => 0,
'adminid' => $_G['adminid'],
'dateline' => $_G['timestamp'],
'expiration' => $_GET['newexpiration'],
'message' => $_GET['newmessage'],
);
C::t('common_adminnote')->insert($data);
}
}
require_once libfile('function/cloudaddons');
$newversion = (CHARSET == 'utf-8') ? dunserialize($_G['setting']['cloudaddons_newversion']) : json_decode($_G['setting']['cloudaddons_newversion'], true);
if(empty($newversion['newversion']) || !is_array($newversion['newversion']) || abs($_G['timestamp'] - $newversion['updatetime']) > 86400 || (isset($_GET['checknewversion']) && $_G['formhash'] == $_GET['formhash'])) {
$newversion = json_decode(cloudaddons_open('&mod=app&ac=upgrade'), true);
if(!empty($newversion['newversion'])) {
$newversion['updatetime'] = $_G['timestamp'];
C::t('common_setting')->update_setting('cloudaddons_newversion', ((CHARSET == 'utf-8') ? $newversion : json_encode($newversion)));
updatecache('setting');
} else {
$newversion = array();
}
}
$reldisp = is_numeric(DISCUZ_RELEASE) ? ('Release '.DISCUZ_RELEASE) : DISCUZ_RELEASE;
cpheader();
shownav();
show_user_bar();
show_todo();
show_security_advise();
show_releasetips();
show_envcheck();
echo '
<style>
*, *::before, *::after {
box-sizing: inherit
}
</style>
';
echo '<div class="drow">';
echo '<div class="dcol d-23">';
show_sysinfo();
show_news();
show_forever_thanks();
echo '</div>';
echo '<div class="dcol d-13">';
show_widgets();
echo '</div>';
echo '</div>';
echo '</div>';
$now = date('Y');
echo <<<EOT
<div class="copyright">
<p>Powered by <a href="https://www.discuz.vip/" target="_blank" class="lightlink2">Discuz!</a> {$_G['setting']['version']}</p>
<p>&copy; 2001-$now <a href="https://code.dismall.com/" target="_blank">Discuz! Team</a>.</p>
</div>
EOT;
function show_user_bar() {
global $_G;
if(isfounder()) {
$cpadmingroup = cplang('founder_admin');
} else {
if($GLOBALS['admincp']->adminsession['cpgroupid']) {
$cpgroup = C::t('common_admincp_group')->fetch($GLOBALS['admincp']->adminsession['cpgroupid']);
$cpadmingroup = $cpgroup['cpgroupname'];
} else {
$cpadmingroup = cplang('founder_master');
}
}
showsubmenu('home_welcome', array(), '</div><div class="dbox hometop">'.avatar(getglobal('uid'), 'middle', array('class' => 'avt')).'
<div class="hinfo">
<h4>'.cplang('home_welcome_txt').$_G['member']['username'].'</h4>
<p>'.$cpadmingroup.'&nbsp;|&nbsp;'.cplang('home_mods').': <span id="mod_num">0</span></p>
</div>', array('bbname' => $_G['setting']['bbname']));
}
function show_security_advise() {
if(!isfounder()) {
return;
}
global $lang, $_G;
$securityadvise = '';
$securityadvise .= !$_G['config']['admincp']['founder'] ? $lang['home_security_nofounder'] : '';
$securityadvise .= !$_G['config']['admincp']['checkip'] ? $lang['home_security_checkip'] : '';
$securityadvise .= $_G['config']['admincp']['runquery'] ? $lang['home_security_runquery'] : '';
if($securityadvise) {
showtableheader('home_security_tips', '', '', 0);
showtablerow('', 'class="tipsblock"', '<ul>'.$securityadvise.'</ul>');
showtablefooter();
}
}
function show_todo() {
global $_G;
$membersmod = C::t('common_member_validate')->count_by_status(0);
$threadsdel = C::t('forum_thread')->count_by_displayorder(-1);
$groupmod = C::t('forum_forum')->validate_level_num();
$reportcount = C::t('common_report')->fetch_count();
$modcount = array();
foreach (C::t('common_moderate')->count_group_idtype_by_status(0) as $value) {
$modcount[$value['idtype']] = $value['count'];
}
$medalsmod = C::t('forum_medallog')->count_by_type(2);
$threadsmod = $modcount['tid'];
$postsmod = $modcount['pid'];
$blogsmod = $modcount['blogid'];
$doingsmod = $modcount['doid'];
$picturesmod = $modcount['picid'];
$sharesmod = $modcount['sid'];
$commentsmod = $modcount['uid_cid'] + $modcount['blogid_cid'] + $modcount['sid_cid'] + $modcount['picid_cid'];
$articlesmod = $modcount['aid'];
$articlecommentsmod = $modcount['aid_cid'];
$topiccommentsmod = $modcount['topicid_cid'];
$verify = '';
foreach (C::t('common_member_verify_info')->group_by_verifytype_count() as $value) {
if($value['num']) {
if($value['verifytype']) {
$verifyinfo = !empty($_G['setting']['verify'][$value['verifytype']]) ? $_G['setting']['verify'][$value['verifytype']] : array();
if($verifyinfo['available']) {
$verify .= '<a href="'.ADMINSCRIPT.'?action=verify&operation=verify&do='.$value['verifytype'].'">'.cplang('home_mod_verify_prefix').$verifyinfo['title'].'</a>(<em class="lightnum">'.$value['num'].'</em>)';
}
} else {
$verify .= '<a href="'.ADMINSCRIPT.'?action=verify&operation=verify&do=0">'.cplang('home_mod_verify_prefix').cplang('members_verify_profile').'</a>(<em class="lightnum">'.$value['num'].'</em>)';
}
}
}
$modtotalnum = intval($membersmod + $threadsmod + $postsmod + $medalsmod + $blogsmod + $picturesmod + $doingsmod + $sharesmod + $commentsmod + $articlesmod + $articlecommentsmod + $topiccommentsmod + $reportcount + $threadsdel);
if($modtotalnum > 0) {
echo '<script>$(\'mod_num\').innerHTML = \''.$modtotalnum.'\';</script>';
}
if($membersmod || $threadsmod || $postsmod || $medalsmod || $blogsmod || $picturesmod || $doingsmod || $sharesmod || $commentsmod || $articlesmod || $articlecommentsmod || $topiccommentsmod || $reportcount || $threadsdel || !empty($verify)) {
showboxheader('', '', '', 1);
echo '<div class="tipsbody"><div class="left tipicon"><svg width="20" height="20" fill="#1f7244" viewBox="0 0 16 16">
<path d="M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707-.195-.195.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 0 1 1.013.16l3.134-3.133a2.772 2.772 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146z"></path></svg></div><h3 class="left margintop">'.cplang('home_mods').': </h3><p class="left difflink">'.
($membersmod ? '<a href="'.ADMINSCRIPT.'?action=moderate&operation=members">'.cplang('home_mod_members').'</a>(<em class="lightnum">'.$membersmod.'</em>)' : '').
($threadsmod ? '<a href="'.ADMINSCRIPT.'?action=moderate&operation=threads&dateline=all">'.cplang('home_mod_threads').'</a>(<em class="lightnum">'.$threadsmod.'</em>)' : '').
($postsmod ? '<a href="'.ADMINSCRIPT.'?action=moderate&operation=replies&dateline=all">'.cplang('home_mod_posts').'</a>(<em class="lightnum">'.$postsmod.'</em>)' : '').
($medalsmod ? '<a href="'.ADMINSCRIPT.'?action=medals&operation=mod">'.cplang('home_mod_medals').'</a>(<em class="lightnum">'.$medalsmod.'</em>)' : '').
($groupmod ? '<a href="'.ADMINSCRIPT.'?action=group&operation=mod">'.cplang('group_mod_wait').'</a>(<em class="lightnum">'.$groupmod.'</em>)' : '').
($blogsmod ? '<a href="'.ADMINSCRIPT.'?action=moderate&operation=blogs&dateline=all">'.cplang('home_mod_blogs').'</a>(<em class="lightnum">'.$blogsmod.'</em>)' : '').
($picturesmod ? '<a href="'.ADMINSCRIPT.'?action=moderate&operation=pictures&dateline=all">'.cplang('home_mod_pictures').'</a>(<em class="lightnum">'.$picturesmod.'</em>)' : '').
($doingsmod ? '<a href="'.ADMINSCRIPT.'?action=moderate&operation=doings&dateline=all">'.cplang('home_mod_doings').'</a>(<em class="lightnum">'.$doingsmod.'</em>)' : '').
($sharesmod ? '<a href="'.ADMINSCRIPT.'?action=moderate&operation=shares&dateline=all">'.cplang('home_mod_shares').'</a>(<em class="lightnum">'.$sharesmod.'</em>)' : '').
($commentsmod ? '<a href="'.ADMINSCRIPT.'?action=moderate&operation=comments&dateline=all">'.cplang('home_mod_comments').'</a>(<em class="lightnum">'.$commentsmod.'</em>)' : '').
($articlesmod ? '<a href="'.ADMINSCRIPT.'?action=moderate&operation=articles&dateline=all">'.cplang('home_mod_articles').'</a>(<em class="lightnum">'.$articlesmod.'</em>)' : '').
($articlecommentsmod ? '<a href="'.ADMINSCRIPT.'?action=moderate&operation=articlecomments&dateline=all">'.cplang('home_mod_articlecomments').'</a>(<em class="lightnum">'.$articlecommentsmod.'</em>)' : '').
($topiccommentsmod ? '<a href="'.ADMINSCRIPT.'?action=moderate&operation=topiccomments&dateline=all">'.cplang('home_mod_topiccomments').'</a>(<em class="lightnum">'.$topiccommentsmod.'</em>)' : '').
($reportcount ? '<a href="'.ADMINSCRIPT.'?action=report">'.cplang('home_mod_reports').'</a>(<em class="lightnum">'.$reportcount.'</em>)' : '').
($threadsdel ? '<a href="'.ADMINSCRIPT.'?action=recyclebin">'.cplang('home_del_threads').'</a>(<em class="lightnum">'.$threadsdel.'</em>)' : '').
$verify.
'</p><div class="clear"></div>';
showboxfooter();
}
}
function show_releasetips() {
global $_G, $reldisp, $newversion;
$siteuniqueid = C::t('common_setting')->fetch_setting('siteuniqueid');
if(empty($siteuniqueid) || strlen($siteuniqueid) < 16) {
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
$siteuniqueid = 'DX'.$chars[date('y') % 60].$chars[date('n')].$chars[date('j')].$chars[date('G')].$chars[date('i')].$chars[date('s')].substr(md5($_G['clientip'].$_G['username'].TIMESTAMP), 0, 4).random(4);
C::t('common_setting')->update_setting('siteuniqueid', $siteuniqueid);
require_once libfile('function/cache');
updatecache('setting');
}
if(!empty($_GET['closesitereleasetips'])) {
C::t('common_setting')->update('sitereleasetips', 0);
$sitereleasetips = 0;
require_once libfile('function/cache');
updatecache('setting');
} else {
$sitereleasetips = C::t('common_setting')->fetch('sitereleasetips');
}
$siterelease = C::t('common_setting')->fetch('siterelease');
$releasehash = substr(hash('sha512', $_G['config']['security']['authkey'].DISCUZ_VERSION.DISCUZ_RELEASE.$siteuniqueid), 0, 32);
if(empty($siterelease) || strcmp($siterelease, $releasehash) !== 0) {
C::t('common_setting')->update('siteversion', DISCUZ_VERSION);
C::t('common_setting')->update('siterelease', $releasehash);
C::t('common_setting')->update('sitereleasetips', 1);
$sitereleasetips = 1;
require_once libfile('function/cloudaddons');
$newversion = json_decode(cloudaddons_open('&mod=app&ac=upgrade'), true);
if(!empty($newversion['newversion'])) {
$newversion['updatetime'] = $_G['timestamp'];
C::t('common_setting')->update_setting('cloudaddons_newversion', ((CHARSET == 'utf-8') ? $newversion : json_encode($newversion)));
} else {
$newversion = array();
}
require_once libfile('function/cache');
updatecache('setting');
}
if($sitereleasetips) {
showboxheader('version_tips', '', 'id="version_tips"');
echo '<em class="unknown">'.lang("admincp", "version_tips_msg", array('ADMINSCRIPT' => ADMINSCRIPT, 'version' => constant("DISCUZ_VERSION").' '.$reldisp)).'</em>';
showboxfooter();
}
}
function show_onlines() {
$admincp_session = C::t('common_admincp_session')->fetch_all_by_panel(1);
if(count($admincp_session) == 1) {
return;
}
$onlines = '';
$members = C::t('common_member')->fetch_all(array_keys($admincp_session), false, 0);
foreach ($admincp_session as $uid => $online) {
$onlines .= '<a href="home.php?mod=space&uid='.$online['uid'].'" title="'.dgmdate($online['dateline']).'" target="_blank">'.$members[$uid]['username'].'</a>&nbsp;&nbsp;&nbsp;';
}
showboxheader('home_onlines', '', 'id="home_onlines"');
echo $onlines;
showboxfooter();
}
function show_note() {
global $_G;
showformheader('index');
showboxheader('home_notes', '', 'id="home_notes"');
$notemsghtml = '';
foreach (C::t('common_adminnote')->fetch_all_by_access(0) as $note) {
if($note['expiration'] < TIMESTAMP) {
C::t('common_adminnote')->delete_note($note['id']);
} else {
$note['adminenc'] = rawurlencode($note['admin']);
$note['expiration'] = ceil(($note['expiration'] - $note['dateline']) / 86400);
$note['dateline'] = dgmdate($note['dateline'], 'dt');
$notemsghtml .= '<div class="dcol"><div class="adminnote">'.'<a'.(isfounder() || $_G['member']['username'] == $note['admin'] ? ' href="'.ADMINSCRIPT.'?action=index&notesubmit=yes&noteid='.$note['id'].'" title="'.cplang('delete').'" class="ndel"' : '').'></a>'.
("<div><p><span class=\"bold\"><a href=\"home.php?mod=space&username={$note['adminenc']}\" target=\"_blank\">{$note['admin']}</a></span></p><p>{$note['dateline']}</p><p class=\"marginbot\">(".cplang('home_notes_add').cplang('validity').": {$note['expiration']} ".cplang('days').")</p><p>{$note['message']}</p>").'</div></div></div>';
}
}
if($notemsghtml) {
echo '<div class="drow">'.$notemsghtml.'</div></div><div class="boxbody">';
}
showboxrow('style="align-items: center"', array('class="dcol lineheight"', 'class="dcol lineheight"'), array(
cplang('home_notes_add'),
'<input type="text" class="txt" name="newmessage" value="" style="width:300px;" />'.cplang('validity').': <input type="text" class="txt" name="newexpiration" value="30" style="width:60px;" />'.cplang('days').'&nbsp;<input name="notesubmit" value="'.cplang('submit').'" type="submit" class="btn" />'
));
showboxfooter();
showformfooter();
}
function show_filecheck() {
global $lang;
if(!isfounder()) {
return;
}
$filecheck = C::t('common_cache')->fetch('checktools_filecheck_result');
if($filecheck) {
list($modifiedfiles, $deletedfiles, $unknownfiles, $doubt) = dunserialize($filecheck['cachevalue']);
$filecheckresult = "<div><em class=\"".($modifiedfiles ? 'edited' : 'correct')."\">{$lang['filecheck_modify']}<span class=\"bignum\">$modifiedfiles</span></em>".
"<em class=\"".($deletedfiles ? 'del' : 'correct')."\">{$lang['filecheck_delete']}<span class=\"bignum\">$deletedfiles</span></em>".
"<em class=\"unknown\">{$lang['filecheck_unknown']}<span class=\"bignum\">$unknownfiles</span></em>".
"<em class=\"unknown\">{$lang['filecheck_doubt']}<span class=\"bignum\">$doubt</span></em></div><p>".
$lang['filecheck_last_homecheck'].': '.dgmdate($filecheck['dateline'], 'u').' <a href="'.ADMINSCRIPT.'?action=checktools&operation=filecheck&step=3">['.$lang['filecheck_view_list'].']</a></p>';
} else {
$filecheckresult = '';
}
showboxheader($lang['nav_filecheck'].' <a href="javascript:;" onclick="ajaxget(\''.ADMINSCRIPT.'?action=checktools&operation=filecheck&homecheck=yes\', \'filecheck_div\')">['.$lang['filecheck_check_now'].']</a>', 'nobottom fixpadding', 'id="filecheck"');
echo '<div id="filecheck_div">'.$filecheckresult.'</div>';
showboxfooter();
if(TIMESTAMP - $filecheck['dateline'] > 86400 * 7) {
echo '<script>ajaxget(\''.ADMINSCRIPT.'?action=checktools&operation=filecheck&homecheck=yes\', \'filecheck_div\');</script>';
}
}
function show_envcheck() {
global $reldisp;
$return = '';
$env_ok = true;
$now_ver_gd = function_exists('gd_info') ? gd_info() : false;
$now_ver = array('PHP' => constant('PHP_VERSION'), 'MySQL' => helper_dbtool::dbversion(), 'XML' => function_exists('xml_parser_create'), 'JSON' => function_exists('json_encode'), 'FileSock Function' => (function_exists('fsockopen') || function_exists('pfsockopen') || function_exists('stream_socket_client') || function_exists('curl_init')), 'GD' => ($now_ver_gd ? preg_replace('/[^0-9.]+/', '', $now_ver_gd['GD Version']) : false));
$req_ver = array('PHP' => '5.6.0', 'MySQL' => '5.5.3', 'XML' => true, 'JSON' => true, 'FileSock Function' => true, 'GD' => '1.0');
$sug_ver = array('PHP' => '7.4.0', 'MySQL' => '8.0.0', 'XML' => true, 'JSON' => true, 'FileSock Function' => true, 'GD' => '2.0');
foreach ($now_ver as $key => $value) {
if($req_ver[$key] === true) {
if(!$value) {
$return .= '<em class="unfixed">'.lang("admincp", "req_not_found", array('req' => $key)).'</em>';
$env_ok = false;
}
} elseif(version_compare($value, $req_ver[$key], '<')) {
$return .= '<em class="unfixed">'.lang("admincp", "req_ver_too_low", array('req' => $key, 'now_ver' => $value, 'sug_ver' => $sug_ver[$key], 'req_ver' => $req_ver[$key])).'</em>';
$env_ok = false;
}
}
if(!$env_ok) {
showboxheader('detect_environment', '', 'id="detect_environment"');
echo $return;
showboxfooter();
}
}
function show_sysinfo() {
global $newversion, $reldisp, $lang, $_G;
loaducenter();
if(empty($newversion['newversion']['qqqun'])) {
$newversion['newversion']['qqqun'] = '73'.'210'.'36'.'90';
}
showboxheader('home_sys_info', 'listbox', 'id="home_sys_info"');
showboxrow('', array('class="dcol lineheight d-14"', 'class="dcol lineheight d-1"'), array(
cplang('home_discuz_version'),
'Discuz! '.DISCUZ_VERSION.' '.$reldisp.' '.strtoupper(CHARSET).((strlen(DISCUZ_RELEASE) == 8 && DISCUZ_RELEASE != '20180101') ? '' : cplang('home_git_version'))
));
$newversion['newversion'] = !empty($newversion['newversion']) ? $newversion['newversion'] : array();
$reldisp_addon = is_numeric($newversion['newversion']['release']) ? ('Release '.$newversion['newversion']['release']) : $newversion['newversion']['release'];
$downlist = array();
foreach ($newversion['newversion']['downlist'] as $key => $value) {
$downlist[] = '<a href="'.diconv($value['url'], 'utf-8', CHARSET).'" target="_blank">'.discuzcode(strip_tags(diconv($value['title'], 'utf-8', CHARSET)), 1, 0).'</a>';
}
showboxrow('', array('class="dcol lineheight d-14"', 'class="dcol lineheight d-1"'), array(
cplang('home_check_newversion'),
($newversion['newversion']['release'] ? ($newversion['newversion']['release'] != DISCUZ_RELEASE ? '<b style="color:red;">' : '').'Discuz! '.$newversion['newversion']['version'].' '.$reldisp_addon.' '.strtoupper(CHARSET).' '.($newversion['newversion']['release'] != DISCUZ_RELEASE ? '</b>' : '') : '<a href="https://www.dismall.com/thread-73-1-1.html" target="_blank">'.cplang('detect_environment_error').'</a>').
' <a href="'.ADMINSCRIPT.'?action=index&checknewversion&formhash='.$_G['formhash'].'">[ '.cplang('refresh').' ]</a>&nbsp;&nbsp;<br><br>'.
(!empty($downlist) ? implode('&#x3001;', $downlist).($newversion['newversion']['qqqun'] ? '<span class="bold">&nbsp;&nbsp;|&nbsp;&nbsp;'.cplang('qq_group').$newversion['newversion']['qqqun'].'</span>' : '') : '<span class="bold"><a href="https://gitee.com/3dming/DiscuzL/attach_files" target="_blank">'.cplang('download_latest').'</a> | '.cplang('qq_group').'73'.'21'.'03'.'690</span>')
));
showboxrow('', array('class="dcol lineheight d-14"', 'class="dcol lineheight d-1"'), array(
cplang('home_ucclient_version'),
'UCenter '.UC_CLIENT_VERSION.' Release '.UC_CLIENT_RELEASE
));
showboxrow('', array('class="dcol lineheight d-14"', 'class="dcol lineheight d-1"'), array(
cplang('home_environment'),
PHP_OS.'('.PHP_OS_FAMILY.') / PHP '.PHP_VERSION.(PHP_ZTS ? ' TS' : '').(PHP_DEBUG ? ' DEBUG' : '').' / '.PHP_SAPI
));
showboxrow('', array('class="dcol lineheight d-14"', 'class="dcol lineheight d-1"'), array(
cplang('home_serversoftware'),
$_SERVER['SERVER_SOFTWARE']
));
showboxrow('', array('class="dcol lineheight d-14"', 'class="dcol lineheight d-1"'), array(
cplang('home_database'),
helper_dbtool::dbversion()
));
if(@ini_get('file_uploads')) {
require_once libfile('function/upload');
$fileupload = getmaxupload();
} else {
$fileupload = '<font color="red">'.$lang['no'].'</font>';
}
showboxrow('', array('class="dcol lineheight d-14"', 'class="dcol lineheight d-1"'), array(
cplang('home_upload_perm'),
$fileupload
));
$dbsize = helper_dbtool::dbsize();
$dbsize = $dbsize ? sizecount($dbsize) : $lang['unknown'];
showboxrow('', array('class="dcol lineheight d-14"', 'class="dcol lineheight d-1"'), array(
cplang('home_database_size'),
$dbsize
));
if(isset($_GET['attachsize'])) {
$attachsize = C::t('forum_attachment_n')->get_total_filesize();
$attachsize = is_numeric($attachsize) ? sizecount($attachsize) : $lang['unknown'];
} else {
$attachsize = '<a href="'.ADMINSCRIPT.'?action=index&attachsize">[ '.$lang['detail'].' ]</a>';
}
showboxrow('', array('class="dcol lineheight d-14"', 'class="dcol lineheight d-1"'), array(
cplang('home_attach_size'),
$attachsize
));
showboxfooter();
}
function show_news() {
global $newversion;
showboxheader('discuz_news', 'listbox', 'id="discuz_news"');
if(!empty($newversion['news'])) {
$newversion['news'] = dhtmlspecialchars($newversion['news']);
foreach ($newversion['news'] as $v) {
showboxrow('', array('class="dcol d-1 lineheight"', 'class="dcol"'), array(
'<a href="'.$v['url'].'" target="_blank">'.discuzcode(strip_tags(diconv($v['title'], 'utf-8', CHARSET)), 1, 0).'</a>',
'['.discuzcode(strip_tags($v['date']), 1, 0).']',
));
}
} else {
showboxrow('', array('class="dcol d-1"', 'class="dcol td21" style="text-align:right;"'), array(
'<a href="https://www.dismall.com/" target="_blank">'.cplang('log_in_to_update').'</a>',
'',
));
showboxrow('', array('class="dcol d-1"', 'class="dcol td21" style="text-align:right;"'), array(
'<a href="https://gitee.com/3dming/DiscuzL/attach_files" target="_blank">'.cplang('download_latest').'</a>',
'',
));
}
showboxfooter();
}
function show_widgets() {
$widgets = array(
array('.', 'show_onlines'),
array('.', 'show_note'),
array('.', 'show_filecheck'),
);
$plugins = C::t('common_plugin')->fetch_all_data();
foreach ($plugins as $plugin) {
$cpindexfile = DISCUZ_ROOT.'./source/plugin/'.$plugin['identifier'].'/admin/admin_widget.php';
if(!file_exists($cpindexfile)) {
continue;
}
$widgets[] = array($cpindexfile, 'widget_'.$plugin['identifier']);
}
foreach ($widgets as $widget) {
list($file, $func) = $widget;
if($file != '.') {
require_once $file;
}
if(!function_exists($func)) {
continue;
}
$func();
}
}
function show_forever_thanks() {
$copyRightMessage = array(
'&#x7248;&#x6743;&#x6240;&#x6709;',
'&#x817E;&#x8BAF;&#x4E91;&#x8BA1;&#x7B97;&#xFF08;&#x5317;&#x4EAC;&#xFF09;&#x6709;&#x9650;&#x8D23;&#x4EFB;&#x516C;&#x53F8;',
'&#x627F;&#x63A5;&#x8FD0;&#x8425;',
'&#x5408;&#x80A5;&#x8D30;&#x9053;&#x7F51;&#x7EDC;&#x79D1;&#x6280;&#x6709;&#x9650;&#x516C;&#x53F8;',
);
$gitTeamStr = '';
$gitTeam = array(
'laozhoubuluo' => '&#x8001;&#x5468;&#x90E8;&#x843D;',
'popcorner' => 'popcorner',
'oldhuhu' => 'oldhuhu',
'zoewho' => '&#x6E56;&#x4E2D;&#x6C89;',
'3dming' => '&#x8BF8;&#x845B;&#x6653;&#x660E;',
'brotherand2' => 'brotherand2',
'contributions' => 'git',
'nftstudio' => '&#x9006;&#x98CE;&#x5929;',
'ONEXIN' => 'ONEXIN',
);
foreach ($gitTeam as $id => $name) {
$gitTeamStr .= '<a href="https://gitee.com/'.$id.'" class="lightlink2 smallfont" target="_blank">'.$name.'</a>';
}
$devTeamStr = '';
$devTeam = array(
'174393' => 'Guode \'sup\' Li',
'859' => 'Hypo \'Cnteacher\' Wang',
'263098' => 'Liming \'huangliming\' Huang',
'706770' => 'Jun \'Yujunhao\' Du',
'80629' => 'Ning \'Monkeye\' Hou',
'246213' => 'Lanbo Liu',
'322293' => 'Qingpeng \'andy888\' Zheng',
'401635' => 'Guosheng \'bilicen\' Zhang',
'2829' => 'Mengshu \'msxcms\' Chen',
'492114' => 'Liang \'Metthew\' Xu',
'1087718' => 'Yushuai \'Max\' Cong',
'875919' => 'Jie \'tom115701\' Zhang',
);
foreach ($devTeam as $id => $name) {
$devTeamStr .= '<a href="https://discuz.dismall.com/home.php?mod=space&uid='.$id.'" class="lightlink2 smallfont" target="_blank">'.$name.'</a>';
}
$devSkins = array(
'294092' => 'Fangming \'Lushnis\' Li',
'674006' => 'Jizhou \'Iavav\' Yuan',
'717854' => 'Ruitao \'Pony.M\' Ma',
);
$devSkinsStr = '';
foreach ($devSkins as $id => $name) {
$devSkinsStr .= '<a href="https://discuz.dismall.com/home.php?mod=space&uid='.$id.'" class="lightlink2 smallfont" target="_blank">'.$name.'</a>';
}
$devThanksStr = '';
$devThanks = array(
'122246' => 'Heyond',
'632268' => 'JinboWang',
'15104' => 'Redstone',
'10407' => 'Qiang Liu',
'210272' => 'XiaoDunFang',
'86282' => 'Jianxieshui',
'9600' => 'Theoldmemory',
'2629' => 'Rain5017',
'26926' => 'Snow Wolf',
'17149' => 'Hehechuan',
'9132' => 'Pk0909',
'248' => 'feixin',
'675' => 'Laobing Jiuba',
'13877' => 'Artery',
'233' => 'Huli Hutu',
'122' => 'Lao Gui',
'159' => 'Tyc',
'177' => 'Stoneage',
'7155' => 'Gregry',
);
foreach ($devThanks as $id => $name) {
$devThanksStr .= '<a href="https://discuz.dismall.com/home.php?mod=space&uid='.$id.'" class="lightlink2 smallfont" target="_blank">'.$name.'</a>';
}
showboxheader('home_dev', 'fixpadding', 'id="home_dev"');
showboxrow('', array('class="dcol d-1 lineheight"', 'class="dcol lineheight team"'), array($copyRightMessage[0], '<span class="bold">'.$copyRightMessage[1].'</span>'));
showboxrow('', array('class="dcol d-1 lineheight"', 'class="dcol lineheight team"'), array($copyRightMessage[2], '<span class="bold">'.$copyRightMessage[3].'</span>'));
showboxrow('', array('class="dcol d-1 lineheight"', 'class="dcol lineheight team"'), array(cplang('contributors'), $gitTeamStr));
showboxrow('', array('class="dcol d-1 lineheight"', 'class="dcol lineheight team"'), array('', '<a href="https://gitee.com/Discuz/DiscuzX/contributors" class="lightlink2" target="_blank">'.cplang('contributors_see').'</a>'));
showboxrow('', array('class="dcol d-1 lineheight"', 'class="dcol lineheight team"'), array(cplang('home_dev_manager'), '<a href="https://discuz.dismall.com/home.php?mod=space&uid=1" class="lightlink2 smallfont" target="_blank">'.cplang('dev_manager').'</a>'));
showboxrow('', array('class="dcol d-1 lineheight"', 'class="dcol lineheight team"'), array(cplang('home_dev_team'), $devTeamStr));
showboxrow('', array('class="dcol d-1 lineheight"', 'class="dcol lineheight team"'), array(cplang('home_dev_skins'), $devSkinsStr));
showboxrow('', array('class="dcol d-1 lineheight"', 'class="dcol lineheight team"'), array(cplang('home_dev_thanks'), $devThanksStr));
showboxrow('', array('class="dcol d-1 lineheight"', 'class="dcol lineheight team tm"'), array(cplang('home_dev_links'), '
<a href="https://code.dismall.com/" class="lightlink2" target="_blank">'.cplang('discuz_git').'</a>,&nbsp;
<a href="https://www.discuz.vip/" class="lightlink2" target="_blank">'.cplang('discussion_area').'</a>, &nbsp;
<a href="https://www.dismall.com/" class="lightlink2" target="_blank">'.cplang('app_discussion').'</a>,&nbsp;
<a href="'.ADMINSCRIPT.'?action=cloudaddons" class="lightlink2" target="_blank">'.cplang('app_center').'</a>'));
showboxfooter();
}

View File

@@ -0,0 +1,168 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_login.php 36284 2016-12-12 00:47:50Z nemohou $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
if($this->core->var['inajax']) {
ajaxshowheader();
ajaxshowfooter();
}
if($this->cpaccess == -2 || $this->cpaccess == -3) {
html_login_header(false);
} else {
html_login_header();
}
if($this->cpaccess == -5) {
echo '<div class="loginbox">'.lang('admincp_login', 'login_cp_guest').'</div>';
}elseif($this->cpaccess == -2 || $this->cpaccess == -3) {
echo '<div class="container loginbox"><span>'.lang('admincp_login', 'login_cp_noaccess').'</span>';
}elseif($this->cpaccess == -1) {
$ltime = $this->sessionlife - (TIMESTAMP - $this->adminsession['dateline']);
echo '<div class="loginbox"><span>'.lang('admincp_login', 'login_cplock', array('ltime' => $ltime)).'</span></div>';
}elseif($this->cpaccess == -4) {
$ltime = $this->sessionlife - (TIMESTAMP - $this->adminsession['dateline']);
echo '<div class="loginbox"><span>'.lang('admincp_login', 'login_user_lock').'</span></div>';
} else {
html_login_form();
}
html_login_footer();
function html_login_header($form = true) {
global $_G;
$charset = CHARSET;
$cptitle = lang('admincp_login', 'admincp_title');
$title = lang('admincp_login', 'login_title');
$tips = lang('admincp_login', 'login_tips');
$staticurl = STATICURL;
$light_mode = lang('admincp_login', 'login_dk_light_mode');
$by_system = lang('admincp_login', 'login_dk_by_system');
$normal_mode = lang('admincp_login', 'login_dk_normal_mode');
$dark_mode = lang('admincp_login', 'login_dk_dark_mode');
echo <<<EOT
<!DOCTYPE html>
<html>
<head>
<meta charset="$charset">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="color-scheme" content="light dark">
<title>$title</title>
<link rel="stylesheet" href="{$staticurl}image/admincp/minireset.css?{$_G['style']['verhash']}">
<link rel="stylesheet" href="{$staticurl}image/admincp/admincplogin.css?{$_G['style']['verhash']}">
<meta content="Comsenz Inc." name="Copyright">
<script src="{$staticurl}js/common.js"></script>
<script src="{$staticurl}js/admincp_base.js"></script>
</head>
<body>
<div class="darkmode" title="$light_mode">
<div>
<div class="dk-light">
<svg width="24" height="24">
<path d="M18 12c0 3.3-2.7 6-6 6s-6-2.7-6-6 2.7-6 6-6 6 2.7 6 6zm-6-7c.3 0 .5-.2.5-.5v-4c0-.3-.2-.5-.5-.5s-.5.2-.5.5v4c0 .3.2.5.5.5zm0 14c-.3 0-.5.2-.5.5v4c0 .3.2.5.5.5s.5-.2.5-.5v-4c0-.3-.2-.5-.5-.5zm-7-7c0-.3-.2-.5-.5-.5h-4c-.3 0-.5.2-.5.5s.2.5.5.5h4c.3 0 .5-.2.5-.5zm18.5-.5h-4c-.3 0-.5.2-.5.5s.2.5.5.5h4c.3 0 .5-.2.5-.5s-.2-.5-.5-.5zM6.3 7c.2.2.5.2.7 0 .2-.2.2-.5 0-.7L4.2 3.5c-.2-.2-.5-.2-.7 0s-.2.5 0 .7L6.3 7zm11.4 9.9c-.2-.2-.5-.2-.7 0-.2.2-.2.5 0 .7l2.8 2.8c.2.2.5.2.7 0s.2-.5 0-.7l-2.8-2.8zm0-9.9l2.8-2.8c.2-.2.2-.5 0-.7s-.5-.2-.7 0L17 6.3c-.2.2-.2.5 0 .7.1.2.5.2.7 0zM6.3 16.9l-2.8 2.8c-.2.2-.2.5 0 .7s.5.2.7 0L7 17.6c.2-.2.2-.5 0-.7-.1-.2-.5-.2-.7 0z" />
</svg>
</div>
<div class="dk-dark">
<svg width="24" height="24">
<path d="M13.1 22c3.1 0 5.9-1.4 7.8-3.7.3-.3 0-.8-.5-.8-4.9.9-9.3-2.8-9.3-7.7 0-2.8 1.5-5.4 4-6.8.4-.2.3-.8-.1-.9-.7-.1-1.3-.1-1.9-.1-5.5 0-10 4.5-10 10s4.4 10 10 10z" />
</svg>
</div>
</div>
<ul id="dkm_menu" style="display: none;"><li class="current">$by_system</li><li>$normal_mode</li><li>$dark_mode</li></ul>
</div>
EOT;
if($form) {
echo <<<EOT
<div class="container">
<div class="intro">
<h3>$cptitle</h3>
<p>$tips</p>
</div>
EOT;
}
}
function html_login_footer($halt = true) {
$version = getglobal('setting/version');
$cookiepre = getglobal('config/cookie/cookiepre');
$copy = lang('admincp_login', 'copyright');
echo <<<EOT
</div>
<footer><span>Powered by <a href="https://www.discuz.vip/" target="_blank">Discuz!</a> $version </span><span>$copy</span></footer>
<script>
var cookiepre = '{$cookiepre}';
if(self.parent.frames.length != 0) {
self.parent.location=document.location;
}
init_darkmode();
</script>
</body>
</html>
EOT;
$halt && exit();
}
function html_login_form() {
global $_G;
$isguest = !getglobal('uid');
$lang = lang('admincp_login');
$sid = getglobal('sid');
$formhash = getglobal('formhash');
$_SERVER['QUERY_STRING'] = str_replace('&amp;', '&', dhtmlspecialchars($_SERVER['QUERY_STRING']));
$extra = ADMINSCRIPT.'?'.(getgpc('action') && getgpc('frames') ? 'frames=yes&' : '').$_SERVER['QUERY_STRING'];
$forcesecques = '<option value="0">'.($_G['config']['admincp']['forcesecques'] || $_G['group']['forcesecques'] ? $lang['forcesecques'] : $lang['security_question_0']).'</option>';
echo <<<EOT
<form method="post" autocomplete="off" name="login" id="loginform" action="$extra" class="loginbox">
<input type="hidden" name="sid" value="$sid">
<input type="hidden" name="frames" value="yes">
<input type="hidden" name="formhash" value="$formhash">
EOT;
if($isguest) {
echo <<<EOT
<img class="logo" src="static/image/common/logo.svg">
<input type="text" name="admin_username" placeholder="{$lang['login_username']}" autofocus autocomplete="off">
EOT;
} else {
echo avatar(getglobal('uid'),'middle',array('class' => 'avt')).'<h1>'.getglobal('member/username').'</h1>';
}
echo '<input type="password" name="admin_password" placeholder="'.$lang['login_password'].'" autocomplete="off"'.($isguest ? '' : 'autofocus').'>';
echo <<<EOT
<p onclick="document.querySelectorAll('.loginqa').forEach(vf=>{vf.className=''});this.style.display='none';"><span tabindex="0" onkeydown="window.event.key!='Tab'&&this.parentNode.click()"></span>{$lang['security_question']}</p>
<select id="questionid" name="admin_questionid" class="loginqa">
$forcesecques
<option value="1">{$lang['security_question_1']}</option>
<option value="2">{$lang['security_question_2']}</option>
<option value="3">{$lang['security_question_3']}</option>
<option value="4">{$lang['security_question_4']}</option>
<option value="5">{$lang['security_question_5']}</option>
<option value="6">{$lang['security_question_6']}</option>
<option value="7">{$lang['security_question_7']}</option>
</select>
<input type="text" name="admin_answer" class="loginqa" placeholder="{$lang['security_answer']}" autocomplete="off">
<button type="submit">{$lang['submit']}</button>
EOT;
if (!empty($_G['admincp_checkip_noaccess'])) {
echo '<br><span>'.lang('admincp_login', 'login_ip_noaccess').'</span>';
}
echo <<<EOT
</form>
EOT;
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,344 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_magics.php 34093 2013-10-09 05:41:18Z nemohou $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
$operation = $operation ? $operation : 'admin';
if($operation == 'admin') {
if(!submitcheck('magicsubmit')) {
shownav('extended', 'magics', 'admin');
showsubmenu('nav_magics', array(
array('admin', 'magics&operation=admin', 1),
array('nav_magics_confer', 'members&operation=confermagic', 0)
));
showtips('magics_tips');
$settings = C::t('common_setting')->fetch_all_setting(array('magicdiscount'));
showformheader('magics&operation=admin');
showtableheader();
showsetting('magics_config_discount', 'settingsnew[magicdiscount]', $settings['magicdiscount'], 'text');
showtablefooter();
showtableheader('magics_list', 'fixpadding');
$newmagics = getmagics();
showsubtitle(array('', 'display_order', '<input type="checkbox" onclick="checkAll(\'prefix\', this.form, \'available\', \'availablechk\')" class="checkbox" id="availablechk" name="availablechk">'.cplang('available'), 'name', $lang['price'], $lang['magics_num'], 'weight'));
foreach(C::t('common_magic')->fetch_all_data() as $magic) {
$magic['credit'] = $magic['credit'] ? $magic['credit'] : $_G['setting']['creditstransextra'][3];
$credits = '<select name="credit['.$magic['magicid'].']">';
foreach($_G['setting']['extcredits'] as $i => $extcredit) {
$credits .= '<option value="'.$i.'" '.($i == $magic['credit'] ? 'selected' : '').'>'.$extcredit['title'].'</option>';
}
$credits .= '</select>';
$magictype = $lang['magics_type_'.$magic['type']];
$eidentifier = explode(':', $magic['identifier']);
showtablerow('', array('class="td25"', 'class="td25"', 'class="td25"', 'class="td28"', 'class="td28"', 'class="td28"', 'class="td28"', '', ''), array(
"<input type=\"checkbox\" class=\"checkbox\" name=\"delete[]\" value=\"{$magic['magicid']}\">",
"<input type=\"text\" class=\"txt\" name=\"displayorder[{$magic['magicid']}]\" value=\"{$magic['displayorder']}\">",
"<input type=\"checkbox\" class=\"checkbox\" name=\"available[{$magic['magicid']}]\" value=\"1\" ".($magic['available'] ? 'checked' : '').">",
"<input type=\"text\" class=\"txt\" style=\"width:80px\" name=\"name[{$magic['magicid']}]\" value=\"{$magic['name']}\">".
(count($eidentifier) > 1 ? (file_exists(DISCUZ_ROOT.'./source/plugin/'.$eidentifier[0].'/magic/magic_'.$eidentifier[1].'.small.gif') ? '<img class="vmiddle" src="source/plugin/'.$eidentifier[0].'/magic/magic_'.$eidentifier[1].'.small.gif" />' : '')
: (file_exists(DISCUZ_ROOT.'./static/image/magic/'.$magic['identifier'].'.small.gif') ? '<img class="vmiddle" src="static/image/magic/'.$magic['identifier'].'.small.gif" />' : '')),
"<input type=\"text\" class=\"txt\" name=\"price[{$magic['magicid']}]\" value=\"{$magic['price']}\">".$credits,
"<input type=\"text\" class=\"txt\" name=\"num[{$magic['magicid']}]\" value=\"{$magic['num']}\">".
($magic['supplytype'] ? '/ '.$magic['supplynum'].' / '.$lang['magic_suppytype_'.$magic['supplytype']] : ''),
"<input type=\"text\" class=\"txt\" name=\"weight[{$magic['magicid']}]\" value=\"{$magic['weight']}\"><input type=\"hidden\" name=\"identifier[{$magic['magicid']}]\" value=\"{$magic['identifier']}\">",
"<a href=\"".ADMINSCRIPT."?action=magics&operation=edit&magicid={$magic['magicid']}\" class=\"act\">{$lang['detail']}</a>"
));
unset($newmagics[$magic['identifier']]);
}
foreach($newmagics as $newmagic) {
$credits = '<select name="newcredit['.$newmagic['class'].']}">';
foreach($_G['setting']['extcredits'] as $i => $extcredit) {
$credits .= '<option value="'.$i.'">'.$extcredit['title'].'</option>';
}
$credits .= '</select>';
$eclass = explode(':', $newmagic['class']);
showtablerow('', array('class="td25"', 'class="td25"', 'class="td25"', 'class="td28"', 'class="td28"', 'class="td28"', 'class="td28"', '', ''), array(
'',
"<input type=\"text\" class=\"txt\" name=\"newdisplayorder[{$newmagic['class']}]\" value=\"0\">",
"<input type=\"checkbox\" class=\"checkbox\" name=\"newavailable[{$newmagic['class']}]\" value=\"1\">",
"<input type=\"text\" class=\"txt\" style=\"width:80px\" name=\"newname[{$newmagic['class']}]\" value=\"{$newmagic['name']}\">".
(count($eclass) > 1 ? (file_exists(DISCUZ_ROOT.'./source/plugin/'.$eclass[0].'/magic/magic_'.$eclass[1].'.small.gif') ? '<img class="vmiddle" src="source/plugin/'.$eclass[0].'/magic/magic_'.$eclass[1].'.small.gif" />' : '')
: (file_exists(DISCUZ_ROOT.'./static/image/magic/'.$newmagic['class'].'.small.gif') ? '<img class="vmiddle" src="static/image/magic/'.$newmagic['class'].'.small.gif" />' : '')).
"<input type=\"hidden\" name=\"newdesc[{$newmagic['class']}]\" value=\"{$newmagic['desc']}\" />".
"<input type=\"hidden\" name=\"newuseevent[{$newmagic['class']}]\" value=\"{$newmagic['useevent']}\" />",
"<input type=\"text\" class=\"txt\" name=\"newprice[{$newmagic['class']}]\" value=\"{$newmagic['price']}\">".$credits,
"<input type=\"text\" class=\"txt\" name=\"newnum[{$newmagic['class']}}]\" value=\"0\">",
"<input type=\"text\" class=\"txt\" name=\"newweight[{$newmagic['class']}]\" value=\"{$newmagic['weight']}\">",
'<font color="#F00">New!</font>'
));
}
showsubmit('magicsubmit', 'submit', 'del', '&nbsp;&nbsp;<input type="checkbox" onclick="checkAll(\'prefix\', this.form, \'available\', \'availablechk1\')" class="checkbox" id="availablechk1" name="availablechk1">'.cplang('available'));
showtablefooter();
showformfooter();
} else {
if(is_array($_GET['settingsnew'])) {
C::t('common_setting')->update_batch(array('magicdiscount' => $_GET['settingsnew']['magicdiscount']));
}
if($ids = dimplode($_GET['delete'])) {
C::t('common_magic')->delete($_GET['delete']);
C::t('common_member_magic')->delete_magic('', $_GET['delete']);
C::t('common_magiclog')->delete_by_magicid($_GET['delete']);
}
if(is_array($_GET['name'])) {
foreach($_GET['name'] as $id => $val) {
if(!is_array($_GET['identifier']) ||
!is_array($_GET['displayorder']) || !is_array($_GET['credit']) ||
!is_array($_GET['price']) || !is_array($_GET['num']) ||
!is_array($_GET['weight']) || !preg_match('/^[\w:]+$/', $_GET['identifier'][$id])) {
continue;
}
C::t('common_magic')->update($id, array(
'available' => $_GET['available'][$id],
'name' => $val,
'identifier' => $_GET['identifier'][$id],
'displayorder' => $_GET['displayorder'][$id],
'credit' => $_GET['credit'][$id],
'price' => $_GET['price'][$id],
'num' => $_GET['num'][$id],
'weight' => $_GET['weight'][$id]
));
}
}
if(is_array($_GET['newname'])) {
foreach($_GET['newname'] as $identifier => $name) {
$data = array(
'name' => $name,
'useevent' => $_GET['newuseevent'][$identifier],
'identifier' => $identifier,
'available' => $_GET['newavailable'][$identifier],
'description' => $_GET['newdesc'][$identifier],
'displayorder' => $_GET['newdisplayorder'][$identifier],
'credit' => $_GET['newcredit'][$identifier],
'price' => $_GET['newprice'][$identifier],
'num' => $_GET['newnum'][$identifier],
'weight' => $_GET['newweight'][$identifier],
);
C::t('common_magic')->insert($data);
}
}
updatecache(array('setting', 'magics'));
cpmsg('magics_data_succeed', 'action=magics&operation=admin', 'succeed');
}
} elseif($operation == 'edit') {
$magicid = intval($_GET['magicid']);
$magic = C::t('common_magic')->fetch($magicid);
if(!submitcheck('magiceditsubmit')) {
$magicperm = dunserialize($magic['magicperm']);
$groups = $forums = array();
foreach(C::t('common_usergroup')->range() as $group) {
$groups[$group['groupid']] = $group['grouptitle'];
}
$typeselect = array($magic['type'] => 'selected');
shownav('extended', 'magics', 'admin');
showsubmenu('nav_magics', array(
array('admin', 'magics&operation=admin', 0),
array('nav_magics_confer', 'members&operation=confermagic', 0)
));
echo '<br />';
$eidentifier = explode(':', $magic['identifier']);
if(count($eidentifier) > 1 && preg_match('/^[\w\_:]+$/', $magic['identifier'])) {
include_once DISCUZ_ROOT.'./source/plugin/'.$eidentifier[0].'/magic/magic_'.$eidentifier[1].'.php';
$magicclass = 'magic_'.$eidentifier[1];
} else {
require_once libfile('magic/'.$magic['identifier'], 'class');
$magicclass = 'magic_'.$magic['identifier'];
}
$magicclass = new $magicclass;
$magicsetting = $magicclass->getsetting($magicperm);
echo '<div class="colorbox"><h4>'.lang('magic/'.$magic['identifier'], $magicclass->name).'</h4>'.
'<table cellspacing="0" cellpadding="3"><tr><td>'.
(count($eidentifier) > 1 ? (file_exists(DISCUZ_ROOT.'./source/plugin/'.$eidentifier[0].'/magic/magic_'.$eidentifier[1].'.gif') ? '<img src="source/plugin/'.$eidentifier[0].'/magic/magic_'.$eidentifier[1].'.gif" />' : '')
: (file_exists(DISCUZ_ROOT.'./static/image/magic/'.$magic['identifier'].'.gif') ? '<img src="static/image/magic/'.$magic['identifier'].'.gif" />' : '')).
'</td><td valign="top">'.lang('magic/'.$magic['identifier'], $magicclass->description).'</td></tr></table>'.
'<div style="width:95%" align="right">'.lang('magic/'.$magic['identifier'], $magicclass->copyright).'</div></div>';
$credits = array();
foreach($_G['setting']['extcredits'] as $i => $extcredit) {
$credits[] = array($i, $extcredit['title']);
}
showformheader('magics&operation=edit&magicid='.$magicid);
showtableheader();
showtitle($lang['magics_edit'].' - '.$magic['name'].'('.$magic['identifier'].')');
showsetting('magics_edit_name', 'namenew', $magic['name'], 'text');
showsetting('magics_edit_credit', array('creditnew', $credits), $magic['credit'], 'select');
showsetting('magics_edit_price', 'pricenew', $magic['price'], 'text');
showsetting('magics_edit_num', 'numnew', $magic['num'], 'text');
showsetting('magics_edit_supplynum', 'supplynumnew', $magic['supplynum'], 'text');
showsetting('magics_edit_weight', 'weightnew', $magic['weight'], 'text');
showsetting('magics_edit_supplytype', array('supplytypenew', array(
array(0, $lang['magics_goods_stack_none']),
array(1, $lang['magics_goods_stack_day']),
array(2, $lang['magics_goods_stack_week']),
array(3, $lang['magics_goods_stack_month']),
)), $magic['supplytype'], 'mradio');
showsetting('magics_edit_useperoid', array('useperoidnew', array(
array(0, $lang['magics_edit_useperoid_none']),
array(1, $lang['magics_edit_useperoid_day']),
array(4, $lang['magics_edit_useperoid_24hr']),
array(2, $lang['magics_edit_useperoid_week']),
array(3, $lang['magics_edit_useperoid_month']),
)), $magic['useperoid'], 'mradio');
showsetting('magics_edit_usenum', 'usenumnew', $magic['usenum'], 'text');
showsetting('magics_edit_description', 'descriptionnew', $magic['description'], 'textarea');
if(is_array($magicsetting)) {
foreach($magicsetting as $settingvar => $setting) {
if(!empty($setting['value']) && is_array($setting['value'])) {
foreach($setting['value'] as $k => $v) {
$setting['value'][$k][1] = lang('magic/'.$magic['identifier'], $setting['value'][$k][1]);
}
}
$varname = in_array($setting['type'], array('mradio', 'mcheckbox', 'select', 'mselect')) ?
($setting['type'] == 'mselect' ? array('perm['.$settingvar.'][]', $setting['value']) : array('perm['.$settingvar.']', $setting['value']))
: 'perm['.$settingvar.']';
$value = $magicperm[$settingvar] != '' ? $magicperm[$settingvar] : $setting['default'];
$comment = lang('magic/'.$magic['identifier'], $setting['title'].'_comment');
$comment = $comment != $setting['title'].'_comment' ? $comment : '';
showsetting(lang('magic/'.$magic['identifier'], $setting['title']).':', $varname, $value, $setting['type'], '', 0, $comment);
}
}
showtitle('magics_edit_perm');
showtablerow('', 'colspan="2" class="td27"', $lang['magics_edit_usergroupperm'].':<input class="checkbox" type="checkbox" name="chkall1" onclick="checkAll(\'prefix\', this.form, \'usergroupsperm\', \'chkall1\', true)" id="chkall1" /><label for="chkall1"> '.cplang('select_all').'</label>');
showtablerow('', 'colspan="2"', mcheckbox('usergroupsperm', $groups, explode("\t", $magicperm['usergroups'])));
if(!empty($magicclass->targetgroupperm)) {
showtablerow('', 'colspan="2" class="td27"', $lang['magics_edit_targetgroupperm'].':<input class="checkbox" type="checkbox" name="chkall2" onclick="checkAll(\'prefix\', this.form, \'targetgroupsperm\', \'chkall2\', true)" id="chkall2" /><label for="chkall2"> '.cplang('select_all').'</label>');
showtablerow('', 'colspan="2"', mcheckbox('targetgroupsperm', $groups, explode("\t", $magicperm['targetgroups'])));
}
showsubmit('magiceditsubmit');
showtablefooter();
showformfooter();
} else {
$namenew = dhtmlspecialchars(trim($_GET['namenew']));
$identifiernew = dhtmlspecialchars(trim(strtoupper($_GET['identifiernew'])));
$descriptionnew = dhtmlspecialchars($_GET['descriptionnew']);
$availablenew = !$identifiernew ? 0 : 1;
$magicperm['usergroups'] = is_array($_GET['usergroupsperm']) && !empty($_GET['usergroupsperm']) ? "\t".implode("\t",$_GET['usergroupsperm'])."\t" : '';
$magicperm['targetgroups'] = is_array($_GET['targetgroupsperm']) && !empty($_GET['targetgroupsperm']) ? "\t".implode("\t",$_GET['targetgroupsperm'])."\t" : '';
$eidentifier = explode(':', $magic['identifier']);
if(count($eidentifier) > 1 && preg_match('/^[\w\_:]+$/', $magic['identifier'])) {
include_once DISCUZ_ROOT.'./source/plugin/'.$eidentifier[0].'/magic/magic_'.$eidentifier[1].'.php';
$magicclass = 'magic_'.$eidentifier[1];
} else {
require_once libfile('magic/'.$magic['identifier'], 'class');
$magicclass = 'magic_'.$magic['identifier'];
}
$magicclass = new $magicclass;
$magicclass->setsetting($magicperm, $_GET['perm']);
$magicpermnew = addslashes(serialize($magicperm));
$supplytypenew = intval($_GET['supplytypenew']);
$supplynumnew = $_GET['supplytypenew'] ? intval($_GET['supplynumnew']) : 0;
$usenumnew = intval($_GET['usenumnew']);
$useperoidnew = $_GET['useperoidnew'] ? intval($_GET['useperoidnew']) : 0;
$creditnew = intval($_GET['creditnew']);
if(!$namenew) {
cpmsg('magics_parameter_invalid', '', 'error');
}
if(C::t('common_magic')->check_identifier($identifiernew, $magicid)) {
cpmsg('magics_identifier_invalid', '', 'error');
}
C::t('common_magic')->update($magicid, array(
'name' => $namenew,
'description' => $descriptionnew,
'price' => $_GET['pricenew'],
'num' => $_GET['numnew'],
'supplytype' => $supplytypenew,
'supplynum' => $supplynumnew,
'useperoid' => $useperoidnew,
'usenum' => $usenumnew,
'weight' => $_GET['weightnew'],
'magicperm' => $magicpermnew,
'credit' => $creditnew
));
updatecache(array('setting', 'magics'));
cpmsg('magics_data_succeed', 'action=magics&operation=admin', 'succeed');
}
}
function getmagics() {
global $_G;
$checkdirs = array_merge(array(''), $_G['setting']['plugins']['available']);
$magics = array();
foreach($checkdirs as $key) {
if($key) {
$dir = DISCUZ_ROOT.'./source/plugin/'.$key.'/magic';
} else {
$dir = DISCUZ_ROOT.'./source/class/magic';
}
if(!file_exists($dir)) {
continue;
}
$magicdir = dir($dir);
while($entry = $magicdir->read()) {
if(!in_array($entry, array('.', '..')) && preg_match("/^magic\_[\w\.]+$/", $entry) && substr($entry, -4) == '.php' && strlen($entry) < 30 && is_file($dir.'/'.$entry)) {
@include_once $dir.'/'.$entry;
$magicclass = substr($entry, 0, -4);
if(class_exists($magicclass)) {
$magic = new $magicclass();
$script = substr($magicclass, 6);
$script = ($key ? $key.':' : '').$script;
$magics[$script] = array(
'class' => $script,
'name' => lang('magic/'.$script, $magic->name),
'desc' => lang('magic/'.$script, $magic->description),
'price' => $magic->price,
'weight' => $magic->weight,
'useevent' => !empty($magic->useevent) ? $magic->useevent : 0,
'version' => $magic->version,
'copyright' => lang('magic/'.$script, $magic->copyright),
'filemtime' => @filemtime($dir.'/'.$entry)
);
}
}
}
}
uasort($magics, 'filemtimesort');
return $magics;
}
?>

View File

@@ -0,0 +1,170 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_main.php 36284 2016-12-12 00:47:50Z nemohou $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
lang('admincp_menu');
$extra = cpurl('url');
$extra = $extra && getgpc('action') ? $extra : 'action=index';
$charset = CHARSET;
$title = cplang('admincp_title');
$header_welcome = cplang('header_welcome');
$header_logout = cplang('header_logout');
$header_bbs = cplang('header_bbs');
if(isfounder()) {
cplang('founder_admin');
} else {
if($GLOBALS['admincp']->adminsession['cpgroupid']) {
$cpgroup = C::t('common_admincp_group')->fetch($GLOBALS['admincp']->adminsession['cpgroupid']);
$cpadmingroup = $cpgroup['cpgroupname'];
} else {
cplang('founder_master');
}
}
require './source/admincp/admincp_menu.php';
$basescript = ADMINSCRIPT;
$staticurl = STATICURL;
$oldlayout = empty($_G['cookie']['admincp_leftlayout']) ? ' class="oldlayout"' : '';
echo <<<EOT
<!DOCTYPE html>
<html><head>
<meta charset="$charset">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="color-scheme" content="light dark">
<title>$title</title>
<meta content="Comsenz Inc." name="Copyright" />
<link rel="stylesheet" href="{$staticurl}image/admincp/minireset.css?{$_G['style']['verhash']}" type="text/css" media="all" />
<link rel="stylesheet" href="{$staticurl}image/admincp/admincpframe.css?{$_G['style']['verhash']}" type="text/css" media="all" />
<script src="{$_G['setting']['jspath']}common.js?{$_G['style']['verhash']}" type="text/javascript"></script>
</head>
<body>
<div id="append_parent"></div>
$shownotice
<div id="bdcontainer"$oldlayout>
<div id="navcontainer" class="navcontainer">
<nav>
<a href="$basescript?frames=yes&action=index" class="logo">
<img src="{$staticurl}image/admincp/logo.svg" alt="Discuz! Administrator's Control Panel">
</a>
<ul id="leftmenu">
EOT;
$uc_api_url = $uchtml = '';
if($isfounder) {
loaducenter();
if(!UC_STANDALONE) {
$uc_api_url = UC_API;
$uchtml = '<li><em><a id="header_uc" hidefocus="true" href="'.UC_API.'/admin.php?m=frame" onmouseover="previewheader(\'uc\')" onmouseout="previewheader()" onclick="uc_login=1;toggleMenu(\'uc\', \'\');doane(event);">'.cplang('header_uc').'</a></em></li>';
$topmenu['uc'] = '';
$menu['uc'] = array(array('header_uc', UC_API.'/admin.php?m=frame', '_blank'));
}
}
foreach($topmenu as $k => $v) {
if($k == 'cloud') {
continue;
}
echo '<li id="lm_'.$k.'">';
showleftheader($k);
showmenu($k, $menu[$k]);
echo '</li>';
}
echo <<<EOT
</ul>
</nav>
</div>
<div class="ifmcontainer">
<div class="mainhd">
<div id="navbtn"><div></div></div>
<div class="currentloca" id="admincpnav"></div>
<form name="search" method="post" autocomplete="off" action="$basescript?action=search" target="main">
<input type="text" name="keywords" value="" class="txt" required>
<button type="submit" name="searchsubmit" value="yes" class="btn"></button>
</form>
<div class="uinfo">
<ul id="topmenu">
EOT;
foreach($topmenu as $k => $v) {
if($k == 'cloud') {
continue;
}
if($v === '') {
$v = is_array($menu[$k]) ? array_keys($menu[$k]) : array();
$v = $menu[$k][$v[0]][1];
}
showheader($k, $v);
}
unset($menu);
$headers = "'".implode("','", array_keys($topmenu))."'";
$useravt = avatar(getglobal('uid'), 'middle', array('class' => 'avt'));
$sitevip = '';
if(isfounder() && $_G['setting']['siteuniqueid']) {
$sitevip = base64_encode($_G['setting']['siteuniqueid']);
$sitevip = '<div id="_siteVip" style="margin-right: 5px"></div><script>
_attachEvent(window, \'load\', function () {
var _as = document.createElement("script");
_as.src = "https://addon.dismall.com/api/sitevip/?'.$sitevip.'";
var _s = document.getElementsByTagName("script")[0];
_s.parentNode.insertBefore(_as, _s);
}, document);</script>';
}
echo <<<EOT
</ul>
<div id="frameuinfo">
{$sitevip}
{$useravt}
<p class="greet">$header_welcome, $cpadmingroup <em>{$_G['member']['username']}</em> <a href="$basescript?action=logout" target="_top">$header_logout</a></p>
<p class="btnlink"><a href="index.php" target="_blank" title="$header_bbs"><svg width="24" height="24">
<path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>
</svg></a></p>
<p class="btnlink" id="cpsetting"><svg width="24" height="24">
<path d="M19.43 12.98c.04-.32.07-.64.07-.98s-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.3-.61-.22l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.23-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98s.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.23.09.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zM12 15.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z"/>
</svg></p>
<p class="btnlink"><div class="darkmode" title="$light_mode">
<div>
<div class="dk-light">
<svg width="24" height="24">
<path d="M18 12c0 3.3-2.7 6-6 6s-6-2.7-6-6 2.7-6 6-6 6 2.7 6 6zm-6-7c.3 0 .5-.2.5-.5v-4c0-.3-.2-.5-.5-.5s-.5.2-.5.5v4c0 .3.2.5.5.5zm0 14c-.3 0-.5.2-.5.5v4c0 .3.2.5.5.5s.5-.2.5-.5v-4c0-.3-.2-.5-.5-.5zm-7-7c0-.3-.2-.5-.5-.5h-4c-.3 0-.5.2-.5.5s.2.5.5.5h4c.3 0 .5-.2.5-.5zm18.5-.5h-4c-.3 0-.5.2-.5.5s.2.5.5.5h4c.3 0 .5-.2.5-.5s-.2-.5-.5-.5zM6.3 7c.2.2.5.2.7 0 .2-.2.2-.5 0-.7L4.2 3.5c-.2-.2-.5-.2-.7 0s-.2.5 0 .7L6.3 7zm11.4 9.9c-.2-.2-.5-.2-.7 0-.2.2-.2.5 0 .7l2.8 2.8c.2.2.5.2.7 0s.2-.5 0-.7l-2.8-2.8zm0-9.9l2.8-2.8c.2-.2.2-.5 0-.7s-.5-.2-.7 0L17 6.3c-.2.2-.2.5 0 .7.1.2.5.2.7 0zM6.3 16.9l-2.8 2.8c-.2.2-.2.5 0 .7s.5.2.7 0L7 17.6c.2-.2.2-.5 0-.7-.1-.2-.5-.2-.7 0z" />
</svg>
</div>
<div class="dk-dark">
<svg width="24" height="24">
<path d="M13.1 22c3.1 0 5.9-1.4 7.8-3.7.3-.3 0-.8-.5-.8-4.9.9-9.3-2.8-9.3-7.7 0-2.8 1.5-5.4 4-6.8.4-.2.3-.8-.1-.9-.7-.1-1.3-.1-1.9-.1-5.5 0-10 4.5-10 10s4.4 10 10 10z" />
</svg>
</div>
</div>
<ul id="dkm_menu" style="display: none;"><li class="current">$by_system</li><li>$normal_mode</li><li>$dark_mode</li></ul>
</div></p>
</div>
</div>
</div>
<iframe src="$basescript?$extra" id="main" name="main"></iframe>
</div>
</div>
<script>var cookiepre = '{$_G['config']['cookie']['cookiepre']}', cookiedomain = '{$_G['config']['cookie']['cookiedomain']}', cookiepath = '{$_G['config']['cookie']['cookiepath']}';
var headers = new Array($headers), admincpfilename = '$basescript', admincpextra = '$extra';</script>
<script src="{$_G['setting']['jspath']}admincp_frame.js?{$_G['style']['verhash']}" type="text/javascript"></script>
<script>
init_darkmode();
</script>
</body></html>
EOT;
?>

View File

@@ -0,0 +1,623 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_makehtml.php 35041 2014-10-29 08:05:36Z nemohou $
*/
if(!defined('IN_DISCUZ') || !defined('IN_DISCUZ')) {
exit('Access Denied');
}
$operation = in_array($operation, array('all', 'index', 'category', 'article', 'topic', 'aids', 'catids', 'topicids', 'makehtmlsetting', 'cleanhtml')) ? $operation : 'all';
cpheader();
shownav('portal', 'nav_makehtml');
$css = '<style>
#mk_result {width:100%; margin-top:10px; border: 1px solid #ccc; margin: 0 auto; font-size:16px; text-align:center; display:none; }
#mk_article, #mk_category, #mk_index{ line-height:30px;}
#progress_bar{ width:400px; height:25px; border:1px solid #09f; margin: 10px auto 0; display:none;}
.mk_msg{ width:100%; line-height:120px;}
</style>';
$result = '<tr><td colspan="15"><div id="mk_result">
<div id="progress_bar"></div>
<div id="mk_topic" mktitle="'.$lang['makehtml_topic'].'"></div>
<div id="mk_article" mktitle="'.$lang['makehtml_article'].'"></div>
<div id="mk_category" mktitle="'.$lang['makehtml_category'].'"></div>
<div id="mk_index" mktitle="'.$lang['makehtml_index'].'"></div>
</div></td></tr>';
if(!in_array($operation, array('aids', 'catids', 'topicids'))) {
$_nav = array();
if(!empty($_G['setting']['makehtml']['flag'])) {
$_nav = array(
array('makehtml_createall', 'makehtml&operation=all', $operation == 'all'),
array('makehtml_createindex', 'makehtml&operation=index', $operation == 'index'),
array('makehtml_createcategory', 'makehtml&operation=category', $operation == 'category'),
array('makehtml_createarticle', 'makehtml&operation=article', $operation == 'article'),
array('makehtml_createtopic', 'makehtml&operation=topic', $operation == 'topic')
);
}
$_nav[] = array('config', 'makehtml&operation=makehtmlsetting', $operation == 'makehtmlsetting');
if(empty($_G['setting']['makehtml']['flag'])) {
$_nav[] = array('makehtml_clear', 'makehtml&operation=cleanhtml', $operation == 'cleanhtml');
}
showsubmenu('html', $_nav, '');
}
if($operation == 'all') {
showtips('makehtml_tips_all');
showformheader('makehtml&operation=all');
showtableheader('');
echo '<script type="text/javascript" src="'.STATICURL.'js/calendar.js"></script>',
'<script type="text/javascript" src="'.STATICURL.'js/makehtml.js?1"></script>',
$css;
showsetting('start_time', 'starttime', dgmdate(TIMESTAMP, 'Y-m-d'), 'calendar', '', '', '', '1');
echo '<tr><td colspan="15"><div class="fixsel"><a href="javascript:void(0);" class="btn_big" id="submit_portal_html">'.$lang['makehtml_createall'].'</a></div></td></tr>', $result;
$adminscript = ADMINSCRIPT;
echo <<<EOT
<script type="text/JavaScript">
var form = document.forms['cpform'];
form.onsubmit = function(){return false;};
_attachEvent($('submit_portal_html'), 'click', function(){
$('mk_result').style.display = 'block';
$('mk_index').style.display = 'none';
this.innerHTML = '{$lang['makehtml_recreate']}';
var starttime = form['starttime'].value;
if(starttime){
make_html_article(starttime);
}
return false;
});
function make_html_ok() {
var dom = $('mk_index');
dom.innerHTML = '<div class="mk_msg">{$lang['makehtml_allfilecomplete']}</div>';
}
function make_html_index() {
var dom = $('mk_index');
dom.innerHTML = '<div class="mk_msg">{$lang['makehtml_waitmaking']}</div>';
dom.style.display = 'block';
new make_html_batch('portal.php?', 0, make_html_ok, dom, 1);
}
function make_html_category(starttime){
var dom = $('mk_category');
dom.innerHTML = '<div class="mk_msg">{$lang['makehtml_waitmakingcategory']}</div>';
dom.style.display = 'block';
starttime = starttime || form['starttime'].value;
var x = new Ajax();
x.get('$adminscript?action=makehtml&operation=catids&inajax=1&frame=no&starttime='+starttime, function (s) {
if(s) {
new make_html_batch('portal.php?mod=list&catid=', s.split(','), make_html_topic, dom);
} else {
dom.innerHTML = '{$lang['makehtml_nofindcategory']}<br/>{$lang['makehtml_startmaketopic']}<br /><a href="javascript:void(0);" onclick="\$(\'mk_category\').style.display = \'none\';make_html_topic();">{$lang['makehtml_browser_error']}</a>';
setTimeout(function(){\$('mk_category').style.display = 'none'; make_html_topic();}, 1000);
}
});
}
function make_html_topic(starttime){
var dom = $('mk_topic');
dom.innerHTML = '<div class="mk_msg">{$lang['makehtml_waitchecktopic']}</div>';
dom.style.display = 'block';
starttime = starttime || form['starttime'].value;
var x = new Ajax();
x.get('$adminscript?action=makehtml&operation=topicids&inajax=1&frame=no&starttime='+starttime, function (s) {
if(s) {
new make_html_batch('portal.php?mod=topic&topicid=', s.split(','), make_html_index, dom);
} else {
dom.innerHTML = '{$lang['makehtml_nofindtopic']}<br/>{$lang['makehtml_startmakeindex']}<br /><a href="javascript:void(0);" onclick="\$(\'mk_topic\').style.display = \'none\';make_html_index();">{$lang['makehtml_browser_error']}</a>';
setTimeout(function(){\$('mk_topic').style.display = 'none'; make_html_index();}, 1000);
}
});
}
function make_html_article(starttime) {
var dom = $('mk_article');
dom.innerHTML = '<div class="mk_msg">{$lang['makehtml_waitcheckarticle']}</div>';
dom.style.display = 'block';
var x = new Ajax();
x.get('$adminscript?action=makehtml&operation=aids&inajax=1&frame=no&starttime='+starttime, function (s) {
if(s){
new make_html_batch('portal.php?mod=view&aid=', s.split(','), make_html_category, dom);
} else {
dom.innerHTML = '{$lang['makehtml_nofindarticle']}<br/>{$lang['makehtml_startmakecategory']}<br /><a href="javascript:void(0);" onclick="\$(\'mk_article\').style.display = \'none\';make_html_category();">{$lang['makehtml_browser_error']}</a>';
setTimeout(function(){\$('mk_article').style.display = 'none'; make_html_category();}, 1000);
}
});
}
</script>
EOT;
showtablefooter();
showformfooter();
} elseif($operation == 'index') {
showtips('makehtml_tips_index');
showformheader('makehtml&operation=index');
showtableheader('');
echo '<script type="text/javascript" src="'.STATICURL.'js/makehtml.js?1"></script>', $css;
echo '<tr><td colspan="15"><div class="fixsel"><a href="javascript:void(0);" class="btn_big" id="submit_portal_html">'.$lang['makehtml_createindex'].'</a></div></td></tr>', $result;
$adminscript = ADMINSCRIPT;
echo <<<EOT
<script type="text/JavaScript">
var form = document.forms['cpform'];
form.onsubmit = function(){return false;};
_attachEvent($('submit_portal_html'), 'click', function(){
$('mk_result').style.display = 'block';
$('mk_index').style.display = 'none';
this.innerHTML = '{$lang['makehtml_recreate']}';
this.disabled = true;
make_html_index();
return false;
});
function make_html_index() {
var dom = $('mk_index');
dom.innerHTML = '<div class="mk_msg">{$lang['makehtml_waitmaking']}</div>';
dom.style.display = 'block';
new make_html_batch('portal.php?', 0, null, dom, 1);
}
</script>
EOT;
showtablefooter();
showformfooter();
} elseif($operation == 'category') {
loadcache('portalcategory');
showtips('makehtml_tips_category');
showformheader('makehtml&operation=category');
showtableheader('');
echo '<script type="text/javascript" src="'.STATICURL.'js/calendar.js"></script>',
'<script type="text/javascript" src="'.STATICURL.'js/makehtml.js?1"></script>',
$css;
showsetting('start_time', 'starttime', '', 'calendar', '', '', '', '1');
$selectdata = array('category', array(array(0, $lang['makehtml_createallcategory'])));
mk_format_category(array_keys($_G['cache']['portalcategory']));
showsetting('makehtml_selectcategory', $selectdata, 0, 'mselect');
echo '<tr><td colspan="15"><div class="fixsel"><a href="javascript:void(0);" class="btn_big" id="submit_portal_html">'.$lang['makehtml_createcategory'].'</a></div></td></tr>', $result;
$adminscript = ADMINSCRIPT;
echo <<<EOT
<script type="text/JavaScript">
var form = document.forms['cpform'];
form.onsubmit = function(){return false;};
_attachEvent($('submit_portal_html'), 'click', function(){
$('mk_result').style.display = 'block';
$('mk_index').style.display = 'none';
this.innerHTML = '{$lang['makehtml_recreate']}';
var starttime = form['starttime'].value;
if(starttime){
make_html_category(starttime);
} else {
var category = form['category'];
var allcatids = [];
var selectedids = [];
for(var i = 0; i < category.options.length; i++) {
var option = category.options[i];
if(option.value > 0) {
allcatids.push(option.value);
}
if(option.selected) {
selectedids.push(option.value);
}
}
if(selectedids.length) {
new make_html_batch('portal.php?mod=list&catid=', selectedids[0] == 0 ? allcatids : selectedids, make_html_category_ok, $('mk_category'));
} else {
var dom = $('mk_index');
dom.style.display = 'block';
dom.innerHTML = '{$lang['makehtml_nofindcategory']}';
}
}
return false;
});
function make_html_category_ok() {
var dom = $('mk_index');
dom.style.display = 'block';
dom.style.color = 'green';
dom.innerHTML = '<div class="mk_msg">{$lang['makehtml_selectcategorycomplete']}</div>';
}
function make_html_category(starttime){
var dom = $('mk_category');
dom.innerHTML = '<div class="mk_msg">{$lang['makehtml_waitmakingcategory']}</div>';
dom.style.display = 'block';
starttime = starttime || form['starttime'].value;
var x = new Ajax();
x.get('$adminscript?action=makehtml&operation=catids&inajax=1&frame=no&starttime='+starttime, function (s) {
if(s) {
new make_html_batch('portal.php?mod=list&catid=', s.split(','), make_html_category_ok, dom);
} else {
dom.innerHTML = '{$lang['makehtml_nofindcategory']}';
setTimeout(function(){\$('mk_category').style.display = 'none'; make_html_index();}, 1000);
}
});
}
</script>
EOT;
showtablefooter();
showformfooter();
} elseif($operation == 'article') {
loadcache('portalcategory');
showtips('makehtml_tips_article');
showformheader('makehtml&operation=category');
showtableheader('');
echo '<script type="text/javascript" src="'.STATICURL.'js/calendar.js"></script>',
'<script type="text/javascript" src="'.STATICURL.'js/makehtml.js?1"></script>',
$css;
showsetting('start_time', 'starttime', dgmdate(TIMESTAMP - 86400, 'Y-m-d'), 'calendar', '', '', '', '1');
$selectdata = array('category', array(array(0, $lang['makehtml_createallcategory'])));
mk_format_category(array_keys($_G['cache']['portalcategory']));
showsetting('makehtml_selectcategory', $selectdata, 0, 'mselect');
showsetting('makehtml_startid', 'startid', 0, 'text');
showsetting('makehtml_endid', 'endid', 0, 'text');
echo '<tr><td colspan="15"><div class="fixsel"><a href="javascript:void(0);" class="btn_big" id="submit_portal_html">'.$lang['makehtml_createarticle'].'</a></div></td></tr>', $result;
$adminscript = ADMINSCRIPT;
echo <<<EOT
<script type="text/JavaScript">
var form = document.forms['cpform'];
form.onsubmit = function(){return false;};
_attachEvent($('submit_portal_html'), 'click', function(){
$('mk_result').style.display = 'block';
$('mk_index').style.display = 'none';
this.innerHTML = '{$lang['makehtml_recreate']}';
var starttime = form['starttime'].value;
var category = form['category'];
var allcatids = [];
var selectedids = [];
for(var i = 0; i < category.options.length; i++) {
var option = category.options[i];
allcatids.push(option.value);
if(option.selected) {
selectedids.push(option.value);
}
}
var startid = parseInt(form['startid'].value);
var endid = parseInt(form['endid'].value);
if(starttime || selectedids.length || startid || endid) {
make_html_article(starttime, selectedids[0] == 0 ? -1 : selectedids, startid, endid);
} else {
var dom = $('mk_index');
dom.style.display = 'block';
dom.innerHTML = '{$lang['makehtml_nofindarticle']}';
}
return false;
});
function make_html_article_ok() {
var dom = $('mk_index');
dom.style.display = 'block';
dom.style.color = 'green';
dom.innerHTML = '<div class="mk_msg">{$lang['makehtml_allarticlecomplete']}</div>';
}
function make_html_article(starttime, catids, startid, endid) {
catids = catids || -1;
startid = startid || 0;
endid = endid || 0;
var dom = $('mk_article');
dom.innerHTML = '<div class="mk_msg">{$lang['makehtml_waitcheckarticle']}</div>';
dom.style.display = 'block';
var x = new Ajax();
x.get('$adminscript?action=makehtml&operation=aids&inajax=1&frame=no&starttime='+starttime+'&catids='+(catids == -1 ? '' : catids.join(','))+'&startid='+startid+'&endid='+endid, function (s) {
if(s && s.indexOf('<') < 0){
new make_html_batch('portal.php?mod=view&aid=', s.split(','), make_html_article_ok, dom);
} else {
dom.innerHTML = '{$lang['makehtml_nofindarticle']}';
}
});
}
</script>
EOT;
showtablefooter();
showformfooter();
} elseif ($operation == 'aids') {
$starttime = strtotime($_GET['starttime']);
$catids = $_GET['catids'];
if($catids) {
$catids = array_map('intval', explode(',', $catids));
}
$startid = intval($_GET['startid']);
$endid = intval($_GET['endid']);
$data = array();
if($starttime || $catids || $startid || $endid) {
$data = C::t('portal_article_title')->fetch_all_aid_by_dateline($starttime, $catids, $startid, $endid);
}
helper_output::xml($data ? implode(',', array_keys($data)) : '');
} elseif($operation == 'topic') {
showtips('makehtml_tips_topic');
showformheader('makehtml&operation=topic');
showtableheader('');
echo '<script type="text/javascript" src="'.STATICURL.'js/calendar.js"></script>',
'<script type="text/javascript" src="'.STATICURL.'js/makehtml.js?1"></script>',
$css;
showsetting('start_time', 'starttime', '', 'calendar', '', '', '', '1');
echo '<tr><td colspan="15"><div class="fixsel"><a href="javascript:void(0);" class="btn_big" id="submit_portal_html">'.$lang['makehtml_createtopic'].'</a></div></td></tr>', $result;
$adminscript = ADMINSCRIPT;
echo <<<EOT
<script type="text/JavaScript">
var form = document.forms['cpform'];
form.onsubmit = function(){return false;};
_attachEvent($('submit_portal_html'), 'click', function(){
$('mk_result').style.display = 'block';
$('mk_index').style.display = 'none';
this.innerHTML = '{$lang['makehtml_recreate']}';
var starttime = form['starttime'].value;
if(starttime) {
make_html_topic(starttime);
} else {
var dom = $('mk_index');
dom.style.display = 'block';
dom.innerHTML = '{$lang['makehtml_nofindtopic']}';
}
return false;
});
function make_html_topic_ok() {
var dom = $('mk_index');
dom.style.display = 'block';
dom.style.color = 'green';
dom.innerHTML = '<div class="mk_msg">{$lang['makehtml_alltopiccomplete']}</div>';
}
function make_html_topic(starttime) {
var dom = $('mk_topic');
dom.innerHTML = '<div class="mk_msg">{$lang['makehtml_waitchecktopic']}</div>';
dom.style.display = 'block';
var x = new Ajax();
x.get('$adminscript?action=makehtml&operation=topicids&inajax=1&frame=no&starttime='+starttime, function (s) {
if(s && s.indexOf('<') < 0){
new make_html_batch('portal.php?mod=topic&topicid=', s.split(','), make_html_topic_ok, dom);
} else {
dom.innerHTML = '{$lang['makehtml_nofindtopic']}';
}
});
}
</script>
EOT;
showtablefooter();
showformfooter();
} elseif ($operation == 'topicids') {
$starttime = strtotime($_GET['starttime']);
$data = array();
if($starttime) {
$data = C::t('portal_topic')->fetch_all_topicid_by_dateline($starttime);
}
helper_output::xml($data ? implode(',', array_keys($data)) : '');
} elseif ($operation == 'catids') {
$starttime = strtotime($_GET['starttime']);
$data = array();
if($starttime) {
loadcache('portalcategory');
foreach ($_G['cache']['portalcategory'] as $key => $value) {
if($value['lastpublish'] >= $starttime) {
$data[$key] = $key;
}
}
}
helper_output::xml($data ? implode(',', $data) : '');
} elseif ($operation == 'makehtmlsetting') {
if(!submitcheck('makehtmlsetting')) {
$setting = $_G['setting'];
showformheader("makehtml&operation=makehtmlsetting");
showtableheader('', 'nobottom', 'id="makehtml"'.($_GET['operation'] != 'makehtmlsetting' ? ' style="display: none"' : ''));
showsetting('setting_functions_makehtml', 'settingnew[makehtml][flag]', $setting['makehtml']['flag'], 'radio', 0, 1);
showsetting('setting_functions_makehtml_extendname', 'settingnew[makehtml][extendname]', $setting['makehtml']['extendname'] ? $setting['makehtml']['extendname'] : 'html', 'text');
showsetting('setting_functions_makehtml_articlehtmldir', 'settingnew[makehtml][articlehtmldir]', $setting['makehtml']['articlehtmldir'], 'text');
$dirformat = array('settingnew[makehtml][htmldirformat]',
array(array(0, dgmdate(TIMESTAMP, '/Ym/')),
array(1, dgmdate(TIMESTAMP, '/Ym/d/')),
array(2, dgmdate(TIMESTAMP, '/Y/m/')),
array(3, dgmdate(TIMESTAMP, '/Y/m/d/')))
);
showsetting('setting_functions_makehtml_htmldirformat', $dirformat, $setting['makehtml']['htmldirformat'], 'select');
showsetting('setting_functions_makehtml_topichtmldir', 'settingnew[makehtml][topichtmldir]', $setting['makehtml']['topichtmldir'], 'text');
showsetting('setting_functions_makehtml_indexname', 'settingnew[makehtml][indexname]', $setting['makehtml']['indexname'] ? $setting['makehtml']['indexname'] : 'index', 'text');
showtagfooter('tbody');
showsubmit('makehtmlsetting', 'submit');
showtablefooter();
showformfooter();
} else {
$settingnew = $_GET['settingnew'];
if(isset($settingnew['makehtml'])) {
$settingnew['makehtml']['flag'] = intval($settingnew['makehtml']['flag']);
$settingnew['makehtml']['extendname'] = !$settingnew['makehtml']['extendname'] || !in_array($settingnew['makehtml']['extendname'], array('htm', 'html')) ? 'html' : $settingnew['makehtml']['extendname'];
if(!$settingnew['makehtml']['indexname']) {
$settingnew['makehtml']['indexname'] = 'index';
} else {
$re = NULL;
preg_match_all('/[^\w\d\_]/',$settingnew['makehtml']['indexname'],$re);
if(!empty($re[0]) || strpos('..', $settingnew['makehtml']['indexname']) !== false) {
cpmsg(cplang('setting_functions_makehtml_indexname_invalid').','.cplang('return'), NULL, 'error');
}
}
$settingnew['makehtml']['articlehtmldir'] = trim($settingnew['makehtml']['articlehtmldir'], ' /\\');
$re = NULL;
preg_match_all('/[^\w\d\_\\\\]/',$settingnew['makehtml']['articlehtmldir'],$re);
if(!empty($re[0]) || !check_html_dir($settingnew['makehtml']['articlehtmldir'])) {
cpmsg(cplang('setting_functions_makehtml_articlehtmldir_invalid').','.cplang('return'), NULL, 'error');
}
$settingnew['makehtml']['topichtmldir'] = trim($settingnew['makehtml']['topichtmldir'], ' /\\');
$re = NULL;
preg_match_all('/[^\w\d\_\\\\]/',$settingnew['makehtml']['topichtmldir'],$re);
if(!empty($re[0]) || !check_html_dir($settingnew['makehtml']['topichtmldir'])) {
cpmsg(cplang('setting_functions_makehtml_topichtmldir_invalid').','.cplang('return'), NULL, 'error');
}
$topichtmldir = realpath($settingnew['makehtml']['topichtmldir']);
if($topichtmldir === false) {
dmkdir($settingnew['makehtml']['topichtmldir'], 777, false);
$topichtmldir = realpath($settingnew['makehtml']['topichtmldir']);
rmdir($settingnew['makehtml']['topichtmldir']);
if($topichtmldir === false) {
cpmsg(cplang('setting_functions_makehtml_topichtmldir_invalid').','.cplang('return'), NULL, 'error');
}
}
$topichtmldir = str_replace(DISCUZ_ROOT, '', $topichtmldir);
$sysdir = array('api', 'archiver', 'config', 'data/diy', 'data\diy', 'install', 'source', 'static', 'template', 'uc_client', 'uc_server');
foreach($sysdir as $_dir) {
if(stripos($topichtmldir, $_dir) === 0) {
cpmsg(cplang('setting_functions_makehtml_topichtmldir_invalid').','.cplang('return'), NULL, 'error');
}
}
$settingnew['makehtml']['htmldirformat'] = intval($settingnew['makehtml']['htmldirformat']);
C::t('common_setting')->update_setting('makehtml', $settingnew['makehtml']);
updatecache('setting');
}
cpmsg('setting_update_succeed', 'action=makehtml&operation=makehtmlsetting', 'succeed');
}
} elseif ($operation == 'cleanhtml') {
$setting = $_G['setting']['makehtml'];
if(!empty($setting['flag'])) {
cpmsg('admincp_makehtml_cleanhtml_error', 'action=makehtml&operation=makehtmlsetting', 'error');
} else {
if(!submitcheck('cleanhtml')) {
showformheader("makehtml&operation=cleanhtml");
showtableheader();
showsetting('setting_functions_makehtml_cleanhtml', array('cleandata', array(cplang('setting_functions_makehtml_cleanhtml_index'), cplang('setting_functions_makehtml_cleanhtml_category'), cplang('setting_functions_makehtml_cleanhtml_other'))), 0, 'binmcheckbox');
showtagfooter('tbody');
showsubmit('cleanhtml', 'submit');
showtablefooter();
showformfooter();
} else {
if(isset($_GET['cleandata'])) {
$cleandata = $_GET['cleandata'];
if(isset($cleandata[1])) {
unlink(DISCUZ_ROOT.'./'.$setting['indexname'].'.'.$setting['extendname']);
}
if(isset($cleandata[2])) {
loadcache('portalcategory');
foreach($_G['cache']['portalcategory'] as $cat) {
if($cat['fullfoldername']) {
unlink($cat['fullfoldername'].'/index.'.$setting['extendname']);
}
}
}
if(isset($cleandata[3])) {
if(!empty($setting['articlehtmldir']) && $setting['articlehtmldir'] === $setting['topichtmldir']) {
drmdir(DISCUZ_ROOT.'./'.$setting['articlehtmldir'], $setting['extendname']);
} elseif(!empty($setting['topichtmldir'])) {
drmdir(DISCUZ_ROOT.'./'.$setting['topichtmldir'], $setting['extendname']);
} elseif(!empty($setting['articlehtmldir'])) {
drmdir(DISCUZ_ROOT.'./'.$setting['articlehtmldir'], $setting['extendname']);
}
if(empty($setting['articlehtmldir'])) {
loadcache('portalcategory');
foreach($_G['cache']['portalcategory'] as $cat) {
if($cat['fullfoldername']) {
if(($dirobj = dir(DISCUZ_ROOT.'./'.$cat['fullfoldername']))) {
while(false !== ($file = $dirobj->read())) {
if ($file != "." && $file != "..") {
$path = $dirobj->path.'/'.$file;
if(is_dir($path) && false === check_son_folder($file, $cat)) {
drmdir($path, $setting['extendname']);
}
}
}
$dirobj->close();
}
}
}
}
}
cpmsg('admincp_makehtml_cleanhtml_succeed', 'action=makehtml&operation=cleanhtml', 'succeed');
} else {
cpmsg('admincp_makehtml_cleanhtml_choose_item', 'action=makehtml&operation=cleanhtml', 'error');
}
}
}
}
function mk_format_category($catids) {
global $_G, $selectdata;
foreach($catids as $catid) {
if(!isset($selectdata[1][$catid])) {
$cate = $_G['cache']['portalcategory'][$catid];
if($cate['level'] == 0) {
$selectdata[1][$catid] = array($catid, $cate['catname']);
mk_format_category($cate['children']);
} elseif ($cate['level'] == 1) {
$selectdata[1][$catid] = array($catid, '&nbsp;&nbsp;&nbsp;'.$cate['catname']);
mk_format_category($cate['children']);
} elseif ($cate['level'] == 2) {
$selectdata[1][$catid] = array($catid, '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$cate['catname']);
}
}
}
}
function drmdir($dir, $fileext = 'html') {
if($dir === '.' || $dir === '..' || strpos($dir, '..') !== false) {
return false;
}
if(substr($dir,-1) === "/") {
$dir = substr($dir,0,-1);
}
if(!file_exists($dir) || !is_dir($dir)) {
return false;
} elseif(!is_readable($dir)) {
return false;
} else {
if(($dirobj = dir($dir))) {
while(false !== ($file = $dirobj->read())) {
if ($file != "." && $file != "..") {
$path = $dirobj->path . "/" . $file;
if(is_dir($path)) {
drmdir($path);
} elseif(fileext($path) === $fileext) {
echo $path,"<br>";
unlink($path);
}
}
}
$dirobj->close();
}
rmdir($dir);
return true;
}
return false;
}
function check_son_folder($file, $cat) {
global $_G;
$category = $_G['cache']['portalcategory'];
if(!empty($cat['children'])) {
foreach ($cat['children'] as $catid) {
if($category[$catid]['upid'] == $cat['catid'] && $category[$catid]['foldername'] == $file) {
return true;
}
}
}
return false;
}
function check_html_dir($dir) {
$dir = str_replace("\\", '/', $dir);
list($first) = explode('/', $dir);
if(in_array(strtolower($first), array('uc_server', 'uc_client', 'template', 'static', 'source', 'm', 'install', 'data', 'config', 'api', 'archiver'), true)) {
return false;
}
return true;
}
?>

View File

@@ -0,0 +1,396 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_medals.php 31634 2012-09-17 06:43:39Z monkey $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
if(!$operation) {
if(!submitcheck('medalsubmit')) {
shownav('extended', 'nav_medals', 'admin');
showsubmenu('nav_medals', array(
array('admin', 'medals', 1),
array('nav_medals_confer', 'members&operation=confermedal', 0),
array('nav_medals_mod', 'medals&operation=mod', 0)
));
showtips('medals_tips');
showformheader('medals');
showtableheader('medals_list', 'fixpadding');
showsubtitle(array('', 'display_order', 'available', 'name', 'description', 'medals_image', 'medals_type', ''));
?>
<script type="text/JavaScript">
var rowtypedata = [
[
[1,'', 'td25'],
[1,'<input type="text" class="txt" name="newdisplayorder[]" size="3">', 'td28'],
[1,'', 'td25'],
[1,'<input type="text" class="txt" name="newname[]" size="10">'],
[1,'<input type="text" class="txt" name="newdescription[]" size="30">'],
[1,'<input type="text" class="txt" name="newimage[]" size="20">'],
[1,'', 'td23'],
[1,'', 'td25']
]
];
</script>
<?php
$perpage = 50;
$start = ($_G['page'] - 1) * $perpage;
$count = C::t('forum_medal')->count_by_available(false);
$multi = multi($count, $perpage, $page, ADMINSCRIPT."?action=medals");
foreach(C::t('forum_medal')->fetch_all_data(false, $start, $perpage) as $medal) {
$checkavailable = $medal['available'] ? 'checked' : '';
switch($medal['type']) {
case 0:
$medal['type'] = cplang('medals_adminadd');
break;
case 1:
$medal['type'] = $medal['price'] ? cplang('medals_buy') : cplang('medals_register');
break;
case 2:
$medal['type'] = cplang('modals_moderate');
break;
}
$image = preg_match('/^https?:\/\//is', $medal['image']) ? $medal['image'] : STATICURL . 'image/common/' . $medal['image'];
showtablerow('', array('class="td25"', 'class="td25"', 'class="td25"', '', '', '', 'class="td23"', 'class="td25"'), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"{$medal['medalid']}\">",
"<input type=\"text\" class=\"txt\" size=\"3\" name=\"displayorder[{$medal['medalid']}]\" value=\"{$medal['displayorder']}\">",
"<input class=\"checkbox\" type=\"checkbox\" name=\"available[{$medal['medalid']}]\" value=\"1\" $checkavailable>",
"<input type=\"text\" class=\"txt\" size=\"10\" name=\"name[{$medal['medalid']}]\" value=\"{$medal['name']}\">",
"<input type=\"text\" class=\"txt\" size=\"30\" name=\"description[{$medal['medalid']}]\" value=\"{$medal['description']}\">",
"<input type=\"text\" class=\"txt\" size=\"20\" name=\"image[{$medal['medalid']}]\" value=\"{$medal['image']}\"><img style=\"vertical-align:middle;max-height:35px;\" src=\"$image\">",
$medal['type'],
"<a href=\"".ADMINSCRIPT."?action=medals&operation=edit&medalid={$medal['medalid']}\" class=\"act\">{$lang['detail']}</a>"
));
}
echo '<tr><td></td><td colspan="8"><div><a href="###" onclick="addrow(this, 0)" class="addtr">'.$lang['medals_addnew'].'</a></div></td></tr>';
showsubmit('medalsubmit', 'submit', 'del', '', $multi);
showtablefooter();
showformfooter();
} else {
if(is_array($_GET['delete']) && $_GET['delete']) {
$ids = array();
foreach($_GET['delete'] as $id) {
$ids[] = $id;
}
C::t('forum_medal')->delete($_GET['delete']);
}
if(is_array($_GET['name'])) {
foreach($_GET['name'] as $id => $val) {
$update = array(
'available' => $_GET['available'][$id],
'displayorder' => intval($_GET['displayorder'][$id])
);
if($_GET['name'][$id]) {
$update['name'] = dhtmlspecialchars($_GET['name'][$id]);
}
if($_GET['description'][$id]) {
$update['description'] = dhtmlspecialchars($_GET['description'][$id]);
}
if($_GET['image'][$id]) {
$update['image'] = dhtmlspecialchars($_GET['image'][$id]);
}
C::t('forum_medal')->update($id, $update);
}
}
if(is_array($_GET['newname'])) {
foreach($_GET['newname'] as $key => $value) {
if($value != '' && $_GET['newimage'][$key] != '') {
$data = array('name' => dhtmlspecialchars($value),
'available' => $_GET['newavailable'][$key],
'image' => $_GET['newimage'][$key],
'displayorder' => intval($_GET['newdisplayorder'][$key]),
'description' => dhtmlspecialchars($_GET['newdescription'][$key]),
);
C::t('forum_medal')->insert($data);
}
}
}
updatecache('setting');
updatecache('medals');
cpmsg('medals_succeed', 'action=medals', 'succeed');
}
} elseif($operation == 'mod') {
if(submitcheck('delmedalsubmit')) {
if (is_array($_GET['delete']) && !empty($_GET['delete'])) {
$ids = array();
foreach($_GET['delete'] as $id) {
$ids[] = $id;
}
C::t('forum_medallog')->update($ids, array('type' => 3));
cpmsg('medals_invalidate_succeed', 'action=medals&operation=mod', 'succeed');
} else {
cpmsg('medals_please_input', 'action=medals&operation=mod', 'error');
}
} elseif(submitcheck('modmedalsubmit')) {
if(is_array($_GET['delete']) && !empty($_GET['delete'])) {
$ids = $comma = '';
foreach($_GET['delete'] as $id) {
$ids .= "$comma'$id'";
$comma = ',';
}
$query = DB::query("SELECT me.id, me.uid, me.medalid, me.dateline, me.expiration, mf.medals
FROM ".DB::table('forum_medallog')." me
LEFT JOIN ".DB::table('common_member_field_forum')." mf USING (uid)
WHERE id IN ($ids)");
loadcache('medals');
while($modmedal = DB::fetch($query)) {
$modmedal['medals'] = empty($medalsnew[$modmedal['uid']]) ? $modmedal['medals'] : $medalsnew[$modmedal['uid']];
foreach($modmedal['medals'] = explode("\t", $modmedal['medals']) as $key => $modmedalid) {
list($medalid, $medalexpiration) = explode("|", $modmedalid);
if(isset($_G['cache']['medals'][$medalid]) && (!$medalexpiration || $medalexpiration > TIMESTAMP)) {
$medalsnew[$modmedal['uid']][$key] = $modmedalid;
}
}
$medalstatus = empty($modmedal['expiration']) ? 0 : 1;
$modmedal['expiration'] = $modmedal['expiration'] ? (TIMESTAMP + $modmedal['expiration'] - $modmedal['dateline']) : '';
$medalsnew[$modmedal['uid']][] = $modmedal['medalid'].(empty($modmedal['expiration']) ? '' : '|'.$modmedal['expiration']);
C::t('forum_medallog')->update($modmedal['id'], array('type' => 1, 'status' => $medalstatus, 'expiration' => $modmedal['expiration'], 'dateline' => TIMESTAMP));
C::t('common_member_medal')->insert(array('uid' => $modmedal['uid'], 'medalid' => $modmedal['medalid']), 0, 1);
}
foreach ($medalsnew as $key => $medalnew) {
$medalnew = array_unique($medalnew);
$medalnew = implode("\t", $medalnew);
C::t('common_member_field_forum')->update($key, array('medals' => $medalnew));
}
cpmsg('medals_validate_succeed', 'action=medals&operation=mod', 'succeed');
} else {
cpmsg('medals_please_input', 'action=medals&operation=mod', 'error');
}
} else {
$medals = '';
$medallogs = $medalids = $uids = array();
foreach(C::t('forum_medallog')->fetch_all_by_type(2) as $id => $medal) {
$medal['dateline'] = dgmdate($medal['dateline'], 'Y-m-d H:i');
$medal['expiration'] = empty($medal['expiration']) ? $lang['medals_forever'] : dgmdate($medal['expiration'], 'Y-m-d H:i');
$medalids[$medal['medalid']] = $medal['medalid'];
$uids[$medal['uid']] = $medal['uid'];
$medallogs[$id] = $medal;
}
$medalnames = C::t('forum_medal')->fetch_all($medalids);
$medalusers = C::t('common_member')->fetch_all($uids);
foreach($medallogs as $id => $medal) {
$medals .= showtablerow('', '', array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"$id\">",
"<a href=\"home.php?mod=space&username=".rawurlencode($medalusers[$medal['uid']]['username'])."\" target=\"_blank\">{$medalusers[$medal['uid']]['username']}</a>",
$medalnames[$medal['medalid']]['name'],
$medal['dateline'],
$medal['expiration']
), TRUE);
}
shownav('extended', 'nav_medals', 'nav_medals_mod');
showsubmenu('nav_medals', array(
array('admin', 'medals', 0),
array('nav_medals_confer', 'members&operation=confermedal', 0),
array('nav_medals_mod', 'medals&operation=mod', 1)
));
showformheader('medals&operation=mod');
showtableheader('medals_mod');
showtablerow('', '', array(
'',
cplang('medals_user'),
cplang('medals_name'),
cplang('medals_date'),
cplang('medals_expr'),
));
echo $medals;
showsubmit('modmedalsubmit', 'medals_modpass', 'select_all', '<input type="submit" class="btn" value="'.cplang('medals_modnopass').'" name="delmedalsubmit"> ');
showtablefooter();
showformfooter();
}
} elseif($operation == 'edit') {
$medalid = intval($_GET['medalid']);
if(!submitcheck('medaleditsubmit')) {
$medal = C::t('forum_medal')->fetch($medalid);
$medal['permission'] = dunserialize($medal['permission']);
$medal['usergroupallow'] = $medal['permission']['usergroupallow'];
$medal['usergroups'] = (array)$medal['permission']['usergroups'];
$medal['permission'] = $medal['permission'][0];
$credits = array();
$credits[] = array(0, $lang['default']);
foreach($_G['setting']['extcredits'] as $i => $extcredit) {
$credits[] = array($i, $extcredit['title']);
}
$groupselect = array();
foreach(C::t('common_usergroup')->range_orderby_credit() as $group) {
$groupselect[$group['type']] .= '<option value="'.$group['groupid'].'"'.(is_array($medal['usergroups']) && in_array($group['groupid'], $medal['usergroups']) ? ' selected' : '').'>'.$group['grouptitle'].'</option>';
}
$usergroups = '<select name="usergroupsnew[]" size="10" multiple="multiple">'.
'<optgroup label="'.$lang['usergroups_member'].'">'.$groupselect['member'].'</optgroup>'.
($groupselect['special'] ? '<optgroup label="'.$lang['usergroups_special'].'">'.$groupselect['special'].'</optgroup>' : '').
($groupselect['specialadmin'] ? '<optgroup label="'.$lang['usergroups_specialadmin'].'">'.$groupselect['specialadmin'].'</optgroup>' : '').
'<optgroup label="'.$lang['usergroups_system'].'">'.$groupselect['system'].'</optgroup></select>';
shownav('extended', 'nav_medals', 'admin');
showsubmenu('nav_medals', array(
array('admin', 'medals', 1),
array('nav_medals_confer', 'members&operation=confermedal', 0),
array('nav_medals_mod', 'medals&operation=mod', 0)
));
showformheader("medals&operation=edit&medalid=$medalid");
showtableheader(cplang('medals_edit').' - '.$medal['name'], 'nobottom');
showsetting('medals_name1', 'namenew', $medal['name'], 'text');
$image = preg_match('/^https?:\/\//is', $medal['image']) ? $medal['image'] : STATICURL . 'image/common/' . $medal['image'];
showsetting('medals_img', '', '', '<input type="text" class="txt" size="30" name="imagenew" value="'.$medal['image'].'" ><img style="max-height:35px;" src="'.$image.'">');
showsetting('medals_type1', array('typenew', array(
array(0, $lang['medals_adminadd'], array('creditdiv' => 'none')),
array(1, $lang['medals_apply_auto'], array('creditdiv' => '')),
array(2, $lang['medals_apply_noauto'], array('creditdiv' => 'none'))
)), $medal['type'], 'mradio');
showtagheader('tbody', 'creditdiv', $medal['type'] == 1, 'sub');
showsetting('medals_credit', array('creditnew', $credits), $medal['credit'], 'select');
showsetting('medals_price', 'pricenew', $medal['price'], 'text');
showtagfooter('tbody');
showsetting('medals_usergroups_allow', 'usergroupallow', $medal['usergroupallow'], 'radio', 0, 1);
showsetting('medals_usergroups', '', '', $usergroups);
showtagfooter('tbody');
showsetting('medals_expr1', 'expirationnew', $medal['expiration'], 'text');
showsetting('medals_memo', 'descriptionnew', $medal['description'], 'text');
showtablefooter();
showtableheader('medals_perm', 'notop');
$formulareplace .= '\'<u>'.$lang['setting_credits_formula_digestposts'].'</u>\',\'<u>'.$lang['setting_credits_formula_posts'].'</u>\',\'<u>'.$lang['setting_credits_formula_oltime'].'</u>\',\'<u>'.$lang['setting_credits_formula_pageviews'].'</u>\'';
?>
<script type="text/JavaScript">
function medalsinsertunit(text, textend) {
insertunit($('formulapermnew'), text, textend);
formulaexp();
}
var formulafind = new Array('digestposts', 'posts', 'threads');
var formulareplace = new Array(<?php echo $formulareplace;?>);
function formulaexp() {
var result = $('formulapermnew').value;
<?php
$extcreditsbtn = '';
for($i = 1; $i <= 8; $i++) {
$extcredittitle = $_G['setting']['extcredits'][$i]['title'] ? $_G['setting']['extcredits'][$i]['title'] : $lang['setting_credits_formula_extcredits'].$i;
echo 'result = result.replace(/extcredits'.$i.'/g, \'<u>'.$extcredittitle.'</u>\');';
$extcreditsbtn .= '<a href="###" onclick="medalsinsertunit(\'extcredits'.$i.'\')">'.$extcredittitle.'</a> &nbsp;';
}
echo 'result = result.replace(/regdate/g, \'<u>'.cplang('forums_edit_perm_formula_regdate').'</u>\');';
echo 'result = result.replace(/regday/g, \'<u>'.cplang('forums_edit_perm_formula_regday').'</u>\');';
echo 'result = result.replace(/regip/g, \'<u>'.cplang('forums_edit_perm_formula_regip').'</u>\');';
echo 'result = result.replace(/lastip/g, \'<u>'.cplang('forums_edit_perm_formula_lastip').'</u>\');';
echo 'result = result.replace(/buyercredit/g, \'<u>'.cplang('forums_edit_perm_formula_buyercredit').'</u>\');';
echo 'result = result.replace(/sellercredit/g, \'<u>'.cplang('forums_edit_perm_formula_sellercredit').'</u>\');';
echo 'result = result.replace(/digestposts/g, \'<u>'.$lang['setting_credits_formula_digestposts'].'</u>\');';
echo 'result = result.replace(/posts/g, \'<u>'.$lang['setting_credits_formula_posts'].'</u>\');';
echo 'result = result.replace(/threads/g, \'<u>'.$lang['setting_credits_formula_threads'].'</u>\');';
echo 'result = result.replace(/oltime/g, \'<u>'.$lang['setting_credits_formula_oltime'].'</u>\');';
echo 'result = result.replace(/and/g, \'&nbsp;&nbsp;'.$lang['setting_credits_formulaperm_and'].'&nbsp;&nbsp;\');';
echo 'result = result.replace(/or/g, \'&nbsp;&nbsp;'.$lang['setting_credits_formulaperm_or'].'&nbsp;&nbsp;\');';
echo 'result = result.replace(/>=/g, \'&ge;\');';
echo 'result = result.replace(/<=/g, \'&le;\');';
?>
$('formulapermexp').innerHTML = result;
}
</script>
<tr><td colspan="2"><div class="extcredits">
<?php echo $extcreditsbtn;?>
<a href="###" onclick="medalsinsertunit(' regdate ')">&nbsp;<?php echo cplang('forums_edit_perm_formula_regdate')?>&nbsp;</a>&nbsp;
<a href="###" onclick="medalsinsertunit(' regday ')">&nbsp;<?php echo cplang('forums_edit_perm_formula_regday')?>&nbsp;</a>&nbsp;
<a href="###" onclick="medalsinsertunit(' regip ')">&nbsp;<?php echo cplang('forums_edit_perm_formula_regip')?>&nbsp;</a>&nbsp;
<a href="###" onclick="medalsinsertunit(' lastip ')">&nbsp;<?php echo cplang('forums_edit_perm_formula_lastip')?>&nbsp;</a>&nbsp;
<a href="###" onclick="medalsinsertunit(' buyercredit ')">&nbsp;<?php echo cplang('forums_edit_perm_formula_buyercredit')?>&nbsp;</a>&nbsp;
<a href="###" onclick="medalsinsertunit(' sellercredit ')">&nbsp;<?php echo cplang('forums_edit_perm_formula_sellercredit')?>&nbsp;</a>&nbsp;
<a href="###" onclick="medalsinsertunit(' digestposts ')"><?php echo $lang['setting_credits_formula_digestposts'];?></a>&nbsp;
<a href="###" onclick="medalsinsertunit(' posts ')"><?php echo $lang['setting_credits_formula_posts'];?></a>&nbsp;
<a href="###" onclick="medalsinsertunit(' threads ')"><?php echo $lang['setting_credits_formula_threads'];?></a>&nbsp;
<a href="###" onclick="medalsinsertunit(' oltime ')"><?php echo $lang['setting_credits_formula_oltime'];?></a>&nbsp;
<a href="###" onclick="medalsinsertunit(' + ')">&nbsp;+&nbsp;</a>&nbsp;
<a href="###" onclick="medalsinsertunit(' - ')">&nbsp;-&nbsp;</a>&nbsp;
<a href="###" onclick="medalsinsertunit(' * ')">&nbsp;*&nbsp;</a>&nbsp;
<a href="###" onclick="medalsinsertunit(' / ')">&nbsp;/&nbsp;</a>&nbsp;
<a href="###" onclick="medalsinsertunit(' > ')">&nbsp;>&nbsp;</a>&nbsp;
<a href="###" onclick="medalsinsertunit(' >= ')">&nbsp;>=&nbsp;</a>&nbsp;
<a href="###" onclick="medalsinsertunit(' < ')">&nbsp;<&nbsp;</a>&nbsp;
<a href="###" onclick="medalsinsertunit(' <= ')">&nbsp;<=&nbsp;</a>&nbsp;
<a href="###" onclick="medalsinsertunit(' == ')">&nbsp;=&nbsp;</a>&nbsp;
<a href="###" onclick="medalsinsertunit(' (', ') ')">&nbsp;(&nbsp;)&nbsp;</a>&nbsp;
<a href="###" onclick="medalsinsertunit(' and ')">&nbsp;<?php echo $lang['setting_credits_formulaperm_and'];?>&nbsp;</a>&nbsp;
<a href="###" onclick="medalsinsertunit(' or ')">&nbsp;<?php echo $lang['setting_credits_formulaperm_or'];?>&nbsp;</a>&nbsp;<br />
</div><div id="formulapermexp" class="marginbot diffcolor2"><?php echo $formulapermexp;?></div>
<textarea name="formulapermnew" id="formulapermnew" style="width: 80%" rows="3" onkeyup="formulaexp()" onkeydown="textareakey(this, event)"><?php echo dhtmlspecialchars($medal['permission']);?></textarea>
<br /><span class="smalltxt"><?php echo $lang['medals_permformula'];?></span>
<br /><?php echo $lang['creditwizard_current_formula_notice'];?>
<script type="text/JavaScript">formulaexp()</script>
</td></tr>
<?php
showsubmit('medaleditsubmit');
showtablefooter();
showformfooter();
} else {
if(!checkformulaperm($_GET['formulapermnew'])) {
cpmsg('forums_formulaperm_error', '', 'error');
}
$formulapermary[0] = $_GET['formulapermnew'];
$formulapermary[1] = preg_replace(
array("/(digestposts|posts|threads|oltime|extcredits[1-8])/", "/(regdate|regday|regip|lastip|buyercredit|sellercredit|field\d+)/"),
array("getuserprofile('\\1')", "\$memberformula['\\1']"),
$_GET['formulapermnew']);
$formulapermary['usergroupallow'] = $_GET['usergroupallow'];
$formulapermary['usergroups'] = (array)$_GET['usergroupsnew'];
$formulapermnew = serialize($formulapermary);
$update = array(
'type' => $_GET['typenew'],
'description' => dhtmlspecialchars($_GET['descriptionnew']),
'expiration' => intval($_GET['expirationnew']),
'permission' => $formulapermnew,
'image' => $_GET['imagenew'],
'credit' => $_GET['creditnew'],
'price' => $_GET['pricenew'],
);
if($_GET['namenew']) {
$update['name'] = dhtmlspecialchars($_GET['namenew']);
}
C::t('forum_medal')->update($medalid, $update);
updatecache('medals');
cpmsg('medals_succeed', 'action=medals&do=editmedals', 'succeed');
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,104 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_membersplit.php 29851 2012-05-02 02:18:40Z zhangguosheng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
if(!$operation) {
$operation = 'check';
}
loadcache(array('membersplitdata', 'userstats'));
if(!empty($_G['cache']['membersplitstep'])) {
cpmsg('membersplit_split_in_backstage', 'action=membersplit&operation=check', 'loadingform');
}
if($operation == 'check') {
shownav('founder', 'nav_membersplit');
showsubmenu('membersplit');
showtips('membersplit_check_tips');
showformheader('membersplit&operation=manage');
showtableheader('membersplit_table_orig');
$membercount = $_G['cache']['userstats']['totalmembers'];
showsubtitle(array('','','membersplit_count', 'membersplit_lasttime_check'));
if($membercount < 50000) {
$msg = $lang['membersplit_without_optimization'];
} else {
$msg = empty($_G['cache']['membersplitdata']) ? $lang['membersplit_has_no_check'] : dgmdate($_G['cache']['membersplitdata']['dateline']);
}
showtablerow('', '', array('','', number_format($membercount), $msg));
if($membercount >= 50000) {
showsubmit('membersplit_check_submit', 'membersplit_check');
}
showtablefooter();
showformfooter();
} else if($operation == 'manage') {
shownav('founder', 'nav_membersplit');
if(!submitcheck('membersplit_split_submit', 1)) {
showsubmenu('membersplit');
showtips('membersplit_tips');
showformheader('membersplit&operation=manage');
showtableheader('membersplit_table_orig');
if($_G['cache']['membersplitdata'] && $_G['cache']['membersplitdata']['dateline'] > TIMESTAMP - 86400) {
$zombiecount = $_G['cache']['membersplitdata']['zombiecount'];
} else {
$zombiecount = C::t('common_member')->count_zombie();
if($zombiecount >= 1) {
$zombiecount--;
}
savecache('membersplitdata', array('zombiecount' => $zombiecount, 'dateline' => TIMESTAMP));
}
$membercount = $_G['cache']['userstats']['totalmembers'];
$percentage = round($zombiecount/$membercount, 4)*100;
showsubtitle(array('','','membersplit_count', 'membersplit_combie_count', 'membersplit_splitnum'));
showtablerow('', '',
array('','', number_format($membercount), number_format($zombiecount).'('.$percentage.'%) ', '<input name="splitnum" value="200" type="text" class="txt"/>'));
if($percentage > 0) {
showsubmit('membersplit_split_submit', 'membersplit_archive');
}
showtablefooter();
showformfooter();
} else {
$step = intval($_GET['step'])+1;
$splitnum = max(10, intval($_GET['splitnum']));
if(!$_GET['nocheck'] && $step == 1 && !C::t('common_member_archive')->check_table()) {
cpmsg('membersplit_split_check_table', 'action=membersplit&operation=rebuildtable&splitnum='.$splitnum, 'loadingform', array());
cpmsg('', 'action=membersplit&operation=manage', 'error');
}
if(!C::t('common_member')->split($splitnum)) {
cpmsg('membersplit_split_succeed', 'action=membersplit&operation=manage', 'succeed');
}
cpmsg('membersplit_split_doing', 'action=membersplit&operation=manage&membersplit_split_submit=1&step='.$step.'&splitnum='.$splitnum, 'loadingform', array('num' => $step*$splitnum));
}
} else if($operation == 'rebuildtable') {
$step = intval($_GET['step']);
$splitnum = max(10, intval($_GET['splitnum']));
$ret = C::t('common_member_archive')->rebuild_table($step);
if($ret === false) {
cpmsg('membersplit_split_check_table_done', 'action=membersplit&operation=manage&membersplit_split_submit=1&nocheck=1&splitnum='.$splitnum, 'loadingform');
} else if($ret === true) {
cpmsg('membersplit_split_checking_table', 'action=membersplit&operation=rebuildtable&splitnum='.$splitnum.'&step='.($step+1), 'loadingform', array('step' => $step+1));
} else {
cpmsg('membersplit_split_check_table_fail', 'action=membersplit&operation=manage&splitnum='.$splitnum, 'error', array('tablename' => $ret));
}
}
?>

View File

@@ -0,0 +1,306 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_menu.php 36284 2016-12-12 00:47:50Z nemohou $
*/
global $_G;
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
$isfounder = isset($isfounder) ? $isfounder : isfounder();
$topmenu = $menu = array();
$topmenu = array (
'index' => '',
'global' => '',
'style' => '',
'topic' => '',
'user' => '',
'portal' => '',
'forum' => '',
'group' => '',
'safe' => '',
'extended' => '',
'plugin' => $isfounder ? 'plugins' : '',
'template' => '',
'tools' => '',
);
if(!$_G['setting']['portalstatus']) {
unset($topmenu['portal']);
}
if(!$_G['setting']['groupstatus']) {
unset($topmenu['group']);
}
$menu['index'] = array(
array('menu_home', 'index'),
array('menu_custommenu_manage', 'misc_custommenu'),
(defined('DISCUZ_DEBUG') && DISCUZ_DEBUG && $isfounder) ? array('menu_setting_runtests', 'runtests') : null,
);
$custommenu = get_custommenu();
$menu['index'] = array_merge($menu['index'], $custommenu);
$menu['global'] = array(
array('menu_setting_basic', 'setting_basic'),
array('menu_setting_access', 'setting_access'),
array('menu_setting_functions', 'setting_functions'),
array('menu_setting_optimize', 'setting_cachethread'),
array('menu_setting_seo', 'setting_seo'),
array('menu_setting_domain', 'domain'),
$_G['setting']['followstatus'] ? array('menu_setting_follow', 'setting_follow') : null,
array('menu_setting_home', 'setting_home'),
array('menu_setting_user', 'setting_permissions'),
array('menu_setting_credits', 'setting_credits'),
array('menu_setting_datetime', 'setting_datetime'),
array('menu_setting_attachments', 'setting_attach'),
array('menu_setting_imgwater', 'setting_imgwater'),
array('menu_posting_attachtypes', 'misc_attachtype'),
array('menu_setting_search', 'setting_search'),
array('menu_setting_district', 'district'),
$_G['setting']['rankliststatus'] ? array('menu_setting_ranklist', 'setting_ranklist') : null,
array('menu_setting_mobile', 'setting_mobile'),
array('menu_setting_antitheft', 'setting_antitheft'),
);
$menu['style'] = array(
array('menu_setting_customnav', 'nav'),
array('menu_setting_styles', 'setting_styles'),
array('menu_posting_smilies', 'smilies'),
array('menu_click', 'click'),
array('menu_thread_stamp', 'misc_stamp'),
array('menu_posting_editor', 'setting_editor'),
array('menu_misc_onlinelist', 'misc_onlinelist'),
);
$show_home = $_G['setting']['doingstatus'] || $_G['setting']['blogstatus'] || $_G['setting']['feedstatus'] || $_G['setting']['albumstatus'] || $_G['setting']['wallstatus'] || $_G['setting']['sharestatus'];
$menu['topic'] = array(
array('menu_moderate_posts', 'moderate'),
array('menu_remoderate', 'remoderate'),
array('menu_posting_censors', 'misc_censor'),
array('menu_maint_report', 'report'),
array('menu_setting_tag', 'tag'),
$_G['setting']['collectionstatus'] ? array('menu_setting_collection', 'collection') : null,
array(cplang('nav_forum'), '', 1),
array('menu_maint_threads', 'threads'),
array('menu_maint_prune', 'prune'),
array('menu_maint_attaches', 'attach'),
array(cplang('nav_forum'), '', 2),
$_G['setting']['groupstatus'] ? array(cplang('nav_group'), '', 1) : null,
$_G['setting']['groupstatus'] ? array('menu_maint_threads_group', 'threads_group') : null,
$_G['setting']['groupstatus'] ? array('menu_maint_prune_group', 'prune_group') : null,
$_G['setting']['groupstatus'] ? array('menu_maint_attaches_group', 'attach_group') : null,
$_G['setting']['groupstatus'] ? array(cplang('nav_group'), '', 2) : null,
array(cplang('thread'), '', 1),
array('menu_moderate_recyclebin', 'recyclebin'),
array('menu_moderate_recyclebinpost', 'recyclebinpost'),
array('menu_threads_forumstick', 'threads_forumstick'),
array('menu_postcomment', 'postcomment'),
array(cplang('thread'), '', 2),
$show_home ? array(cplang('nav_home'), '', 1) : null,
$_G['setting']['doingstatus'] ? array('menu_maint_doing', 'doing') : null,
$_G['setting']['blogstatus'] ? array('menu_maint_blog', 'blog') : null,
$_G['setting']['blogstatus'] ? array('menu_maint_blog_recycle_bin', 'blogrecyclebin') : null,
$_G['setting']['feedstatus'] ? array('menu_maint_feed', 'feed') : null,
$_G['setting']['albumstatus'] ? array('menu_maint_album', 'album') : null,
$_G['setting']['albumstatus'] ? array('menu_maint_pic', 'pic') : null,
$_G['setting']['wallstatus'] ? array('menu_maint_comment', 'comment') : null,
$_G['setting']['sharestatus'] ? array('menu_maint_share', 'share') : null,
$show_home ? array(cplang('nav_home'), '', 2) : null,
);
$menu['user'] = array(
array('menu_members_edit', 'members_search'),
array('menu_members_profile', 'members_profile'),
array('menu_members_stat', 'members_stat'),
array('menu_members_newsletter', 'members_newsletter'),
array('menu_members_mobile', 'members_newsletter_mobile'),
array('menu_members_sms', 'members_newsletter_sms'),
array('menu_usertag', 'usertag'),
array('menu_members_edit_ban_user', 'members_ban'),
array('menu_members_ipban', 'members_ipban'),
array('menu_members_credits', 'members_reward'),
array('menu_moderate_modmembers', 'moderate_members'),
array('menu_admingroups', 'admingroup'),
array('menu_usergroups', 'usergroups'),
array('menu_follow', 'specialuser_follow'),
array('menu_defaultuser', 'specialuser_defaultuser'),
array('menu_members_verify_profile', 'verify_verify'),
array('menu_members_verify_setting', 'verify'),
);
if(is_array($_G['setting']['verify'])) {
foreach($_G['setting']['verify'] as $vid => $verify) {
if($vid != 7 && $verify['available']) {
$menu['user'][] = array($verify['title'], "verify_verify_$vid");
}
}
}
$menu['portal'] = array(
array('menu_portalcategory', 'portalcategory'),
array('menu_article', 'article'),
array('menu_topic', 'topic'),
array('menu_html', 'makehtml'),
array('menu_diytemplate', 'diytemplate'),
array('menu_block', 'block'),
array('menu_blockstyle', 'blockstyle'),
array('menu_blockxml', 'blockxml'),
array('menu_portalpermission', 'portalpermission'),
array('menu_blogcategory', 'blogcategory'),
array('menu_albumcategory', 'albumcategory'),
);
$menu['forum'] = array(
array('menu_forums', 'forums'),
array('menu_forums_merge', 'forums_merge'),
array('menu_forums_infotypes', 'threadtypes'),
array('menu_grid', 'grid'),
);
$menu['group'] = array(
array('menu_group_setting', 'group_setting'),
array('menu_group_type', 'group_type'),
array('menu_group_manage', 'group_manage'),
array('menu_group_userperm', 'group_userperm'),
array('menu_group_level', 'group_level'),
array('menu_group_mod', 'group_mod'),
);
$menu['safe'] = array(
array('menu_safe_setting', 'setting_sec'),
array('menu_safe_seccheck', 'setting_seccheck'),
array('menu_security', 'optimizer_security'),
array('menu_serversec', 'optimizer_serversec'),
array('menu_safe_accountguard', 'setting_accountguard'),
);
$menu['extended'] = array(
array('menu_misc_announce', 'announce'),
array('menu_adv_custom', 'adv'),
$_G['setting']['taskstatus'] ? array('menu_tasks', 'tasks') : null,
$_G['setting']['magicstatus'] ? array('menu_magics', 'magics') : null,
$_G['setting']['medalstatus'] ? array('menu_medals', 'medals') : null,
$isfounder ? array('menu_smsgw', 'smsgw') : null,
array('menu_misc_help', 'faq'),
array('menu_ec', 'setting_ec'),
array('menu_misc_link', 'misc_link'),
array('memu_focus_topic', 'misc_focus'),
array('menu_misc_relatedlink', 'misc_relatedlink'),
array('menu_card', 'card')
);
if(file_exists($menudir = DISCUZ_ROOT.'./source/admincp/menu')) {
$adminextend = $adminextendnew = array();
if(file_exists($adminextendfile = DISCUZ_ROOT.'./data/sysdata/cache_adminextend.php')) {
@include $adminextendfile;
}
$menudirhandle = dir($menudir);
while($entry = $menudirhandle->read()) {
if(!in_array($entry, array('.', '..')) && preg_match("/^menu\_([\w\.]+)$/", $entry, $entryr) && substr($entry, -4) == '.php' && strlen($entry) < 30 && is_file($menudir.'/'.$entry)) {
@include_once $menudir.'/'.$entry;
$adminextendnew[] = $entryr[1];
}
}
if($adminextend != $adminextendnew) {
@unlink($adminextendfile);
if($adminextendnew) {
require_once libfile('function/cache');
writetocache('adminextend', getcachevars(array('adminextend' => $adminextendnew)));
}
unset($_G['lang']['admincp']);
}
}
if($isfounder) {
$menu['plugin'] = array(
array('menu_plugins', 'plugins'),
);
}
$menu['template'] = array(
array('menu_styles', 'styles'),
);
if($isfounder && isset($_G['config']['plugindeveloper']) && $_G['config']['plugindeveloper'] > 0) {
$menu['template'][] = array('menu_templates_add', 'templates_add');
}
loadcache('adminmenu');
if(is_array($_G['cache']['adminmenu'])) {
foreach($_G['cache']['adminmenu'] as $row) {
if($row['name'] == 'plugins_system') {
$row['name'] = cplang('plugins_system');
}
$menu['plugin'][] = array($row['name'], $row['action'], $row['sub']);
}
}
if(!$menu['plugin']) {
unset($topmenu['plugin']);
}
$menu['tools'] = array(
array('menu_tools_updatecaches', 'tools_updatecache'),
array('menu_tools_updatecounters', 'counter'),
array('menu_logs', 'logs'),
array('menu_misc_cron', 'misc_cron'),
$isfounder ? array('menu_tools_fileperms', 'tools_fileperms') : null,
$isfounder ? array('menu_tools_filecheck', 'checktools_filecheck') : null,
$isfounder ? array('menu_tools_hookcheck', 'checktools_hookcheck') : null,
$isfounder ? array('menu_tools_replacekey', 'checktools_replacekey') : null,
);
if($isfounder) {
$topmenu['founder'] = '';
$menu['founder'] = array(
array('menu_founder_perm', 'founder_perm'),
array('menu_setting_mail', 'setting_mail'),
array('menu_setting_uc', 'setting_uc'),
array('menu_db', 'db_export'),
array('menu_membersplit', 'membersplit_check'),
array('menu_postsplit', 'postsplit_manage'),
array('menu_threadsplit', 'threadsplit_manage'),
array('menu_optimizer', 'optimizer_performance'),
);
$menu['uc'] = array();
}
if($isfounder || $_G['adminid'] == 1) {
$topmenu['cloudaddons'] = '';
$menu['cloudaddons'] = array(
array('menu_addons', 'cloudaddons&frame=no', '_blank'),
);
}
if(!isfounder() && !isset($GLOBALS['admincp']->perms['all'])) {
$menunew = $menu;
foreach($menu as $topkey => $datas) {
if($topkey == 'index') {
continue;
}
$itemexists = 0;
foreach($datas as $key => $data) {
if(array_key_exists($data[1], $GLOBALS['admincp']->perms)) {
$itemexists = 1;
} else {
unset($menunew[$topkey][$key]);
}
}
if(!$itemexists) {
unset($topmenu[$topkey]);
unset($menunew[$topkey]);
}
}
$menu = $menunew;
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,304 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_moderate.php 32501 2013-01-29 09:51:00Z chenmengshu $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
$ignore = $_GET['ignore'];
$filter = $_GET['filter'];
$modfid = $_GET['modfid'];
$modsubmit = $_GET['modsubmit'];
$moderate = $_GET['moderate'];
$pm = $_GET['pm'];
$showcensor = !empty($_GET['showcensor']) ? 1 : 0;
$_G['setting']['memberperpage'] = 100;
if(empty($operation)) {
$operation = 'threads';
}
if($operation == 'members') {
require_once libfile('moderate/member', 'admincp');
exit;
} else {
require_once libfile('function/forumlist');
require_once libfile('function/post');
$modfid = !empty($modfid) ? intval($modfid) : 0;
$recyclebins = $forumlist = array();
$query = C::t('forum_forum')->fetch_all_valid_forum();
foreach($query as $forum) {
$recyclebins[$forum['fid']] = $forum['recyclebin'];
$forumlist[$forum['fid']] = $forum['name'];
}
if($modfid && $modfid != '-1') {
$fidadd = array('fids' => $modfid, 'and' => ' AND ', 't' => 't.', 'p' => 'p.');
} else {
$fidadd = array();
}
if(isset($filter) && $filter == 'ignore') {
$displayorder = -3;
$moderatestatus = 1;
$filteroptions = '<option value="normal">'.$lang['moderate_none'].'</option><option value="ignore" selected>'.$lang['moderate_ignore'].'</option>';
} else {
$displayorder = -2;
$moderatestatus = 0;
$filter = 'normal';
$filteroptions = '<option value="normal" selected>'.$lang['moderate_none'].'</option><option value="ignore">'.$lang['moderate_ignore'].'</option>';
}
$forumoptions = '<option value="all"'.(empty($modfid) ? ' selected' : '').'>'.$lang['moderate_all_fields'].'</option>';
if($operation != 'replies') {
$forumoptions .= '<option value="-1" '.($modfid == '-1' ? 'selected' : '').'>'.$lang['moderate_all_groups'].'</option>'."\n";
}
foreach($forumlist as $fid => $forumname) {
$selected = $modfid == $fid ? ' selected' : '';
$forumoptions .= '<option value="'.$fid.'" '.$selected.'>'.$forumname.'</option>'."\n";
}
require_once libfile('function/misc');
$modreasonoptions = '<option value="">'.$lang['none'].'</option><option value="">--------</option>'.modreasonselect(1);
echo <<<EOT
<script type="text/JavaScript">
var cookiepre = "{$_G['config']['cookie']['cookiepre']}";
function mod_setbg(tid, value) {
$('mod_' + tid + '_row1').className = 'mod_' + value;
$('mod_' + tid + '_row2').className = 'mod_' + value;
$('mod_' + tid + '_row3').className = 'mod_' + value;
$("chk_apply_all").checked = false;
$("chk_apply_all").disabled = true;
}
function mod_setbg_all(value) {
checkAll('option', $('cpform'), value);
var trs = $('cpform').getElementsByTagName('TR');
for(var i in trs) {
if(trs[i].id && trs[i].id.substr(0, 4) == 'mod_') {
trs[i].className = 'mod_' + value;
}
}
$("chk_apply_all").disabled = false;
$("chk_apply_all").value = value;
}
function attachimg() {}
function expandall() {
var tds = $('cpform').getElementsByTagName('TD');
for(var i in tds) {
if(tds[i].id && tds[i].id.match(/^mod_(\d+)_row1_op$/) != null) {
tds[i].rowSpan = "3";
}
}
var trs = $('cpform').getElementsByTagName('TR');
for(var i in trs) {
if(trs[i].id && trs[i].id.match(/^mod_(\d+)_row1$/) != null) {
tds = trs[i].getElementsByTagName('TD');
for(var j in tds) {
if(tds[j].className == "threadtitle threadopt") {
tds[j].className = "";
}
}
}
if(trs[i].id && trs[i].id.match(/^mod_(\d+)_row(2|3)$/) != null) {
trs[i].style.display = "";
}
}
setcookie("foldall", 0, 3600);
}
function foldall() {
var tds = $('cpform').getElementsByTagName('TD');
for(var i in tds) {
if(tds[i].id && tds[i].id.match(/^mod_(\d+)_row1_op$/) != null) {
tds[i].rowSpan = "1";
}
}
var trs = $('cpform').getElementsByTagName('TR');
for(var i in trs) {
if(trs[i].id && trs[i].id.match(/^mod_(\d+)_row1$/) != null) {
tds = trs[i].getElementsByTagName('TD');
for(var j in tds) {
if(tds[j].className == "") {
tds[j].className = "threadtitle threadopt";
}
}
}
if(trs[i].id && trs[i].id.match(/^mod_(\d+)_row(2|3)$/) != null) {
trs[i].style.display = "none";
}
}
setcookie("foldall", 1, 3600);
}
function display_toggle(tid) {
var tr1 = $('mod_' + tid + '_row1');
var tr1_op = $('mod_' + tid + '_row1_op');
var tr2 = $('mod_' + tid + '_row2');
var tr3 = $('mod_' + tid + '_row3');
var tds = tr1.getElementsByTagName('TD');
if(tr1_op.rowSpan == "1") {
for(var i in tds) {
if(tds[i].className == "threadtitle threadopt") {
tds[i].className = "";
}
}
tr1_op.rowSpan = "3";
tr2.style.display = "";
tr3.style.display = "";
} else {
for(var i in tds) {
if(tds[i].className == "") {
tds[i].className = "threadtitle threadopt";
}
}
tr1_op.rowSpan = "1";
tr2.style.display = "none";
tr3.style.display = "none";
}
}
function mod_cancel_all() {
var form = $('cpform');
var checkall = 'chkall';
for(var i = 0; i < form.elements.length; i++) {
var e = form.elements[i];
if(e.type == 'radio') {
e.checked = '';
}
}
var trs = $('cpform').getElementsByTagName('TR');
for(var i in trs) {
if(trs[i].id && trs[i].id.match(/^mod_(\d+)_row(1|2|3)$/)) {
trs[i].className = "mod_cancel";
}
}
$("chk_apply_all").checked = false;
$("chk_apply_all").disabled = true;
}
function remove_element(_element) {
var _parentElement = _element.parentNode;
if(_parentElement){
_parentElement.removeChild(_element);
}
}
function mod_remove_row(id) {
var id1 = "mod_" + id + "_row1";
var id2 = "mod_" + id + "_row2";
var id3 = "mod_" + id + "_row3";
var node1 = parent.document.getElementById(id1);
var node2 = parent.document.getElementById(id2);
var node3 = parent.document.getElementById(id3);
remove_element(node1);
remove_element(node2);
remove_element(node3);
}
window.onload = function() {
if(getcookie("foldall")) {
foldall();
}
};
</script>
EOT;
}
$submenu = array(
array(array('menu' => 'moderate_m_forum', 'submenu' => array(
'threads' => array('nav_moderate_threads', 'moderate&operation=threads', $operation == 'threads'),
'replies' => array('nav_moderate_replies', 'moderate&operation=replies', $operation == 'replies'),
)), in_array($operation, array('threads', 'replies'))),
array(array('menu' => 'moderate_m_home', 'submenu' => array(
'blogs' => array('nav_moderate_blogs', 'moderate&operation=blogs', $operation == 'blogs'),
'pictures' => array('nav_moderate_pictures', 'moderate&operation=pictures', $operation == 'pictures'),
'doings' => array('nav_moderate_doings', 'moderate&operation=doings', $operation == 'doings'),
'shares' => array('nav_moderate_shares', 'moderate&operation=shares', $operation == 'shares'),
'comments' => array('nav_moderate_comments', 'moderate&operation=comments', $operation == 'comments'),
)), in_array($operation, array('blogs', 'pictures', 'doings', 'shares', 'comments'))),
array(array('menu' => 'moderate_m_portal', 'submenu' => array(
'articles' => array('nav_moderate_articles', 'moderate&operation=articles', $operation == 'articles'),
'articlecomments' => array('nav_moderate_articlecomments', 'moderate&operation=articlecomments', $operation == 'articlecomments'),
'topiccomments' => array('nav_moderate_topiccomments', 'moderate&operation=topiccomments', $operation == 'topiccomments'),
)), in_array($operation, array('articles', 'articlecomments', 'topiccomments')))
);
if($operation == 'threads') {
require_once libfile('moderate/thread', 'admincp');
} elseif($operation == 'replies') {
require_once libfile('moderate/reply', 'admincp');
} elseif($operation == 'blogs') {
require_once libfile('moderate/blog', 'admincp');
} elseif($operation == 'pictures') {
require_once libfile('moderate/picture', 'admincp');
} elseif($operation == 'doings') {
require_once libfile('moderate/doing', 'admincp');
} elseif($operation == 'shares') {
require_once libfile('moderate/share', 'admincp');
} elseif($operation == 'comments') {
require_once libfile('moderate/comment', 'admincp');
} elseif($operation == 'articles') {
require_once libfile('moderate/article', 'admincp');
} elseif($operation == 'articlecomments' || $operation == 'topiccomments') {
require_once libfile('moderate/portalcomment', 'admincp');
}
echo '<iframe name="fasthandle" style="display: none;"></iframe>';
function callback_js($id) {
$js = <<<EOT
<script type="text/javascript">
mod_remove_row('$id');
</script>
EOT;
return $js;
}
function moderateswipe($type, $ids) {
if($type == 'pid') {
$exist_ids = array_keys(C::t('forum_post')->fetch_all_post(0, $ids));
} elseif($type == 'tid') {
$exist_ids = array_keys(C::t('forum_thread')->fetch_all($ids));
}
$remove_ids = array_diff($ids, $exist_ids);
if($remove_ids) {
return C::t('common_moderate')->delete_moderate($remove_ids, $type);
} else {
return 0;
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,329 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_optimizer.php 33867 2013-08-23 06:12:21Z jeffjzhang $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
$optimizer_option = array(
'optimizer_thread',
'optimizer_setting',
'optimizer_post',
'optimizer_dbbackup',
'optimizer_dbbackup_clean',
'optimizer_seo'
);
$security_option = array(
'optimizer_inviteregister',
'optimizer_emailregister',
'optimizer_pwlength',
'optimizer_regmaildomain',
'optimizer_ipregctrl',
'optimizer_newbiespan',
'optimizer_editperdel',
'optimizer_recyclebin',
'optimizer_forumstatus',
'optimizer_usergroup9',
'optimizer_usergroup4',
'optimizer_usergroup5',
'optimizer_usergroup6',
'optimizer_attachexpire',
'optimizer_attachrefcheck',
'optimizer_filecheck',
'optimizer_plugin',
'optimizer_loginpwcheck',
'optimizer_loginoutofdate',
'optimizer_dbbackup_visit',
'optimizer_filesafe',
'optimizer_remote',
);
$serversec_option = array(
'optimizer_dos8p3',
'optimizer_httphost'
);
if($_G['setting']['connect']['allow']) {
$security_option[] = 'optimizer_postqqonly';
$security_option[] = 'optimizer_aggid';
}
$check_record_time_key = 'check_record_time';
if(in_array($operation, array('security', 'serversec', 'performance'))) {
$_GET['anchor'] = $operation;
$operation = '';
}
if($_GET['anchor'] == 'security') {
shownav('safe', 'menu_security');
$optimizer_option = $security_option;
$check_record_time_key = 'security_check_record_time';
showsubmenu('menu_security');
} elseif($_GET['anchor'] == 'serversec') {
shownav('safe', 'menu_serversec');
$optimizer_option = $serversec_option;
$check_record_time_key = 'serversec_check_record_time';
showsubmenu('menu_serversec');
} elseif($_GET['anchor'] == 'performance') {
shownav('founder', 'menu_optimizer');
showsubmenu('menu_optimizer');
}
if($operation) {
$type = $_GET['type'];
if(!in_array($type, $optimizer_option)) {
cpmsg('parameters_error', '', 'error');
}
include_once 'source/discuz_version.php';
$optimizer = new optimizer($type);
}
$_GET['anchor'] = in_array($_GET['anchor'], array('security', 'serversec', 'performance')) ? $_GET['anchor'] : 'security';
if($operation == 'optimize_unit') {
$optimizer->optimizer();
} elseif($operation == 'check_unit') {
$checkstatus = $optimizer->check();
C::t('common_optimizer')->update_optimizer($type.'_checkrecord', ($checkstatus['status'] == 1 ? $checkstatus['status'] : 0));
C::t('common_optimizer')->update_optimizer($check_record_time_key, $_G['timestamp']);
include template('common/header_ajax');
echo '<script type="text/javascript">updatecheckstatus(\''.$type.'\', \''.$checkstatus['lang'].'\', \''.$checkstatus['status'].'\', \''.$checkstatus['type'].'\', \''.$checkstatus['extraurl'].'\');</script>';
include template('common/footer_ajax');
exit;
} elseif($operation == 'setting_optimizer') {
if(submitcheck('setting_optimizer', 1)) {
$setting_options = $_GET['options'];
if($optimizer->option_optimizer($setting_options)) {
cpmsg('founder_optimizer_setting_succeed', 'action=optimizer&operation=setting_optimizer&type=optimizer_setting', 'succeed');
} else {
cpmsg('founder_optimizer_setting_error', '', 'error');
}
} else {
showformheader('optimizer&operation=setting_optimizer&type=optimizer_setting');
showtableheader();
$option = $optimizer->get_option();
echo '<tr class="header">';
echo '<th></th>';
echo '<th class="td24">'.$lang['founder_optimizer_setting_option'].'</th>';
echo '<th>'.$lang['founder_optimizer_setting_option_description'].'</th>';
echo '<th class="td24">'.$lang['founder_optimizer_setting_description'].'</th>';
echo '</tr>';
foreach($option as $setting) {
$color = ' style="'.($setting[4] ? 'color:red;' : 'color:green').'"';
echo '<tr>';
echo '<td><input type="checkbox" name="options[]" value="'.$setting[0].'" '.($setting[4] ? 'checked' : 'disabled').' /></td>';
echo '<td'.$color.'>'.$setting[1].'</td>';
echo '<td'.$color.'>'.$setting[2].'</td>';
echo '<td'.$color.'>'.$setting[3].'</td>';
echo '</tr>';
}
showsubmit('setting_optimizer');
showtablefooter();
showformfooter();
}
} else {
$checkrecordtime = C::t('common_optimizer')->fetch_optimizer($check_record_time_key);
if(!$_GET['checking']) {
showtips('optimizer_'.$_GET['anchor'].'_tips');
}
showboxheader();
echo '<div class="drow" style="margin-bottom: 0px;"><div class="dcol">';
echo $_GET['checking'] ? '<a href="javascript:;" id="checking" class="btn_big">'.$lang['founder_optimizer_checking'].'</a></div>' :
'<a href="'.ADMINSCRIPT.'?action=optimizer&checking=1&anchor='.$_GET['anchor'].'" id="checking" class="btn_big">'.$lang['founder_optimizer_start_check'].'</a></div>';
if($_GET['checking']) {
echo '<div class="dcol"><div class="pbg" id="processid">';
echo '<div class="pbr" style="width: 0;" id="percentprocess"></div>';
echo '<div class="xs0" id="percent">0%</div>';
echo '</div></div>';
}
echo '<div id="checkstatus" class="dcol">';
if(!$checkrecordtime) {
echo $lang['founder_optimizer_first_use'];
} else {
$num = 0;
$checkrecordkey = array();
foreach($optimizer_option as $option) {
$checkrecordkey[] = $option.'_checkrecord';
}
foreach(C::t('common_optimizer')->fetch_all($checkrecordkey) as $checkrecordvalue) {
if($checkrecordvalue['v'] == 1) {
$num++;
}
}
if(!$_GET['checking']) {
echo $lang['founder_optimizer_lastcheck'].dgmdate($checkrecordtime).$lang['founder_optimizer_findnum'].$num.$lang['founder_optimizer_neednum'];
}
}
echo '</div>';
echo '</div>';
if($_GET['checking']) {
$inc_unit = ceil(100/count($optimizer_option));
$adminscipt = ADMINSCRIPT;
$C = '$C';
print <<<END
<script type="text/javascript">
var checkpercent = 0;
var checknum = 0;
var optimize_num = 0;
var security_num = 0;
var tip_num = 0;
var securitygrade = '';
function updatecheckpercent() {
checkpercent += {$inc_unit};
checknum++;
$('percent').innerHTML = parseInt(checkpercent) + '%';
$('percentprocess').style.width = parseInt(checkpercent) * 2 + 'px';
}
function updatecheckstatus(id, msg, status, type, extraurl) {
var optimize_table = $('optimizerable');
var optimize_tablerows = optimize_table.rows.length;
var security_table = $('securityoption');
var security_tablerows = security_table.rows.length;
var tip_table = $('tipoption');
var tip_tablerows = tip_table.rows.length;
if(id == 'optimizer_upgrade' || id == 'optimizer_patch') {
securitygrade = '{$lang['founder_optimizer_low']}';
}
var optiontype = id;
id = 'progress_' + id;
$(id + '_tr').style.display = 'none';
var color = 'green';
if(status == 1) {
color = 'red';
optimize_num++;
$('optimizerablenum').innerHTML = optimize_num;
optimize_table.style.display = 'block';
var newtr = optimize_table.insertRow(optimize_tablerows);
newtr.className = 'ooclass';
} else if(status == 2) {
color = 'blue';
tip_num++;
$('tipoptionnum').innerHTML = tip_num;
tip_table.style.display = 'block';
var newtr = tip_table.insertRow(tip_tablerows);
newtr.className = 'toclass';
newtr.style.display = 'none';
} else {
color = 'green';
security_num++;
$('securityoptionnum').innerHTML = security_num;
security_table.style.display = 'block';
var newtr = security_table.insertRow(security_tablerows);
newtr.className = 'soclass';
newtr.style.display = 'none';
}
var statusstr = '';
if(status != 0) {
if(type == 'header') {
statusstr = '<a class="btn" href="$adminscipt?action=optimizer&operation=optimize_unit&anchor={$_GET['anchor']}&type='+ optiontype + extraurl + '" target="_blank">{$lang['founder_optimizer_optimizer']}</a>';
} else if(type == 'view') {
statusstr = '<a class="btn" href="$adminscipt?action=optimizer&operation=optimize_unit&anchor={$_GET['anchor']}&type='+ optiontype + extraurl + '" target="_blank">{$lang['founder_optimizer_view']}</a>';
} else if(type == 'scan') {
statusstr = '<a class="btn" href="$adminscipt?action=optimizer&operation=optimize_unit&anchor={$_GET['anchor']}&type='+ optiontype + extraurl + '" target="_blank">{$lang['founder_optimizer_scan']}</a>';
}
}
newtr.insertCell(0).innerHTML = $(id + '_unit').innerHTML;
newtr.insertCell(1).innerHTML = msg;
newtr.insertCell(2).innerHTML = statusstr;
if(parseInt(checkpercent) >= 100) {
$('checking').innerHTML = '{$lang['founder_optimizer_recheck_js']}';
$('checking').href = '{$adminscipt}?action=optimizer&checking=1&anchor={$_GET['anchor']}';
$('processid').style.display = 'none';
if('{$_GET['anchor']}' == 'security') {
if(securitygrade == '') {
if(optimize_num <= 1) {
securitygrade = '{$lang['founder_optimizer_high']}';
} else if(optimize_num >=2 && optimize_num <=4) {
securitygrade = '{$lang['founder_optimizer_middle']}';
} else {
securitygrade = '{$lang['founder_optimizer_low']}';
}
}
$('checkstatus').innerHTML = '{$lang['founder_optimizer_check_complete_js']}' + checknum + '{$lang['founder_optimizer_findnum']}' + optimize_num + '{$lang['founder_optimizer_neednum']}' + ' {$lang['founder_optimizer_level']}: <span style="color:green;font-size:16px;font-weight:700;">' + securitygrade + '</span>';
} else {
$('checkstatus').innerHTML = '{$lang['founder_optimizer_check_complete_js']}' + checknum + '{$lang['founder_optimizer_findnum']}' + optimize_num + '{$lang['founder_optimizer_neednum']}';
}
}
}
function showoptions(obj, option) {
var o = $C(option);
var isopen = 0;
if(obj.innerHTML == '[-]') {
isoepn = 0;
obj.innerHTML = '[+]';
} else {
isopen = 1;
obj.innerHTML = '[-]';
}
for(var i=0; i<o.length; i++) {
if(isopen == 1) {
o[i].style.display = '';
} else {
o[i].style.display = 'none';
}
}
}
function showlistmore(btnid, classname) {
var btn = $(btnid);
var o = $C(classname);
btn.style.display = 'none';
for(var i=0; i<o.length; i++) {
o[i].style.display = 'block';
}
}
</script>
END;
echo '<table class="tb tb2" style="margin-top:0;">';
foreach($optimizer_option as $option) {
echo '<tr class="hover" id="progress_'.$option.'_tr">';
echo '<td width="200"><div id="progress_'.$option.'_unit">'.$lang['optimizer_check_unit_'.$option].'</td>';
echo '<td width="350"><div id="progress_'.$option.'">'.$lang['founder_optimizer_checking'].'...</div></td><script type="text/javascript">ajaxget(\''.ADMINSCRIPT.'?action=optimizer&operation=check_unit&type='.$option.'&anchor='.$_GET['anchor'].'\', \'progress_'.$option.'\', \'\', \'\', \'\', updatecheckpercent)</script>';
echo '<td><div id="progress_'.$option.'_status"></div></td>';
echo '</tr>';
}
echo '</table>';
echo '<table id="optimizerable" class="tb tb2" style="margin-top:0;display:none;">';
echo '<tr><td width="300" style="color:red;font-weight:700;"><a href="javascript:;" onclick="showoptions(this, \'ooclass\')">[-]</a> '.$lang['founder_optimizer_needopti'].'(<span id="optimizerablenum"></span>)</td><td width="350"></td><td width="100"></td></tr>';
echo '</table>';
echo '<table id="securityoption" class="tb tb2" style="margin-top:0;display:none;">';
echo '<tr><td width="300" style="color:green;font-weight:700;"><a href="javascript:;" onclick="showoptions(this, \'soclass\')">[+]</a> '.$lang['founder_optimizer_safe'].'(<span id="securityoptionnum"></span>)</td><td width="350"></td><td width="100"></td></tr>';
echo '</table>';
echo '<table id="tipoption" class="tb tb2" style="margin-top:0;display:none;">';
echo '<tr><td width="300" style="color:blue;font-weight:700;"><a href="javascript:;" onclick="showoptions(this, \'toclass\')">[+]</a> '.$lang['founder_optimizer_notice'].'(<span id="tipoptionnum"></span>)</td><td width="350"></td><td width="100"></td></tr>';
echo '</table>';
}
showboxfooter();
}
?>

View File

@@ -0,0 +1,55 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_perm.php 22528 2011-05-11 05:43:55Z monkey $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
array_splice($menu['global'], 4, 0, array(
array('setting_memory', 'setting_memory'),
array('setting_serveropti', 'setting_serveropti'),
));
array_splice($menu['global'], 9, 0, array(
array('founder_perm_credits', 'credits'),
));
array_splice($menu['style'], 8, 0, array(
array('setting_editor_code', 'misc_bbcode'),
));
array_splice($menu['user'], 1, 0, array(
array('founder_perm_members_group', 'members_group'),
array('founder_perm_members_access', 'members_access'),
array('founder_perm_members_credit', 'members_credit'),
array('founder_perm_members_medal', 'members_medal'),
array('founder_perm_members_repeat', 'members_repeat'),
array('founder_perm_members_clean', 'members_clean'),
array('founder_perm_members_edit', 'members_edit'),
));
array_splice($menu['group'], 1, 0, array(
array('founder_perm_group_editgroup', 'group_editgroup'),
array('founder_perm_group_deletegroup', 'group_deletegroup'),
));
array_splice($menu['extended'], 4, 0, array(
array('founder_perm_members_confermedal', 'members_confermedal'),
));
array_splice($menu['extended'], 7, 0, array(
array('founder_perm_ec_qpay', 'ec_qpay'),
array('founder_perm_ec_wechat', 'ec_wechat'),
array('founder_perm_ec_alipay', 'ec_alipay'),
array('founder_perm_ec_credit', 'ec_credit'),
array('founder_perm_ec_orders', 'ec_orders'),
array('founder_perm_tradelog', 'tradelog'),
));
?>

View File

@@ -0,0 +1,252 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_pic.php 28299 2012-02-27 08:48:36Z svn_project_zhangjie $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
$detail = $_GET['detail'];
$albumid = $_GET['albumid'];
$users = $_GET['users'];
$picid = $_GET['picid'];
$postip = $_GET['postip'];
$hot1 = $_GET['hot1'];
$hot2 = $_GET['hot2'];
$starttime = $_GET['starttime'];
$endtime = $_GET['endtime'];
$searchsubmit = $_GET['searchsubmit'];
$picids = $_GET['picids'];
$title = $_GET['title'];
$orderby = $_GET['orderby'];
$ordersc = $_GET['ordersc'];
$fromumanage = $_GET['fromumanage'] ? 1 : 0;
$muticondition = '';
$muticondition .= $albumid ? '&albumid='.$albumid : '';
$muticondition .= $users ? '&users='.$users : '';
$muticondition .= $picid ? '&picid='.$picid : '';
$muticondition .= $postip ? '&postip='.$postip : '';
$muticondition .= $hot1 ? '&hot1='.$hot1 : '';
$muticondition .= $hot2 ? '&hot2='.$hot2 : '';
$muticondition .= $starttime ? '&starttime='.$starttime : '';
$muticondition .= $endtime ? '&endtime='.$endtime : '';
$muticondition .= $title ? '&title='.$title : '';
$muticondition .= $orderby ? '&orderby='.$orderby : '';
$muticondition .= $ordersc ? '&ordersc='.$ordersc : '';
$muticondition .= $fromumanage ? '&fromumanage='.$fromumanage : '';
$muticondition .= $searchsubmit ? '&searchsubmit='.$searchsubmit : '';
$muticondition .= $_GET['search'] ? '&search='.$_GET['search'] : '';
$muticondition .= $detail ? '&detail='.$detail : '';
cpheader();
if(!submitcheck('picsubmit')) {
if(empty($_GET['search'])) {
$newlist = 1;
$detail = 1;
}
if($fromumanage) {
$starttime = !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $starttime) ? '' : $starttime;
$endtime = $_G['adminid'] == 3 || !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $endtime) ? '' : $endtime;
} else {
$starttime = !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $starttime) ? dgmdate(TIMESTAMP - 86400 * 7, 'Y-n-j') : $starttime;
$endtime = $_G['adminid'] == 3 || !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $endtime) ? dgmdate(TIMESTAMP, 'Y-n-j') : $endtime;
}
shownav('topic', 'nav_pic');
showsubmenu('nav_pic', array(
array('newlist', 'pic', !empty($newlist)),
array('search', 'pic&search=true', empty($newlist)),
));
empty($newlist) && showsubmenusteps('', array(
array('pic_search', !$searchsubmit),
array('nav_pic', $searchsubmit)
));
if($muticondition) {
showtips('pic_tips');
}
$staticurl = STATICURL;
echo <<<EOT
<script type="text/javascript" src="{$staticurl}js/calendar.js"></script>
<script type="text/JavaScript">
function page(number) {
$('picforum').page.value=number;
$('picforum').searchsubmit.click();
}
</script>
EOT;
showtagheader('div', 'searchposts', !$searchsubmit && empty($newlist));
showformheader("pic".(!empty($_GET['search']) ? '&search=true' : ''), '', 'picforum');
showhiddenfields(array('page' => $page, 'pp' => $_GET['pp'] ? $_GET['pp'] : $_GET['perpage']));
showtableheader();
showsetting('pic_search_detail', 'detail', $detail, 'radio');
showsetting('pic_search_perpage', '', $_GET['perpage'], "<select name='perpage'><option value='20'>{$lang['perpage_20']}</option><option value='50'>{$lang['perpage_50']}</option><option value='100'>{$lang['perpage_100']}</option></select>");
showsetting('resultsort', '', $orderby, "<select name='orderby'><option value=''>{$lang['defaultsort']}</option><option value='dateline'>{$lang['pic_search_createtime']}</option><option value='size'>{$lang['pic_size']}</option><option value='hot'>{$lang['pic_search_hot']}</option></select> ");
showsetting('', '', $ordersc, "<select name='ordersc'><option value='desc'>{$lang['orderdesc']}</option><option value='asc'>{$lang['orderasc']}</option></select>", '', 0, '', '', '', true);
showsetting('pic_search_albumid', 'albumid', $albumid, 'text');
showsetting('pic_search_user', 'users', $users, 'text');
showsetting('pic_search_picid', 'picid', $picid, 'text');
showsetting('pic_search_title', 'title', $title, 'text');
showsetting('pic_search_ip', 'postip', $postip, 'text');
showsetting('pic_search_hot', array('hot1', 'hot2'), array('', ''), 'range');
showsetting('pic_search_time', array('starttime', 'endtime'), array($starttime, $endtime), 'daterange');
echo '<input type="hidden" name="fromumanage" value="'.$fromumanage.'">';
showsubmit('searchsubmit');
showtablefooter();
showformfooter();
showtagfooter('div');
} else {
$picids = authcode($picids, 'DECODE');
$picidsadd = $picids ? explode(',', $picids) : $_GET['delete'];
include_once libfile('function/delete');
$deletecount = count(deletepics($picidsadd));
$cpmsg = cplang('pic_succeed', array('deletecount' => $deletecount));
?>
<script type="text/JavaScript">alert('<?php echo $cpmsg;?>');parent.$('picforum').searchsubmit.click();</script>
<?php
}
if(submitcheck('searchsubmit', 1) || $newlist) {
$picids = $piccount = '0';
$sql = $error = '';
$users = trim($users);
if($starttime != '') {
$starttime = strtotime($starttime);
$sql .= ' AND p.'.DB::field('dateline', $starttime, '>');
}
if($_G['adminid'] == 1 && $endtime != dgmdate(TIMESTAMP, 'Y-n-j')) {
if($endtime != '') {
$endtime = strtotime($endtime);
$sql .= ' AND p.'.DB::field('dateline', $endtime, '<');
}
} else {
$endtime = TIMESTAMP;
}
if($picid !='') {
$picids = '-1';
$picidsarr = array('-1');
$query = C::t('home_pic')->fetch_all(explode(',', str_replace(' ', '', $picid)));
foreach($query as $arr) {
$picids .=",{$arr['picid']}";
$picidsarr[] = $arr['picid'];
}
$sql .= ' AND p.'.DB::field('picid', $picidsarr);
}
if($albumid !='') {
$albumids = '-1';
$albumidsarr = array('-1');
$query = C::t('home_album')->fetch_all_album(explode(',', $albumid));
foreach($query as $arr) {
$albumids .=",{$arr['albumid']}";
$albumidsarr[] = $arr['albumid'];
}
$sql .= ' AND p.'.DB::field('albumid', $albumidsarr);
}
if($users != '') {
$uids = '-1';
$uidsarr = array('-1');
$query = C::t('home_album')->fetch_uid_by_username(explode(',', $users));
foreach($query as $arr) {
$uids .= ",{$arr['uid']}";
$uidsarr[] = $arr['uid'];
}
$sql .= ' AND p.'.DB::field('uid', $uidsarr);
}
if($postip != '') {
$sql .= ' AND p.'.DB::field('postip', str_replace('*', '%', $postip), 'like');
}
$sql .= $hot1 ? ' AND p.'.DB::field('hot', $hot1, '>=') : '';
$sql .= $hot2 ? ' AND p.'.DB::field('hot', $hot2, '<=') : '';
$sql .= $title ? ' AND p.'.DB::field('title', '%'.$title.'%', 'like') : '';
$orderby = $orderby ? $orderby : 'dateline';
$ordersc = $ordersc ? "$ordersc" : 'DESC';
if(($_G['adminid'] == 2 && $endtime - $starttime > 86400 * 16) || ($_G['adminid'] == 3 && $endtime - $starttime > 86400 * 8)) {
$error = 'pic_mod_range_illegal';
}
if(!$error) {
if($detail) {
$_GET['perpage'] = intval($_GET['perpage']) < 1 ? 20 : intval($_GET['perpage']);
$perpage = $_GET['pp'] ? $_GET['pp'] : $_GET['perpage'];
$query = C::t('home_pic')->fetch_all_by_sql('1 '.$sql, 'p.'.DB::order($orderby, $ordersc), (($page - 1) * $perpage), $perpage);
$pics = '';
include_once libfile('function/home');
foreach($query as $pic) {
$pic['dateline'] = dgmdate($pic['dateline']);
$pic['pic'] = pic_get($pic['filepath'], 'album', $pic['thumb'], $pic['remote']);
$pic['albumname'] = empty($pic['albumname']) && empty($pic['albumid']) ? $lang['album_default'] : $pic['albumname'];
$pic['albumid'] = empty($pic['albumid']) ? -1 : $pic['albumid'];
$pics .= showtablerow('', '', array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"{$pic['picid']}\" />",
"<a href='home.php?mod=space&uid={$pic['uid']}&do=album&picid={$pic['picid']}' target='_blank'><img src='{$pic['pic']}'/></a>",
$pic['size'],
"<a href='home.php?mod=space&uid={$pic['uid']}&do=album&id={$pic['albumid']}' target='_blank'>{$pic['albumname']}</a>",
"<a href=\"home.php?mod=space&uid={$pic['uid']}\" target=\"_blank\">".$pic['username']."</a>",
$pic['dateline'], "<a href=\"".ADMINSCRIPT."?action=comment&detail=1&searchsubmit=1&idtype=picid&id={$pic['picid']}\">".$lang['pic_comment']."</a>"
), TRUE);
}
$piccount = C::t('home_pic')->fetch_all_by_sql('1 '.$sql, '', 0, 0, 1);
$multi = multi($piccount, $perpage, $page, ADMINSCRIPT."?action=pic$muticondition");
} else {
$piccount = 0;
$query = C::t('home_pic')->fetch_all_by_sql('1 '.$sql, '', 0, 0, 0, 0);
foreach($query as $pic) {
$picids .= ','.$pic['picid'];
$piccount++;
}
$multi = '';
}
if(!$piccount) {
$error = 'pic_post_nonexistence';
}
}
showtagheader('div', 'postlist', $searchsubmit || $newlist);
showformheader('pic&frame=no', 'target="picframe"');
showhiddenfields(array('picids' => authcode($picids, 'ENCODE')));
if(!$muticondition) {
showtableheader(cplang('pic_new_result').' '.$piccount, 'fixpadding');
} else {
showtableheader(cplang('pic_result').' '.$piccount.(empty($newlist) ? ' <a href="###" onclick="$(\'searchposts\').style.display=\'\';$(\'postlist\').style.display=\'none\';$(\'picforum\').pp.value=\'\';$(\'picforum\').page.value=\'\';" class="act lightlink normal">'.cplang('research').'</a>' : ''), 'fixpadding');
}
if($error) {
echo "<tr><td class=\"lineheight\" colspan=\"15\">$lang[$error]</td></tr>";
} else {
if($detail) {
showsubtitle(array('', 'albumpic', 'pic_size', 'albumname', 'author', 'time', 'pic_comment'));
echo $pics;
}
}
showsubmit('picsubmit', 'delete', $detail ? 'del' : '', '', $multi);
showtablefooter();
showformfooter();
echo '<iframe name="picframe" style="display:none"></iframe>';
showtagfooter('div');
}
?>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,187 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_portalpermission.php 29236 2012-03-30 05:34:47Z chenmengshu $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
$ops = array('article', 'template', 'block');
$operation = in_array($operation, $ops, true) ? $operation : 'article';
$opdata = array();
foreach($ops as $op) {
$opdata[] = array('portalpermission_'.$op, 'portalpermission&operation='.$op, $op == $operation);
}
$line = '&minus;';
$right = '&radic;';
$adminscript = $mpurl = ADMINSCRIPT.'?action=portalpermission&operation='.$operation;
$permissions = $members = $uids = array();
shownav('portal', 'portalpermission');
showsubmenu('portalpermission', $opdata);
$_GET['ordersc'] = in_array($_GET['ordersc'], array('desc', 'asc'), true) ? $_GET['ordersc'] : 'desc';
$_GET['uid'] = dintval($_GET['uid']);
if(($_GET['uid'] = $_GET['uid'] ? $_GET['uid'] : '')) {
$mpurl .= '&uid='.$_GET['uid'];
} elseif($_GET['username']) {
$uids = array_keys(C::t('common_member')->fetch_all_by_like_username($_GET['username']));
$uids = $uids ? $uids : array(0);
$mpurl .= '&username='.dhtmlspecialchars($_GET['username']);
}
if($_GET['inherited']) {
$inherited = ' checked';
$mpurl .= '&inherited=1';
}
$ordersc = array($_GET['ordersc']=>' selected');
$perpage = in_array($_GET['perpage'], array(10,20,50,100)) ? $_GET['perpage'] : 20;
$start = ($page-1)*$perpage;
$perpages = array($perpage => ' selected');
$searchlang = array();
$keys = array('search', 'resultsort', 'orderdesc', 'orderasc', 'perpage_10', 'perpage_20', 'perpage_50', 'perpage_100', 'likesupport',
'uid', 'username', 'portalpermission_no_inherited');
foreach ($keys as $key) {
$searchlang[$key] = cplang($key);
}
echo <<<SEARCH
<form method="get" autocomplete="off" action="$adminscript" id="tb_search">
<table class="tb tb2" cellspacing="3" cellpadding="3">
<tr>
<th>{$searchlang['uid']}</th><td><input type="text" class="txt" name="uid" value="{$_GET['uid']}"></td>
<th>{$searchlang['username']}*</th><td><input type="text" class="txt" name="username" value="{$_GET['username']}"> *{$searchlang['likesupport']}</td>
</tr>
<tr>
<th>{$searchlang['resultsort']}</th>
<td>
<select name="ordersc">
<option value="desc"{$ordersc['desc']}>{$searchlang['orderdesc']}</option>
<option value="asc"{$ordersc['asc']}>{$searchlang['orderasc']}</option>
</select>
<select name="perpage">
<option value="10"{$perpages[10]}>{$searchlang['perpage_10']}</option>
<option value="20"{$perpages[20]}>{$searchlang['perpage_20']}</option>
<option value="50"{$perpages[50]}>{$searchlang['perpage_50']}</option>
<option value="100"{$perpages[100]}>{$searchlang['perpage_100']}</option>
</select>
</td>
<th><label for="inherited">{$searchlang['portalpermission_no_inherited']}</label></th>
<td>
<input type="checkbox" value=1 name="inherited" id="inherited" $inherited/>
<input type="hidden" name="action" value="portalpermission">
<input type="hidden" name="operation" value="$operation">
<input type="submit" name="searchsubmit" value="{$searchlang['search']}" class="btn">
</td>
</tr>
</table>
</form>
SEARCH;
showformheader('portalpermission&operation='.$operation);
showtableheader('portalpermission');
if($operation == 'article') {
showsubtitle(array('username', 'portalcategory', 'portalcategory_perm_publish', 'portalcategory_perm_manage', 'block_perm_inherited'));
showtagheader('tbody', '', true);
loadcache('portalcategory');
$wherearr = array();
if(($where = $_GET['uid'] ? 'uid='.$_GET['uid'] : ($uids ? 'uid IN('.dimplode($uids).')' : ''))) {
$wherearr[] = $where;
}
if($inherited) {
$wherearr[] = 'inheritedcatid = \'\'';
}
$wheresql = $wherearr ? ' WHERE '.implode(' AND ', $wherearr) : '';
$uids = $_GET['uid'] ? array($_GET['uid']) : $uids;
$count = C::t('portal_category_permission')->count_by_uids($uids, !$inherited);
if($count) {
$permissions = C::t('portal_category_permission')->fetch_all_by_uid($uids, !$inherited, $_GET['ordersc'], $start, $perpage);
foreach($permissions as $value) {
$uids[$value['uid']] = $value['uid'];
}
if(empty($members)) $members = C::t('common_member')->fetch_all($uids);
$multipage = multi($count, $perpage, $page, $mpurl.'&perpage='.$perpage);
foreach($permissions as $value){
showtablerow('', '', array(
$members[$value['uid']]['username'],
'<a href="'.ADMINSCRIPT.'?action=portalcategory&operation=perm&catid='.$value['catid'].'">'.$_G['cache']['portalcategory'][$value['catid']]['catname'].'</a>',
$value['allowpublish'] ? $right : $line,
$value['allowmanage'] ? $right : $line,
$value['inheritedcatid'] ? '<a href="'.ADMINSCRIPT.'?action=portalcategory&operation=perm&catid='.$value['inheritedcatid'].'">'.$_G['cache']['portalcategory'][$value['inheritedcatid']]['catname'].'</a>' : $line,
));
}
echo '<tr><td colspan="6">'.$multipage.'</td></tr>';
}
showtagfooter('tbody');
} elseif ($operation == 'template') {
showsubtitle(array('username', 'diytemplate_name', 'block_perm_manage', 'block_perm_recommend', 'block_perm_needverify', 'block_perm_inherited'));
showtagheader('tbody', '', true);
loadcache('diytemplatename');
$uids = $_GET['uid'] ? array($_GET['uid']) : $uids;
$count = C::t('common_template_permission')->count_by_uids($uids, !$inherited);
if($count) {
$permissions = C::t('common_template_permission')->fetch_all_by_uid($uids, !$inherited, $_GET['ordersc'], $start, $perpage);
foreach($permissions as $value) {
$uids[$value['uid']] = $value['uid'];
}
if(empty($members)) $members = C::t('common_member')->fetch_all($uids);
$multipage = multi($count, $perpage, $page, $mpurl.'&perpage='.$perpage);
foreach($permissions as $value){
$targettplname = $_G['cache']['diytemplatename'][$value['targettplname']];
showtablerow('', '', array(
$members[$value['uid']]['username'],
'<a href="'.ADMINSCRIPT.'?action=diytemplate&operation=perm&targettplname='.$value['targettplname'].'">'.$targettplname.'</a>',
$value['allowmanage'] ? $right : $line,
$value['allowrecommend'] ? $right : $line,
$value['needverify'] ? $right : $line,
$value['inheritedtplname'] ? '<a href="'.ADMINSCRIPT.'?action=diytemplate&operation=perm&targettplname='.$value['inheritedtplname'].'">'.$_G['cache']['diytemplatename'][$value['inheritedtplname']].'</a>' : $line,
));
}
echo '<tr><td colspan="6">'.$multipage.'</td></tr>';
}
showtagfooter('tbody');
} elseif ($operation == 'block') {
showsubtitle(array('username', 'block_name', 'block_perm_manage', 'block_perm_recommend', 'block_perm_needverify', 'block_perm_inherited'));
showtagheader('tbody', '', true);
loadcache('diytemplatename');
$uids = $_GET['uid'] ? array($_GET['uid']) : $uids;
if(($count = C::t('common_block_permission')->count_by_uids($uids, !$inherited))) {
$blocks = $bids = array();
$permissions = C::t('common_block_permission')->fetch_all_by_uid($uids, !$inherited, $_GET['ordersc'], $start, $perpage);
foreach($permissions as $value) {
$uids[$value['uid']] = $value['uid'];
$bids[$value['bid']] = $value['bid'];
}
if($bids) $blocks = C::t('common_block')->fetch_all($bids);
if(empty($members)) $members = C::t('common_member')->fetch_all($uids);
$multipage = multi($count, $perpage, $page, $mpurl.'&perpage='.$perpage);
foreach($permissions as $value){
$blockname = $blocks[$value['bid']]['name'] ? $blocks[$value['bid']]['name'] : $value['bid'];
showtablerow('', '', array(
$members[$value['uid']]['username'],
'<a href="'.ADMINSCRIPT.'?action=block&operation=perm&bid='.$value['bid'].'">'.$blockname.'</a>',
$value['allowmanage'] ? $right : $line,
$value['allowrecommend'] ? $right : $line,
$value['needverify'] ? $right : $line,
$value['inheritedtplname'] ? '<a href="'.ADMINSCRIPT.'?action=diytemplate&operation=perm&targettplname='.$value['inheritedtplname'].'">'.$_G['cache']['diytemplatename'][$value['inheritedtplname']].'</a>' : $line,
));
}
echo '<tr><td colspan="6">'.$multipage.'</td></tr>';
}
showtagfooter('tbody');
}
showtablefooter();
showformfooter();
?>

View File

@@ -0,0 +1,192 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_postcomment.php 25832 2011-11-24 01:11:51Z monkey $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
$detail = !empty($_GET['authorid']) ? true : $_GET['detail'];
$author = $_GET['author'];
$authorid = $_GET['authorid'];
$uid = $_GET['uid'];
$message = $_GET['message'];
$ip = $_GET['ip'];
$users = $_GET['users'];
$starttime = $_GET['starttime'];
$endtime = $_GET['endtime'];
$searchtid = $_GET['searchtid'];
$searchpid = $_GET['searchpid'];
$searchsubmit = $_GET['searchsubmit'];
$cids = $_GET['cids'];
$page = max(1, $_GET['page']);
cpheader();
$aid = $_GET['aid'];
$subject = $_GET['subject'];
if(!submitcheck('postcommentsubmit')) {
if(empty($_GET['search'])) {
$newlist = 1;
$detail = 1;
$starttime = dgmdate(TIMESTAMP - 86400 * 7, 'Y-n-j');
}
$starttime = !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $starttime) ? dgmdate(TIMESTAMP - 86400 * 7, 'Y-n-j') : $starttime;
$endtime = $_G['adminid'] == 3 || !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $endtime) ? dgmdate(TIMESTAMP, 'Y-n-j') : $endtime;
shownav('topic', 'nav_postcomment');
showsubmenu('nav_postcomment', array(
array('newlist', 'postcomment', !empty($newlist)),
array('search', 'postcomment&search=true', empty($newlist)),
));
empty($newlist) && showsubmenusteps('', array(
array('postcomment_search', !$searchsubmit),
array('nav_postcomment', $searchsubmit)
));
if(empty($newlist)) {
$search_tips = 1;
showtips('postcomment_tips');
}
$staticurl = STATICURL;
echo <<<EOT
<script type="text/javascript" src="{$staticurl}js/calendar.js"></script>
<script type="text/JavaScript">
function page(number) {
$('postcommentforum').page.value=number;
$('postcommentforum').searchsubmit.click();
}
</script>
EOT;
showtagheader('div', 'searchposts', !$searchsubmit && empty($newlist));
showformheader("postcomment".(!empty($_GET['search']) ? '&search=true' : ''), '', 'postcommentforum');
showhiddenfields(array('page' => $page, 'pp' => $_GET['pp'] ? $_GET['pp'] : $_GET['perpage']));
showtableheader();
showsetting('postcomment_search_detail', 'detail', $detail, 'radio');
showsetting('comment_search_perpage', '', $_GET['perpage'], "<select name='perpage'><option value='20'>{$lang['perpage_20']}</option><option value='50'>{$lang['perpage_50']}</option><option value='100'>{$lang['perpage_100']}</option></select>");
showsetting('postcomment_content', 'message', $message, 'text');
showsetting('postcomment_search_tid', 'searchtid', $searchtid, 'text');
showsetting('postcomment_search_pid', 'searchpid', $searchpid, 'text');
showsetting('postcomment_search_author', 'author', $author, 'text');
showsetting('postcomment_search_authorid', 'authorid', $authorid, 'text');
showsetting('comment_search_ip', 'ip', $ip, 'text');
showsetting('postcomment_search_time', array('starttime', 'endtime'), array($starttime, $endtime), 'daterange');
showsubmit('searchsubmit');
showtablefooter();
showformfooter();
showtagfooter('div');
} else {
$cids = authcode($cids, 'DECODE');
$cidsadd = $cids ? explode(',', $cids) : $_GET['delete'];
$pids = array();
foreach(C::t('forum_postcomment')->fetch_all($cidsadd) as $postcomment) {
$pids[$postcomment['pid']] = $postcomment['pid'];
}
C::t('forum_postcache')->delete($pids);
$cidsadd && C::t('forum_postcomment')->delete($cidsadd);
$cpmsg = cplang('postcomment_delete');
?>
<script type="text/JavaScript">alert('<?php echo $cpmsg;?>');parent.$('postcommentforum').searchsubmit.click();</script>
<?php
}
if(submitcheck('searchsubmit') || $newlist) {
$comments = $commentcount = '0';
$sql = $error = '';
$author = trim($author);
if($author != '') {
$authorids = C::t('common_member')->fetch_all_uid_by_username(array_map('trim', explode(',', $author)));
$authorid = ($authorid ? $authorid.',' : '').implode(',',$authorids);
}
$authorid = trim($authorid,', ');
if($starttime != '0') {
$starttime = strtotime($starttime);
}
if($_G['adminid'] == 1 && $endtime != dgmdate(TIMESTAMP, 'Y-n-j')) {
if($endtime != '0') {
$endtime = strtotime($endtime);
}
} else {
$endtime = TIMESTAMP;
}
if(($_G['adminid'] == 2 && $endtime - $starttime > 86400 * 16) || ($_G['adminid'] == 3 && $endtime - $starttime > 86400 * 8)) {
$error = 'comment_mod_range_illegal';
}
if(!$error) {
if($detail) {
$commentcount = C::t('forum_postcomment')->count_by_search($searchtid, $searchpid, ($authorid ? explode(',', str_replace(' ', '', $authorid)) : null), $starttime, $endtime, $ip, $message);
if($commentcount) {
$_GET['perpage'] = intval($_GET['perpage']) < 1 ? 20 : intval($_GET['perpage']);
$perpage = $_GET['pp'] ? $_GET['pp'] : $_GET['perpage'];
$comments = '';
foreach(C::t('forum_postcomment')->fetch_all_by_search($searchtid, $searchpid, ($authorid ? explode(',', str_replace(' ', '', $authorid)) : null), $starttime, $endtime, $ip, $message, (($page - 1) * $perpage), $perpage) as $comment) {
$comment['dateline'] = dgmdate($comment['dateline']);
$comments .= showtablerow('', '', array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"{$comment['id']}\" />",
str_replace(array('[b]', '[/b]', '[/color]'), array('<b>', '</b>', '</font>'), preg_replace("/\[color=([#\w]+?)\]/i", "<font color=\"\\1\">", $comment['comment'])),
($comment['author'] ? "<a href=\"home.php?mod=space&uid={$comment['authorid']}\" target=\"_blank\">".$comment['author']."</a>" : cplang('postcomment_guest')),
$comment['dateline'],
$comment['useip'],
"<a href=\"forum.php?mod=redirect&goto=findpost&ptid={$comment['tid']}&pid={$comment['pid']}\" target=\"_blank\">".cplang('postcomment_pid')."</a>"
), TRUE);
}
$multi = multi($commentcount, $perpage, $page, ADMINSCRIPT."?action=postcomment");
$multi = preg_replace("/href=\"".ADMINSCRIPT."\?action=postcomment&amp;page=(\d+)\"/", "href=\"javascript:page(\\1)\"", $multi);
$multi = str_replace("window.location='".ADMINSCRIPT."?action=postcomment&amp;page='+this.value", "page(this.value)", $multi);
} else {
$error = 'postcomment_nonexistence';
}
} else {
$commentcount = 0;
foreach(C::t('forum_postcomment')->fetch_all_by_search($searchtid, $searchpid, ($authorid ? explode(',', str_replace(' ', '', $authorid)) : null), $starttime, $endtime, $ip, $message) as $row) {
$cids .= ','.$row['id'];
$commentcount++;
}
$multi = '';
}
}
showtagheader('div', 'postlist', $searchsubmit || $newlist);
showformheader('postcomment&frame=no', 'target="postcommentframe"');
showhiddenfields(array('cids' => authcode($cids, 'ENCODE')));
if(!$search_tips) {
showtableheader(cplang('postcomment_new_result').' '.$commentcount, 'fixpadding');
} else {
showtableheader(cplang('postcomment_result').' '.$commentcount.(empty($newlist) ? ' <a href="###" onclick="$(\'searchposts\').style.display=\'\';$(\'postlist\').style.display=\'none\';$(\'postcommentforum\').pp.value=\'\';$(\'postcommentforum\').page.value=\'\';" class="act lightlink normal">'.cplang('research').'</a>' : ''), 'fixpadding');
}
if($error) {
echo "<tr><td class=\"lineheight\" colspan=\"15\">$lang[$error]</td></tr>";
} elseif($detail) {
showsubtitle(array('', 'postcomment_content', 'author', 'time', 'ip' ,''));
echo $comments;
}
showsubmit('postcommentsubmit', 'delete', $detail ? 'del' : '', '', $multi);
showtablefooter();
showformfooter();
echo '<iframe name="postcommentframe" style="display:none"></iframe>';
showtagfooter('div');
}
?>

View File

@@ -0,0 +1,365 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_postsplit.php 33060 2013-04-16 09:00:06Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
define('IN_DEBUG', false);
@set_time_limit(0);
define('MAX_POSTS_MOVE', 100000);
cpheader();
$topicperpage = 50;
if(empty($operation)) {
$operation = 'manage';
}
$setting = C::t('common_setting')->fetch_all_setting(array('posttable_info', 'posttableids', 'threadtableids'), true);
if($setting['posttable_info']) {
$posttable_info = $setting['posttable_info'];
} else {
$posttable_info = array();
$posttable_info[0]['type'] = 'primary';
}
$posttableids = $setting['posttableids'] ? $setting['posttableids'] : array();
$threadtableids = $setting['threadtableids'];
if($operation == 'manage') {
shownav('founder', 'nav_postsplit');
if(!submitcheck('postsplit_manage')) {
showsubmenu('nav_postsplit_manage');
showtips('postsplit_manage_tips');
showformheader('postsplit&operation=manage');
showtableheader();
showsubtitle(array('postsplit_manage_tablename', 'postsplit_manage_datalength', 'postsplit_manage_table_memo', ''));
$tablename = C::t('forum_post')->getposttable(0, true);
$tableid = 0;
$tablestatus = helper_dbtool::gettablestatus($tablename);
$postcount = $tablestatus['Rows'];
$data_length = $tablestatus['Data_length'];
$index_length = $tablestatus['Index_length'];
$opstr = '<a href="'.ADMINSCRIPT.'?action=postsplit&operation=split&tableid=0">'.cplang('postsplit_name').'</a>';
showtablerow('', array('', '', '', 'class="td25"'), array($tablename, $data_length, "<input type=\"text\" class=\"txt\" name=\"memo[0]\" value=\"{$posttable_info[0]['memo']}\" />", $opstr));
foreach(C::t('forum_post')->show_table() as $table) {
$tablename = current($table);
$tableid = gettableid($tablename);
if(!preg_match('/^\d+$/', $tableid)) {
continue;
}
$tablestatus = helper_dbtool::gettablestatus($tablename);
$opstr = '<a href="'.ADMINSCRIPT.'?action=postsplit&operation=split&tableid='.$tableid.'">'.cplang('postsplit_name').'</a>';
showtablerow('', array('', '', '', 'class="td25"'), array($tablename, $tablestatus['Data_length'], "<input type=\"text\" class=\"txt\" name=\"memo[$tableid]\" value=\"{$posttable_info[$tableid]['memo']}\" />", $opstr));
}
showsubmit('postsplit_manage', 'postsplit_manage_update_memo_submit');
showtablefooter();
showformfooter();
} else {
$posttable_info = array();
foreach($_GET['memo'] as $key => $value) {
$key = intval($key);
$posttable_info[$key]['memo'] = dhtmlspecialchars($value);
}
C::t('common_setting')->update_setting('posttable_info', $posttable_info);
savecache('posttable_info', $posttable_info);
update_posttableids();
updatecache('setting');
cpmsg('postsplit_table_memo_update_succeed', 'action=postsplit&operation=manage', 'succeed');
}
} elseif($operation == 'split') {
if(!$_G['setting']['bbclosed']) {
cpmsg('postsplit_forum_must_be_closed', 'action=postsplit&operation=manage', 'error');
}
$tableid = intval($_GET['tableid']);
$tablename = getposttable($tableid);
if($tableid && $tablename != 'forum_post' || !$tableid) {
$status = helper_dbtool::gettablestatus(getposttable($tableid, true), false);
$allowsplit = false;
if($status && ((!$tableid && $status['Data_length'] > 400 * 1048576) || ($tableid && $status['Data_length']))) {
if(!submitcheck('splitsubmit')) {
showsubmenu('nav_postsplit_manage');
showtips('postsplit_manage_tips');
showformheader('postsplit&operation=split&tableid='.$tableid);
showtableheader();
showsetting('postsplit_from', '', '', getposttable($tableid, true).(!empty($posttable_info[$tableid]['memo']) ? '('.$posttable_info[$tableid]['memo'].')' : ''));
$tablelist = '<option value="-1">'.cplang('postsplit_create').'</option>';
foreach($posttable_info as $tid => $info) {
if($tableid != $tid) {
$tablestatus = helper_dbtool::gettablestatus(getposttable($tid, true));
$tablelist .= '<option value="'.$tid.'">'.($info['memo'] ? $info['memo'] : 'forum_post'.($tid ? '_'.$tid : '')).'('.$tablestatus['Data_length'].')'.'</option>';
}
}
showsetting('postsplit_to', '', '', '<select onchange="if(this.value >= 0) {$(\'tableinfo\').style.display = \'none\';} else {$(\'tableinfo\').style.display = \'\';}" name="targettable">'.$tablelist.'</select>');
showtagheader('tbody', 'tableinfo', true, 'sub');
showsetting('postsplit_manage_table_memo', "memo", '', 'text');
showtagfooter('tbody');
$datasize = round($status['Data_length'] / 1048576);
$maxsize = round(($datasize - ($tableid ? 0 : 300)) / 100);
$maxi = $maxsize > 10 ? 10 : ($maxsize < 1 ? 1 : $maxsize);
for($i = 1; $i <= $maxi; $i++) {
$movesize = $i == 10 ? 1024 : $i * 100;
$maxsizestr .= '<option value="'.$movesize.'">'.($i == 10 ? sizecount($movesize * 1048576) : $movesize.'MB').'</option>';
}
showsetting('postsplit_move_size', '', '', '<select name="movesize">'.$maxsizestr.'</select>');
showsubmit('splitsubmit', 'postsplit_manage_submit');
showtablefooter();
showformfooter();
} else {
$targettable = intval($_GET['targettable']);
$createtable = false;
if($targettable == -1) {
$maxtableid = getmaxposttableid();
DB::query('SET SQL_QUOTE_SHOW_CREATE=0', 'SILENT');
$tableinfo = C::t('forum_post')->show_table_by_tableid(0);
$createsql = $tableinfo['Create Table'];
$targettable = $maxtableid + 1;
$newtable = 'forum_post_'.$targettable;
$createsql = str_replace(getposttable(), $newtable, $createsql);
DB::query($createsql);
$posttable_info[$targettable]['memo'] = $_GET['memo'];
C::t('common_setting')->update_setting('posttable_info', $posttable_info);
savecache('posttable_info', $posttable_info);
update_posttableids();
$createtable = true;
}
$sourcetablearr = gettablefields(getposttable($tableid));
$targettablearr = gettablefields(getposttable($targettable));
$fields = array_diff(array_keys($sourcetablearr), array_keys($targettablearr));
if(!empty($fields)) {
cpmsg('postsplit_do_error', '', '', array('tableid' => getposttable($targettable, true), 'fields' => implode(',', $fields)));
}
$movesize = intval($_GET['movesize']);
$movesize = $movesize >= 100 && $movesize <= 1024 ? $movesize : 100;
$targetstatus = helper_dbtool::gettablestatus(getposttable($targettable, true), false);
$hash = urlencode(authcode("$tableid\t$movesize\t$targettable\t{$targetstatus['Data_length']}", 'ENCODE'));
if($createtable) {
cpmsg('postsplit_table_create_succeed', 'action=postsplit&operation=movepost&fromtable='.$tableid.'&movesize='.$movesize.'&targettable='.$targettable.'&hash='.$hash, 'loadingform');
} else {
cpmsg('postsplit_finish', 'action=postsplit&operation=movepost&fromtable='.$tableid.'&movesize='.$movesize.'&targettable='.$targettable.'&hash='.$hash, 'loadingform');
}
}
} else {
cpmsg('postsplit_unallow', 'action=postsplit');
}
}
} elseif($operation == 'movepost') {
if(!$_G['setting']['bbclosed']) {
cpmsg('postsplit_forum_must_be_closed', 'action=postsplit&operation=manage', 'error');
}
list($tableid, $movesize, $targettableid, $sourcesize) = explode("\t", urldecode(authcode($_GET['hash'])));
$hash = urlencode($_GET['hash']);
if($tableid == $_GET['fromtable'] && $movesize == $_GET['movesize'] && $targettableid == $_GET['targettable']) {
$fromtableid = intval($_GET['fromtable']);
$movesize = intval($_GET['movesize']);
$targettableid = intval($_GET['targettable']);
$targettable = gettablefields(getposttable($targettableid));
$fieldstr = '`'.implode('`, `', array_keys($targettable)).'`';
loadcache('threadtableids');
$threadtableids = array(0);
if(!empty($_G['cache']['threadtableids'])) {
$threadtableids = array_merge($threadtableids, $_G['cache']['threadtableids']);
}
$tableindex = intval(!empty($_GET['tindex']) ? $_GET['tindex'] : 0);
if(isset($threadtableids[$tableindex])) {
if(!$fromtableid) {
$threadtableid = $threadtableids[$tableindex];
$count = C::t('forum_thread')->count_by_posttableid_displayorder($threadtableid);
if($count) {
$tids = array();
foreach(C::t('forum_thread')->fetch_all_by_posttableid_displayorder($threadtableid) as $tid => $thread) {
$tids[$tid] = $tid;
}
movedate($tids);
}
if($tableindex+1 < count($threadtableids)) {
$tableindex++;
$status = helper_dbtool::gettablestatus(getposttable($targettableid, true), false);
$targetsize = $sourcesize + $movesize * 1048576;
$nowdatasize = $targetsize - $status['Data_length'];
cpmsg('postsplit_doing', 'action=postsplit&operation=movepost&fromtable='.$tableid.'&movesize='.$movesize.'&targettable='.$targettableid.'&hash='.$hash.'&tindex='.$tableindex, 'loadingform', array('datalength' => sizecount($status['Data_length']), 'nowdatalength' => sizecount($nowdatasize)));
}
} else {
$count = C::t('forum_post')->count_by_first($fromtableid, 1);
if($count) {
$threads = C::t('forum_post')->fetch_all_tid_by_first($fromtableid, 1, 0, 1000);
$tids = array();
foreach($threads as $thread) {
$tids[$thread['tid']] = $thread['tid'];
}
movedate($tids);
} else {
cpmsg('postsplit_done', 'action=postsplit&operation=optimize&tableid='.$fromtableid, 'form');
}
}
}
} else {
cpmsg('postsplit_abnormal', 'action=postsplit', 'succeed');
}
} elseif($operation == 'optimize') {
if(!$_G['setting']['bbclosed']) {
cpmsg('postsplit_forum_must_be_closed', 'action=postsplit&operation=manage', 'error');
}
$fromtableid = intval($_GET['tableid']);
$optimize = true;
$tablename = getposttable($fromtableid);
if($fromtableid && $tablename != 'forum_post') {
$count = C::t('forum_post')->count_table($fromtableid);
if(!$count) {
C::t('forum_post')->drop_table($fromtableid);
unset($posttable_info[$fromtableid]);
C::t('common_setting')->update_setting('posttable_info', $posttable_info);
savecache('posttable_info', $posttable_info);
update_posttableids();
$optimize = false;
}
}
if($optimize) {
C::t('forum_post')->optimize_table($fromtableid);
}
cpmsg('postsplit_do_succeed', 'action=postsplit', 'succeed');
} elseif($operation == 'pidreset') {
loadcache('posttableids');
if(!empty($_G['cache']['posttableids'])) {
$posttableids = $_G['cache']['posttableids'];
} else {
$posttableids = array('0');
}
$pidmax = 0;
foreach($posttableids as $id) {
if($id == 0) {
$pidtmp = C::t('forum_post')->fetch_maxid(0);
} else {
$pidtmp = C::t('forum_post')->fetch_maxid($id);
}
if($pidtmp > $pidmax) {
$pidmax = $pidtmp;
}
}
$auto_increment = $pidmax + 1;
C::t('forum_post_tableid')->alter_auto_increment($auto_increment);
cpmsg('postsplit_resetpid_succeed', 'action=postsplit&operation=manage', 'succeed');
}
function gettableid($tablename) {
$tableid = substr($tablename, strrpos($tablename, '_') + 1);
return $tableid;
}
function getmaxposttableid() {
$maxtableid = 0;
foreach(C::t('forum_post')->show_table() as $table) {
$tablename = current($table);
$tableid = intval(gettableid($tablename));
if($tableid > $maxtableid) {
$maxtableid = $tableid;
}
}
return $maxtableid;
}
function update_posttableids() {
$tableids = get_posttableids();
C::t('common_setting')->update_setting('posttableids', $tableids);
savecache('posttableids', $tableids);
}
function get_posttableids() {
$tableids = array(0);
foreach(C::t('forum_post')->show_table() as $table) {
$tablename = current($table);
$tableid = gettableid($tablename);
if(!preg_match('/^\d+$/', $tableid)) {
continue;
}
$tableid = intval($tableid);
if(!$tableid) {
continue;
}
$tableids[] = $tableid;
}
return $tableids;
}
function gettablefields($table) {
static $tables = array();
if(!isset($tables[$table])) {
$tables[$table] = C::t('forum_post')->show_table_columns($table);
}
return $tables[$table];
}
function movedate($tids) {
global $sourcesize, $tableid, $movesize, $targettableid, $hash, $tableindex, $threadtableids, $fieldstr, $fromtableid, $posttable_info;
$fromtable = getposttable($fromtableid, true);
C::t('forum_post')->move_table($targettableid, $fieldstr, $fromtable, $tids);
if(DB::errno()) {
C::t('forum_post')->delete_by_tid($targettableid, $tids);
} else {
foreach($threadtableids as $threadtableid) {
$affected_rows = C::t('forum_thread')->update($tids, array('posttableid' => $targettableid), false, false, $threadtableid);
if($affected_rows == count($tids)) {
break;
}
}
C::t('forum_post')->delete_by_tid($fromtableid, $tids);
}
$status = helper_dbtool::gettablestatus(getposttable($targettableid, true), false);
$targetsize = $sourcesize + $movesize * 1048576;
$nowdatasize = $targetsize - $status['Data_length'];
if($status['Data_length'] >= $targetsize) {
cpmsg('postsplit_done', 'action=postsplit&operation=optimize&tableid='.$fromtableid, 'form');
}
cpmsg('postsplit_doing', 'action=postsplit&operation=movepost&fromtable='.$tableid.'&movesize='.$movesize.'&targettable='.$targettableid.'&hash='.$hash.'&tindex='.$tableindex, 'loadingform', array('datalength' => sizecount($status['Data_length']), 'nowdatalength' => sizecount($nowdatasize)));
}
?>

View File

@@ -0,0 +1,291 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_prune.php 29900 2012-05-02 08:17:44Z liulanbo $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
$searchsubmit = $_GET['searchsubmit'];
$fromumanage = $_GET['fromumanage'] ? 1 : 0;
require_once libfile('function/misc');
loadcache('forums');
if(!submitcheck('prunesubmit')) {
require_once libfile('function/forumlist');
if($_G['adminid'] == 1 || $_G['adminid'] == 2) {
$forumselect = '<select name="forums"><option value="">&nbsp;&nbsp;> '.$lang['select'].'</option>'.
'<option value="">&nbsp;</option>'.forumselect(FALSE, 0, 0, TRUE).'</select>';
if($_GET['forums']) {
$forumselect = preg_replace("/(\<option value=\"{$_GET['forums']}\")(\>)/", "\\1 selected=\"selected\" \\2", $forumselect);
}
} else {
$forumselect = $comma = '';
$mfids = array();
foreach(C::t('forum_moderator')->fetch_all_by_uid($_G['uid']) as $row) {
$mfids[] = $row['fid'];
}
$query = C::t('forum_forum')->fetch_all_by_fid($mfids);
foreach($query as $forum) {
$forumselect .= $comma.$forum['name'];
$comma = ', ';
}
$forumselect = $forumselect ? $forumselect : $lang['none'];
}
if($fromumanage) {
$starttime = !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $_GET['starttime']) ? '' : $_GET['starttime'];
$endtime = $_G['adminid'] == 3 || !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $_GET['endtime']) ? '' : $_GET['endtime'];
} else {
$starttime = !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $_GET['starttime']) ? dgmdate(TIMESTAMP - 86400 * 7, 'Y-n-j') : $_GET['starttime'];
$endtime = $_G['adminid'] == 3 || !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $_GET['endtime']) ? dgmdate(TIMESTAMP, 'Y-n-j') : $_GET['endtime'];
}
shownav('topic', 'nav_prune'.($operation ? '_'.$operation : ''));
showsubmenusteps('nav_prune'.($operation ? '_'.$operation : ''), array(
array('prune_search', !$searchsubmit),
array('nav_prune', $searchsubmit)
));
showtips('prune_tips');
echo <<<EOT
<script type="text/javascript" src="static/js/calendar.js"></script>
<script type="text/JavaScript">
function page(number) {
$('pruneforum').page.value=number;
$('pruneforum').searchsubmit.click();
}
</script>
EOT;
$posttableselect = getposttableselect_admin();
showtagheader('div', 'searchposts', !$searchsubmit);
showformheader("prune".($operation ? '&operation='.$operation : ''), '', 'pruneforum');
showhiddenfields(array('page' => $page, 'pp' => $_GET['pp'] ? $_GET['pp'] : $_GET['perpage']));
showtableheader();
showsetting('prune_search_detail', 'detail', $_GET['detail'], 'radio');
if($posttableselect) {
showsetting('prune_search_select_postsplit', '', '', $posttableselect);
}
if($operation != 'group') {
showsetting('prune_search_forum', '', '', $forumselect);
}
showsetting('prune_search_perpage', '', $_GET['perpage'], "<select name='perpage'><option value='20'>{$lang['perpage_20']}</option><option value='50'>{$lang['perpage_50']}</option><option value='100'>{$lang['perpage_100']}</option></select>");
if(!$fromumanage) {
empty($_GET['starttime']) && $_GET['starttime'] = dgmdate(TIMESTAMP - 86400 * 7, 'Y-n-j');
}
echo '<input type="hidden" name="fromumanage" value="'.$fromumanage.'">';
showsetting('prune_search_time', array('starttime', 'endtime'), array($_GET['starttime'], $_GET['endtime']), 'daterange');
showsetting('prune_search_user', 'users', $_GET['users'], 'text');
showsetting('prune_search_ip', 'useip', $_GET['useip'], 'text');
showsetting('prune_search_keyword', 'keywords', $_GET['keywords'], 'text');
showsetting('prune_search_lengthlimit', 'lengthlimit', $_GET['lengthlimit'], 'text');
showsubmit('searchsubmit');
showtablefooter();
showformfooter();
showtagfooter('div');
} else {
$pidsdelete = $tidsdelete = array();
$pids = authcode($_GET['pids'], 'DECODE');
loadcache('posttableids');
$posttable = in_array($_GET['posttableid'], $_G['cache']['posttableids']) ? $_GET['posttableid'] : 0;
foreach(C::t('forum_post')->fetch_all_post($posttable, ($pids ? explode(',', $pids) : $_GET['pidarray']), false) as $post) {
$prune['forums'][] = $post['fid'];
$prune['thread'][$post['tid']]++;
$pidsdelete[] = $post['pid'];
if($post['first']) {
$tidsdelete[] = $post['tid'];
}
}
if($pidsdelete) {
require_once libfile('function/post');
require_once libfile('function/delete');
$deletedposts = deletepost($pidsdelete, 'pid', !$_GET['donotupdatemember'], $posttable);
$deletedthreads = deletethread($tidsdelete, !$_GET['donotupdatemember'], !$_GET['donotupdatemember']);
if(count($prune['thread']) < 50) {
foreach($prune['thread'] as $tid => $decrease) {
updatethreadcount($tid);
}
} else {
$repliesarray = array();
foreach($prune['thread'] as $tid => $decrease) {
$repliesarray[$decrease][] = $tid;
}
foreach($repliesarray as $decrease => $tidarray) {
C::t('forum_thread')->increase($tidarray, array('replies'=>-$decrease));
}
}
if($_G['setting']['globalstick']) {
updatecache('globalstick');
}
foreach(array_unique($prune['forums']) as $fid) {
updateforumcount($fid);
}
}
$deletedthreads = intval($deletedthreads);
$deletedposts = intval($deletedposts);
updatemodworks('DLP', $deletedposts);
$cpmsg = cplang('prune_succeed', array('deletedthreads' => $deletedthreads, 'deletedposts' => $deletedposts));
?>
<script type="text/JavaScript">alert('<?php echo $cpmsg;?>');parent.$('pruneforum').searchsubmit.click();</script>
<?php
}
if(submitcheck('searchsubmit', 1)) {
loadcache('posttableids');
$posttable = (is_array($_G['cache']['posttableids']) && in_array($_GET['posttableid'], $_G['cache']['posttableids'])) ? $_GET['posttableid'] : 0;
$pids = array();
$postcount = '0';
$sql = $error = '';
$operation == 'group' && $_GET['forums'] = 'isgroup';
$_GET['keywords'] = trim($_GET['keywords']);
$_GET['users'] = trim($_GET['users']);
if(($_GET['starttime'] == '' && $_GET['endtime'] == '' && !$fromumanage) || ($_GET['keywords'] == '' && $_GET['useip'] == '' && $_GET['users'] == '')) {
$error = 'prune_condition_invalid';
}
if($_G['adminid'] == 1 || $_G['adminid'] == 2) {
if($_GET['forums'] && $_GET['forums'] != 'isgroup') {
$fid = $_GET['forums'];
}
if($_GET['forums'] == 'isgroup') {
$isgroup = 1;
} else {
$isgroup = 0;
}
} else {
$forums = array();
foreach(C::t('forum_moderator')->fetch_all_by_uid($_G['uid']) as $forum) {
$forums[] = $forum['fid'];
}
$fid = $forums;
}
if($_GET['users'] != '') {
$uids = C::t('common_member')->fetch_all_uid_by_username(array_map('trim', explode(',', $_GET['users'])));
$authorid = $uids;
}
if($_GET['useip'] != '') {
$useip = str_replace('*', '%', $_GET['useip']);
}
if($_GET['keywords'] != '') {
$keywords = $_GET['keywords'];
}
if($_GET['lengthlimit'] != '') {
$lengthlimit = intval($_GET['lengthlimit']);
$len_message = $lengthlimit;
}
if(!empty($_GET['starttime'])) {
$starttime = strtotime($_GET['starttime']);
}
if($_G['adminid'] == 1 && !empty($_GET['endtime']) && $_GET['endtime'] != dgmdate(TIMESTAMP, 'Y-n-j')) {
$endtime = strtotime($_GET['endtime']);
} else {
$endtime = TIMESTAMP;
}
if(($_G['adminid'] == 2 && $endtime - $starttime > 86400 * 16) || ($_G['adminid'] == 3 && $endtime - $starttime > 86400 * 8)) {
$error = 'prune_mod_range_illegal';
}
if(!$error) {
if($_GET['detail']) {
$_GET['perpage'] = intval($_GET['perpage']) < 1 ? 20 : intval($_GET['perpage']);
$perpage = $_GET['pp'] ? $_GET['pp'] : $_GET['perpage'];
$posts = '';
$groupsname = $groupsfid = $postlist = array();
$postlist = C::t('forum_post')->fetch_all_prune_by_search($posttable, $isgroup, $keywords, $len_message, $fid, $authorid, $starttime, $endtime, $useip, true, ($page - 1) * $perpage, $perpage);
require_once libfile('function/post');
foreach($postlist as $key => $post) {
$postfids[$post['fid']] = $post['fid'];
$post['dateline'] = dgmdate($post['dateline']);
$post['subject'] = empty($post['subject']) ? cplang('prune_nosubject') : cutstr($post['subject'], 30);
$post['message'] = dhtmlspecialchars(messagecutstr($post['message'], 50));
$postlist[$key] = $post;
}
if($postfids) {
$query = C::t('forum_forum')->fetch_all_by_fid($postfids);
foreach($query as $row) {
$forumnames[$row['fid']] = $row['name'];
}
}
if($postlist) {
foreach($postlist as $post) {
$posts .= showtablerow('', '', array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"pidarray[]\" value=\"{$post['pid']}\" checked />",
"<a href=\"forum.php?mod=redirect&goto=findpost&pid={$post['pid']}&ptid={$post['tid']}\" target=\"_blank\">{$post['subject']}</a>",
$post['message'],
"<a href=\"forum.php?mod=forumdisplay&fid={$post['fid']}\" target=\"_blank\">".$forumnames[$post['fid']]."</a>",
"<a href=\"home.php?mod=space&uid={$post['authorid']}\" target=\"_blank\">{$post['author']}</a>",
$post['dateline']
), TRUE);
}
}
$postcount = C::t('forum_post')->count_prune_by_search($posttable, $isgroup, $keywords, $len_message, $fid, $authorid, $starttime, $endtime, $useip);
$multi = multi($postcount, $perpage, $page, ADMINSCRIPT."?action=prune");
$multi = preg_replace("/href=\"".ADMINSCRIPT."\?action=prune&amp;page=(\d+)\"/", "href=\"javascript:page(\\1)\"", $multi);
$multi = str_replace("window.location='".ADMINSCRIPT."?action=prune&amp;page='+this.value", "page(this.value)", $multi);
} else {
$postcount = 0;
foreach(C::t('forum_post')->fetch_all_prune_by_search($posttable, $isgroup, $keywords, $len_message, $fid, $authorid, $starttime, $endtime, $useip, false) as $post) {
$pids[] = $post['pid'];
$postcount++;
}
$multi = '';
}
if(!$postcount) {
$error = 'prune_post_nonexistence';
}
}
showtagheader('div', 'postlist', $searchsubmit);
showformheader('prune&frame=no'.($operation ? '&operation='.$operation : ''), 'target="pruneframe"');
showhiddenfields(array('pids' => authcode(implode(',', $pids), 'ENCODE'), 'posttableid' => $posttable));
showtableheader(cplang('prune_result').' '.$postcount.' <a href="###" onclick="$(\'searchposts\').style.display=\'\';$(\'postlist\').style.display=\'none\';$(\'pruneforum\').pp.value=\'\';$(\'pruneforum\').page.value=\'\';" class="act lightlink normal">'.cplang('research').'</a>', 'fixpadding');
if($error) {
cpmsg($error);
} else {
if($_GET['detail']) {
showsubtitle(array('', 'subject', 'message', 'forum', 'author', 'time'));
echo $posts;
}
}
showsubmit('prunesubmit', 'submit', $_GET['detail'] ? '<input type="checkbox" name="chkall" id="chkall" class="checkbox" checked onclick="checkAll(\'prefix\', this.form, \'pidarray\')" /><label for="chkall">'.cplang('del').'</label>' : '',
'<input class="checkbox" type="checkbox" name="donotupdatemember" id="donotupdatemember" value="1" checked="checked" /><label for="donotupdatemember"> '.cplang('prune_no_update_member').'</label>', $multi);
showtablefooter();
showformfooter();
echo '<iframe name="pruneframe" style="display:none"></iframe>';
showtagfooter('div');
}
?>

View File

@@ -0,0 +1,36 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_quickquery.php 20397 2011-02-23 03:24:20Z congyushuai $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
$simplequeries = array(
array('comment' => cplang('quickquery_open_forum'), 'sql' => ''),
array('comment' => cplang('quickquery_open_recycle'), 'sql' => 'UPDATE {tablepre}forum_forum SET recyclebin=\'1\' WHERE status<\'3\''),
array('comment' => cplang('quickquery_open_discuzcode'), 'sql' => 'UPDATE {tablepre}forum_forum SET allowbbcode=\'1\' WHERE status<\'3\''),
array('comment' => cplang('quickquery_open_imgcode'), 'sql' => 'UPDATE {tablepre}forum_forum SET allowimgcode=\'1\' WHERE status<\'3\''),
array('comment' => cplang('quickquery_open_smilies'), 'sql' => 'UPDATE {tablepre}forum_forum SET allowsmilies=\'1\' WHERE status<\'3\''),
array('comment' => cplang('quickquery_open_jam'), 'sql' => 'UPDATE {tablepre}forum_forum SET jammer=\'1\' WHERE status<\'3\''),
array('comment' => cplang('quickquery_open_guest'), 'sql' => 'UPDATE {tablepre}forum_forum SET allowanonymous=\'1\' WHERE status<\'3\''),
array('comment' => cplang('quickquery_close_forum'), 'sql' => ''),
array('comment' => cplang('quickquery_close_recycle'), 'sql' => 'UPDATE {tablepre}forum_forum SET recyclebin=\'0\' WHERE status<\'3\''),
array('comment' => cplang('quickquery_close_html'), 'sql' => 'UPDATE {tablepre}forum_forum SET allowhtml=\'0\' WHERE status<\'3\''),
array('comment' => cplang('quickquery_close_discuzcode'), 'sql' => 'UPDATE {tablepre}forum_forum SET allowbbcode=\'0\' WHERE status<\'3\''),
array('comment' => cplang('quickquery_close_imgcode'), 'sql' => 'UPDATE {tablepre}forum_forum SET allowimgcode=\'0\' WHERE status<\'3\''),
array('comment' => cplang('quickquery_close_smilies'), 'sql' => 'UPDATE {tablepre}forum_forum SET allowsmilies=\'0\' WHERE status<\'3\''),
array('comment' => cplang('quickquery_close_jam'), 'sql' => 'UPDATE {tablepre}forum_forum SET jammer=\'0\' WHERE status<\'3\''),
array('comment' => cplang('quickquery_close_guest'), 'sql' => 'UPDATE {tablepre}forum_forum SET allowanonymous=\'0\' WHERE status<\'3\''),
array('comment' => cplang('quickquery_user'), 'sql' => ''),
array('comment' => cplang('quickquery_clear_userlog'), 'sql' => 'TRUNCATE {tablepre}common_credit_log'),
);
?>

View File

@@ -0,0 +1,312 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_recyclebin.php 31045 2012-07-12 01:55:00Z chenmengshu $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
require_once libfile('function/post');
require_once libfile('function/discuzcode');
cpheader();
if(!$operation) {
shownav('topic', 'nav_recyclebin');
if(!submitcheck('delsubmit') && !submitcheck('undelsubmit')) {
showsubmenu('nav_recyclebin', array(
array('recyclebin_list', 'recyclebin', 1),
array('search', 'recyclebin&operation=search', 0),
array('clean', 'recyclebin&operation=clean', 0)
));
$lpp = empty($_GET['lpp']) ? 20 : $_GET['lpp'];
$start = ($page - 1) * $lpp;
$start_limit = ($page - 1) * $lpp;
$checklpp = array();
$checklpp[$lpp] = 'selected="selected"';
showformheader('recyclebin');
showtableheader($lang['recyclebin_list'].
'&nbsp<select onchange="if(this.options[this.selectedIndex].value != \'\') {window.location=\''.ADMINSCRIPT.'?action=recyclebin&lpp=\'+this.options[this.selectedIndex].value }">
<option value="20" '.$checklpp[20].'> '.$lang['perpage_20'].' </option><option value="50" '.$checklpp[50].'>'.$lang['perpage_50'].'</option><option value="100" '.$checklpp[100].'>'.$lang['perpage_100'].'</option></select>');
showsubtitle(array('', 'thread', 'recyclebin_list_thread', 'recyclebin_list_author', 'recyclebin_list_status', 'recyclebin_list_lastpost', 'recyclebin_list_operation', 'reason'));
$fids = $threadlist = array();
$threads = C::t('forum_thread')->fetch_all_by_tid_fid_displayorder(0, 0, -1, 'dateline', $start_limit, $lpp, '=');
foreach($threads as $tid => $value) {
$fids[$value['fid']] = $value['fid'];
}
if($fids) {
$forums = C::t('forum_forum')->fetch_all_name_by_fid($fids);
foreach($threads as $tid => $thread) {
$thread['forumname'] = $forums[$thread['fid']]['name'];
$thread['modthreadkey'] = modauthkey($thread['tid']);
$threadlist[$thread['tid']] = $thread;
}
}
if($threadlist) {
$tids = array_keys($threadlist);
foreach(C::t('forum_threadmod')->fetch_all_by_tid($tids) as $row) {
if(empty($threadlist[$row['tid']]['moduid'])) {
$threadlist[$row['tid']]['moduid'] = $row['uid'];
$threadlist[$row['tid']]['modusername'] = $row['username'];
$threadlist[$row['tid']]['moddateline'] = $row['dateline'];
$threadlist[$row['tid']]['modaction'] = $row['action'];
$threadlist[$row['tid']]['reason'] = $row['reason'];
}
}
foreach($threadlist as $tid => $thread) {
showtablerow('', array('class="td25"', '', '', 'class="td28"', 'class="td28"'), array(
"<input type=\"checkbox\" class=\"checkbox\" name=\"threadlist[]\" value=\"{$thread['tid']}\">",
'<a href="forum.php?mod=viewthread&tid='.$thread['tid'].'&modthreadkey='.$thread['modthreadkey'].'" target="_blank">'.$thread['subject'].'</a>',
'<a href="forum.php?mod=forumdisplay&fid='.$thread['fid'].'" target="_blank">'.$thread['forumname'].'</a>',
'<a href="home.php?mod=space&uid='.$thread['authorid'].'" target="_blank">'.$thread['author'].'</a><br /><em style="font-size:9px;color:#999999;">'.dgmdate($thread['dateline'], 'd').'</em>',
$thread['replies'].' / '.$thread['views'],
$thread['lastposter'].'<br /><em style="font-size:9px;color:#999999;">'.dgmdate($thread['lastpost'], 'd').'</em>',
$thread['modusername'] ? $thread['modusername'].'<br /><em style="font-size:9px;color:#999999;">'.dgmdate($thread['moddateline'], 'd').'</em>' : '',
$thread['reason']
));
}
}
$threadcount = C::t('forum_thread')->count_by_displayorder(-1);
$multipage = multi($threadcount, $lpp, $page, ADMINSCRIPT."?action=recyclebin&lpp=$lpp", 0, 6);
showsubmit('', '', '', '<input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'threadlist\')" /><label for="chkall">'.cplang('select_all').'</label>&nbsp;&nbsp;<input type="submit" class="btn" name="delsubmit" value="'.cplang('recyclebin_delete').'" />&nbsp;<input type="submit" class="btn" name="undelsubmit" value="'.cplang('recyclebin_undelete').'" />', $multipage);
showtablefooter();
showformfooter();
} else {
$threadlist = $_GET['threadlist'];
if(empty($threadlist)) {
cpmsg('recyclebin_none_selected', 'action=recyclebin', 'error');
}
$threadsundel = $threadsdel = 0;
if(submitcheck('undelsubmit')) {
$threadsundel = undeletethreads($threadlist);
} elseif(submitcheck('delsubmit')) {
require_once libfile('function/delete');
$threadsdel = deletethread($threadlist);
}
cpmsg('recyclebin_succeed', 'action=recyclebin', 'succeed', array('threadsdel' => $threadsdel, 'threadsundel' => $threadsundel));
}
} elseif($operation == 'search') {
if(!submitcheck('rbsubmit')) {
$inforum = $_GET['inforum'];
$authors = $_GET['authors'];
$keywords = $_GET['keywords'];
$admins = $_GET['admins'];
$pstarttime = $_GET['pstarttime'];
$pendtime = $_GET['pendtime'];
$mstarttime = $_GET['mstarttime'];
$mendtime = $_GET['mendtime'];
$secStatus = false;
$searchsubmit = $_GET['searchsubmit'];
require_once libfile('function/forumlist');
$forumselect = '<select name="inforum"><option value="">&nbsp;&nbsp;> '.$lang['select'].'</option>'.
'<option value="">&nbsp;</option><option value="groupthread">'.$lang['group_thread'].'</option>'.forumselect(FALSE, 0, 0, TRUE).'</select>';
if($inforum) {
$forumselect = preg_replace("/(\<option value=\"$inforum\")(\>)/", "\\1 selected=\"selected\" \\2", $forumselect);
}
shownav('topic', 'nav_recyclebin');
showsubmenu('nav_recyclebin', array(
array('recyclebin_list', 'recyclebin', 0),
array('search', 'recyclebin&operation=search', 1),
array('clean', 'recyclebin&operation=clean', 0)
));
$staticurl = STATICURL;
echo <<<EOT
<script type="text/javascript" src="{$staticurl}js/calendar.js"></script>
<script type="text/JavaScript">
function page(number) {
$('rbsearchform').page.value=number;
$('rbsearchform').searchsubmit.click();
}
</script>
EOT;
showtagheader('div', 'threadsearch', !$searchsubmit);
showformheader('recyclebin&operation=search', '', 'rbsearchform');
showhiddenfields(array('page' => $page));
showtableheader('recyclebin_search');
showsetting('recyclebin_search_forum', '', '', $forumselect);
showsetting('recyclebin_search_author', 'authors', $authors, 'text');
showsetting('recyclebin_search_keyword', 'keywords', $keywords, 'text');
showsetting('recyclebin_search_admin', 'admins', $admins, 'text');
showsetting('recyclebin_search_post_time', array('pstarttime', 'pendtime'), array($pstarttime, $pendtime), 'daterange');
showsetting('recyclebin_search_mod_time', array('mstarttime', 'mendtime'), array($mstarttime, $mendtime), 'daterange');
if($secStatus){
showsetting('recyclebin_search_security_thread', 'security', $security, 'radio');
}
showsubmit('searchsubmit');
showtablefooter();
showformfooter();
showtagfooter('div');
if(submitcheck('searchsubmit')) {
$sql = '';
$isgroup = $fid = 0;
if($inforum == 'groupthread') {
$isgroup = 1;
} else {
$fid = $inforum ? $inforum : 0;
}
$author = $authors != '' ? explode(' ', $authors) : '';
$admins = $admins != '' ? explode(' ', $admins) : '';
$pstarttime = $pstarttime != '' ? strtotime($pstarttime) : '';
$pendtime = $pendtime != '' ? strtotime($pendtime) : '';
$mstarttime = $mstarttime != '' ? strtotime($mstarttime) : '';
$mendtime = $mendtime != '' ? strtotime($mendtime) : '';
$security = $secStatus && $security;
if($security){
$threadcount = C::t('#security#security_evilpost')->count_by_recyclebine($fid, $isgroup, $author, $admins, $pstarttime, $pendtime, $mstarttime, $mendtime, $keywords);
}else{
$threadcount = C::t('forum_thread')->count_by_recyclebine($fid, $isgroup, $author, $admins, $pstarttime, $pendtime, $mstarttime, $mendtime, $keywords);
}
$pagetmp = $page;
$multi = multi($threadcount, $_G['ppp'], $page, ADMINSCRIPT."?action=recyclebin");
$multi = preg_replace("/href=\"".ADMINSCRIPT."\?action=recyclebin&amp;page=(\d+)\"/", "href=\"javascript:page(\\1)\"", $multi);
$multi = str_replace("window.location='".ADMINSCRIPT."?action=recyclebin&amp;page='+this.value", "page(this.value)", $multi);
echo '<script type="text/JavaScript">var replyreload;function attachimg() {}</script>';
showtagheader('div', 'threadlist', $searchsubmit);
showformheader('recyclebin&operation=search&frame=no', 'target="rbframe"', 'rbform');
showtableheader(cplang('recyclebin_result').' '.$threadcount.' <a href="#" onclick="$(\'threadlist\').style.display=\'none\';$(\'threadsearch\').style.display=\'\';" class="act lightlink normal">'.cplang('research').'</a>', 'fixpadding');
if($threadcount) {
if($security){
$searchresult = C::t('#security#security_evilpost')->fetch_all_by_recyclebine($fid, $isgroup, $author, $admins, $pstarttime, $pendtime, $mstarttime, $mendtime, $keywords, ($pagetmp - 1) * $_G['ppp'], $_G['ppp']);
}else{
$searchresult = C::t('forum_thread')->fetch_all_by_recyclebine($fid, $isgroup, $author, $admins, $pstarttime, $pendtime, $mstarttime, $mendtime, $keywords, ($pagetmp - 1) * $_G['ppp'], $_G['ppp']);
}
$issettids = array();
foreach($searchresult as $thread) {
$disabledstr = '';
if(isset($issettids[$thread['tid']])) {
$disabledstr = 'disabled';
} else {
$issettids[$thread['tid']] = $thread['tid'];
}
$post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid']);
$thread = array_merge($thread, $post);
$thread['message'] = discuzcode($thread['message'], $thread['smileyoff'], $thread['bbcodeoff'], sprintf('%00b', $thread['htmlon']), $thread['allowsmilies'], $thread['allowbbcode'], $thread['allowimgcode'], $thread['allowhtml']);
$thread['moddateline'] = dgmdate($thread['moddateline']);
$thread['dateline'] = dgmdate($thread['dateline']);
if($thread['attachment']) {
require_once libfile('function/attachment');
foreach(C::t('forum_attachment_n')->fetch_all_by_id('tid:'.$thread['tid'], 'tid', $thread['tid']) as $attach) {
$_G['setting']['attachurl'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl'];
$attach['url'] = $attach['isimage']
? " {$attach['filename']} (".sizecount($attach['filesize']).")<br /><br /><img src=\"".$_G['setting']['attachurl']."forum/{$attach['attachment']}\" onload=\"if(this.width > 100) {this.resized=true; this.width=100;}\">"
: "<a href=\"".$_G['setting']['attachurl']."forum/{$attach['attachment']}\" target=\"_blank\">{$attach['filename']}</a> (".sizecount($attach['filesize']).")";
$thread['message'] .= "<br /><br />{$lang['attachment']}: ".attachtype(fileext($attach['filename'])."\t").$attach['url'];
}
}
showtablerow("id=\"mod_{$thread['tid']}_row1\"", array('rowspan="3" class="rowform threadopt" style="width:80px;"', 'class="threadtitle"'), array(
"<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$thread['tid']}]\" id=\"mod_{$thread['tid']}_1\" value=\"delete\" ".(empty($disabledstr) ? "checked=\"checked\"" : '')." $disabledstr /><label for=\"mod_{$thread['tid']}_1\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$thread['tid']}]\" id=\"mod_{$thread['tid']}_2\" value=\"undelete\" $disabledstr/><label for=\"mod_{$thread['tid']}_2\">{$lang['undelete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$thread['tid']}]\" id=\"mod_{$thread['tid']}_3\" value=\"ignore\" $disabledstr/><label for=\"mod_{$thread['tid']}_3\">{$lang['ignore']}</label></li></ul>",
"<h3><a href=\"forum.php?mod=forumdisplay&fid={$thread['fid']}}\" target=\"_blank\">{$thread['forumname']}</a> &raquo; {$thread['subject']}</h3><p><span class=\"bold\">{$lang['author']}:</span> <a href=\"home.php?mod=space&uid={$thread['authorid']}\" target=\"_blank\">{$thread['author']}</a> &nbsp;&nbsp; <span class=\"bold\">{$lang['time']}:</span> {$thread['dateline']} &nbsp;&nbsp; {$lang['threads_replies']}: {$thread['replies']} {$lang['threads_views']}: {$thread['views']}</p>"
));
showtablerow("id=\"mod_{$thread['tid']}_row2\"", 'colspan="2" style="padding: 10px; line-height: 180%;"', '<div style="overflow: auto; overflow-x: hidden; max-height:120px; height:auto !important; height:120px; word-break: break-all;">'.$thread['message'].'</div>');
showtablerow("id=\"mod_{$thread['tid']}_row3\"", 'class="threadopt threadtitle" colspan="2"', "{$lang['operator']}: <a href=\"home.php?mod=space&uid={$thread['moduid']}\" target=\"_blank\">{$thread['modusername']}</a> &nbsp;&nbsp; {$lang['recyclebin_delete_time']}: {$thread['moddateline']}&nbsp;&nbsp; {$lang['reason']}: {$thread['reason']}");
}
}
showsubmit('rbsubmit', 'submit', '', '<a href="#rb" onclick="checkAll(\'option\', $(\'rbform\'), \'delete\')">'.cplang('recyclebin_all_delete').'</a> &nbsp;<a href="#rb" onclick="checkAll(\'option\', $(\'rbform\'), \'undelete\')">'.cplang('recyclebin_all_undelete').'</a> &nbsp;<a href="#rb" onclick="checkAll(\'option\', $(\'rbform\'), \'ignore\')">'.cplang('recyclebin_all_ignore').'</a> &nbsp;', $multi);
showtablefooter();
showformfooter();
echo '<iframe name="rbframe" style="display:none"></iframe>';
showtagfooter('div');
}
} else {
$moderate = $_GET['moderate'];
$moderation = array('delete' => array(), 'undelete' => array(), 'ignore' => array());
if(is_array($moderate)) {
foreach($moderate as $tid => $action) {
$moderation[$action][] = intval($tid);
}
}
require_once libfile('function/delete');
$threadsdel = deletethread($moderation['delete']);
$threadsundel = undeletethreads($moderation['undelete']);
if($threadsdel || $threadsundel) {
$cpmsg = cplang('recyclebin_succeed', array('threadsdel' => $threadsdel, 'threadsundel' => $threadsundel));
} else {
$cpmsg = cplang('recyclebin_nothread');
}
?>
<script type="text/JavaScript">alert('<?php echo $cpmsg;?>');parent.$('rbsearchform').searchsubmit.click();</script>
<?php
}
} elseif($operation == 'clean') {
if(!submitcheck('rbsubmit', 1)) {
shownav('topic', 'nav_recyclebin');
showsubmenu('nav_recyclebin', array(
array('recyclebin_list', 'recyclebin', 0),
array('search', 'recyclebin&operation=search', 0),
array('clean', 'recyclebin&operation=clean', 1)
));
showformheader('recyclebin&operation=clean');
showtableheader('recyclebin_clean');
showsetting('recyclebin_clean_days', 'days', '30', 'text');
showsubmit('rbsubmit');
showtablefooter();
showformfooter();
} else {
$deletetids = array();
$timestamp = TIMESTAMP;
$pernum = 20;
$threadsdel = intval($_GET['threadsdel']);
$days = intval($_GET['days']);
foreach(C::t('forum_thread')->fetch_all_recyclebin_by_dateline($timestamp-($days * 86400), 0, $pernum) as $thread) {
$deletetids[] = $thread['tid'];
}
if($deletetids) {
require_once libfile('function/delete');
$delcount = deletethread($deletetids);
$threadsdel += $delcount;
$startlimit += $pernum;
cpmsg('recyclebin_clean_next', 'action=recyclebin&operation=clean&rbsubmit=1&threadsdel='.$threadsdel.'&days='.$days, 'loading', array('threadsdel' => $threadsdel));
} else {
cpmsg('recyclebin_succeed', 'action=recyclebin&operation=clean', 'succeed', array('threadsdel' => $threadsdel, 'threadsundel' => 0));
}
}
}
?>

View File

@@ -0,0 +1,262 @@
<?php
/*
[Discuz!] (C)2001-2099 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: admincp_recyclebinpost.php 28728 2012-03-09 03:15:48Z songlixin $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
require_once libfile('function/post');
require_once libfile('function/discuzcode');
$posttableid = intval($_GET['posttableid']);
cpheader();
if(submitcheck('rbsubmit')) {
$moderate = $_GET['moderate'];
$moderation = array('delete' => array(), 'undelete' => array(), 'ignore' => array());
if(is_array($moderate)) {
foreach($moderate as $pid => $action) {
$moderation[$action][] = intval($pid);
}
}
$postsdel = $postsundel = 0;
if($moderation['delete']) {
$postsdel = recyclebinpostdelete($moderation['delete'], $posttableid);
}
if($moderation['undelete']) {
$postsundel = recyclebinpostundelete($moderation['undelete'], $posttableid);
}
if($operation == 'search') {
$cpmsg = cplang('recyclebinpost_succeed', array('postsdel' => $postsdel, 'postsundel' => $postsundel));
?>
<script type="text/JavaScript">alert('<?php echo $cpmsg;?>');parent.$('rbsearchform').searchsubmit.click();</script>
<?php
} else {
cpmsg('recyclebinpost_succeed', 'action=recyclebinpost&operation='.$operation, 'succeed', array('postsdel' => $postsdel, 'postsundel' => $postsundel));
}
}
$lpp = empty($_GET['lpp']) ? 20 : $_GET['lpp'];
$start = ($page - 1) * $lpp;
$start_limit = ($page - 1) * $lpp;
$multi = '';
if(!$operation) {
shownav('topic', 'nav_recyclebinpost');
showsubmenu('nav_recyclebinpost', array(
array('recyclebinpost_list', 'recyclebinpost', 1),
array('search', 'recyclebinpost&operation=search', 0),
array('clean', 'recyclebinpost&operation=clean', 0)
));
showtagheader('div', 'postlist', 1);
showformheader('recyclebinpost', '', 'rbform');
showhiddenfields(array('posttableid' => $posttableid));
$checklpp = array();
$checklpp[$lpp] = 'selected="selected"';
showtableheader($lang['recyclebinpost_list'].
'&nbsp<select onchange="if(this.options[this.selectedIndex].value != \'\') {window.location=\''.ADMINSCRIPT.'?action=recyclebinpost&lpp=\'+this.options[this.selectedIndex].value }">
<option value="20" '.$checklpp[20].'> '.$lang['perpage_20'].' </option><option value="50" '.$checklpp[50].'>'.$lang['perpage_50'].'</option><option value="100" '.$checklpp[100].'>'.$lang['perpage_100'].'</option></select>');
$postlistcount = C::t('forum_post')->count_by_invisible($posttableid, '-5');
if($postlistcount && recyclebinpostshowpostlist(null, null, null, null, null, $start_limit, $lpp)) {
$multi = multi($postlistcount, $lpp, $page, ADMINSCRIPT."?action=recyclebinpost&lpp=$lpp");
}
showsubmit('rbsubmit', 'submit', '', '<a href="#rb" onclick="checkAll(\'option\', $(\'rbform\'), \'delete\')">'.cplang('recyclebin_all_delete').'</a> &nbsp;<a href="#rb" onclick="checkAll(\'option\', $(\'rbform\'), \'undelete\')">'.cplang('recyclebin_all_undelete').'</a> &nbsp;<a href="#rb" onclick="checkAll(\'option\', $(\'rbform\'), \'ignore\')">'.cplang('recyclebin_all_ignore').'</a> &nbsp;', $multi);
showtablefooter();
showformfooter();
echo '<iframe name="rbframe" style="display:none"></iframe>';
showtagfooter('div');
} elseif($operation == 'search') {
$inforum = $_GET['inforum'];
$authors = $_GET['authors'];
$keywords = $_GET['keywords'];
$pstarttime = $_GET['pstarttime'];
$pendtime = $_GET['pendtime'];
$secStatus = false;
$searchsubmit = $_GET['searchsubmit'];
require_once libfile('function/forumlist');
$forumselect = '<select name="inforum"><option value="">&nbsp;&nbsp;> '.$lang['allthread'].'</option>'.
'<option value="">&nbsp;</option>'.forumselect(FALSE, 0, 0, TRUE).'</select>';
if($inforum) {
$forumselect = preg_replace("/(\<option value=\"$inforum\")(\>)/", "\\1 selected=\"selected\" \\2", $forumselect);
}
shownav('topic', 'nav_recyclebinpost');
showsubmenu('nav_recyclebinpost', array(
array('recyclebinpost_list', 'recyclebinpost', 0),
array('search', 'recyclebinpost&operation=search', 1),
array('clean', 'recyclebinpost&operation=clean', 0)
));
$staticurl = STATICURL;
echo <<<EOT
<script type="text/javascript" src="{$staticurl}js/calendar.js"></script>
<script type="text/JavaScript">
function page(number) {
$('rbsearchform').page.value=number;
$('rbsearchform').searchsubmit.click();
}
</script>
EOT;
showtagheader('div', 'postsearch', !$searchsubmit);
showformheader('recyclebinpost&operation=search', '', 'rbsearchform');
showhiddenfields(array('page' => $page));
showtableheader('recyclebinpost_search');
showsetting('recyclebinpost_search_forum', '', '', $forumselect);
showsetting('recyclebinpost_search_author', 'authors', $authors, 'text');
showsetting('recyclebinpost_search_keyword', 'keywords', $keywords, 'text');
showsetting('recyclebin_search_post_time', array('pstarttime', 'pendtime'), array($pstarttime, $pendtime), 'daterange');
showsetting('postsplit', '', '', getposttableselect_admin());
if($secStatus){
showsetting('recyclebin_search_security_thread', 'security', $security, 'radio');
}
showsubmit('searchsubmit');
showtablefooter();
showformfooter();
showtagfooter('div');
if(submitcheck('searchsubmit')) {
$security = $secStatus && $security;
if($security){
$postlistcount = C::t('#security#security_evilpost')->count_by_search($posttableid, null, $keywords, -5, $inforum, null, ($authors ? explode(',', str_replace(' ', '', $authors)) : null), strtotime($pstarttime), strtotime($pendtime));
}else{
$postlistcount = C::t('forum_post')->count_by_search($posttableid, null, $keywords, -5, $inforum, null, ($authors ? explode(',', str_replace(' ', '', $authors)) : null), strtotime($pstarttime), strtotime($pendtime));
}
showtagheader('div', 'postlist', $searchsubmit);
showformheader('recyclebinpost&operation=search&frame=no', 'target="rbframe"', 'rbform');
showtableheader(cplang('recyclebinpost_result').' '.$postlistcount.' <a href="#" onclick="$(\'postlist\').style.display=\'none\';$(\'postsearch\').style.display=\'\';" class="act lightlink normal">'.cplang('research').'</a>', 'fixpadding');
if($postlistcount && recyclebinpostshowpostlist($inforum, $authors, $pstarttime, $pendtime, $keywords, $start_limit, $lpp)) {
$multi = multi($postlistcount, $lpp, $page, ADMINSCRIPT."?action=recyclebinpost");
$multi = preg_replace("/href=\"".ADMINSCRIPT."\?action=recyclebinpost&amp;page=(\d+)\"/", "href=\"javascript:page(\\1)\"", $multi);
$multi = str_replace("window.location='".ADMINSCRIPT."?action=recyclebinpost&amp;page='+this.value", "page(this.value)", $multi);
}
showsubmit('rbsubmit', 'submit', '', '<a href="#rb" onclick="checkAll(\'option\', $(\'rbform\'), \'delete\')">'.cplang('recyclebin_all_delete').'</a> &nbsp;<a href="#rb" onclick="checkAll(\'option\', $(\'rbform\'), \'undelete\')">'.cplang('recyclebin_all_undelete').'</a> &nbsp;<a href="#rb" onclick="checkAll(\'option\', $(\'rbform\'), \'ignore\')">'.cplang('recyclebin_all_ignore').'</a> &nbsp;', $multi);
showtablefooter();
showformfooter();
echo '<iframe name="rbframe" style="display:none"></iframe>';
showtagfooter('div');
}
} elseif($operation == 'clean') {
if(!submitcheck('cleanrbsubmit', 1)) {
shownav('topic', 'nav_recyclebinpost');
showsubmenu('nav_recyclebinpost', array(
array('recyclebinpost_list', 'recyclebinpost', 0),
array('search', 'recyclebinpost&operation=search', 0),
array('clean', 'recyclebinpost&operation=clean', 1)
));
showformheader('recyclebinpost&operation=clean');
showtableheader('recyclebinpost_clean');
showsetting('recyclebinpost_clean_days', 'days', '30', 'text');
showsubmit('cleanrbsubmit');
showtablefooter();
showformfooter();
} else {
$deletetids = array();
$pernum = 200;
$postsdel = intval($_GET['postsdel']);
$days = intval($_GET['days']);
$timestamp = TIMESTAMP - max(0, $days * 86400);
$postlist = array();
loadcache('posttableids');
$posttables = !empty($_G['cache']['posttableids']) ? $_G['cache']['posttableids'] : array(0);
foreach($posttables as $ptid) {
foreach(C::t('forum_post')->fetch_all_pid_by_invisible_dateline($ptid, -5, $timestamp, 0, $pernum) as $post) {
$postlist[$ptid][] = $post['pid'];
}
}
$postsundel = 0;
if($postlist) {
foreach($postlist as $ptid => $deletepids) {
$postsdel += recyclebinpostdelete($deletepids, $ptid);
}
$startlimit += $pernum;
cpmsg('recyclebinpost_clean_next', 'action=recyclebinpost&operation=clean&cleanrbsubmit=1&days='.$days.'&postsdel='.$postsdel, 'succeed', array('postsdel' => $postsdel));
} else {
cpmsg('recyclebinpost_succeed', 'action=recyclebinpost&operation=clean', 'succeed', array('postsdel' => $postsdel, 'postsundel' => $postsundel));
}
}
}
function recyclebinpostshowpostlist($fid, $authors, $starttime, $endtime, $keywords, $start_limit, $lpp) {
global $_G, $lang, $posttableid, $security;
$tids = $fids = array();
if($security){
$postlist = C::t('#security#security_evilpost')->fetch_all_by_search($posttableid, null, $keywords, -5, $fid, null, ($authors ? explode(',', str_replace(' ', '', $authors)): null), strtotime($starttime), strtotime($endtime), null, null, $start_limit, $lpp);
}else{
$postlist = C::t('forum_post')->fetch_all_by_search($posttableid, null, $keywords, -5, $fid, null, ($authors ? explode(',', str_replace(' ', '', $authors)): null), strtotime($starttime), strtotime($endtime), null, null, $start_limit, $lpp);
}
if(empty($postlist)) return false;
foreach($postlist as $key => $post) {
$tids[$post['tid']] = $post['tid'];
$fids[$post['fid']] = $post['fid'];
}
foreach(C::t('forum_thread')->fetch_all_by_tid($tids) as $thread) {
$thread['tsubject'] = $thread['subject'];
$threadlist[$thread['tid']] = $thread;
}
$query = C::t('forum_forum')->fetch_all_by_fid($fids);
foreach($query as $val) {
$forum = array('fid' => $val['fid'],
'forumname' => $val['name'],
'allowsmilies' => $val['allowsmilies'],
'allowhtml' => $val['allowhtml'],
'allowbbcode' => $val['allowbbcode'],
'allowimgcode' => $val['allowimgcode']
);
$forumlist[$forum['fid']] = $forum;
}
foreach($postlist as $key => $post) {
$post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], sprintf('%00b', $post['htmlon']), $forumlist[$post['fid']]['allowsmilies'], $forumlist[$post['fid']]['allowbbcode'], $forumlist[$post['fid']]['allowimgcode'], $forumlist[$post['fid']]['allowhtml']);
$post['dateline'] = dgmdate($post['dateline']);
if($post['attachment']) {
require_once libfile('function/attachment');
foreach(C::t('forum_attachment_n')->fetch_all_by_id('tid:'.$post['tid'], 'pid', $post['pid']) as $attach) {
$_G['setting']['attachurl'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl'];
$attach['url'] = $attach['isimage']
? " {$attach['filename']} (".sizecount($attach['filesize']).")<br /><br /><img src=\"".$_G['setting']['attachurl']."forum/{$attach['attachment']}\" onload=\"if(this.width > 100) {this.resized=true; this.width=100;}\">"
: "<a href=\"".$_G['setting']['attachurl']."forum/{$attach['attachment']}\" target=\"_blank\">{$attach['filename']}</a> (".sizecount($attach['filesize']).")";
$post['message'] .= "<br /><br />{$lang['attachment']}: ".attachtype(fileext($attach['filename'])."\t").$attach['url'];
}
}
showtablerow("id=\"mod_{$post['pid']}_row1\"", array('rowspan="3" class="rowform threadopt" style="width:80px;"', 'class="threadtitle"'), array(
"<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_1\" value=\"delete\" checked=\"checked\" /><label for=\"mod_{$post['pid']}_1\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_2\" value=\"undelete\" /><label for=\"mod_{$post['pid']}_2\">{$lang['undelete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_3\" value=\"ignore\" /><label for=\"mod_{$post['pid']}_3\">{$lang['ignore']}</label></li></ul>",
"<h3><a href=\"forum.php?mod=forumdisplay&fid={$post['fid']}\" target=\"_blank\">".$forumlist[$post['fid']]['forumname']."</a> &raquo; <a href=\"forum.php?mod=viewthread&tid={$post['tid']}\" target=\"_blank\">".$threadlist[$post['tid']]['tsubject']."</a>".($post['subject'] ? ' &raquo; '.$post['subject'] : '')."</h3><p><span class=\"bold\">{$lang['author']}:</span> <a href=\"home.php?mod=space&uid={$post['authorid']}\" target=\"_blank\">{$post['author']}</a> &nbsp;&nbsp; <span class=\"bold\">{$lang['time']}:</span> {$post['dateline']} &nbsp;&nbsp; IP: {$post['useip']}</p>"
));
showtablerow("id=\"mod_{$post['pid']}_row2\"", 'colspan="2" style="padding: 10px; line-height: 180%;"', '<div style="overflow: auto; overflow-x: hidden; max-height:120px; height:auto !important; height:120px; word-break: break-all;">'.$post['message'].'</div>');
showtablerow("id=\"mod_{$post['pid']}_row3\"", 'class="threadopt threadtitle" colspan="2"', "{$lang['isanonymous']}: ".($post['anonymous'] ? $lang['yes'] : $lang['no'])." &nbsp;&nbsp; {$lang['ishtmlon']}: ".($post['htmlon'] ? $lang['yes'] : $lang['no']));
}
return true;
}
?>

View File

@@ -0,0 +1,392 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id$
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
$pertask = isset($_GET['pertask']) ? intval($_GET['pertask']) : 100;
$current = isset($_GET['current']) && $_GET['current'] > 0 ? intval($_GET['current']) : 0;
$next = $current + $pertask;
if(submitcheck('threadsubmit', 1)) {
$nextlink = "action=remoderate&current=$next&pertask=$pertask&threadsubmit=yes";
$processed = 0;
$censor = & discuz_censor::instance();
foreach(C::t('forum_thread')->fetch_all_by_displayorder(0, '>=', $current, $pertask) as $thread) {
$processed = 1;
foreach(C::t('forum_post')->fetch_all_visiblepost_by_tid($thread['posttableid'], $thread['tid']) as $post) {
$subject = $post['subject'];
$message = $post['message'];
$subject_result = empty($subject) ? 0 : $censor->check($subject);
$message_result = (in_array($subject_result, array(1, 2)) || empty($message)) ? 0 : $censor->check($message);
if($subject_result) {
if($subject_result == 3) {
if(strcmp($post['subject'], $subject)) {
C::t('forum_post')->update($thread['posttableid'], $post['pid'], array('subject' => $subject), false, false, null, -2, null, 0);
}
} else {
if($post['first'] == 1) {
C::t('forum_thread')->update($thread['tid'], array('displayorder' => -2));
updatemoderate('tid', $thread['tid']);
} else {
updatemoderate('pid', $post['pid']);
}
}
}
if($message_result) {
if($message_result == 3) {
if(strcmp($post['message'], $message)) {
C::t('forum_post')->update($thread['posttableid'], $post['pid'], array('message' => $message), false, false, null, -2, null, 0);
}
} else {
if($post['first'] == 1) {
C::t('forum_thread')->update($thread['tid'], array('displayorder' => -2));
updatemoderate('tid', $thread['tid']);
} else {
updatemoderate('pid', $post['pid']);
}
}
}
}
}
if($processed) {
cpmsg("{$lang['remoderate_thread']}: ".cplang('remoderate_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
} else {
cpmsg('remoderate_thread_succeed', 'action=remoderate', 'succeed');
}
} elseif(submitcheck('blogsubmit', 1)) {
$nextlink = "action=remoderate&current=$next&pertask=$pertask&blogsubmit=yes";
$processed = 0;
$censor = & discuz_censor::instance();
foreach(C::t('home_blog')->range($current, $pertask, 'ASC', 'dateline', null, 0) as $blog) {
$processed = 1;
$post = C::t('home_blogfield')->fetch($blog['blogid']);
$subject = $blog['subject'];
$message = $post['message'];
$subject_result = empty($subject) ? 0 : $censor->check($subject);
$message_result = (in_array($subject_result, array(1, 2)) || empty($message)) ? 0 : $censor->check($message);
if($subject_result) {
if($subject_result == 3) {
if(strcmp($blog['subject'], $subject)) {
C::t('home_blog')->update($blog['blogid'], array('subject' => $subject));
}
} else {
C::t('home_blog')->update($blog['blogid'], array('status' => 1));
updatemoderate('blogid', $blog['blogid']);
}
}
if($message_result) {
if($message_result == 3) {
if(strcmp($post['message'], $message)) {
C::t('home_blogfield')->update($blog['blogid'], array('message' => $message));
}
} else {
C::t('home_blog')->update($blog['blogid'], array('status' => 1));
updatemoderate('blogid', $blog['blogid']);
}
}
}
if($processed) {
cpmsg("{$lang['remoderate_blog']}: ".cplang('remoderate_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
} else {
cpmsg('remoderate_blog_succeed', 'action=remoderate', 'succeed');
}
} elseif(submitcheck('picsubmit', 1)) {
$nextlink = "action=remoderate&current=$next&pertask=$pertask&picsubmit=yes";
$processed = 0;
$censor = & discuz_censor::instance();
foreach(C::t('home_pic')->fetch_all_by_sql('`status` = 0', 'picid', $current, $pertask, 0, 0) as $pic) {
$processed = 1;
$title = $pic['title'];
$title_result = empty($title) ? 0 : $censor->check($title);
if($title_result) {
if($title_result == 3) {
if(strcmp($pic['title'], $title)) {
C::t('home_pic')->update($pic['picid'], array('title' => $title));
}
} else {
C::t('home_pic')->update($pic['picid'], array('status' => 1));
updatemoderate('picid', $pic['picid']);
}
}
}
if($processed) {
cpmsg("{$lang['remoderate_pic']}: ".cplang('remoderate_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
} else {
cpmsg('remoderate_pic_succeed', 'action=remoderate', 'succeed');
}
} elseif(submitcheck('doingsubmit', 1)) {
$nextlink = "action=remoderate&current=$next&pertask=$pertask&doingsubmit=yes";
$processed = 0;
$censor = & discuz_censor::instance();
foreach(C::t('home_doing')->fetch_all_by_status(0, $current, $pertask) as $doing) {
$processed = 1;
$message = $doing['message'];
$message_result = empty($message) ? 0 : $censor->check($message);
if($message_result) {
if($message_result == 3) {
if(strcmp($doing['message'], $message)) {
C::t('home_doing')->update($doing['doid'], array('message' => $message));
}
} else {
C::t('home_doing')->update($doing['doid'], array('status' => 1));
updatemoderate('doid', $doing['doid']);
}
}
}
if($processed) {
cpmsg("{$lang['remoderate_doing']}: ".cplang('remoderate_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
} else {
cpmsg('remoderate_doing_succeed', 'action=remoderate', 'succeed');
}
} elseif(submitcheck('sharesubmit', 1)) {
$nextlink = "action=remoderate&current=$next&pertask=$pertask&sharesubmit=yes";
$processed = 0;
$censor = & discuz_censor::instance();
foreach(C::t('home_share')->fetch_all_by_status(0, $current, $pertask) as $share) {
$processed = 1;
$sharebody = $share['body_general'];
$sharebody_result = empty($sharebody) ? 0 : $censor->check($sharebody);
if($sharebody_result) {
if($sharebody_result == 3) {
if(strcmp($share['body_general'], $sharebody)) {
C::t('home_share')->update($share['sid'], array('body_general' => $sharebody));
}
} else {
C::t('home_share')->update($share['sid'], array('status' => 1));
updatemoderate('sid', $share['sid']);
}
}
}
if($processed) {
cpmsg("{$lang['remoderate_share']}: ".cplang('remoderate_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
} else {
cpmsg('remoderate_share_succeed', 'action=remoderate', 'succeed');
}
} elseif(submitcheck('commentsubmit', 1)) {
$nextlink = "action=remoderate&current=$next&pertask=$pertask&commentsubmit=yes";
$processed = 0;
$censor = & discuz_censor::instance();
foreach(C::t('home_comment')->fetch_all_by_status(0, $current, $pertask) as $comment) {
$processed = 1;
$comment = $comment['message'];
$comment_result = empty($comment) ? 0 : $censor->check($comment);
if($comment_result) {
if($comment_result == 3) {
if(strcmp($comment['message'], $comment)) {
C::t('home_comment')->update($comment['cid'], array('message' => $comment));
}
} else {
C::t('home_comment')->update($comment['cid'], array('status' => 1));
updatemoderate($comment['idtype'].'_cid', $comment['cid']);
}
}
}
if($processed) {
cpmsg("{$lang['remoderate_comment']}: ".cplang('remoderate_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
} else {
cpmsg('remoderate_comment_succeed', 'action=remoderate', 'succeed');
}
} elseif(submitcheck('articlesubmit', 1)) {
$nextlink = "action=remoderate&current=$next&pertask=$pertask&articlesubmit=yes";
$processed = 0;
$censor = & discuz_censor::instance();
foreach(C::t('portal_article_title')->fetch_all_by_sql('`status` = 0', '', $current, $pertask) as $article) {
$processed = 1;
$subject = $article['subject'];
$subject_result = empty($subject) ? 0 : $censor->check($subject);
if($subject_result) {
if($subject_result == 3) {
if(strcmp($article['subject'], $subject)) {
C::t('portal_article_title')->update($article['aid'], array('message' => $subject));
}
} else {
C::t('portal_article_title')->update($article['aid'], array('status' => 1));
updatemoderate('aid', $article['aid']);
}
}
if(in_array($subject_result, array(0, 3))) {
foreach(C::t('portal_article_content')->fetch_all($article['aid']) as $post) {
$content = $post['content'];
$content_result = empty($content) ? 0 : $censor->check($content);
if($content_result) {
if($content_result == 3) {
if(strcmp($post['content'], $content)) {
C::t('portal_article_content')->update($post['cid'], array('content' => $content));
}
} else {
C::t('portal_article_title')->update($article['aid'], array('status' => 1));
updatemoderate('aid', $article['aid']);
break;
}
}
}
}
}
if($processed) {
cpmsg("{$lang['remoderate_article']}: ".cplang('remoderate_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
} else {
cpmsg('remoderate_article_succeed', 'action=remoderate', 'succeed');
}
} elseif(submitcheck('articlecommentsubmit', 1)) {
$nextlink = "action=remoderate&current=$next&pertask=$pertask&articlecommentsubmit=yes";
$processed = 0;
$censor = & discuz_censor::instance();
foreach(C::t('portal_comment')->fetch_all_by_idtype_status('aid', 0, $current, $pertask) as $comment) {
$processed = 1;
$comment = $comment['message'];
$comment_result = empty($comment) ? 0 : $censor->check($comment);
if($comment_result) {
if($comment_result == 3) {
if(strcmp($comment['message'], $comment)) {
C::t('portal_comment')->update($comment['cid'], array('message' => $comment));
}
} else {
C::t('portal_comment')->update($comment['cid'], array('status' => 1));
updatemoderate($comment['idtype'].'_cid', $comment['cid']);
}
}
}
if($processed) {
cpmsg("{$lang['remoderate_articlecomment']}: ".cplang('remoderate_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
} else {
cpmsg('remoderate_articlecomment_succeed', 'action=remoderate', 'succeed');
}
} elseif(submitcheck('topiccommentsubmit', 1)) {
$nextlink = "action=remoderate&current=$next&pertask=$pertask&topiccommentsubmit=yes";
$processed = 0;
$censor = & discuz_censor::instance();
foreach(C::t('portal_comment')->fetch_all_by_idtype_status('topicid', 0, $current, $pertask) as $comment) {
$processed = 1;
$comment = $comment['message'];
$comment_result = empty($comment) ? 0 : $censor->check($comment);
if($comment_result) {
if($comment_result == 3) {
if(strcmp($comment['message'], $comment)) {
C::t('portal_comment')->update($comment['cid'], array('message' => $comment));
}
} else {
C::t('portal_comment')->update($comment['cid'], array('status' => 1));
updatemoderate($comment['idtype'].'_cid', $comment['cid']);
}
}
}
if($processed) {
cpmsg("{$lang['remoderate_topiccomment']}: ".cplang('remoderate_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
} else {
cpmsg('remoderate_topiccomment_succeed', 'action=remoderate', 'succeed');
}
} else {
shownav('topic', 'nav_remoderate');
showsubmenu('nav_remoderate');
showtips('remoderate_tips');
showformheader('remoderate');
showtableheader();
showsubtitle(array('', 'remoderate_amount'));
showhiddenfields(array('pertask' => ''));
showtablerow('', array('class="td31 bold"'), array(
"{$lang['remoderate_thread']}:",
'<input name="pertask1" type="text" class="txt" value="100" /><input type="submit" class="btn" name="threadsubmit" onclick="this.form.pertask.value=this.form.pertask1.value" value="'.$lang['submit'].'" />'
));
showtablerow('', array('class="td31 bold"'), array(
"{$lang['remoderate_blog']}:",
'<input name="pertask2" type="text" class="txt" value="100" /><input type="submit" class="btn" name="blogsubmit" onclick="this.form.pertask.value=this.form.pertask2.value" value="'.$lang['submit'].'" />'
));
showtablerow('', array('class="td31 bold"'), array(
"{$lang['remoderate_pic']}:",
'<input name="pertask3" type="text" class="txt" value="100" /><input type="submit" class="btn" name="picsubmit" onclick="this.form.pertask.value=this.form.pertask3.value" value="'.$lang['submit'].'" />'
));
showtablerow('', array('class="td31 bold"'), array(
"{$lang['remoderate_doing']}:",
'<input name="pertask4" type="text" class="txt" value="100" /><input type="submit" class="btn" name="doingsubmit" onclick="this.form.pertask.value=this.form.pertask4.value" value="'.$lang['submit'].'" />'
));
showtablerow('', array('class="td31 bold"'), array(
"{$lang['remoderate_share']}:",
'<input name="pertask5" type="text" class="txt" value="100" /><input type="submit" class="btn" name="sharesubmit" onclick="this.form.pertask.value=this.form.pertask5.value" value="'.$lang['submit'].'" />'
));
showtablerow('', array('class="td31 bold"'), array(
"{$lang['remoderate_comment']}:",
'<input name="pertask6" type="text" class="txt" value="100" /><input type="submit" class="btn" name="commentsubmit" onclick="this.form.pertask.value=this.form.pertask6.value" value="'.$lang['submit'].'" />'
));
showtablerow('', array('class="td31 bold"'), array(
"{$lang['remoderate_article']}:",
'<input name="pertask7" type="text" class="txt" value="100" /><input type="submit" class="btn" name="articlesubmit" onclick="this.form.pertask.value=this.form.pertask7.value" value="'.$lang['submit'].'" />'
));
showtablerow('', array('class="td31 bold"'), array(
"{$lang['remoderate_articlecomment']}:",
'<input name="pertask8" type="text" class="txt" value="100" /><input type="submit" class="btn" name="articlecommentsubmit" onclick="this.form.pertask.value=this.form.pertask8.value" value="'.$lang['submit'].'" />'
));
showtablerow('', array('class="td31 bold"'), array(
"{$lang['remoderate_topiccomment']}:",
'<input name="pertask9" type="text" class="txt" value="100" /><input type="submit" class="btn" name="topiccommentsubmit" onclick="this.form.pertask.value=this.form.pertask9.value" value="'.$lang['submit'].'" />'
));
showtablefooter();
showformfooter();
}

View File

@@ -0,0 +1,227 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_report.php 29236 2012-03-30 05:34:47Z chenmengshu $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
require_once libfile('function/post');
cpheader();
$operation = $operation ? $operation : 'newreport';
if(submitcheck('delsubmit')) {
if(!empty($_GET['reportids'])) {
C::t('common_report')->delete($_GET['reportids']);
}
}
if(submitcheck('resolvesubmit')) {
if(!empty($_GET['reportids'])) {
$curcredits = $_G['setting']['creditstransextra'][8] ? $_G['setting']['creditstransextra'][8] : $_G['setting']['creditstrans'];
foreach($_GET['reportids'] as $id) {
$creditchange = '';
$opresult = !empty($_GET['creditsvalue'][$id])? $curcredits."\t".intval($_GET['creditsvalue'][$id]) : 'ignore';
$uid = $_GET['reportuids'][$id];
$msg = !empty($_GET['msg'][$id]) ? '<br />'.dhtmlspecialchars($_GET['msg'][$id]) : '';
if(!empty($_GET['creditsvalue'][$id])) {
$credittag = $_GET['creditsvalue'][$id] > 0 ? '+' : '';
$creditchange = '<br />'.cplang('report_your').$_G['setting']['extcredits'][$curcredits]['title'].'&nbsp;'.$credittag.$_GET['creditsvalue'][$id];
updatemembercount($uid, array($curcredits => $_GET['creditsvalue'][$id]), true, 'RPC', $id);
}
if($uid != $_G['uid'] && ($creditchange || $msg)) {
notification_add($uid, 'report', 'report_change_credits', array('creditchange' => $creditchange, 'msg' => $msg), 1);
}
C::t('common_report')->update($id, array('opuid' => $_G['uid'], 'opname' => $_G['username'], 'optime' => TIMESTAMP, 'opresult' => $opresult));
}
cpmsg('report_resolve_succeed', 'action=report', 'succeed');
}
}
if(submitcheck('receivesubmit') && $admincp->isfounder) {
$supmoderator = $_GET['supmoderator'];
$adminuser = $_GET['adminuser'];
C::t('common_setting')->update_setting('report_receive', array('adminuser' => $adminuser, 'supmoderator' => $supmoderator));
updatecache('setting');
cpmsg('report_receive_succeed', 'action=report&operation=receiveuser', 'succeed');
}
shownav('topic', 'nav_report');
$lpp = empty($_GET['lpp']) ? 20 : $_GET['lpp'];
$start = ($page - 1) * $lpp;
if($operation == 'newreport') {
showsubmenu('nav_report', array(
array('report_newreport', 'report', 1),
array('report_resolved', 'report&operation=resolved', 0),
array('report_receiveuser', 'report&operation=receiveuser', 0)
));
showtips('report_tips');
showformheader('report&operation=newreport');
showtableheader();
$curcredits = $_G['setting']['creditstransextra'][8] ? $_G['setting']['creditstransextra'][8] : $_G['setting']['creditstrans'];
$report_reward = dunserialize($_G['setting']['report_reward']);
$offset = abs(ceil(($report_reward['max'] - $report_reward['min']) / 10));
if($report_reward['max'] > $report_reward['min']) {
for($vote = $report_reward['max']; $vote >= $report_reward['min']; $vote -= $offset) {
if($vote != 0) {
$rewardlist .= $vote ? '<option value="'.$vote.'">'.($vote > 0 ? '+'.$vote : $vote).'</option>' : '';
} else {
$rewardlist .= '<option value="0" selected>'.cplang('report_newreport_no_operate').'</option>';
}
}
}
showsubtitle(array('', 'report_detail', 'report_user', ($report_reward['max'] != $report_reward['min'] ? 'operation' : '')));
$reportcount = C::t('common_report')->fetch_count();
$query = C::t('common_report')->fetch_all_report($start, $lpp);
foreach($query as $row) {
$tmp = itemview_parse($row['url']);
$itemview = ($tmp == false) ? '' : ('<br><b>'.cplang('report_newreport_view').'</b><br>'.$tmp);
showtablerow('', array('class="td25"', 'class="td28"', '', ''), array(
'<input type="checkbox" class="checkbox" name="reportids[]" value="'.$row['id'].'" />',
'<b>'.cplang('report_newreport_url').'</b><a href="'.$row['url'].'" target="_blank">'.$row['url'].'</a><br \><b>'.cplang('report_newreport_time').'</b>'.dgmdate($row['dateline']).$itemview.'<br><b>'.cplang('report_newreport_message').'</b><br>'.$row['message'],
'<a href="home.php?mod=space&uid='.$row['uid'].'">'.$row['username'].'</a><input type="hidden" name="reportuids['.$row['id'].']" value="'.$row['uid'].'">',
($report_reward['max'] != $report_reward['min'] ? $_G['setting']['extcredits'][$curcredits]['title'].':&nbsp;<select name="creditsvalue['.$row['id'].']">'.$rewardlist.'</select><br /><br />'.cplang('report_note').':&nbsp;<input type="text" name="msg['.$row['id'].']" value="">' : '')
));
}
$multipage = multi($reportcount, $lpp, $page, ADMINSCRIPT."?action=report&lpp=$lpp", 0, 3);
showsubmit('', '', '', '<input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'reportids\')" /><label for="chkall">'.cplang('select_all').'</label>&nbsp;&nbsp;<input type="submit" class="btn" name="delsubmit" value="'.$lang['delete'].'" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" class="btn" name="resolvesubmit" value="'.cplang('report_newreport_resolve').'" />', $multipage);
showtablefooter();
showformfooter();
} elseif($operation == 'resolved') {
showsubmenu('nav_report', array(
array('report_newreport', 'report', 0),
array('report_resolved', 'report&operation=resolved', 1),
array('report_receiveuser', 'report&operation=receiveuser', 0)
));
showformheader('report&operation=resolved');
showtableheader();
showsubtitle(array('', 'report_detail', 'report_optuser', 'report_opttime'));
$reportcount = C::t('common_report')->fetch_count(1);
$query = C::t('common_report')->fetch_all_report($start, $lpp, 1);
foreach($query as $row) {
if($row['opresult'] == 'ignore') {
$opresult = cplang('report_newreport_no_operate');
} else {
$row['opresult'] = explode("\t", $row['opresult']);
if($row['opresult'][1] > 0) {
$row['opresult'][1] = '+'.$row['opresult'][1];
}
$opresult = $_G['setting']['extcredits'][$row['opresult'][0]]['title'].'&nbsp;'.$row['opresult'][1];
}
showtablerow('', array('class="td25"', 'class="td28"', '', '', 'class="td26"'), array(
'<input type="checkbox" class="checkbox" name="reportids[]" value="'.$row['id'].'" />',
'<b>'.cplang('report_newreport_url').'</b><a href="'.$row['url'].'" target="_blank">'.$row['url'].'</a><br><b>'.cplang('report_newreport_time').'</b>'.dgmdate($row['dateline']).'<br><b>'.cplang('report_newreport_message').'</b>: '.$row['message'].'<br \><b>'.cplang('report_resolved_result').'</b>'.$opresult,
$row['opname'],
date('y-m-d H:i', $row['optime'])
));
}
$multipage = multi($reportcount, $lpp, $page, ADMINSCRIPT."?action=report&operation=resolved&lpp=$lpp", 0, 3);
showsubmit('', '', '', '<input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'reportids\')" /><label for="chkall">'.cplang('del').'</label>&nbsp;&nbsp;<input type="submit" class="btn" name="delsubmit" value="'.$lang['delete'].'" />', $multipage);
showtablefooter();
showformfooter();
} elseif($operation == 'receiveuser') {
showsubmenu('nav_report', array(
array('report_newreport', 'report', 0),
array('report_resolved', 'report&operation=resolved', 0),
array('report_receiveuser', 'report&operation=receiveuser', 1)
));
if(!$admincp->isfounder) {
cpmsg('report_need_founder');
}
$report_receive = dunserialize($_G['setting']['report_receive']);
showformheader('report&operation=receiveuser');
showtips('report_receive_tips');
$users = array();
$founders = $_G['config']['admincp']['founder'] !== '' ? explode(',', str_replace(' ', '', addslashes($_G['config']['admincp']['founder']))) : array();
if($founders) {
$founderexists = true;
$fuid = $fuser = array();
foreach($founders as $founder) {
if(is_numeric($founder)) {
$fuid[] = $founder;
} else {
$fuser[] = $founder;
}
}
if($fuid) {
$users = C::t('common_member')->fetch_all($fuid);
}
if($fuser) {
$users = $users + C::t('common_member')->fetch_all_by_username($fuser);
}
}
$query = C::t('common_admincp_member')->fetch_all_uid_by_gid_perm(0, 'report');
foreach ($query as $user) {
if(empty($users[$user['uid']])) {
$newuids[] = $user['uid'];
}
}
if($newuids) {
$users = $users + C::t('common_member')->fetch_all($newuids);
}
$supmoderator = array();
foreach(C::t('common_member')->fetch_all_by_adminid(2) as $uid => $row) {
if(empty($users[$uid])) {
$supmoderator[$uid] = $row['username'];
}
}
showtableheader('<input type="checkbox" name="chkall_admin" id="chkall_admin" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'adminuser\', \'chkall_admin\')" />'.cplang('usergroups_system_1'));
foreach($users as $uid => $member) {
$username = trim($member['username']);
if(empty($username) || empty($uid)) continue;
$checked = is_array($report_receive['adminuser']) && in_array($uid, $report_receive['adminuser']) ? 'checked' : '';
showtablerow('style="height:20px;width:50px;"', array('class="td25"'), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"adminuser[]\" value=\"$uid\" $checked>",
"<a href=\"home.php?mod=space&uid=$uid\" target=\"_blank\">$username</a>"
));
}
showtablefooter();
showtableheader('<input type="checkbox" name="chkall_sup" id="chkall_sup" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'supmoderator\', \'chkall_sup\')" />'.cplang('usergroups_system_2'));
foreach($supmoderator as $uid => $username) {
$username = trim($username);
if(empty($username) || empty($uid)) continue;
$checked = is_array($report_receive['supmoderator']) && in_array($uid, $report_receive['supmoderator']) ? 'checked' : '';
showtablerow('style="height:20px;width:50px;"', array('class="td25"'), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"supmoderator[]\" value=\"$uid]\" $checked>",
"<a href=\"home.php?mod=space&uid=$uid\" target=\"_blank\">$username</a>"
));
}
showsubmit('', '', '', '<input type="submit" class="btn" name="receivesubmit" value="'.$lang['submit'].'" />');
showtablefooter();
showformfooter();
}
function itemview_parse($url) {
$default_url = array(
'post' => 'forum.php?mod=redirect&goto=findpost&ptid=',
'thread' => 'forum.php?mod=viewthread&tid=',
'blog' => 'home.php?mod=space&do=blog&uid='
);
foreach($default_url as $key => $value) {
if(strpos($url, $value) === 0) {
$tmp = explode('?', $url);
parse_str($tmp[1], $kvarr);
if($key == 'post' && isset($kvarr['pid'])) {
require_once libfile('function/forum');
$pid = intval($kvarr['pid']);
$post = get_post_by_pid($pid);
return empty($post['message']) ? false : dhtmlspecialchars(messagecutstr($post['message'], 60));
} else if ($key == 'thread' && isset($kvarr['tid'])) {
require_once libfile('function/forum');
$tid = intval($kvarr['tid']);
$post = C::t('forum_post')->fetch_visiblepost_by_tid('tid:'.$tid, $tid);
return empty($post['message']) ? false : dhtmlspecialchars(messagecutstr($post['message'], 60));
} else if ($key == 'blog' && isset($kvarr['id'])) {
$id = intval($kvarr['id']);
$post = C::t('home_blogfield')->fetch($id);
return empty($post['message']) ? false : dhtmlspecialchars(messagecutstr($post['message'], 60));
}
}
}
return false;
}

View File

@@ -0,0 +1,185 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
if(!defined('DISCUZ_DEBUG') || !DISCUZ_DEBUG) {
cpheader();
cpmsg('action_noaccess', '', 'error');
}
if(!isfounder()) cpmsg('noaccess_isfounder', '', 'error');
$test_main_file = __DIR__ . "/../../tests/runtests.php";
if (!file_exists($test_main_file)) {
exit('No tests found');
}
$dbfile = __DIR__ . "/progress.db";
if ($operation === "prepare") {
unlink($dbfile);
ob_start();
echo "ok";
ob_end_flush();
exit();
}
if ($operation === "start") {
$sl3 = new SQLite3(__DIR__ . "/progress.db");
$sl3->exec('create table tests (id INTEGER PRIMARY KEY, message TEXT NOT NULL)');
define("IN_UNITTESTING", 1);
require_once($test_main_file);
global $LOGGING_OUTPUT_FUNC;
$LOGGING_OUTPUT_FUNC = function($str) use (&$sl3) {
$stmt = $sl3->prepare("insert into tests (message) values (:message)");
$stmt->bindParam(":message", trim($str), SQLITE3_TEXT);
$stmt->execute();
$stmt->close();
};
runtests_main();
$sl3->close();
exit();
}
if ($operation === "fetch") {
$sl3 = new SQLite3(__DIR__ . "/progress.db", SQLITE3_OPEN_READONLY);
$stmt = $sl3->prepare("select id, message from tests where id > :from ORDER BY id");
$stmt->bindParam(":from", dintval($_GET['from']), SQLITE3_INTEGER);
$rs = $stmt->execute();
$rsa = array();
while($row = $rs->fetchArray(SQLITE3_ASSOC)) {
$rsa[] = $row;
}
$stmt->close();
$sl3->close();
header('Content-Type: application/json');
ob_start();
echo json_encode($rsa);
ob_end_flush();
exit();
}
cpheader();
shownav('global', 'setting_runtests');
showsubmenu('setting_runtests');
?>
<?=cplang('setting_runtests_prompt')?> &nbsp;
<input type="submit" class="btn" name="confirmed" value="<?=cplang('ok')?>">
<div>
<pre id="content"></pre>
</div>
<style>
#content {
margin: 20px;
padding: 5px;
text-align: left;
line-height: 1.3em;
font-family: "Fira Code",Menlo,Consolas,monospace;
}
.failed {
color: red;
}
</style>
<script type="text/JavaScript">
var ajax = {};
ajax.x = function () {
if (typeof XMLHttpRequest !== 'undefined') {
return new XMLHttpRequest();
}
var versions = [
"MSXML2.XmlHttp.6.0",
"MSXML2.XmlHttp.5.0",
"MSXML2.XmlHttp.4.0",
"MSXML2.XmlHttp.3.0",
"MSXML2.XmlHttp.2.0",
"Microsoft.XmlHttp"
];
var xhr;
for (var i = 0; i < versions.length; i++) {
try {
xhr = new ActiveXObject(versions[i]);
break;
} catch (e) {
}
}
return xhr;
};
ajax.send = function (url, callback, method, data, async) {
if (async === undefined) {
async = true;
}
var x = ajax.x();
x.open(method, url, async);
x.onreadystatechange = function () {
if (x.readyState == 4) {
callback(x.responseText)
}
};
if (method == 'POST') {
x.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
}
x.send(data)
};
ajax.get = function (url, data, callback, async) {
var query = [];
for (var key in data) {
query.push(encodeURIComponent(key) + '=' + encodeURIComponent(data[key]));
}
ajax.send(url + (query.length ? '?' + query.join('&') : ''), callback, 'GET', null, async)
};
var MAX_ID = 0;
function read_status() {
ajax.get('<?php echo ADMINSCRIPT; ?>?action=runtests&operation=fetch&from=' + MAX_ID, '', function(s) {
try {
var items = JSON.parse(s);
for (i = 0; i < items.length; ++i) {
if (items[i].message.indexOf('FAILED') !== -1) items[i].message = '<span class="failed">' + items[i].message + '</span>';
top.frames['main'].document.getElementById('content').innerHTML += items[i].message + '<br />';
top.frames['main'].scrollTo(0,top.frames['main'].document.body.scrollHeight);
MAX_ID = items[i].id;
if (items[i].message.indexOf('totally') !== -1) return;
}
} catch (e) {
}
read_status();
})
}
function prepare() {
ajax.get('<?php echo ADMINSCRIPT; ?>?action=runtests&operation=prepare', "", function(s) {
top.frames['main'].document.getElementById('content').innerHTML += "previous log deleted <br/> <br/>";
MAX_ID = 0;
ajax.get('<?php echo ADMINSCRIPT; ?>?action=runtests&operation=start');
read_status();
});
}
var btn = top.frames['main'].document.getElementsByName('confirmed');
btn[0].onclick = function() {
top.frames['main'].document.getElementById('content').innerHTML = "test started <br/>";
prepare();
return false;
}
</script>

View File

@@ -0,0 +1,95 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_search.php 25246 2011-11-02 03:34:53Z zhangguosheng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
if(!file_exists('./data/sysdata/cache_searchindex.php')) {
require_once libfile('function/searchindex');
searchindex_cache();
}
require './data/sysdata/cache_searchindex.php';
if(!$searchindex) {
cpmsg('searchindex_not_found', '', 'error');
}
$keywords = trim($_GET['keywords']);
$kws = explode(' ', $keywords);
$kws = array_map('trim', $kws);
$kws = array_filter($kws);
$keywords = implode(' ', $kws);
$result = $html = array();
if($_GET['searchsubmit'] && $keywords) {
foreach($searchindex as $skey => $items) {
foreach($kws as $kw) {
foreach($items['text'] as $k => $text) {
if(strpos(strtolower($text), strtolower($kw)) !== FALSE) {
$result[$skey][] = $k;
}
}
}
}
if($result) {
$totalcount = 0;
foreach($result as $skey => $tkeys) {
$tmp = array();
foreach($searchindex[$skey]['index'] as $title => $url) {
if($title[0] != '_') {
$tmp[] = '<a href="'.ADMINSCRIPT.'?'.$url.'&highlight='.rawurlencode($keywords).'" target="_blank">'.$title.'</a>';
}
}
$texts = array();
$tkeys = array_unique($tkeys);
foreach($tkeys as $tkey) {
if(isset($lang[$searchindex[$skey]['text'][$tkey]])) {
$texts[] = '<li><span s="1">'.strip_tags($lang[$searchindex[$skey]['text'][$tkey]]).'</span><span s="1" class="lightfont">('.$searchindex[$skey]['text'][$tkey].')</span></li>';
} else {
$texts[] = '<li><span s="1">'.$searchindex[$skey]['text'][$tkey].'</span></li>';
}
}
$texts = array_unique($texts);
$texts = implode('', $texts);
$totalcount += $count = count($tkeys);
$html[] = '<div class="news"><span class="right">'.cplang('search_result_item', array('number' => $count)).'</span><b>'.implode(' &raquo; ', $tmp).'</b></div><ul class="tipsblock">'.$texts.'</ul>';
}
if($totalcount) {
showsubmenu('search_result', array(), '<span class="right">'.cplang('search_result_find', array('number' => $totalcount)).'</span>');
showboxheader();
echo implode('<br />', $html);
hlkws($kws);
showboxfooter();
} else {
cpmsg('search_result_noexists', '', 'error');
}
} else {
cpmsg('search_result_noexists', '', 'error');
}
} else {
cpmsg('search_keyword_noexists', '', 'error');
}
function hlkws($kws) {
echo <<<EOF
<script type="text/JavaScript">
_attachEvent(window, 'load', function () {
EOF;
foreach($kws as $kw) {
echo 'parsetag(\''.$kw.'\');';
}
echo '}, document)</script>';
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,229 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_share.php 27696 2012-02-10 03:39:50Z svn_project_zhangjie $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
$detail = $_GET['detail'];
$uid = $_GET['uid'];
$users = $_GET['users'];
$sid = $_GET['sid'];
$type = $_GET['type'];
$hot1 = $_GET['hot1'];
$hot2 = $_GET['hot2'];
$starttime = $_GET['starttime'];
$endtime = $_GET['endtime'];
$searchsubmit = $_GET['searchsubmit'];
$sids = $_GET['sids'];
$fromumanage = $_GET['fromumanage'] ? 1 : 0;
cpheader();
if(!submitcheck('sharesubmit')) {
if(empty($_GET['search'])) {
$newlist = 1;
$detail = 1;
}
if($fromumanage) {
$starttime = !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $starttime) ? '' : $starttime;
$endtime = $_G['adminid'] == 3 || !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $endtime) ? '' : $endtime;
} else {
$starttime = !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $starttime) ? dgmdate(TIMESTAMP - 86400 * 7, 'Y-n-j') : $starttime;
$endtime = $_G['adminid'] == 3 || !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", $endtime) ? dgmdate(TIMESTAMP, 'Y-n-j') : $endtime;
}
shownav('topic', 'nav_share');
showsubmenu('nav_share', array(
array('newlist', 'share', !empty($newlist)),
array('search', 'share&search=true', empty($newlist)),
));
empty($newlist) && showsubmenusteps('', array(
array('share_search', !$searchsubmit),
array('nav_share', $searchsubmit)
));
showtips('share_tips');
$staticurl = STATICURL;
echo <<<EOT
<script type="text/javascript" src="{$staticurl}js/calendar.js"></script>
<script type="text/JavaScript">
function page(number) {
$('shareforum').page.value=number;
$('shareforum').searchsubmit.click();
}
</script>
EOT;
showtagheader('div', 'searchposts', !$searchsubmit && empty($newlist));
showformheader("share".(!empty($_GET['search']) ? '&search=true' : ''), '', 'shareforum');
showhiddenfields(array('page' => $page, 'pp' => $_GET['pp'] ? $_GET['pp'] : $_GET['perpage']));
showtableheader();
showsetting('share_search_detail', 'detail', $detail, 'radio');
showsetting('share_search_perpage', '', $_GET['perpage'], "<select name='perpage'><option value='20'>{$lang['perpage_20']}</option><option value='50'>{$lang['perpage_50']}</option><option value='100'>{$lang['perpage_100']}</option></select>");
$selected[$type] = $type ? 'selected="selected"' : '';
showsetting('share_search_icon', '', $type, "<select name='type'><option value=''>{$lang['all']}</option><option value='link' {$selected['link']}>{$lang['link']}</option>
<option value='video' {$selected['video']}>{$lang['video']}</option><option value='music' {$selected['music']}>{$lang['music']}</option><option value='flash' {$selected['flash']}}>Flash</option>
<option value='blog' {$selected['blog']}>{$lang['blogs']}</option><option value='album' {$selected['album']}>{$lang['albums']}</option><option value='pic' {$selected['pic']}>{$lang['pics']}</option>
<option value='space' {$selected['space']}>{$lang['members']}</option><option value='thread' {$selected['thread']}>{$lang['thread']}</option></select>");
showsetting('share_search_uid', 'uid', $uid, 'text');
showsetting('share_search_user', 'users', $users, 'text');
showsetting('share_search_sid', 'sid', $sid, 'text');
showsetting('share_search_hot', array('hot1', 'hot2'), array('', ''), 'range');
showsetting('share_search_time', array('starttime', 'endtime'), array($starttime, $endtime), 'daterange');
echo '<input type="hidden" name="fromumanage" value="'.$fromumanage.'">';
showsubmit('searchsubmit');
showtablefooter();
showformfooter();
showtagfooter('div');
} else {
$sids = authcode($sids, 'DECODE');
$sidsadd = $sids ? explode(',', $sids) : $_GET['delete'];
include_once libfile('function/delete');
$deletecount = count(deleteshares($sidsadd));
$cpmsg = cplang('share_succeed', array('deletecount' => $deletecount));
?>
<script type="text/JavaScript">alert('<?php echo $cpmsg;?>');parent.$('shareforum').searchsubmit.click();</script>
<?php
}
if(submitcheck('searchsubmit', 1) || $newlist) {
$uids = $sids = $sharecount = 0;
$sql = $error = '';
$users = trim($users);
$uids = array();
if($users != '') {
foreach(C::t('home_share')->fetch_all_by_username(explode(',', str_replace(' ', '', $users))) as $arr) {
$uids[$arr['uid']] = $arr['uid'];
}
if(!$uids) {
$uids = array(-1);
}
$sql .= " AND s.uid IN ($uids)";
}
if($type != '') {
$arr = C::t('home_share')->fetch_by_type($type);
$type = $arr['type'];
}
if($starttime != '') {
$starttime = strtotime($starttime);
$sql .= " AND s.dateline>'$starttime'";
}
if($_G['adminid'] == 1 && $endtime != dgmdate(TIMESTAMP, 'Y-n-j')) {
if($endtime != '') {
$endtime = strtotime($endtime);
$sql .= " AND s.dateline<'$endtime'";
}
} else {
$endtime = TIMESTAMP;
}
if($sid != '') {
$sids = array();
foreach(C::t('home_share')->fetch_all(explode(',', str_replace(' ', '', $sid))) as $fidarr) {
$sids[] = $fidarr['sid'];
}
if(!$sids) {
$sids = array(-1);
}
$sql .= " AND s.sid IN ($sids)";
}
if($uid != '') {
$uidtmp = array();
foreach(C::t('home_share')->fetch_all_by_uid(explode(',', str_replace(' ', '', $uid))) as $uidarr) {
$uidtmp[$uidarr['uid']] = $uidarr['uid'];
}
if($uids && $uids[0] != -1) {
$uids = array_intersect($uids, $uidtmp);
} else {
$uids = $uidtmp;
}
if(!$uids) {
$uids = array(-1);
}
}
$sql .= $hot1 ? " AND s.hot >= '$hot1'" : '';
$sql .= $hot2 ? " AND s.hot <= '$hot2'" : '';
if(($_G['adminid'] == 2 && $endtime - $starttime > 86400 * 16) || ($_G['adminid'] == 3 && $endtime - $starttime > 86400 * 8)) {
$error = 'share_mod_range_illegal';
}
if(!$error) {
if($detail) {
$_GET['perpage'] = intval($_GET['perpage']) < 1 ? 20 : intval($_GET['perpage']);
$perpage = $_GET['pp'] ? $_GET['pp'] : $_GET['perpage'];
$sharecount = C::t('home_share')->count_by_search($sids, $uids, $type, $starttime, $endtime, $hot1, $hot2);
if($sharecount) {
$shares = '';
require_once libfile('function/share');
$start = ($page - 1) * $perpage;
foreach(C::t('home_share')->fetch_all_search($sids, $uids, $type, $starttime, $endtime, $hot1, $hot2, $start, $perpage) as $share) {
$share['dateline'] = dgmdate($share['dateline']);
$share = mkshare($share);
$shares .= showtablerow('', array('', 'style="width:80px;"', 'style="width:150px;"', 'style="width:500px;"'), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"{$share['sid']}\" />",
"<a href=\"home.php?mod=space&uid={$share['uid']}\" target=\"_blank\">".$share['username']."</a>",
$share['title_template'],
$share['body_template'],
$share['dateline']
), TRUE);
}
$multi = multi($sharecount, $perpage, $page, ADMINSCRIPT."?action=share");
$multi = preg_replace("/href=\"".ADMINSCRIPT."\?action=share&amp;page=(\d+)\"/", "href=\"javascript:page(\\1)\"", $multi);
$multi = str_replace("window.location='".ADMINSCRIPT."?action=share&amp;page='+this.value", "page(this.value)", $multi);
}
} else {
$sharecount = 0;
foreach(C::t('home_share')->fetch_all_search($sids, $uids, $type, $starttime, $endtime, $hot1, $hot2) as $share) {
$sids .= ','.$share['sid'];
$sharecount++;
}
$multi = '';
}
if(!$sharecount) {
$error = 'share_post_nonexistence';
}
}
showtagheader('div', 'postlist', $searchsubmit || $newlist);
showformheader('share&frame=no', 'target="shareframe"');
showhiddenfields(array('sids' => authcode($sids, 'ENCODE')));
showtableheader(cplang('share_result').' '.$sharecount.(empty($newlist) ? ' <a href="###" onclick="$(\'searchposts\').style.display=\'\';$(\'postlist\').style.display=\'none\';$(\'shareforum\').pp.value=\'\';$(\'shareforum\').page.value=\'\';" class="act lightlink normal">'.cplang('research').'</a>' : ''), 'fixpadding');
if($error) {
echo "<tr><td class=\"lineheight\" colspan=\"15\">$lang[$error]</td></tr>";
} else {
if($detail) {
showsubtitle(array('', 'author', 'share_title', 'share_body', 'time'));
echo $shares;
}
}
showsubmit('sharesubmit', 'delete', $detail ? 'del' : '', '', $multi);
showtablefooter();
showformfooter();
echo '<iframe name="shareframe" style="display:none"></iframe>';
showtagfooter('div');
}
?>

View File

@@ -0,0 +1,451 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_smilies.php 29236 2012-03-30 05:34:47Z chenmengshu $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
$imgextarray = array('jpg', 'gif', 'png');
$id = $_GET['id'];
if($operation == 'export' && $id) {
$smileyarray = C::t('forum_imagetype')->fetch($id);
if(!$smileyarray) {
cpheader();
cpmsg('smilies_type_nonexistence', '', 'error');
}
$smileyarray['smilies'] = array();
foreach(C::t('common_smiley')->fetch_all_by_typeid_type($id, 'smiley') as $smiley) {
$smileyarray['smilies'][] = $smiley;
}
$smileyarray['version'] = strip_tags($_G['setting']['version']);
exportdata('Discuz! Smilies', $smileyarray['name'], $smileyarray);
}
cpheader();
if(!$operation) {
if(!submitcheck('smiliessubmit')) {
shownav('style', 'smilies_edit');
showsubmenu('nav_smilies', array(
array('smilies_type', 'smilies', 1),
array('smilies_import', 'smilies&operation=import', 0),
));
showtips('smilies_tips_smileytypes');
showformheader('smilies');
showboxheader();
showtableheader();
showsubtitle(array('', 'display_order', 'enable', 'smilies_type', 'dir', 'smilies_nums', ''));
$smtypes = 0;
$dirfilter = array();
foreach(C::t('forum_imagetype')->fetch_all_by_type('smiley') as $type) {
$smiliesnum = C::t('common_smiley')->count_by_type_typeid('smiley', $type['typeid']);
showtablerow('', array('class="td25"', 'class="td28"'), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"{$type['typeid']}\" ".($smiliesnum ? 'disabled' : '').">",
"<input type=\"text\" class=\"txt\" name=\"displayordernew[{$type['typeid']}]\" value=\"{$type['displayorder']}\" size=\"2\">",
"<input class=\"checkbox\" type=\"checkbox\" name=\"availablenew[{$type['typeid']}]\" value=\"1\" ".($type['available'] ? 'checked' : '').">",
"<input type=\"text\" class=\"txt\" name=\"namenew[{$type['typeid']}]\" value=\"{$type['name']}\" size=\"15\">",
"./static/image/smiley/{$type['directory']}",
"$smiliesnum<input type=\"hidden\" name=\"smiliesnum[{$type['typeid']}]\" value=\"$smiliesnum\" />",
"<a href=\"".ADMINSCRIPT."?action=smilies&operation=update&id={$type['typeid']}\" class=\"act\" onclick=\"return confirm('{$lang['smilies_update_confirm1']}{$type['directory']}{$lang['smilies_update_confirm2']}{$type['name']}{$lang['smilies_update_confirm3']}')\">{$lang['smilies_update']}</a>&nbsp;".
"<a href=\"".ADMINSCRIPT."?action=smilies&operation=export&id={$type['typeid']}\" class=\"act\">{$lang['export']}</a>&nbsp;".
"<a href=\"".ADMINSCRIPT."?action=smilies&operation=edit&id={$type['typeid']}\" class=\"act\">{$lang['detail']}</a>"
));
$dirfilter[] = $type['directory'];
$smtypes++;
}
$smdir = DISCUZ_ROOT.'./static/image/smiley';
$smtypedir = dir($smdir);
$dirnum = 0;
while($entry = $smtypedir->read()) {
if($entry != '.' && $entry != '..' && !in_array($entry, $dirfilter) && preg_match("/^\w+$/", $entry) && strlen($entry) < 30 && is_dir($smdir.'/'.$entry)){
$smiliesdir = dir($smdir.'/'.$entry);
$smnums = 0;
$smilies = '';
while($subentry = $smiliesdir->read()) {
if(in_array(strtolower(fileext($subentry)), $imgextarray) && preg_match("/^[\w\-\.\[\]\(\)\<\> &]+$/", substr($subentry, 0, strrpos($subentry, '.'))) && strlen($subentry) < 30 && is_file($smdir.'/'.$entry.'/'.$subentry)) {
$smilies .= '<input type="hidden" name="smilies['.$dirnum.']['.$smnums.'][available]" value="1"><input type="hidden" name="smilies['.$dirnum.']['.$smnums.'][displayorder]" value="0"><input type="hidden" name="smilies['.$dirnum.']['.$smnums.'][url]" value="'.$subentry.'">';
$smnums++;
}
}
showtablerow('', array('class="td25"', 'class="td28"'), array(
($lang['add_new']),
'<input type="text" class="txt" name="newdisplayorder['.$dirnum.']" value="'.($smtypes + $dirnum + 1).'" size="2" />',
'<input class="checkbox" type="checkbox" name="newavailable['.$dirnum.']" value="1"'.($smnums ? ' checked="checked"' : ' disabled="disabled"').' />',
'<input type="text" class="txt" name="newname['.$dirnum.']" value="" size="15" />',
'./static/image/smiley/'.$entry.'<input type="hidden" name="newdirectory['.$dirnum.']" value="'.$entry.'">',
"$smnums<input type=\"hidden\" name=\"smnums[$dirnum]\" value=\"$smnums\" />",
$smilies,
'',
''
));
$dirnum++;
}
}
if(!$dirnum) {
showtablerow('', array('', 'colspan="8"'), array(
cplang('add_new'),
cplang('smiliesupload_tips')
));
}
showsubmit('smiliessubmit', 'submit', 'del');
showtablefooter();
showboxfooter();
showformfooter();
} else {
if(is_array($_GET['namenew'])) {
foreach($_GET['namenew'] as $id => $val) {
$_GET['availablenew'][$id] = $_GET['availablenew'][$id] && $_GET['smiliesnum'][$id] > 0 ? 1 : 0;
C::t('forum_imagetype')->update($id, array(
'available' => $_GET['availablenew'][$id],
'name' => dhtmlspecialchars(trim($val)),
'displayorder' => $_GET['displayordernew'][$id]
));
}
}
if($_GET['delete']) {
if(C::t('common_smiley')->count_by_type_typeid('smiley', $_GET['delete'])) {
cpmsg('smilies_delete_invalid', '', 'error');
}
C::t('forum_imagetype')->delete($_GET['delete']);
}
if(is_array($_GET['newname'])) {
foreach($_GET['newname'] as $key => $val) {
$val = trim($val);
if($val) {
$smurl = './static/image/smiley/'.$_GET['newdirectory'][$key];
$smdir = DISCUZ_ROOT.$smurl;
if(!is_dir($smdir)) {
cpmsg('smilies_directory_invalid', '', 'error', array('smurl' => $smurl));
}
$newavailable[$key] = $_GET['newavailable'][$key] && $smnums[$key] > 0 ? 1 : 0;
$data = array(
'available' => $_GET['newavailable'][$key],
'name' => dhtmlspecialchars($val),
'type' => 'smiley',
'displayorder' => $_GET['newdisplayorder'][$key],
'directory' => $_GET['newdirectory'][$key],
);
$newSmileId = C::t('forum_imagetype')->insert($data, true);
$smilies = update_smiles($smdir, $newSmileId, $imgextarray);
if($smilies['smilies']) {
addsmilies($newSmileId, $smilies['smilies']);
updatecache(array('smilies', 'smileycodes', 'smilies_js'));
}
}
}
}
updatecache(array('smileytypes', 'smilies', 'smileycodes', 'smilies_js'));
cpmsg('smilies_edit_succeed', 'action=smilies', 'succeed');
}
} elseif($operation == 'edit' && $id) {
$type = C::t('forum_imagetype')->fetch($id);
$smurl = './static/image/smiley/'.$type['directory'];
$smdir = DISCUZ_ROOT.$smurl;
if(!is_dir($smdir)) {
cpmsg('smilies_directory_invalid', '', 'error', array('smurl' => $smurl));
}
$fastsmiley = C::t('common_setting')->fetch_setting('fastsmiley', true);
if(!$do) {
if(!submitcheck('editsubmit')) {
$smiliesperpage = 100;
$start_limit = ($page - 1) * $smiliesperpage;
$num = C::t('common_smiley')->count_by_type_typeid('smiley', $id);
$multipage = multi($num, $smiliesperpage, $page, ADMINSCRIPT.'?action=smilies&operation=edit&id='.$id);
$smileynum = 1;
$smilies = '';
foreach(C::t('common_smiley')->fetch_all_by_typeid_type($id, 'smiley', $start_limit, $smiliesperpage) as $smiley) {
$smilies .= showtablerow('', array('class="td25"', 'class="td28 td24"', 'class="td25"', 'class="td23"', 'class="td23"', 'class="td24"'), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"{$smiley['id']}\">",
"<input type=\"text\" class=\"txt\" size=\"2\" name=\"displayorder[{$smiley['id']}]\" value=\"{$smiley['displayorder']}\">",
"<input class=\"checkbox\" type=\"checkbox\" name=\"fast[]\" ".(is_array($fastsmiley[$id]) && in_array($smiley['id'], $fastsmiley[$id]) ? 'checked="checked"' : '')." value=\"{$smiley['id']}\">",
"<img src=\"$smurl/{$smiley['url']}\" border=\"0\" onload=\"if(this.height>30) {this.resized=true; this.height=30;}\" onmouseover=\"if(this.resized) this.style.cursor='pointer';\" onclick=\"if(!this.resized) {return false;} else {window.open(this.src);}\">",
$smiley['id'],
"<input type=\"text\" class=\"txt\" size=\"25\" name=\"code[{$smiley['id']}]\" value=\"".dhtmlspecialchars($smiley['code'])."\" id=\"code_$smileynum\" smileyid=\"{$smiley['id']}\" />",
"<input type=\"hidden\" value=\"{$smiley['url']}\" id=\"url_$smileynum\">{$smiley['url']}"
), TRUE);
$imgfilter[] = $smiley['url'];
$smileynum ++;
}
echo <<<EOT
<script type="text/JavaScript">
function addsmileycodes(smiliesnum, pre) {
smiliesnum = parseInt(smiliesnum);
if(smiliesnum > 1) {
for(var i = 1; i < smiliesnum; i++) {
var prefix = trim($(pre + 'prefix').value);
var suffix = trim($(pre + 'suffix').value);
var page = parseInt('$page');
var middle = $(pre + 'middle').value == 1 ? $(pre + 'url_' + i).value.substr(0,$(pre + 'url_' + i).value.lastIndexOf('.')) : ($(pre + 'middle').value == 2 ? i + page * 10 : $(pre + 'code_'+ i).attributes['smileyid'].nodeValue);
if(!prefix || prefix == '{$lang['smilies_prefix']}' || !suffix || suffix == '{$lang['smilies_suffix']}') {
alert('{$lang['smilies_prefix_tips']}');
return;
}
suffix = !suffix || suffix == '{$lang['smilies_suffix']}' ? '' : suffix;
$(pre + 'code_' + i).value = prefix + middle + suffix;
}
}
}
function autoaddsmileycodes(smiliesnum) {
smiliesnum = parseInt(smiliesnum);
if(smiliesnum > 1) {
for(var i = 1; i < smiliesnum; i++) {
$('code_' + i).value = '{:' + '$id' + '_' + $('code_'+ i).attributes['smileyid'].nodeValue + ':}';
}
}
}
function clearinput(obj, defaultval) {
if(obj.value == defaultval) {
obj.value = '';
}
}
</script>
EOT;
shownav('style', 'nav_smilies');
showsubmenu(cplang('smilies_edit').' - '.$type['name'], array(
array('smilies_type', 'smilies', 0),
array('admin', "smilies&operation=edit&id=$id", !$do),
array('add', "smilies&operation=edit&do=add&id=$id", $do == 'add')
));
showformheader("smilies&operation=edit&id=$id");
showhiddenfields(array('page' => $_GET['page']));
showtableheader('', 'nobottom');
showsubtitle(array('', 'display_order', 'smilies_fast', 'smilies_edit_image', 'smilies_id', 'smilies_edit_code', 'smilies_edit_filename'));
echo $smilies;
showtablerow('', array('', 'colspan="5"'), array(
'',
$lang['smilies_edit_add_code'].' <input type="text" class="txt" style="margin-right:0;width:40px;" size="2" value="{:" title="'.$lang['smilies_prefix'].'" id="prefix" onclick="clearinput(this, \''.$lang['smilies_prefix'].'\')" /> + <select id="middle"><option value="1">'.$lang['smilies_edit_order_file'].'</option><option value="2">'.$lang['smilies_edit_order_radom'].'</option><option value="3">'.$lang['smilies_id'].'</option></select> + <input type="text" class="txt" style="margin-right:0;width:40px;" size="2" value=":}" title="'.$lang['smilies_suffix'].'" id="suffix" onclick="clearinput(this, \''.$lang['smilies_suffix'].'\')" /> <input type="button" class="btn" onclick="addsmileycodes(\''.$smileynum.'\', \'\');" value="'.$lang['apply'].'" /> &nbsp;&nbsp; <input type="button" class="btn" onclick="autoaddsmileycodes(\''.$smileynum.'\');" value="'.$lang['smilies_edit_addcode_auto'].'" />'
));
showsubmit('editsubmit', 'submit', 'del', '', $multipage);
showtablefooter();
showformfooter();
} else {
if($_GET['delete']) {
C::t('common_smiley')->delete($_GET['delete']);
}
$unsfast = array();
if(is_array($_GET['displayorder'])) {
foreach($_GET['displayorder'] as $key => $val) {
if(empty($_GET['fast']) || (is_array($_GET['fast']) && !in_array($key, $_GET['fast']))) {
$unsfast[] = $key;
}
$_GET['displayorder'][$key] = intval($_GET['displayorder'][$key]);
$_GET['code'][$key] = trim($_GET['code'][$key]);
$data = array('displayorder' => $_GET['displayorder'][$key]);
if(!empty($_GET['code'][$key])) {
$data['code'] = $_GET['code'][$key];
}
C::t('common_smiley')->update($key, $data);
}
}
$fastsmiley[$id] = array_diff(array_unique(array_merge((array)$fastsmiley[$id], (array)$_GET['fast'])), $unsfast);
C::t('common_setting')->update_setting('fastsmiley', $fastsmiley);
updatecache(array('smilies', 'smileycodes', 'smilies_js'));
cpmsg('smilies_edit_succeed', "action=smilies&operation=edit&id=$id&page={$_GET['page']}", 'succeed');
}
} elseif($do == 'add') {
if(!submitcheck('editsubmit')) {
shownav('style', 'nav_smilies');
showsubmenu(cplang('smilies_edit').' - '.$type['name'], array(
array('smilies_type', 'smilies', 0),
array('admin', "smilies&operation=edit&id=$id", !$do),
array('add', "smilies&operation=edit&do=add&id=$id", $do == 'add')
));
showtips('smilies_tips');
showtagheader('div', 'addsmilies', TRUE);
showtableheader('smilies_add', 'notop fixpadding');
showtablerow('', '', "<span class=\"bold marginright\">{$lang['smilies_type']}:</span>{$type['name']}");
showtablerow('', '', "<span class=\"bold marginright\">{$lang['dir']}:</span>$smurl {$lang['smilies_add_search']}");
showtablerow('', '', '<input type="button" class="btn" value="'.$lang['search'].'" onclick="ajaxget(\''.ADMINSCRIPT.'?action=smilies&operation=edit&do=add&id='.$id.'&search=yes\', \'addsmilies\', \'addsmilies\', \'auto\');doane(event);">');
showtablefooter();
showtagfooter('div');
if($_GET['search']) {
$newid = 1;
$newimages = '';
$imgfilter = array();
foreach(C::t('common_smiley')->fetch_all_by_typeid_type($id, 'smiley') as $smiley) {
$imgfilter[] = $img['url'];
}
$smiliesdir = dir($smdir);
while($entry = $smiliesdir->read()) {
if(in_array(strtolower(fileext($entry)), $imgextarray) && !in_array($entry, $imgfilter) && preg_match("/^[\w\-\.\[\]\(\)\<\> &]+$/", substr($entry, 0, strrpos($entry, '.'))) && strlen($entry) < 30 && is_file($smdir.'/'.$entry)) {
$newimages .= showtablerow('', array('class="td25"', 'class="td28 td24"', 'class="td23"'), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"smilies[$newid][available]\" value=\"1\" checked=\"checked\">",
"<input type=\"text\" class=\"txt\" size=\"2\" name=\"smilies[$newid][displayorder]\" value=\"0\">",
"<img src=\"$smurl/$entry\" border=\"0\" onload=\"if(this.height>30) {this.resized=true; this.height=30;}\" onmouseover=\"if(this.resized) this.style.cursor='pointer';\" onclick=\"if(!this.resized) {return false;} else {window.open(this.src);}\">",
"<input type=\"hidden\" size=\"25\" name=\"smilies[$newid][url]\" value=\"$entry\" id=\"addurl_$newid\">$entry"
), TRUE);
$newid ++;
}
}
$smiliesdir->close();
ajaxshowheader();
if($newimages) {
showformheader("smilies&operation=edit&do=add&id=$id");
showtableheader('smilies_add', 'notop fixpadding');
showsubtitle(array('', 'display_order', 'smilies_edit_image', 'smilies_edit_filename'));
echo $newimages;
showtablerow('', array('class="td25"', 'colspan="3"'), array(
'<input type="checkbox" name="chkall" onclick="checkAll(\'prefix\', this.form, \'available\')" class="checkbox" checked="checked">'.$lang['enable'],
'<input type="submit" class="btn" name="editsubmit" value="'.$lang['submit'].'"> &nbsp; <input type="button" class="btn" value="'.$lang['research'].'" onclick="ajaxget(\''.ADMINSCRIPT.'?action=smilies&operation=edit&do=add&id='.$id.'&search=yes\', \'addsmilies\', \'addsmilies\', \'auto\');doane(event);">'
));
showtablefooter();
showformfooter();
} else {
showtableheader('smilies_add', 'notop');
showtablerow('', 'class="lineheight"', cplang('smilies_edit_add_tips', array('smurl' => $smurl)));
showtablerow('', '', '<input type="button" class="btn" value="'.$lang['research'].'" onclick="ajaxget(\''.ADMINSCRIPT.'?action=smilies&operation=edit&do=add&id='.$id.'&search=yes\', \'addsmilies\', \'addsmilies\', \'auto\');doane(event);">');
showtablefooter();
}
ajaxshowfooter();
}
} else {
if(is_array($_GET['smilies'])) {
addsmilies($id, $_GET['smilies']);
}
updatecache(array('smilies', 'smileycodes', 'smilies_js'));
cpmsg('smilies_edit_succeed', "action=smilies&operation=edit&id=$id", 'succeed');
}
}
} elseif($operation == 'update' && $id) {
if(!($smtype = C::t('forum_imagetype')->fetch($id))) {
cpmsg('smilies_type_nonexistence', '', 'error');
} else {
$smurl = './static/image/smiley/'.$smtype['directory'];
$smdir = DISCUZ_ROOT.$smurl;
if(!is_dir($smdir)) {
cpmsg('smilies_directory_invalid', '', 'error', array('smurl' => $smurl));
}
}
$smilies = update_smiles($smdir, $id, $imgextarray);
if($smilies['smilies']) {
addsmilies($id, $smilies['smilies']);
updatecache(array('smilies', 'smileycodes', 'smilies_js'));
cpmsg('smilies_update_succeed', "action=smilies", 'succeed', array('smurl' => $smurl, 'num' => $smilies['num'], 'typename' => $smtype['name']));
} else {
cpmsg('smilies_update_error', '', 'error', array('smurl' => $smurl));
}
} elseif($operation == 'import') {
if(!submitcheck('importsubmit')) {
shownav('style', 'smilies_edit');
showsubmenu('nav_smilies', array(
array('smilies_type', 'smilies', 0),
array('smilies_import', 'smilies&operation=import', 1),
));
showtips('smilies_tips');
showformheader('smilies&operation=import', 'enctype');
showtableheader('smilies_import');
showimportdata();
showsubmit('importsubmit');
showtablefooter();
showformfooter();
} else {
require_once libfile('function/importdata');
$renamed = import_smilies();
if($renamed) {
cpmsg('smilies_import_succeed_renamed', 'action=smilies', 'succeed');
} else {
cpmsg('smilies_import_succeed', 'action=smilies', 'succeed');
}
}
}
function addsmilies($typeid, $smilies = array()) {
if(is_array($smilies)) {
$ids = array();
foreach($smilies as $smiley) {
if($smiley['available']) {
$data = array(
'type' => 'smiley',
'displayorder' => $smiley['displayorder'],
'typeid' => $typeid,
'code' => '',
'url' => $smiley['url'],
);
$ids[] = C::t('common_smiley')->insert($data, true);
}
}
if($ids) {
C::t('common_smiley')->update_code_by_id($ids);
}
}
}
function update_smiles($smdir, $id, &$imgextarray) {
$num = 0;
$smilies = $imgfilter = array();
foreach(C::t('common_smiley')->fetch_all_by_typeid_type($id, 'smiley') as $img) {
$imgfilter[] = $img['url'];
}
$smiliesdir = dir($smdir);
while($entry = $smiliesdir->read()) {
if(in_array(strtolower(fileext($entry)), $imgextarray) && !in_array($entry, $imgfilter) && preg_match("/^[\w\-\.\[\]\(\)\<\> &]+$/", substr($entry, 0, strrpos($entry, '.'))) && strlen($entry) < 30 && is_file($smdir.'/'.$entry)) {
$smilies[] = array('available' => 1, 'displayorder' => 0, 'url' => $entry);
$num++;
}
}
$smiliesdir->close();
return array('smilies'=>$smilies, 'num'=>$num);
}
?>

View File

@@ -0,0 +1,321 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_smsgw.php 34093 2013-10-09 05:41:18Z nemohou $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
$root = '<a href="'.ADMINSCRIPT.'?action=smsgw">'.cplang('smsgw_admin').'</a>';
$operation = $operation ? $operation : 'setting';
cpheader();
if($operation == 'list') {
if(!submitcheck('smsgwsubmit')) {
shownav('extended', 'smsgw_admin');
showsubmenu($root.' &raquo; '.cplang('smsgw_admin_list'));
showformheader("smsgw&operation=$operation");
showtableheader('', 'fixpadding');
showsubtitle(array('', 'order', 'available', 'name', 'type', ''));
$flag = false;
$classnames = array();
$avaliablesmsgw = getsmsgws();
foreach(C::t('common_smsgw')->fetch_all_gw_order_id() as $smsgw) {
$smsgwfile = '';
$etype = explode(':', $smsgw['class']);
if(count($etype) > 1 && preg_match('/^[\w\_:]+$/', $smsgw['class'])) {
$key = 'smsgw_'.$etype[1].'.php';
if(array_key_exists($key, $avaliablesmsgw)) {
$smsgwfile = DISCUZ_ROOT.'./source/plugin/'.$etype[0].'/smsgw/smsgw_'.$etype[1].'.php';
$smsgwclass = 'smsgw_'.$etype[1];
unset($avaliablesmsgw[$key]);
} else {
C::t('common_smsgw')->update($smsgw['id'], array('available' => 0));
$flag = true;
continue;
}
} else {
$key = 'smsgw_'.$smsgw['class'].'.php';
if(array_key_exists($key, $avaliablesmsgw)) {
$smsgwfile = libfile('smsgw/'.$smsgw['class'], 'class');
$smsgwclass = 'smsgw_'.$smsgw['class'];
unset($avaliablesmsgw[$key]);
} else {
C::t('common_smsgw')->update($smsgw['id'], array('available' => 0));
$flag = true;
continue;
}
}
if(!isset($classnames[$smsgw['class']])) {
require_once $smsgwfile;
if(class_exists($smsgwclass)) {
$smsgwclassv = new $smsgwclass();
$classnames[$smsgw['class']] = lang('smsgw/'.$smsgw['class'], $smsgwclassv->name);
} else {
$classnames[$smsgw['class']] = $smsgw['class'];
}
}
showtablerow('', array('class="td25"', 'class="td25"', 'class="td25"'), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"{$smsgw['smsgwid']}\" disabled=\"disabled\">",
"<input type=\"text\" class=\"txt\" size=\"2\" name=\"ordernew[{$smsgw['smsgwid']}]\" value=\"{$smsgw['order']}\">",
"<input class=\"checkbox\" type=\"checkbox\" name=\"availablenew[{$smsgw['smsgwid']}]\" value=\"1\" ".($smsgw['available'] ? 'checked' : '').">",
"<input type=\"text\" class=\"txt\" size=\"15\" name=\"namenew[{$smsgw['smsgwid']}]\" value=\"".dhtmlspecialchars($smsgw['name'])."\">",
$smsgw['type'] == 0 ? cplang('smsgw_type_message') : cplang('smsgw_type_template'),
"<a href=\"".ADMINSCRIPT."?action=smsgw&operation=edit&smsgwid={$smsgw['smsgwid']}\" class=\"act\">{$lang['edit']}</a>"
));
}
if(count($avaliablesmsgw) > 0) {
foreach($avaliablesmsgw as $smsgw) {
$arr = array('type' => $smsgw['type'], 'class' => $smsgw['class'], 'order' => 0, 'name' => $smsgw['name'], 'sendrule' => $smsgw['sendrule']);
C::t('common_smsgw')->insert($arr);
$flag = true;
}
}
if($flag) {
header("Location: ".ADMINSCRIPT."?action=smsgw&operation=$operation");
}
showsubmit('smsgwsubmit');
showtablefooter();
showformfooter();
} else {
if($_GET['delete']) {
C::t('common_smsgw')->delete($_GET['delete']);
}
if(is_array($_GET['namenew'])) {
foreach($_GET['namenew'] as $smsgwid => $title) {
C::t('common_smsgw')->update($smsgwid, array(
'available' => $_GET['availablenew'][$smsgwid],
'order' => $_GET['ordernew'][$smsgwid],
'name' => $_GET['namenew'][$smsgwid]
));
}
}
updatecache('setting');
cpmsg('smsgw_succeed', dreferer(), 'succeed');
}
} elseif($operation == 'edit' && !empty($_GET['smsgwid'])) {
if(!submitcheck('smsgwsubmit')) {
$smsgwid = $_GET['smsgwid'];
$smsgw = C::t('common_smsgw')->fetch($smsgwid);
if(!$smsgw) {
cpmsg('smsgw_nonexistence', '', 'error');
}
$smsgw['parameters'] = dunserialize($smsgw['parameters']);
$class = $smsgw['class'];
$etype = explode(':', $class);
if(count($etype) > 1 && preg_match('/^[\w\_:]+$/', $class)) {
include_once DISCUZ_ROOT.'./source/plugin/'.$etype[0].'/smsgw/smsgw_'.$etype[1].'.php';
$smsgwclass = 'smsgw_'.$etype[1];
} else {
require_once libfile('smsgw/'.$class, 'class');
$smsgwclass = 'smsgw_'.$class;
}
$smsgwclass = new $smsgwclass;
$smsgwsetting = $smsgwclass->getsetting();
$smsgwname = lang('smsgw/'.$class, $smsgwclass->name).' '.$smsgwclass->customname;
$returnurl = 'action=smsgw&operation=list';
$return = '<a href="'.ADMINSCRIPT.'?'.$returnurl.'">'.cplang('smsgw_admin_list').(empty($_GET['from']) ? ' - '.$smsgwname : '').'</a>';
shownav('extended', 'smsgw_admin');
showsubmenu($root.' &raquo; '.$return.' &raquo; ' . cplang('smsgw_edit'));
showformheader("smsgw&operation=$operation&smsgwid=$smsgwid", 'enctype');
showhiddenfields(array('referer' => $returnurl));
showtableheader(cplang('smsgw_edit').' - '.lang('smsgw/'.$class, $smsgwclass->name), 'fixpadding');
showsetting('smsgw_edit_name', 'smsgwnew[name]', $smsgw['name'], 'text');
showsetting('smsgw_edit_order', 'smsgwnew[order]', $smsgw['order'], 'text');
showsetting('smsgw_edit_sendrule', 'smsgwnew[sendrule]', $smsgw['sendrule'], 'text');
if(is_array($smsgwsetting)) {
foreach($smsgwsetting as $settingvar => $setting) {
if(!empty($setting['value']) && is_array($setting['value'])) {
foreach($setting['value'] as $k => $v) {
$setting['value'][$k][1] = lang('smsgw/'.$class, $setting['value'][$k][1]);
}
}
$varname = in_array($setting['type'], array('mradio', 'mcheckbox', 'select', 'mselect')) ?
($setting['type'] == 'mselect' ? array('parameters['.$settingvar.'][]', $setting['value']) : array('parameters['.$settingvar.']', $setting['value']))
: 'parameters['.$settingvar.']';
$value = $smsgw['parameters'][$settingvar] != '' ? $smsgw['parameters'][$settingvar] : $setting['default'];
$comment = lang('smsgw/'.$class, $setting['title'].'_comment');
$comment = $comment != $setting['title'].'_comment' ? $comment : '';
showsetting(lang('smsgw/'.$class, $setting['title']).':', $varname, $value, $setting['type'], '', 0, $comment);
}
}
showsubmit('smsgwsubmit');
showtablefooter();
showformfooter();
} else {
$smsgwid = $_GET['smsgwid'];
$smsgw = C::t('common_smsgw')->fetch($smsgwid);
$class = $smsgw['class'];
$smsgw['parameters'] = dunserialize($smsgw['parameters']);
$etype = explode(':', $class);
if(count($etype) > 1 && preg_match('/^[\w\_:]+$/', $class)) {
include_once DISCUZ_ROOT.'./source/plugin/'.$etype[0].'/smsgw/smsgw_'.$etype[1].'.php';
$smsgwclass = 'smsgw_'.$etype[1];
} else {
require_once libfile('smsgw/'.$class, 'class');
$smsgwclass = 'smsgw_'.$class;
}
$smsgwclass = new $smsgwclass;
$smsgwnew = $_GET['smsgwnew'];
$parameters = !empty($_GET['parameters']) ? $_GET['parameters'] : array();
$smsgwclass->setsetting($smsgwnew, $parameters);
if(!$smsgwnew['name']) {
cpmsg('smsgw_name_invalid', '', 'error');
} elseif(strlen($smsgwnew['name']) > 255) {
cpmsg('smsgw_name_more', '', 'error');
}
if(!$smsgwnew['sendrule']) {
cpmsg('smsgw_sendrule_invalid', '', 'error');
}
C::t('common_smsgw')->update($smsgwid, array(
'name' => $smsgwnew['name'],
'order' => (int)$smsgwnew['order'],
'sendrule' => $smsgwnew['sendrule'],
'parameters' => serialize($parameters),
));
updatecache('setting');
cpmsg('smsgw_succeed', 'action=smsgw&operation=edit&smsgwid='.$smsgwid, 'succeed');
}
} elseif($operation == 'setting') {
if(submitcheck('smsgwsubmit')) {
$smsstatus = (int)$_GET['smsstatusnew'];
$smsdefaultcc = (int)$_GET['smsdefaultccnew'];
$smsdefaultcc = $smsdefaultcc > 0 ? $smsdefaultcc : 86;
$smsdefaultlength = (int)$_GET['smsdefaultlengthnew'];
$smsdefaultlength = $smsdefaultlength > 0 ? $smsdefaultlength : 4;
$smstimelimit = (int)$_GET['smstimelimitnew'];
$smstimelimit = $smstimelimit > 0 ? $smstimelimit : 86400;
$smsnumlimit = (int)$_GET['smsnumlimitnew'];
$smsnumlimit = $smsnumlimit > 0 ? $smsnumlimit : 5;
$smsinterval = (int)$_GET['smsintervalnew'];
$smsinterval = $smsinterval > 0 ? $smsinterval : 300;
$smsmillimit = (int)$_GET['smsmillimitnew'];
$smsmillimit = $smsmillimit > 0 ? $smsmillimit : 20;
$smsglblimit = (int)$_GET['smsglblimitnew'];
$smsglblimit = $smsglblimit > 0 ? $smsglblimit : 1000;
C::t('common_setting')->update_setting('smsstatus', $smsstatus);
C::t('common_setting')->update_setting('smsdefaultcc', $smsdefaultcc);
C::t('common_setting')->update_setting('smsdefaultlength', $smsdefaultlength);
C::t('common_setting')->update_setting('smstimelimit', $smstimelimit);
C::t('common_setting')->update_setting('smsnumlimit', $smsnumlimit);
C::t('common_setting')->update_setting('smsinterval', $smsinterval);
C::t('common_setting')->update_setting('smsmillimit', $smsmillimit);
C::t('common_setting')->update_setting('smsglblimit', $smsglblimit);
updatecache('setting');
cpmsg('setting_update_succeed', 'action=smsgw&operation=setting', 'succeed');
} else {
shownav('extended', 'smsgw_admin');
showsubmenu('smsgw_admin', array(
array('smsgw_admin_setting', 'smsgw&operation=setting', 1),
array('smsgw_admin_list', 'smsgw&operation=list', 0)
));
$smsstatus = C::t('common_setting')->fetch_setting('smsstatus');
$smsdefaultcc = C::t('common_setting')->fetch_setting('smsdefaultcc');
$smsdefaultlength = C::t('common_setting')->fetch_setting('smsdefaultlength');
$smstimelimit = C::t('common_setting')->fetch_setting('smstimelimit');
$smsnumlimit = C::t('common_setting')->fetch_setting('smsnumlimit');
$smsinterval = C::t('common_setting')->fetch_setting('smsinterval');
$smsmillimit = C::t('common_setting')->fetch_setting('smsmillimit');
$smsglblimit = C::t('common_setting')->fetch_setting('smsglblimit');
showformheader("smsgw&operation=$operation");
showtableheader();
showsetting('smsgw_setting_smsstatus', 'smsstatusnew', $smsstatus, 'radio', 0, 1);
showsetting('smsgw_setting_smsdefaultcc', 'smsdefaultccnew', $smsdefaultcc, 'text');
showsetting('smsgw_setting_smsdefaultlength', 'smsdefaultlengthnew', $smsdefaultlength, 'text');
showsetting('smsgw_setting_smstimelimit', 'smstimelimitnew', $smstimelimit, 'text');
showsetting('smsgw_setting_smsnumlimit', 'smsnumlimitnew', $smsnumlimit, 'text');
showsetting('smsgw_setting_smsinterval', 'smsintervalnew', $smsinterval, 'text');
showsetting('smsgw_setting_smsmillimit', 'smsmillimitnew', $smsmillimit, 'text');
showsetting('smsgw_setting_smsglblimit', 'smsglblimitnew', $smsglblimit, 'text');
showtagfooter('tbody');
showsubmit('smsgwsubmit');
showtablefooter();
showformfooter();
}
}
function getsmsgws() {
global $_G;
$checkdirs = array_merge(array(''), $_G['setting']['plugins']['available']);
$smsgws = array();
foreach($checkdirs as $key) {
if($key) {
$dir = DISCUZ_ROOT.'./source/plugin/'.$key.'/smsgw';
} else {
$dir = DISCUZ_ROOT.'./source/class/smsgw';
}
if(!file_exists($dir)) {
continue;
}
$smsgwdir = dir($dir);
while($entry = $smsgwdir->read()) {
if(!in_array($entry, array('.', '..')) && preg_match("/^smsgw\_[\w\.]+$/", $entry) && substr($entry, -4) == '.php' && strlen($entry) < 30 && is_file($dir.'/'.$entry)) {
@include_once $dir.'/'.$entry;
$smsgwclass = substr($entry, 0, -4);
if(class_exists($smsgwclass)) {
$smsgw = new $smsgwclass();
$script = substr($smsgwclass, 6);
$script = ($key ? $key.':' : '').$script;
$smsgws[$entry] = array(
'class' => $script,
'name' => lang('smsgw/'.$script, $smsgw->name),
'version' => $smsgw->version,
'copyright' => lang('smsgw/'.$script, $smsgw->copyright),
'type' => $smsgw->type,
'sendrule' => $smsgw->sendrule,
'filemtime' => @filemtime($dir.'/'.$entry)
);
}
}
}
}
uasort($smsgws, 'filemtimesort');
return $smsgws;
}
?>

View File

@@ -0,0 +1,149 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_specialuser.php 27515 2012-02-03 03:29:49Z liulanbo $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
$operation = in_array($_GET['operation'], array('defaultuser', 'follow')) ? trim($_GET['operation']) : 'defaultuser';
$suboperation = in_array($_GET['suboperation'], array('adduser', 'specialuser')) ? trim($_GET['suboperation']) : '';
$status = ($operation == 'defaultuser') ? 1 : 0;
$op = ($status == 1) ? 'defaultuser' : 'follow';
$url = 'specialuser&operation='.$op.'&suboperation=specialuser';
if($suboperation !== 'adduser') {
if($_GET['do'] == 'edit') {
$_GET['id'] = intval($_GET['id']);
if(!submitcheck('editsubmit')) {
$info = C::t('home_specialuser')->fetch_by_uid_status($_GET['uid'], $status);
shownav('user', 'nav_defaultuser');
showsubmenu('edit');
showformheader('specialuser&operation='.$op.'&do=edit&uid='.$info['uid'], '', 'userforum');
showtableheader();
showsetting('reason', 'reason', $info['reason'], 'text');
showsubmit('editsubmit');
showtablefooter();
showformfooter();
} else {
if(!$_GET['reason']) {
cpmsg('specialuser_'.$op.'_noreason_invalid', 'action=specialuser&operation='.$op, 'error');
}
$updatearr = array('reason' => $_GET['reason']);
C::t('home_specialuser')->update_by_uid_status($_GET['uid'], $status, $updatearr);
cpmsg('specialuser_defaultuser_edit_succeed', 'action=specialuser&operation='.$op, 'succeed');
}
} elseif(!submitcheck('usersubmit')) {
shownav('user', 'nav_'.$op);
showsubmenu('nav_'.$op, array(
array('nav_'.$operation, 'specialuser&operation='.$operation, 1),
array('nav_add_'.$op, 'specialuser&operation='.$op.'&suboperation=adduser', 0)));
showtips('specialuser_'.$op.'_tips');
showformheader($url, '', 'userforum');
showtableheader();
$status ? showsubtitle(array('', 'specialuser_order', 'uid', 'username', 'reason', 'operator', 'time', ''))
: showsubtitle(array('', 'specialuser_order', 'uid', 'username', 'reason', 'operator', 'time', ''));
foreach(C::t('home_specialuser')->fetch_all_by_status($status, ($page - 1) * $_G['ppp'], $_G['ppp']) as $specialuser) {
$specialuser['dateline'] = dgmdate($specialuser['dateline']);
$arr = array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"{$specialuser['uid']}\">",
"<input type=\"text\" name=\"displayorder[{$specialuser['uid']}]\" value=\"{$specialuser['displayorder']}\" size=\"8\">",
$specialuser['uid'],
"<a href=\"home.php?mod=space&uid={$specialuser['uid']}\" target=\"_blank\">{$specialuser['username']}</a>",
$specialuser['reason'],
"<a href=\"home.php?mod=space&uid={$specialuser['opuid']}\" target=\"_blank\">{$specialuser['opusername']}</a>",
$specialuser['dateline'],
"<a href=\"".ADMINSCRIPT."?action=specialuser&operation=$op&do=edit&uid={$specialuser['uid']}\" class=\"act\">".$lang['edit']."</a>"
);
showtablerow('', '', $arr);
}
$usercount = C::t('home_specialuser')->count_by_status($status);
$multi = multi($usercount, $_G['ppp'], $page, ADMINSCRIPT."?action=specialuser&operation=$op");
showsubmit('usersubmit', 'submit', 'del', '', $multi);
showtablefooter();
showformfooter();
} else {
$ids = array();
if(is_array($_GET['delete'])) {
foreach($_GET['delete'] as $id) {
$ids[] = $id;
}
if($ids) {
C::t('home_specialuser')->delete_by_uid_status($ids, $status);
cpmsg('specialuser_'.$op.'_del_succeed', 'action='.$url, 'succeed');
}
}
if(is_array($_GET['displayorder'])) {
foreach($_GET['displayorder'] as $id => $val) {
$updatearr = array('displayorder' => intval($_GET['displayorder'][$id]));
C::t('home_specialuser')->update_by_uid_status($id, $status, $updatearr);
}
}
cpmsg('specialuser_defaultuser_edit_succeed', 'action='.$url, 'succeed');
}
} elseif($suboperation == 'adduser') {
if(!submitcheck('addsubmit')) {
shownav('user', 'nav_'.$op);
showsubmenu('nav_'.$op, array(
array('nav_'.$operation, 'specialuser&operation='.$operation, 0),
array('nav_add_'.$op, 'specialuser&operation='.$op.'&suboperation=adduser', 1)));
showtips('specialuser_defaultuser_add_tips');
showformheader('specialuser&operation='.$op.'&suboperation=adduser', '', 'userforum');
showtableheader();
showsetting('username', 'username', '', 'text');
showsetting('reason', 'reason', '', 'text');
showsubmit('addsubmit');
showtablefooter();
showformfooter();
} else {
$username = trim($_GET['username']);
$reason = trim($_GET['reason']);
if(!$username || !$reason) {
cpmsg('specialuser_defaultuser_add_invaild', '', 'error');
}
if(C::t('home_specialuser')->count_by_status($status, $username)) {
cpmsg('specialuser_defaultuser_added_invalid', '', 'error');
}
$member = C::t('common_member')->fetch_by_username($username);
if(empty($member)) {
cpmsg('specialuser_defaultuser_nouser_invalid', '', 'error');
}
$data = array(
'status' => $status,
'uid' => $member['uid'],
'username' => $member['username'],
'reason' => $reason,
'dateline' => $_G['timestamp'],
'opuid' => $_G['member']['uid'],
'opusername' => $_G['member']['username']
);
if(C::t('home_specialuser')->insert($data)) {
cpmsg('specialuser_'.$op.'_add_succeed', 'action='.$url, 'succeed');
}
}
}
?>

View File

@@ -0,0 +1,796 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_styles.php 36353 2017-01-17 07:19:28Z nemohou $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
if(!empty($_GET['preview'])) {
loadcache('style_'.$_GET['styleid']);
$_G['style'] = $_G['cache']['style_'.$_GET['styleid']];
include template('common/preview', $_G['style']['templateid'], $_G['style']['tpldir']);
exit;
}
require_once libfile('function/cloudaddons');
$scrolltop = $_GET['scrolltop'];
$anchor = $_GET['anchor'];
$namenew = $_GET['namenew'];
$defaultnew = $_GET['defaultnew'];
$newname = $_GET['newname'];
$id = $_GET['id'];
$isplugindeveloper = isset($_G['config']['plugindeveloper']) && $_G['config']['plugindeveloper'] > 0;
$operation = empty($operation) ? 'admin' : $operation;
if($operation == 'export' && $id) {
$stylearray = C::t('common_style')->fetch_by_styleid($id);
if(!$stylearray) {
cpheader();
cpmsg('styles_export_invalid', '', 'error');
}
$addonid = '';
if(preg_match('/^.?\/template\/([a-z]+[a-z0-9_]*)$/', $stylearray['directory'], $a) && $a[1] != 'default') {
$addonid = $a[1].'.template';
}
if(($isplugindeveloper && $isfounder) || !$addonid || !cloudaddons_getmd5($addonid)) {
if (ispluginkey(basename($stylearray['directory']))) {
cpheader();
cloudaddons_validator(basename($stylearray['directory']).'.template');
}
foreach(C::t('common_stylevar')->fetch_all_by_styleid($id) as $style) {
$stylearray['style'][$style['variable']] = $style['substitute'];
}
$stylearray['version'] = strip_tags($_G['setting']['version']);
exportdata('Discuz! Style', basename($stylearray['directory']), $stylearray);
} else {
cpheader();
cpmsg('styles_export_invalid', '', 'error');
}
}
cpheader();
$predefinedvars = array('available' => array(), 'boardimg' => array(), 'searchimg' => array(), 'touchimg' => array(), 'imgdir' => array(), 'styleimgdir' => array(), 'stypeid' => array(),
'headerbgcolor' => array(0, $lang['styles_edit_type_bg']),
'bgcolor' => array(0),
'sidebgcolor' => array(0, '', '#FFF sidebg.gif repeat-y 100% 0'),
'titlebgcolor' => array(0),
'headerborder' => array(1, $lang['styles_edit_type_header'], '1px'),
'headertext' => array(0),
'footertext' => array(0),
'font' => array(1, $lang['styles_edit_type_font']),
'fontsize' => array(1),
'threadtitlefont' => array(1, $lang['styles_edit_type_thread_title']),
'threadtitlefontsize' => array(1),
'smfont' => array(1),
'smfontsize' => array(1),
'tabletext' => array(0),
'midtext' => array(0),
'lighttext' => array(0),
'link' => array(0, $lang['styles_edit_type_url']),
'highlightlink' => array(0),
'lightlink' => array(0),
'wrapbg' => array(0),
'wrapbordercolor' => array(0),
'msgfontsize' => array(1, $lang['styles_edit_type_post'], '14px'),
'contentwidth' => array(1),
'contentseparate' => array(0),
'menubgcolor' => array(0, $lang['styles_edit_type_menu']),
'menutext' => array(0),
'menucurbgcolor' => array(0),
'menuhoverbgcolor' => array(0),
'menuhovertext' => array(0),
'inputborder' => array(0, $lang['styles_edit_type_input']),
'inputborderdarkcolor' => array(0),
'inputbg' => array(0, '', '#FFF'),
'dropmenuborder' => array(0, $lang['styles_edit_type_dropmenu']),
'dropmenubgcolor' => array(0),
'floatbgcolor' => array(0, $lang['styles_edit_type_float']),
'floatmaskbgcolor' => array(0),
'commonborder' => array(0, $lang['styles_edit_type_other']),
'commonbg' => array(0),
'specialborder' => array(0),
'specialbg' => array(0),
'noticetext' => array(0),
);
if($operation == 'admin') {
$sarray = $tpldirs = $addonids = array();
foreach(C::t('common_style')->fetch_all_data(true) as $row) {
if(preg_match('/^.?\/template\/([a-z]+[a-z0-9_]*)$/', $row['directory'], $a) && $a[1] != 'default') {
$addonids[$row['styleid']] = $a[1].'.template';
}
$sarray[$row['styleid']] = $row;
$tpldirs[] = realpath($row['directory']);
}
$defaultid = C::t('common_setting')->fetch_setting('styleid');
$defaultid1 = C::t('common_setting')->fetch_setting('styleid1');
$defaultid2 = C::t('common_setting')->fetch_setting('styleid2');
$defaultid3 = C::t('common_setting')->fetch_setting('styleid3');
if(!submitcheck('stylesubmit')) {
$narray = array();
$dir = DISCUZ_ROOT.'./template/';
$templatedir = dir($dir);$i = -1;
while($entry = $templatedir->read()) {
$tpldir = realpath($dir.'/'.$entry);
if(!in_array($entry, array('.', '..')) && !in_array($tpldir, $tpldirs) && is_dir($tpldir)) {
$styleexist = 0;
$searchdir = dir($tpldir);
while($searchentry = $searchdir->read()) {
if(substr($searchentry, 0, 13) == 'discuz_style_' && fileext($searchentry) == 'xml') {
$styleexist++;
}
}
if($styleexist) {
$narray[$i] = array(
'styleid' => '',
'available' => '',
'directory' => './template/'.$entry,
'name' => $entry,
'tplname' => $entry,
'filemtime' => @filemtime($dir.'/'.$entry),
'stylecount' => $styleexist
);
$i--;
}
}
}
uasort($narray, 'filemtimesort');
$recommendaddon = dunserialize($_G['setting']['cloudaddons_recommendaddon']);
if(empty($recommendaddon['updatetime']) || abs($_G['timestamp'] - $recommendaddon['updatetime']) > 7200 || (isset($_GET['checknew']) && $_G['formhash'] == $_GET['formhash'])) {
$recommendaddon = json_decode(cloudaddons_recommendaddon($addonids), true);
if(empty($recommendaddon) || !is_array($recommendaddon)){
$recommendaddon = array();
}
$recommendaddon['updatetime'] = $_G['timestamp'];
C::t('common_setting')->update('cloudaddons_recommendaddon', $recommendaddon);
updatecache('setting');
}
if(!empty($recommendaddon['templates']) && is_array($recommendaddon['templates'])){
$count = 0;
foreach ($recommendaddon['templates'] as $key => $value) {
if (!empty($value['identifier']) && !is_dir($dir.'/'.$value['identifier'])) {
$narray[$i] = array(
'styleid' => '',
'available' => '',
'name' => diconv($value['name'], 'utf-8', CHARSET),
'directory' => './template/'.$value['identifier'],
'tplname' => diconv($value['tplname'], 'utf-8', CHARSET),
'filemtime' => $value['updatetime'],
'stylecount' => $value['stylecount'],
'down' => 1,
);
$i--;
$count++;
if (!empty($recommendaddon['templateshownum']) && $count >= $recommendaddon['templateshownum']) {
break;
}
}
}
}
$sarray += $narray;
$stylelist = '';
$i = 0;
$updatestring = array();
foreach($sarray as $id => $style) {
$style['name'] = dhtmlspecialchars($style['name']);
$isdefault = $id == $defaultid || $id == 1 ? 'checked' : '';
$isdefault1 = $id == $defaultid1 ? 'checked' : '';
$isdefault2 = $id == $defaultid2 ? 'checked' : '';
$isdefault3 = $id == $defaultid3 ? 'checked' : '';
$d2exists = file_exists($style['directory'].'/touch');
$available = $style['available'] ? 'checked' : NULL;
$identifier = end(explode('/', $style['directory']));
$preview = file_exists($style['directory'].'/preview.jpg') ? $style['directory'].'/preview.jpg' : cloudaddons_pluginlogo_url($identifier, 'template');
$previewlarge = file_exists($style['directory'].'/preview_large.jpg') ? $style['directory'].'/preview_large.jpg' : cloudaddons_pluginlogo_url($identifier, 'template');
$styleicons = isset($styleicons[$id]) ? $styleicons[$id] : '';
if($addonids[$style['styleid']]) {
if(!isset($updatestring[$addonids[$style['styleid']]])) {
$updatestring[$addonids[$style['styleid']]] = "<p id=\"update_".$addonids[$style['styleid']]."\"></p>";
} else {
$updatestring[$addonids[$style['styleid']]] = '';
}
}
$stylelist .=
'<table cellspacing="0" cellpadding="0" style="margin-left: 10px; width: 250px;height: 200px;" class="left"><tr><th class="partition" colspan="2">'.($addonids[$id] ? "<a href=\"".ADMINSCRIPT."?action=cloudaddons&frame=no&id=".$identifier.".template\" target=\"_blank\" title=\"$lang[cloudaddons_linkto]\">$style[tplname]</a>" : $style['tplname']).'</th></tr><tr><td style="width: 130px;height:150px" valign="top">'.
($id > 0 ? "<p style=\"margin-bottom: 12px;\"><img width=\"110\" height=\"120\" ".($previewlarge ? 'style="cursor:pointer" title="'.$lang['preview_large'].'" onclick="zoom(this, \''.$previewlarge.'\', 1)" ' : '')."src=\"$preview\" alt=\"{$lang['preview']}\" onerror=\"this.onerror=null;this.src='./static/image/admincp/stylepreview.gif'\"/></p>
<p style=\"margin: 2px 0\"><input type=\"text\" class=\"txt\" name=\"namenew[$id]\" value=\"{$style['name']}\" style=\"margin:0; width: 104px;\"></p></td><td valign=\"top\">
<p> {$lang['styles_default']}</p>
<p style=\"margin: 1px 0\"><label><input type=\"radio\" class=\"radio\" name=\"defaultnew\" value=\"$id\" $isdefault /> {$lang['styles_default0']}</label></p>
".($d2exists ? "<p style=\"margin: 1px 0\"><label><input type=\"radio\" class=\"radio\" name=\"defaultnew2\" value=\"$id\" $isdefault2 /> {$lang['styles_default2']}</label></p>" : "<p style=\"margin: 1px 0\" class=\"lightfont\"><label><input type=\"radio\" class=\"radio\" disabled readonly /> {$lang['styles_default2']}</label></p>")."
<p style=\"margin: 8px 0 0 0\"><label>".($isdefault || $isdefault1 || $isdefault2 || $isdefault3 ? '<input class="checkbox" type="checkbox" disabled="disabled" />' : '<input class="checkbox" type="checkbox" name="delete[]" value="'.$id.'" />')." {$lang['styles_uninstall']}</label></p>
<p style=\"margin: 8px 0 2px 0\"><a href=\"".ADMINSCRIPT."?action=styles&operation=edit&id=$id\">{$lang['edit']}</a> &nbsp;".
(($isplugindeveloper && $isfounder) || !$addonids[$style['styleid']] || !cloudaddons_getmd5($addonids[$style['styleid']]) ? " <a href=\"".ADMINSCRIPT."?action=styles&operation=export&id=$id\">{$lang['export']}</a><br />" : '<br />').
"<a href=\"".ADMINSCRIPT."?action=styles&operation=copy&id=$id\">{$lang['copy']}</a> &nbsp; <a href=\"".ADMINSCRIPT."?action=styles&operation=import&dir=".$identifier."&restore=$id\">{$lang['restore']}</a>
".($isfounder && $addonids[$id] ? " &nbsp; <a href=\"".ADMINSCRIPT."?action=cloudaddons&frame=no&id=".$identifier.".template&from=comment\" target=\"_blank\" title=\"{$lang['cloudaddons_linkto']}\">{$lang['plugins_visit']}</a>" : '')."
</p>"
:
"<img width=\"110\" height=\"120\" src=\"$preview\" ".($previewlarge ? 'style="cursor:pointer" title="'.$lang['preview_large'].'" onclick="zoom(this, \''.$previewlarge.'\', 1)" ' : '')." onerror=\"this.onerror=null;this.src='./static/image/admincp/stylepreview.gif'\" /></td><td valign=\"top\">
<p style=\"margin: 2px 0\"><a href=\"".ADMINSCRIPT."?action=styles&operation=import&dir=$identifier\">{$lang['styles_install']}</a></p>".
($style['stylecount'] > 0 ? "<p style=\"margin: 2px 0\">{$lang['styles_stylecount']}: {$style['stylecount']}</p>" : '').
($style['filemtime'] > $timestamp - 86400 ? '<p style=\"margin-bottom: 2px;\"><font color="red">New!</font></p>' : '')).
"</td></tr><tr><td colspan=\"2\">".$updatestring[$addonids[$style['styleid']]]."</td></tr></table>\n".($i == 3 ? '</tr>' : '');
$i++;
if($i == 3) {
$i = 0;
}
}
if($i > 0) {
$stylelist .= str_repeat('<td></td>', 3 - $i);
}
if(empty($_G['cookie']['addoncheck_template'])) {
$checkresult = dunserialize(cloudaddons_upgradecheck($addonids));
savecache('addoncheck_template', $checkresult);
dsetcookie('addoncheck_template', 1, 3600);
} else {
loadcache('addoncheck_template');
$checkresult = $_G['cache']['addoncheck_template'];
}
$updatecount = 0;
$newvers = '';
foreach($checkresult as $addonid => $value) {
list($return, $newver) = explode(':', $value);
if($newver) {
$updatecount++;
$newvers .= "if($('update_$addonid')) $('update_$addonid').innerHTML=' <a href=\"".ADMINSCRIPT."?action=cloudaddons&frame=no&id=$addonid&from=newver\" target=\"_blank\"><font color=\"red\">".cplang('styles_find_newversion')." $newver</font></a>';";
}
}
shownav('template', 'styles_list');
showsubmenu('styles_admin', array(
array('styles_list', 'styles', 1),
array('styles_import', 'styles&operation=import', 0),
$isfounder ? array('plugins_validator'.($updatecount ? '_new' : ''), 'styles&operation=upgradecheck', 0) : array(),
$isfounder ? array('cloudaddons_style_link', 'cloudaddons&frame=no&operation=templates&from=more', 0, 1) : array(),
), '<a href="https://www.dismall.com/?from=templates_question" target="_blank" class="rlink">'.$lang['templates_question'].'</a>', array('updatecount' => $updatecount));
showtips('styles_home_tips');
showformheader('styles');
showhiddenfields(array('updatecsscache' => 0));
showboxheader('', 'nobottom');
echo $stylelist;
showboxfooter();
showtableheader();
showsubmit('stylesubmit', 'submit', 'del', '<input onclick="this.form.updatecsscache.value=1" type="submit" class="btn" name="stylesubmit" value="'.cplang('styles_csscache_update').'">'.($isfounder ? '&nbsp;&nbsp;<a href="'.ADMINSCRIPT.'?action=cloudaddons&frame=no&operation=templates&from=more" target="_blank">'.cplang('cloudaddons_style_link').'</a>' : ''));
showtablefooter();
showformfooter();
if($newvers) {
echo '<script type="text/javascript">'.$newvers.'</script>';
}
} else {
if($_GET['updatecsscache']) {
updatecache(array('setting', 'styles'));
loadcache('style_default', true);
updatecache('updatediytemplate');
$tpl = dir(DISCUZ_ROOT.'./data/template');
while($entry = $tpl->read()) {
if(preg_match("/\.tpl\.php$/", $entry)) {
@unlink(DISCUZ_ROOT.'./data/template/'.$entry);
}
}
$tpl->close();
cpmsg('csscache_update', 'action=styles', 'succeed');
} else {
$defaultids = array();
$dfids = array('', '1', '2', '3');
foreach ($dfids as $dfid) {
$defaultnew = $_GET['defaultnew'.$dfid];
if(is_numeric($defaultnew) && isset($sarray[$defaultnew])) {
if (!in_array($defaultnew, $defaultids)) {
if (basename($sarray[$defaultnew]['directory']) != 'default' && ispluginkey(basename($sarray[$defaultnew]['directory']))) {
cpheader();
$addonid = basename($sarray[$defaultnew]['directory']).'.template';
$array = cloudaddons_getmd5($addonid);
if(cloudaddons_open('&mod=app&ac=validator&ver=2&addonid='.$addonid.($array !== false ? '&rid='.$array['RevisionID'].'&sn='.$array['SN'].'&rd='.$array['RevisionDateline'] : '')) === '0') {
cpmsg('clo'.'uda'.'ddon'.'s_gen'.'uine_'.'mes'.'sage', '', 'error', array('addonid' => $addonid));
}
}
$defaultids[] = $defaultnew;
}
C::t('common_setting')->update_setting('styleid'.$dfid, $defaultnew);
}
}
if(isset($_GET['namenew'])) {
foreach($sarray as $id => $old) {
$namenew[$id] = trim($_GET['namenew'][$id]);
if($namenew[$id] != $old['name']) {
C::t('common_style')->update($id, array('name' => $namenew[$id]));
}
}
}
$delete = $_GET['delete'];
if(!empty($delete) && is_array($delete)) {
$did = array();
foreach($delete as $id) {
$id = intval($id);
if(in_array($id, $defaultids)) {
cpmsg('styles_delete_invalid', '', 'error');
} elseif($id != 1){
$did[] = intval($id);
}
}
if($did) {
$tplids = array();
foreach(C::t('common_style')->fetch_all_data() as $style) {
$tplids[$style['templateid']] = $style['templateid'];
}
C::t('common_style')->delete($did);
C::t('common_stylevar')->delete_by_styleid($did);
C::t('forum_forum')->update_styleid($did);
foreach(C::t('common_style')->fetch_all_data() as $style) {
unset($tplids[$style['templateid']]);
}
if($tplids) {
foreach(C::t('common_template')->fetch_all($tplids) as $tpl) {
cloudaddons_uninstall(basename($tpl['directory']).'.template', $tpl['directory']);
}
C::t('common_template')->delete_tpl($tplids);
}
}
}
if($_GET['newname']) {
$styleidnew = C::t('common_style')->insert(array('name' => $_GET['newname'], 'templateid' => 1), true);
foreach(array_keys($predefinedvars) as $variable) {
$substitute = isset($predefinedvars[$variable][2]) ? $predefinedvars[$variable][2] : '';
C::t('common_stylevar')->insert(array('styleid' => $styleidnew, 'variable' => $variable, 'substitute' => $substitute));
}
}
updatecache(array('setting', 'styles'));
loadcache('style_default', true);
updatecache('updatediytemplate');
cpmsg('styles_edit_succeed', 'action=styles', 'succeed');
}
}
} elseif($operation == 'import') {
$_GET['dir'] = isset($_GET['dir']) ? preg_replace('#([^\w]+)#is', '', $_GET['dir']) : '';
if(!submitcheck('importsubmit') && empty($_GET['dir'])) {
shownav('template', 'styles_import');
showsubmenu('styles_admin', array(
array('styles_list', 'styles', 0),
array('styles_import', 'styles&operation=import', 1),
$isfounder ? array('cloudaddons_style_link', 'cloudaddons&frame=no&operation=templates&from=more', 0, 1) : array(),
), '<a href="https://www.dismall.com/?from=templates_question" target="_blank" class="rlink">'.$lang['templates_question'].'</a>');
showformheader('styles&operation=import', 'enctype');
showtableheader('styles_import');
showimportdata();
showtablerow('', 'colspan="2"', '<input class="checkbox" type="checkbox" name="ignoreversion" id="ignoreversion" value="1" /><label for="ignoreversion"> '.cplang('styles_import_ignore_version').'</label>');
showsubmit('importsubmit');
showtablefooter();
showformfooter();
} else {
if (!is_dir(DISCUZ_ROOT.'./template/'.$_GET['dir'])) {
echo '<script type="text/javascript">top.location.href=\''.ADMINSCRIPT.'?action=cloudaddons&frame=no&id='.$_GET['dir'].'.template&from=recommendaddon\';</script>';
exit;
}
require_once libfile('function/importdata');
$restore = !empty($_GET['restore']) ? $_GET['restore'] : 0;
if($restore) {
$style = C::t('common_style')->fetch_by_styleid($restore);
$_GET['dir'] = $style['directory'];
}
if(!empty($_GET['dir'])) {
$renamed = import_styles($_GET['ignoreversion'], $_GET['dir'], $restore);
} else {
$renamed = import_styles($_GET['ignoreversion'], $_GET['dir']);
}
dsetcookie('addoncheck_template', '', -1);
cpmsg(!empty($_GET['dir']) ? (!$restore ? 'styles_install_succeed' : 'styles_restore_succeed') : ($renamed ? 'styles_import_succeed_renamed' : 'styles_import_succeed'), 'action=styles', 'succeed');
}
} elseif($operation == 'copy') {
$style = C::t('common_style')->fetch_by_styleid($id);
if (ispluginkey(basename($style['directory']))) {
cloudaddons_validator(basename($style['directory']).'.template');
}
$style['name'] .= '_'.random(4);
$styleidnew = C::t('common_style')->insert(array('name' => $style['name'], 'available' => $style['available'], 'templateid' => $style['templateid']), true);
foreach(C::t('common_stylevar')->fetch_all_by_styleid($id) as $stylevar) {
C::t('common_stylevar')->insert(array('styleid' => $styleidnew, 'variable' => $stylevar['variable'], 'substitute' => $stylevar['substitute']));
}
updatecache(array('setting', 'styles'));
cpmsg('styles_copy_succeed', 'action=styles', 'succeed');
} elseif($operation == 'edit') {
if(!submitcheck('editsubmit')) {
if(empty($id)) {
$stylelist = "<select name=\"id\" style=\"width: 150px\">\n";
foreach(C::t('common_style')->fetch_all_data() as $style) {
$stylelist .= "<option value=\"{$style['styleid']}\">{$style['name']}</option>\n";
}
$stylelist .= '</select>';
$highlight = getgpc('highlight');
$highlight = !empty($highlight) ? dhtmlspecialchars($highlight, ENT_QUOTES) : '';
cpmsg('styles_nonexistence', 'action=styles&operation=edit'.(!empty($highlight) ? "&highlight=$highlight" : ''), 'form', array(), $stylelist);
}
$style = C::t('common_style')->fetch_by_styleid($id);
if(!$style) {
cpmsg('style_not_found', '', 'error');
}
list($style['extstyle'], $style['defaultextstyle']) = explode('|', $style['extstyle']);
$style['extstyle'] = explode("\t", $style['extstyle']);
$extstyle = $defaultextstyle = array();
if(file_exists($extstyledir = DISCUZ_ROOT.$style['directory'].'/style')) {
$defaultextstyle[] = array('', $lang['default']);
$tpl = dir($extstyledir);
while($entry = $tpl->read()) {
if($entry != '.' && $entry != '..' && file_exists($extstylefile = $extstyledir.'/'.$entry.'/style.css')) {
$content = file_get_contents($extstylefile);
if(preg_match('/\[name\](.+?)\[\/name\]/i', $content, $r1) && preg_match('/\[iconbgcolor](.+?)\[\/iconbgcolor]/i', $content, $r2)) {
$extstyle[] = array($entry, '<em style="background:'.$r2[1].'">&nbsp;&nbsp;&nbsp;&nbsp;</em> '.$r1[1]);
$defaultextstyle[] = array($entry, $r1[1]);
}
}
}
$tpl->close();
}
$stylecustom = '';
$stylestuff = $existvars = $stylecustomvars = array();
foreach(C::t('common_stylevar')->fetch_all_by_styleid($id) as $stylevar) {
if(array_key_exists($stylevar['variable'], $predefinedvars)) {
$stylestuff[$stylevar['variable']] = array('id' => $stylevar['stylevarid'], 'subst' => $stylevar['substitute']);
$existvars[] = $stylevar['variable'];
} else {
$stylecustom .= showtablerow('', array('class="td25"', 'class="td24 bold"', 'class="td26"'), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"{$stylevar['stylevarid']}\">",
'{'.strtoupper($stylevar['variable']).'}',
"<textarea name=\"stylevar[{$stylevar['stylevarid']}]\" style=\"height: 45px\" cols=\"50\" rows=\"2\">{$stylevar['substitute']}</textarea>",
), TRUE);
$stylecustomvars[$stylevar['stylevarid']] = $stylevar;
}
}
if($diffvars = array_diff(array_keys($predefinedvars), $existvars)) {
foreach($diffvars as $variable) {
$stylestuff[$variable] = array(
'id' => C::t('common_stylevar')->insert(array('styleid' => $id, 'variable' => $variable, 'substitute' => ''), true),
'subst' => ''
);
}
}
$tplselect = array();
foreach(C::t('common_template')->fetch_all_data() as $template) {
$tplselect[] = array($template['templateid'], $template['name']);
}
$smileytypes = array();
foreach(C::t('forum_imagetype')->fetch_all_available() as $type) {
$smileytypes[] = array($type['typeid'], $type['name']);
}
$adv = !empty($_GET['adv']) ? 1 : 0;
shownav('template', 'styles_edit');
showsubmenu(cplang('styles_admin').' - '.$style['name'], array(
array('admin', 'styles', 0),
array('edit' , 'styles&operation=edit&id='.$id, 1),
$isfounder ? array('export', 'styles&operation=export&id='.$id, 0) : array(),
$isplugindeveloper ? array('templates_add', 'templates&operation=add', 0) : array(),
array('cloudaddons_style_link', 'cloudaddons&frame=no&operation=templates&from=more', 0, 1),
));
?>
<script type="text/JavaScript">
function imgpre_onload(obj) {
if(!obj.complete) {
setTimeout(function() {imgpre_resize(obj)}, 100);
}
imgpre_resize(obj);
}
function imgpre_resize(obj) {
if(obj.width > 350) {
obj.style.width = '350px';
}
}
function imgpre_update(id, obj) {
url = obj.value;
if(url) {
re = /^(https?:)?\/\//i;
var matches = re.exec(url);
if(matches == null) {
url = ($('styleimgdir').value ? $('styleimgdir').value : ($('imgdir').value ? $('imgdir').value : '<?php echo STATICURL; ?>image/common')) + '/' + url;
}
$('bgpre_' + id).style.backgroundImage = 'url(' + url + ')';
} else {
$('bgpre_' + id).style.backgroundImage = 'url(<?php echo STATICURL; ?>image/common/none.gif)';
}
}
function imgpre_switch(id) {
if($('bgpre_' + id).innerHTML == '') {
url = $('bgpre_' + id).style.backgroundImage.substring(4, $('bgpre_' + id).style.backgroundImage.length - 1);
$('bgpre_' + id).innerHTML = '<img onload="imgpre_onload(this)" src="' + url + '" />';
$('bgpre_' + id).backgroundImage = $('bgpre_' + id).style.backgroundImage;
$('bgpre_' + id).style.backgroundImage = '';
} else {
$('bgpre_' + id).style.backgroundImage = $('bgpre_' + id).backgroundImage;
$('bgpre_' + id).innerHTML = '';
}
}
</script>
<?php
$configflag = false;
if(preg_match('/^.?\/template\/([a-z]+[a-z0-9_]*)$/', $style['directory'], $a)) {
$configfile = DISCUZ_ROOT . './template/' . $a[1] . '/config.inc.php';
if(file_exists($configfile)) {
$configflag = true;
include $configfile;
}
}
if(!$configflag) {
echo '<iframe class="preview" frameborder="0" src="' . ADMINSCRIPT . '?action=styles&preview=yes&styleid=' . $id . '"></iframe>';
showtips('styles_tips');
showformheader("styles&operation=edit&id=$id", 'enctype');
showtableheader($lang['styles_edit'], 'nobottom');
showsetting('styles_edit_name', 'namenew', $style['name'], 'text');
showsetting('styles_edit_tpl', array('templateidnew', $tplselect), $style['templateid'], 'select');
showsetting('styles_edit_extstyle', array('extstylenew', $extstyle), $style['extstyle'], 'mcheckbox');
if($extstyle) {
showsetting('styles_edit_defaultextstyle', array('defaultextstylenew', $defaultextstyle), $style['defaultextstyle'], 'select');
}
showsetting('styles_edit_smileytype', array("stylevar[{$stylestuff['stypeid']['id']}]", $smileytypes), $stylestuff['stypeid']['subst'], 'select');
showsetting('styles_edit_imgdir', '', '', '<input type="text" class="txt" name="stylevar['.$stylestuff['imgdir']['id'].']" id="imgdir" value="'.$stylestuff['imgdir']['subst'].'" />');
showsetting('styles_edit_styleimgdir', '', '', '<input type="text" class="txt" name="stylevar['.$stylestuff['styleimgdir']['id'].']" id="styleimgdir" value="'.$stylestuff['styleimgdir']['subst'].'" />');
empty($stylestuff['imgdir']['subst']) && $stylestuff['imgdir']['subst'] = 'static/image/common';
empty($stylestuff['styleimgdir']['subst']) && $stylestuff['styleimgdir']['subst'] = $stylestuff['imgdir']['subst'];
$boardimghtml = '<br /><img src="'.(empty($stylestuff['boardimg']['subst']) ? $stylestuff['imgdir']['subst'].'/logo.svg' : (preg_match('/^(https?:)?\/\//i', $stylestuff['boardimg']['subst']) || file_exists($stylestuff['boardimg']['subst']) ? '' : (file_exists($stylestuff['styleimgdir']['subst'].'/'.$stylestuff['boardimg']['subst']) ? $stylestuff['styleimgdir']['subst'].'/' : $stylestuff['imgdir']['subst'].'/')).$stylestuff['boardimg']['subst']).'" style="max-height: 70px;" />';
$searchimghtml = '<img src="'.(empty($stylestuff['searchimg']['subst']) ? $stylestuff['imgdir']['subst'].'/logo_sc.svg' : (preg_match('/^(https?:)?\/\//i', $stylestuff['searchimg']['subst']) || file_exists($stylestuff['searchimg']['subst']) ? '' : (file_exists($stylestuff['styleimgdir']['subst'].'/'.$stylestuff['searchimg']['subst']) ? $stylestuff['styleimgdir']['subst'].'/' : $stylestuff['imgdir']['subst'].'/')).$stylestuff['searchimg']['subst']).'" style="max-height: 70px;" />';
$touchimghtml = '<img src="'.(empty($stylestuff['touchimg']['subst']) ? $stylestuff['imgdir']['subst'].'/logo_m.svg' : (preg_match('/^(https?:)?\/\//i', $stylestuff['touchimg']['subst']) || file_exists($stylestuff['touchimg']['subst']) ? '' : (file_exists($stylestuff['styleimgdir']['subst'].'/'.$stylestuff['touchimg']['subst']) ? $stylestuff['styleimgdir']['subst'].'/' : $stylestuff['imgdir']['subst'].'/')).$stylestuff['touchimg']['subst']).'" style="max-height: 70px;" />';
showsetting('styles_edit_logo', "stylevar[{$stylestuff['boardimg']['id']}]", empty($stylestuff['boardimg']['subst']) ? 'logo.svg' : $stylestuff['boardimg']['subst'], 'filetext', '', 0, cplang('styles_edit_logo_comment').$boardimghtml);
showsetting('styles_edit_searchlogo', "stylevar[{$stylestuff['searchimg']['id']}]", empty($stylestuff['searchimg']['subst']) ? 'logo_sc.svg' : $stylestuff['searchimg']['subst'], 'filetext', '', 0, $searchimghtml);
showsetting('styles_edit_touchlogo', "stylevar[{$stylestuff['touchimg']['id']}]", empty($stylestuff['touchimg']['subst']) ? 'logo_m.svg' : $stylestuff['touchimg']['subst'], 'filetext', '', 0, $touchimghtml);
foreach($predefinedvars as $predefinedvar => $v) {
if($v !== array()) {
if(!empty($v[1])) {
showtitle($v[1]);
}
$type = $v[0] == 1 ? 'text' : 'color';
$extra = '';
$comment = ($type == 'text' ? $lang['styles_edit_'.$predefinedvar.'_comment'] : $lang['styles_edit_hexcolor']).$lang['styles_edit_'.$predefinedvar.'_comment'];
if(substr($predefinedvar, -7, 7) == 'bgcolor') {
$stylestuff[$predefinedvar]['subst'] = explode(' ', $stylestuff[$predefinedvar]['subst']);
$bgimg = $stylestuff[$predefinedvar]['subst'][1];
$bgextra = implode(' ', array_slice($stylestuff[$predefinedvar]['subst'], 2));
$stylestuff[$predefinedvar]['subst'] = $stylestuff[$predefinedvar]['subst'][0];
$bgimgpre = $bgimg ? (preg_match('/^(https?:)?\/\//i', $bgimg) ? $bgimg : ($stylestuff['styleimgdir']['subst'] ? $stylestuff['styleimgdir']['subst'] : ($stylestuff['imgdir']['subst'] ? $stylestuff['imgdir']['subst'] : (STATICURL.'image/common'))).'/'.$bgimg) : (STATICURL.'image/common/none.gif');
$comment .= '<div id="bgpre_'.$stylestuff[$predefinedvar]['id'].'" onclick="imgpre_switch('.$stylestuff[$predefinedvar]['id'].')" style="background-image:url('.$bgimgpre.');cursor:pointer;float:right;width:350px;height:40px;overflow:hidden;border: 1px solid #ccc"></div>'.$lang['styles_edit_'.$predefinedvar.'_comment'].$lang['styles_edit_bg'];
$extra = '<br /><input name="stylevarbgimg['.$stylestuff[$predefinedvar]['id'].']" value="'.$bgimg.'" onchange="imgpre_update('.$stylestuff[$predefinedvar]['id'].', this)" type="text" class="txt" style="margin:5px 0;" />'.
'<br /><input name="stylevarbgextra['.$stylestuff[$predefinedvar]['id'].']" value="'.$bgextra.'" type="text" class="txt" />';
$varcomment = ' {'.strtoupper($predefinedvar).'},{'.strtoupper(substr($predefinedvar, 0, -7)).'BGCODE}:';
} else {
$varcomment = ' {'.strtoupper($predefinedvar).'}:';
}
showsetting(cplang('styles_edit_'.$predefinedvar).$varcomment, 'stylevar['.$stylestuff[$predefinedvar]['id'].']', $stylestuff[$predefinedvar]['subst'], $type, '', 0, $comment, $extra);
}
}
showtablefooter();
showtableheader('styles_edit_customvariable', 'notop');
showsubtitle(array('', 'styles_edit_variable', 'styles_edit_subst'));
echo $stylecustom;
showtablerow('', array('class="td25"', 'class="td24 bold"', 'class="td26"'), array(
cplang('add_new'),
'<input type="text" class="txt" name="newcvar">',
'<textarea name="newcsubst" class="tarea" style="height: 45px" cols="50" rows="2"></textarea>'
));
showsubmit('editsubmit', 'submit', 'del');
showtablefooter();
showformfooter();
}
} else {
$style = C::t('common_style')->fetch_by_styleid($id);
if(!$style) {
cpmsg('style_not_found', '', 'error');
}
$configflag = false;
if(preg_match('/^.?\/template\/([a-z]+[a-z0-9_]*)$/', $style['directory'], $a)) {
$configfile = DISCUZ_ROOT . './template/' . $a[1] . '/config.inc.php';
if(file_exists($configfile)) {
$configflag = true;
include $configfile;
}
}
if($_GET['newcvar'] && $_GET['newcsubst']) {
if(C::t('common_stylevar')->check_duplicate($id, $_GET['newcvar'])) {
cpmsg('styles_edit_variable_duplicate', '', 'error');
} elseif(!preg_match("/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/", $_GET['newcvar'])) {
cpmsg('styles_edit_variable_illegal', '', 'error');
}
$newcvar = strtolower($_GET['newcvar']);
C::t('common_stylevar')->insert(array('styleid' => $id, 'variable' => $newcvar, 'substitute' => $_GET['newcsubst']));
}
if(!$configflag) {
$data = array();
if(isset($_GET['namenew'])) {
$data['name'] = $_GET['namenew'];
}
if(isset($_GET['templateidnew'])) {
$data['templateid'] = $_GET['templateidnew'];
}
if(isset($_GET['defaultextstylenew'])) {
if(!isset($_GET['extstylenew']) || !is_array($_GET['extstylenew'])) {
$_GET['extstylenew'] = array();
}
if(!in_array($_GET['defaultextstylenew'], $_GET['extstylenew'])) {
$_GET['extstylenew'][] = $_GET['defaultextstylenew'];
}
$data['extstyle'] = implode("\t", $_GET['extstylenew']) . '|' . $_GET['defaultextstylenew'];
}
if(!empty($data)) {
C::t('common_style')->update($id, $data);
}
if(isset($_GET['stylevar'])) {
$stylevar = $_GET['stylevar'];
$stylevarbgimg = $_GET['stylevarbgimg'];
$stylevarbgextra = $_GET['stylevarbgextra'];
foreach($stylevar as $varid => $substitute) {
if(!empty($stylevarbgimg[$varid])) {
$substitute .= ' '.$stylevarbgimg[$varid];
if(!empty($stylevarbgextra[$varid])) {
$substitute .= ' '.$stylevarbgextra[$varid];
}
}
$substitute = @dhtmlspecialchars($substitute);
$stylevarids = array($varid);
C::t('common_stylevar')->update_substitute_by_styleid($substitute, $id, $stylevarids);
}
if(isset($_FILES['stylevar']['name'])) {
foreach(C::t('common_stylevar')->fetch_all_by_styleid($id) as $stylevar) {
$stylesvar[$stylevar['stylevarid']] = $stylevar['variable'];
}
$upload = new discuz_upload();
foreach ($_FILES['stylevar']['name'] as $varid => $value) {
if($stylesvar[$varid]) {
$file = array(
'name' => $_FILES['stylevar']['name'][$varid],
'type' => $_FILES['stylevar']['type'][$varid],
'tmp_name' => $_FILES['stylevar']['tmp_name'][$varid],
'error' => $_FILES['stylevar']['error'][$varid],
'size' => $_FILES['stylevar']['size'][$varid],
);
if($upload->init($file, 'common', 0, '', 'template', 0, $stylesvar[$varid].'_'.date('Ymd').strtolower(random(8))) && $upload->save()) {
$logonew = $_G['setting']['attachurl'].'common/'.$upload->attach['attachment'];
$stylevarids = array($varid);
C::t('common_stylevar')->update_substitute_by_styleid($logonew, $id, $stylevarids);
}
}
}
}
}
}
if($_GET['delete']) {
C::t('common_stylevar')->delete_by_styleid($id, $_GET['delete']);
}
updatecache(array('setting', 'styles'));
$tpl = dir(DISCUZ_ROOT.'./data/template');
while($entry = $tpl->read()) {
if(preg_match("/\.tpl\.php$/", $entry)) {
@unlink(DISCUZ_ROOT.'./data/template/'.$entry);
}
}
$tpl->close();
cpmsg('styles_edit_succeed', 'action=styles&operation=edit&id=' . $id, 'succeed');
}
} elseif($operation == 'upgradecheck') {
if(!$admincp->isfounder) {
cpmsg('noaccess_isfounder', '', 'error');
}
$templatearray = C::t('common_template')->fetch_all_data();
if(!$templatearray) {
cpmsg('plugin_not_found', '', 'error');
} else {
$addonids = $result = $errarray = $newarray = array();
foreach($templatearray as $k => $row) {
if(preg_match('/^.?\/template\/([a-z]+[a-z0-9_]*)$/', $row['directory'], $a) && $a[1] != 'default') {
$addonids[$k] = $a[1].'.template';
}
}
$checkresult = dunserialize(cloudaddons_upgradecheck($addonids));
savecache('addoncheck_template', $checkresult);
foreach($addonids as $k => $addonid) {
if(isset($checkresult[$addonid])) {
list($return, $newver) = explode(':', $checkresult[$addonid]);
$result[$addonid]['result'] = $return;
$result[$addonid]['id'] = $k;
if($newver) {
$result[$addonid]['newver'] = $newver;
}
}
}
}
foreach($result as $id => $row) {
if($row['result'] == 0) {
$errarray[] = '<a href="'.ADMINSCRIPT.'?action=cloudaddons&frame=no&id='.$id.'&from=newver" target="_blank">'.$templatearray[$row['id']]['name'].'</a>';
} elseif($row['result'] == 2) {
$newarray[] = '<a href="'.ADMINSCRIPT.'?action=cloudaddons&frame=no&id='.$id.'&from=newver" target="_blank">'.$templatearray[$row['id']]['name'].($row['newver'] ? ' -> '.$row['newver'] : '').'</a>';
}
}
if(!$newarray && !$errarray) {
cpmsg('styles_validator_noupdate', '', 'error');
} else {
shownav('template', 'plugins_validator');
showsubmenu('styles_admin', array(
array('styles_list', 'styles', 0),
array('styles_import', 'styles&operation=import', 0),
array('plugins_validator', 'styles&operation=upgradecheck', 1),
array('cloudaddons_style_link', 'cloudaddons&frame=no&operation=templates&from=more', 0, 1),
), '<a href="https://www.dismall.com/?from=templates_question" target="_blank" class="rlink">'.$lang['templates_question'].'</a>');
showtableheader();
if($newarray) {
showtitle('styles_validator_newversion');
foreach($newarray as $row) {
showtablerow('class="hover"', array(), array($row));
}
}
if($errarray) {
showtitle('styles_validator_error');
foreach($errarray as $row) {
showtablerow('class="hover"', array(), array($row));
}
}
showtablefooter();
}
}
?>

View File

@@ -0,0 +1,95 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_tag.php 25889 2011-11-24 09:52:20Z monkey $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
$operation = in_array($operation, array('admin')) ? $operation : 'admin';
$current = array($operation => 1);
shownav('global', 'tag');
showsubmenu('tag', array(
array('search', 'tag&operation=admin', $current['admin']),
));
if($operation == 'admin') {
$tagarray = array();
if(submitcheck('submit') && !empty($_GET['tagidarray']) && is_array($_GET['tagidarray']) && !empty($_GET['operate_type'])) {
$class_tag = new tag();
$tagidarray = array();
$operate_type = $newtag = $thread = '';
$tagidarray = $_GET['tagidarray'];
$operate_type = $_GET['operate_type'];
if($operate_type == 'delete') {
$class_tag->delete_tag($tagidarray);
} elseif($operate_type == 'open') {
C::t('common_tag')->update($tagidarray, array('status' => 0));
} elseif($operate_type == 'close') {
C::t('common_tag')->update($tagidarray, array('status' => 1));
} elseif($operate_type == 'merge') {
$data = $class_tag->merge_tag($tagidarray, $_GET['newtag']);
if($data != 'succeed') {
cpmsg($data);
}
}
cpmsg('tag_admin_updated', 'action=tag&operation=admin&searchsubmit=yes&tagname='.$_GET['tagname'].'&perpage='.$_GET['perpage'].'&status='.$_GET['status'].'&page='.$_GET['page'], 'succeed');
}
if(!submitcheck('searchsubmit', 1)) {
showformheader('tag&operation=admin');
showtableheader();
showsetting('tagname', 'tagname', $tagname, 'text');
showsetting('feed_search_perpage', '', $_GET['perpage'], "<select name='perpage'><option value='20'>{$lang['perpage_20']}</option><option value='50'>{$lang['perpage_50']}</option><option value='100'>{$lang['perpage_100']}</option></select>");
showsetting('misc_tag_status', array('status', array(
array('', cplang('unlimited')),
array(0, cplang('misc_tag_status_0')),
array(1, cplang('misc_tag_status_1')),
), TRUE), '', 'mradio');
showsubmit('searchsubmit');
showtablefooter();
showformfooter();
showtagfooter('div');
} else {
$tagname = trim($_GET['tagname']);
$status = $_GET['status'];
if(!$status) {
$table_status = NULL;
} else {
$table_status = $status;
}
$ppp = $_GET['perpage'];
$startlimit = ($page - 1) * $ppp;
$multipage = '';
$totalcount = C::t('common_tag')->fetch_all_by_status($table_status, $tagname, 0, 0, 1);
$multipage = multi($totalcount, $ppp, $page, ADMINSCRIPT."?action=tag&operation=admin&searchsubmit=yes&tagname=$tagname&perpage=$ppp&status=$status");
$query = C::t('common_tag')->fetch_all_by_status($table_status, $tagname, $startlimit, $ppp);
showformheader('tag&operation=admin');
showtableheader(cplang('tag_result').' '.$totalcount.' <a href="###" onclick="location.href=\''.ADMINSCRIPT.'?action=tag&operation=admin;\'" class="act lightlink normal">'.cplang('research').'</a>', 'nobottom');
showhiddenfields(array('page' => $_GET['page'], 'tagname' => $tagname, 'status' => $status, 'perpage' => $ppp));
showsubtitle(array('', 'tagname', 'misc_tag_status'));
foreach($query as $result) {
if($result['status'] == 0) {
$tagstatus = cplang('misc_tag_status_0');
} elseif($result['status'] == 1) {
$tagstatus = cplang('misc_tag_status_1');
}
showtablerow('', array('class="td25"', 'width=400', ''), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"tagidarray[]\" value=\"{$result['tagid']}\" />",
$result['tagname'],
$tagstatus
));
}
showtablerow('', array('class="td25" colspan="3"'), array('<input name="chkall" id="chkall" type="checkbox" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'tagidarray\', \'chkall\')" /><label for="chkall">'.cplang('select_all').'</label>'));
showtablerow('', array('class="td25"', 'colspan="2"'), array(
cplang('operation'),
'<input class="radio" type="radio" name="operate_type" value="open" checked> '.cplang('misc_tag_status_0').' &nbsp; &nbsp;<input class="radio" type="radio" name="operate_type" value="close"> '.cplang('misc_tag_status_1').' &nbsp; &nbsp;<input class="radio" type="radio" name="operate_type" value="delete"> '.cplang('delete').' &nbsp; &nbsp;<input class="radio" type="radio" name="operate_type" value="merge"> '.cplang('mergeto').' <input name="newtag" value="" class="txt" type="text">'
));
showsubmit('submit', 'submit', '', '', $multipage);
showtablefooter();
showformfooter();
}
}
?>

View File

@@ -0,0 +1,744 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_tasks.php 34093 2013-10-09 05:41:18Z nemohou $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
$id = intval($_GET['id']);
$membervars = array('act', 'num', 'time');
$postvars = array('act', 'forumid', 'num', 'time', 'threadid', 'authorid');
$modvars = array();
$custom_types = C::t('common_setting')->fetch_setting('tasktypes', true);
$custom_scripts = array_keys($custom_types);
$submenus = array();
foreach($custom_types as $k => $v) {
$submenus[] = array($v['name'], "tasks&operation=add&script=$k", $_GET['script'] == $k);
}
if(!($operation)) {
if(!submitcheck('tasksubmit')) {
shownav('extended', 'nav_tasks');
showsubmenu('nav_tasks', array(
array('admin', 'tasks', 1),
$submenus ? array(array('menu' => 'add', 'submenu' => $submenus)) : array(),
array('nav_task_type', 'tasks&operation=type', 0)
));
showformheader('tasks');
showtableheader('tasks_list', 'fixpadding');
showsubtitle(array('display_order', 'available', 'name', 'tasks_reward', 'time', 'tasks_status', ''));
$starttasks = array();
foreach(C::t('common_task')->fetch_all_data() as $task) {
if($task['reward'] == 'credit') {
$reward = cplang('credits').' '.$_G['setting']['extcredits'][$task['prize']]['title'].' '.$task['bonus'].' '.$_G['setting']['extcredits'][$task['prize']]['unit'];
} elseif($task['reward'] == 'magic') {
$magicname = C::t('common_magic')->fetch($task['prize']);
$reward = cplang('tasks_reward_magic').' '.$magicname['name'].' '.$task['bonus'].' '.cplang('magic_unit');
} elseif($task['reward'] == 'medal') {
$medalname = C::t('forum_medal')->fetch($task['prize']);
$reward = cplang('medals').' '.$medalname['name'].($task['bonus'] ? ' '.cplang('validity').$task['bonus'].' '.cplang('days') : '');
} elseif($task['reward'] == 'invite') {
$reward = cplang('tasks_reward_invite').' '.$task['prize'].($task['bonus'] ? ' '.cplang('validity').$task['bonus'].' '.cplang('days') : '');
} elseif($task['reward'] == 'group') {
$group = C::t('common_usergroup')->fetch($task['prize']);
$grouptitle = $group['grouptitle'];
$reward = cplang('usergroup').' '.$grouptitle.($task['bonus'] ? ' '.cplang('validity').' '.$task['bonus'].' '.cplang('days') : '');
} else {
$reward = cplang('none');
}
if($task['available'] == '1' && (!$task['starttime'] || $task['starttime'] <= TIMESTAMP) && (!$task['endtime'] || $task['endtime'] > TIMESTAMP)) {
$starttasks[] = $task['taskid'];
}
$checked = $task['available'] ? ' checked="checked"' : '';
if($task['starttime'] && $task['endtime']) {
$task['time'] = dgmdate($task['starttime'], 'y-m-d H:i').' ~ '.dgmdate($task['endtime'], 'y-m-d H:i');
} elseif($task['starttime'] && !$task['endtime']) {
$task['time'] = dgmdate($task['starttime'], 'y-m-d H:i').' '.cplang('tasks_online');
} elseif(!$task['starttime'] && $task['endtime']) {
$task['time'] = dgmdate($task['endtime'], 'y-m-d H:i').' '.cplang('tasks_offline');
} else {
$task['time'] = cplang('nolimit');
}
if($task['available'] == 2 && ($task['starttime'] > TIMESTAMP || ($task['endtime'] && $task['endtime'] <= TIMESTAMP))) {
$task['available'] = 1;
C::t('common_task')->update($task['taskid'], array('available' => 1));
}
if($task['available'] == 1 && (!$task['starttime'] || $task['starttime'] <= TIMESTAMP) && (!$task['endtime'] || $task['endtime'] > TIMESTAMP)) {
$task['available'] = 2;
C::t('common_task')->update($task['taskid'], array('available' => 2));
}
showtablerow('', array('class="td25"', 'class="td25"'), array(
'<input type="text" class="txt" name="displayordernew['.$task['taskid'].']" value="'.$task['displayorder'].'" size="3" />',
"<input class=\"checkbox\" type=\"checkbox\" name=\"availablenew[{$task['taskid']}]\" value=\"1\"$checked><input type=\"hidden\" name=\"availableold[{$task['taskid']}]\" value=\"{$task['available']}\">",
"<input type=\"text\" class=\"txt\" name=\"namenew[{$task['taskid']}]\" size=\"20\" value=\"{$task['name']}\"><input type=\"hidden\" name=\"nameold[{$task['taskid']}]\" value=\"{$task['name']}\">",
$reward,
$task['time'].'<input type="hidden" name="scriptnamenew['.$task['taskid'].']" value="'.$task['scriptname'].'">',
($task['available'] == 1 ? ($task['endtime'] && $task['endtime'] <= TIMESTAMP ? cplang('tasks_status_3') : cplang('tasks_status_1')) : ($task['available'] == 2 ? cplang('tasks_status_2') : cplang('tasks_status_0'))),
"<a href=\"".ADMINSCRIPT."?action=tasks&operation=edit&id={$task['taskid']}\" class=\"act\">{$lang['edit']}</a>&nbsp;&nbsp;<a href=\"".ADMINSCRIPT."?action=tasks&operation=delete&id={$task['taskid']}\" class=\"act\">{$lang['delete']}</a>"
));
}
if($starttasks) {
C::t('common_task')->update($starttasks, array('available' => 2));
require_once libfile('class/task');
$tasklib = & task::instance();
$tasklib->update_available(1);
}
showsubmit('tasksubmit', 'submit');
showtablefooter();
showformfooter();
} else {
$checksettingsok = TRUE;
if(is_array($_GET['namenew'])) {
foreach($_GET['namenew'] as $id => $name) {
$_GET['availablenew'][$id] = $_GET['availablenew'][$id] && (!$starttimenew[$id] || $starttimenew[$id] <= TIMESTAMP) && (!$endtimenew[$id] || $endtimenew[$id] > TIMESTAMP) ? 2 : $_GET['availablenew'][$id];
$update = array('name' => dhtmlspecialchars($_GET['namenew'][$id]), 'available' => $_GET['availablenew'][$id]);
if(isset($_GET['displayordernew'][$id])) {
$update['displayorder'] = $_GET['displayordernew'][$id];
}
C::t('common_task')->update($id, $update);
}
}
updatecache('setting');
require_once libfile('class/task');
$tasklib = & task::instance();
$tasklib->update_available(1);
if($checksettingsok) {
cpmsg('tasks_succeed', 'action=tasks', 'succeed');
} else {
cpmsg('tasks_setting_invalid', '', 'error');
}
}
} elseif($operation == 'add' && $_GET['script']) {
$task_name = $task_description = $task_icon = $task_period = $task_periodtype = $task_conditions = '';
if(in_array($_GET['script'], $custom_scripts)) {
$escript = explode(':', $_GET['script']);
if(count($escript) > 1 && preg_match('/^[\w\_:]+$/', $_GET['script'])) {
include_once DISCUZ_ROOT.'./source/plugin/'.$escript[0].'/task/task_'.$escript[1].'.php';
$taskclass = 'task_'.$escript[1];
} else {
require_once libfile('task/'.$_GET['script'], 'class');
$taskclass = 'task_'.$_GET['script'];
}
$task = new $taskclass;
$task_name = lang('task/'.$_GET['script'], $task->name);
$task_description = lang('task/'.$_GET['script'], $task->description);
$task_icon = $task->icon;
$task_period = $task->period;
$task_periodtype = $task->periodtype;
$task_conditions = $task->conditions;
} else {
cpmsg('parameters_error', '', 'error');
}
if(!submitcheck('addsubmit')) {
echo '<script type="text/javascript" src="'.STATICURL.'js/calendar.js"></script>';
shownav('extended', 'nav_tasks');
showsubmenu('nav_tasks', array(
array('admin', 'tasks', 0),
array(array('menu' => 'add', 'submenu' => $submenus), 1),
array('nav_task_type', 'tasks&operation=type', 0)
));
showformheader('tasks&operation=add&script='.$_GET['script']);
showtableheader('tasks_add_basic', 'fixpadding');
showsetting('tasks_add_name', 'name', $task_name, 'text');
showsetting('tasks_add_desc', 'description', $task_description, 'textarea');
if(count($escript) > 1 && file_exists(DISCUZ_ROOT.'./source/plugin/'.$escript[0].'/task/task_'.$escript[1].'.gif')) {
$defaulticon = 'source/plugin/'.$escript[0].'/task/task_'.$escript[1].'.gif';
} else {
$defaulticon = STATICURL . '/image/task/task.gif';
}
showsetting('tasks_add_icon', 'iconnew', $task_icon, 'text', '', 0, cplang('tasks_add_icon_comment', array('defaulticon' => $defaulticon)));
showsetting('tasks_add_starttime', 'starttime', '', 'calendar', '', 0, '', 1);
showsetting('tasks_add_endtime', 'endtime', '', 'calendar', '', 0, '', 1);
showsetting('tasks_add_periodtype', array('periodtype', array(
array(0, cplang('tasks_add_periodtype_hour')),
array(1, cplang('tasks_add_periodtype_day')),
array(2, cplang('tasks_add_periodtype_week')),
array(3, cplang('tasks_add_periodtype_month')),
)), $task_periodtype, 'mradio');
showsetting('tasks_add_period', 'period', $task_period, 'text');
showsetting('tasks_add_reward', array('reward', array(
array('', cplang('none'), array('reward_credit' => 'none', 'reward_magic' => 'none', 'reward_medal' => 'none', 'reward_group' => 'none', 'reward_invite' => 'none')),
array('credit', cplang('credits'), array('reward_credit' => '', 'reward_magic' => 'none', 'reward_medal' => 'none', 'reward_group' => 'none', 'reward_invite' => 'none')),
$_G['setting']['magicstatus'] ? array('magic', cplang('tasks_reward_magic'), array('reward_credit' => 'none', 'reward_magic' => '', 'reward_medal' => 'none', 'reward_group' => 'none', 'reward_invite' => 'none')) : '',
$_G['setting']['medalstatus'] ? array('medal', cplang('medals'), array('reward_credit' => 'none', 'reward_magic' => 'none', 'reward_medal' => '', 'reward_group' => 'none', 'reward_invite' => 'none')) : '',
$_G['setting']['regstatus'] > 1 ? array('invite', cplang('tasks_reward_invite'), array('reward_credit' => 'none', 'reward_magic' => 'none', 'reward_medal' => 'none', 'reward_group' => 'none', 'reward_invite' => '')) : '',
array('group', cplang('tasks_add_group'), array('reward_credit' => 'none', 'reward_magic' => 'none', 'reward_medal' => 'none', 'reward_group' => '', 'reward_invite' => 'none'))
)), '', 'mradio');
$extcreditarray = array(array(0, cplang('select')));
foreach($_G['setting']['extcredits'] as $creditid => $extcredit) {
$extcreditarray[] = array($creditid, $extcredit['title']);
}
showtagheader('tbody', 'reward_credit');
showsetting('tasks_add_extcredit', array('prize_credit', $extcreditarray), 0, 'select');
showsetting('tasks_add_credits', 'bonus_credit', '0', 'text');
showtagfooter('tbody');
showtagheader('tbody', 'reward_magic');
showsetting('tasks_add_magicname', array('prize_magic', C::t('common_magic')->fetch_all_name_by_available()), 0, 'select');
showsetting('tasks_add_magicnum', 'bonus_magic', '0', 'text');
showtagfooter('tbody');
showtagheader('tbody', 'reward_medal');
showsetting('tasks_add_medalname', array('prize_medal', C::t('forum_medal')->fetch_all_name_by_available()), 0, 'select');
showsetting('tasks_add_medalexp', 'bonus_medal', '', 'text');
showtagfooter('tbody');
showtagheader('tbody', 'reward_invite');
showsetting('tasks_add_invitenum', 'prize_invite', '1', 'text');
showsetting('tasks_add_inviteexp', 'bonus_invite', '10', 'text');
showtagfooter('tbody');
showtagheader('tbody', 'reward_group');
showsetting('tasks_add_group', array('prize_group', C::t('common_usergroup')->fetch_all_by_type('special', 0)), 0, 'select');
showsetting('tasks_add_groupexp', 'bonus_group', '', 'text');
showtagfooter('tbody');
showtitle('tasks_add_appyperm');
showsetting('tasks_add_groupperm', array('grouplimit', array(
array('all', cplang('tasks_add_group_all'), array('specialgroup' => 'none')),
array('member', cplang('tasks_add_group_member'), array('specialgroup' => 'none')),
array('admin', cplang('tasks_add_group_admin'), array('specialgroup' => 'none')),
array('special', cplang('tasks_add_group_special'), array('specialgroup' => ''))
)), 'all', 'mradio');
showtagheader('tbody', 'specialgroup');
showsetting('tasks_add_usergroup', array('applyperm[]', C::t('common_usergroup')->fetch_all_by_type()), 0, 'mselect');
showtagfooter('tbody');
showsetting('tasks_add_maxnum', 'tasklimits', '', 'text');
if(is_array($task_conditions)) {
foreach($task_conditions as $taskvarkey => $taskvar) {
if($taskvar['sort'] == 'apply' && $taskvar['title']) {
if(!empty($taskvar['value']) && is_array($taskvar['value'])) {
foreach($taskvar['value'] as $k => $v) {
$taskvar['value'][$k][1] = lang('task/'.$_GET['script'], $taskvar['value'][$k][1]);
}
}
$varname = in_array($taskvar['type'], array('mradio', 'mcheckbox', 'select', 'mselect')) ?
($taskvar['type'] == 'mselect' ? array($taskvarkey.'[]', $taskvar['value']) : array($taskvarkey, $taskvar['value']))
: $taskvarkey;
$comment = lang('task/'.$_GET['script'], $taskvar['title'].'_comment');
$comment = $comment != $taskvar['title'].'_comment' ? $comment : '';
showsetting(lang('task/'.$_GET['script'], $taskvar['title']).':', $varname, $taskvar['value'], $taskvar['type'], '', 0, $comment);
}
}
}
showtitle('tasks_add_conditions');
if(in_array($_GET['script'], $custom_scripts)) {
$haveconditions = false;
if(is_array($task_conditions)) {
foreach($task_conditions as $taskvarkey => $taskvar) {
if($taskvar['sort'] == 'complete' && $taskvar['title']) {
if(!empty($taskvar['value']) && is_array($taskvar['value'])) {
foreach($taskvar['value'] as $k => $v) {
$taskvar['value'][$k][1] = lang('task/'.$_GET['script'], $taskvar['value'][$k][1]);
}
}
$haveconditions = true;
$varname = in_array($taskvar['type'], array('mradio', 'mcheckbox', 'select', 'mselect')) ?
($taskvar['type'] == 'mselect' ? array($taskvarkey.'[]', $taskvar['value']) : array($taskvarkey, $taskvar['value']))
: $taskvarkey;
$comment = lang('task/'.$_GET['script'], $taskvar['title'].'_comment');
$comment = $comment != $taskvar['title'].'_comment' ? $comment : '';
showsetting(lang('task/'.$_GET['script'], $taskvar['title']).':', $varname, $taskvar['default'], $taskvar['type'], '', 0, $comment);
}
}
}
if(!$haveconditions) {
showtablerow('', 'class="td27" colspan="2"', cplang('nolimit'));
}
}
showsubmit('addsubmit', 'submit');
showtablefooter();
showformfooter();
} else {
$applyperm = $_GET['grouplimit'] == 'special' && is_array($_GET['applyperm']) ? implode("\t", $_GET['applyperm']) : $_GET['grouplimit'];
$_GET['starttime'] = strtotime($_GET['starttime']);
$_GET['endtime'] = strtotime($_GET['endtime']);
$reward = $_GET['reward'];
$prize = $_GET['prize_'.$reward];
$bonus = $_GET['bonus_'.$reward];
if(!$_GET['name'] || !$_GET['description']) {
cpmsg('tasks_basic_invalid', '', 'error');
} elseif(($_GET['endtime'] && $_GET['endtime'] <= TIMESTAMP) || ($_GET['starttime'] && $_GET['endtime'] && $_GET['endtime'] <= $_GET['starttime'])) {
cpmsg('tasks_time_invalid', '', 'error');
} elseif($reward && (!$prize || ($reward == 'credit' && !$bonus))) {
cpmsg('tasks_reward_invalid', '', 'error');
}
$data = array(
'relatedtaskid' => $_GET['relatedtaskid'],
'exclusivetaskid' => $_GET['exclusivetaskid'],
'available' => 0,
'name' => $_GET['name'],
'description' => $_GET['description'],
'icon' => $_GET['iconnew'],
'tasklimits' => $_GET['tasklimits'],
'applyperm' => $applyperm,
'scriptname' => $_GET['script'],
'starttime' => $_GET['starttime'],
'endtime' => $_GET['endtime'],
'period' => $_GET['period'],
'periodtype' => $_GET['periodtype'],
'reward' => $reward,
'prize' => $prize,
'bonus' => $bonus,
);
$taskid = C::t('common_task')->insert($data, true);
if(is_array($task_conditions)) {
foreach($task_conditions as $taskvarkey => $taskvars) {
if($taskvars['title']) {
$comment = lang('task/'.$_GET['script'], $taskvars['title'].'_comment');
$comment = $comment != $taskvars['title'].'_comment' ? $comment : '';
$data = array(
'taskid' => $taskid,
'sort' => $taskvars['sort'],
'name' => lang('task/'.$_GET['script'], $taskvars['title']),
'description' => $comment,
'variable' => $taskvarkey,
'value' => is_array($_GET[''.$taskvarkey]) ? serialize($_GET[''.$taskvarkey]) : $_GET[''.$taskvarkey],
'type' => $taskvars['type'],
);
C::t('common_taskvar')->insert($data);
}
}
}
require_once libfile('class/task');
$tasklib = & task::instance();
$tasklib->update_available(1);
cpmsg('tasks_succeed', "action=tasks", 'succeed');
}
} elseif($operation == 'edit' && $id) {
$task = C::t('common_task')->fetch($id);
if(!submitcheck('editsubmit')) {
echo '<script type="text/javascript" src="'.STATICURL.'js/calendar.js"></script>';
shownav('extended', 'nav_tasks');
showsubmenu('nav_tasks', array(
array('admin', 'tasks', 0),
array(array('menu' => 'add', 'submenu' => $submenus)),
array('nav_task_type', 'tasks&operation=type', 0)
));
$escript = explode(':', $task['scriptname']);
showformheader('tasks&operation=edit&id='.$id);
showtableheader(cplang('tasks_edit').' - '.$task['name'], 'fixpadding');
showsetting('tasks_add_name', 'name', $task['name'], 'text');
showsetting('tasks_add_desc', 'description', $task['description'], 'textarea');
if(count($escript) > 1 && preg_match('/^[\w\_:]+$/', $task['scriptname']) && file_exists(DISCUZ_ROOT.'./source/plugin/'.$escript[0].'/task/task_'.$escript[1].'.gif')) {
$defaulticon = 'source/plugin/'.$escript[0].'/task/task_'.$escript[1].'.gif';
} else {
$defaulticon = 'static/image/task/task.gif';
}
showsetting('tasks_add_icon', 'iconnew', $task['icon'], 'text', '', 0, cplang('tasks_add_icon_comment', array('defaulticon' => $defaulticon)));
showsetting('tasks_add_starttime', 'starttime', $task['starttime'] ? dgmdate($task['starttime'], 'Y-m-d H:i') : '', 'calendar', '', 0, '', 1);
showsetting('tasks_add_endtime', 'endtime', $task['endtime'] ? dgmdate($task['endtime'], 'Y-m-d H:i') : '', 'calendar', '', 0, '', 1);
showsetting('tasks_add_periodtype', array('periodtype', array(
array(0, cplang('tasks_add_periodtype_hour')),
array(1, cplang('tasks_add_periodtype_day')),
array(2, cplang('tasks_add_periodtype_week')),
array(3, cplang('tasks_add_periodtype_month')),
)), $task['periodtype'], 'mradio');
showsetting('tasks_add_period', 'period', $task['period'], 'text');
showsetting('tasks_add_reward', array('reward', array(
array('', cplang('none'), array('reward_credit' => 'none', 'reward_magic' => 'none', 'reward_medal' => 'none', 'reward_group' => 'none')),
array('credit', cplang('credits'), array('reward_credit' => '', 'reward_magic' => 'none', 'reward_medal' => 'none', 'reward_group' => 'none')),
$_G['setting']['magicstatus'] ? array('magic', cplang('tasks_reward_magic'), array('reward_credit' => 'none', 'reward_magic' => '', 'reward_medal' => 'none', 'reward_group' => 'none')) : '',
$_G['setting']['medalstatus'] ? array('medal', cplang('medals'), array('reward_credit' => 'none', 'reward_magic' => 'none', 'reward_medal' => '', 'reward_group' => 'none')) : '',
$_G['setting']['regstatus'] > 1 ? array('invite', cplang('tasks_reward_invite'), array('reward_credit' => 'none', 'reward_magic' => 'none', 'reward_medal' => 'none', 'reward_group' => 'none', 'reward_invite' => '')) : '',
array('group', cplang('tasks_add_group'), array('reward_credit' => 'none', 'reward_magic' => 'none', 'reward_medal' => 'none', 'reward_group' => ''))
)), $task['reward'], 'mradio');
$extcreditarray = array(array(0, cplang('select')));
foreach($_G['setting']['extcredits'] as $creditid => $extcredit) {
$extcreditarray[] = array($creditid, $extcredit['title']);
}
showtagheader('tbody', 'reward_credit', $task['reward'] == 'credit');
showsetting('tasks_add_extcredit', array('prize_credit', $extcreditarray), $task['prize'], 'select');
showsetting('tasks_add_credits', 'bonus_credit', $task['bonus'], 'text');
showtagfooter('tbody');
showtagheader('tbody', 'reward_magic', $task['reward'] == 'magic');
showsetting('tasks_add_magicname', array('prize_magic', C::t('common_magic')->fetch_all_name_by_available()), $task['prize'], 'select');
showsetting('tasks_add_magicnum', 'bonus_magic', $task['bonus'], 'text');
showtagfooter('tbody');
showtagheader('tbody', 'reward_medal', $task['reward'] == 'medal');
showsetting('tasks_add_medalname', array('prize_medal', C::t('forum_medal')->fetch_all_name_by_available()), $task['prize'], 'select');
showsetting('tasks_add_medalexp', 'bonus_medal', $task['bonus'], 'text');
showtagfooter('tbody');
showtagheader('tbody', 'reward_invite', $task['reward'] == 'invite');
showsetting('tasks_add_invitenum', 'prize_invite', $task['prize'], 'text');
showsetting('tasks_add_inviteexp', 'bonus_invite', $task['bonus'], 'text');
showtagfooter('tbody');
showtagheader('tbody', 'reward_group', $task['reward'] == 'group');
showsetting('tasks_add_group', array('prize_group', C::t('common_usergroup')->fetch_all_by_type('special', 0)), $task['prize'], 'select');
showsetting('tasks_add_groupexp', 'bonus_group', $task['bonus'], 'text');
showtagfooter('tbody');
showtitle('tasks_add_appyperm');
if(!$task['applyperm']) {
$task['applyperm'] = 'all';
}
$task['grouplimit'] = in_array($task['applyperm'], array('all', 'member', 'admin')) ? $task['applyperm'] : 'special';
showsetting('tasks_add_groupperm', array('grouplimit', array(
array('all', cplang('tasks_add_group_all'), array('specialgroup' => 'none')),
array('member', cplang('tasks_add_group_member'), array('specialgroup' => 'none')),
array('admin', cplang('tasks_add_group_admin'), array('specialgroup' => 'none')),
array('special', cplang('tasks_add_group_special'), array('specialgroup' => ''))
)), $task['grouplimit'], 'mradio');
showtagheader('tbody', 'specialgroup', $task['grouplimit'] == 'special');
showsetting('tasks_add_usergroup', array('applyperm[]', C::t('common_usergroup')->fetch_all_by_type()), explode("\t", $task['applyperm']), 'mselect');
showtagfooter('tbody');
$tasklist = array(0 => array('taskid'=>0, 'name'=>cplang('nolimit') ));
foreach(C::t('common_task')->fetch_all_by_available(2) as $value) {
if($value['taskid'] != $task['taskid']) {
$tasklist[$value['taskid']] = array('taskid'=>$value['taskid'], 'name'=>$value['name']);
}
}
showsetting('tasks_add_relatedtask', array('relatedtaskid', $tasklist), $task['relatedtaskid'], 'select');
showsetting('tasks_add_exclusivetask', array('exclusivetaskid', $tasklist), $task['exclusivetaskid'], 'select');
showsetting('tasks_add_maxnum', 'tasklimits', $task['tasklimits'], 'text');
$taskvars = array();
foreach(C::t('common_taskvar')->fetch_all_by_taskid($id) as $taskvar) {
if($taskvar['sort'] == 'apply') {
$taskvars['apply'][] = $taskvar;
} elseif($taskvar['sort'] == 'complete') {
$taskvars['complete'][$taskvar['variable']] = $taskvar;
} elseif($taskvar['sort'] == 'setting' && $taskvar['name']) {
$taskvars['setting'][$taskvar['variable']] = $taskvar;
}
}
if($taskvars['apply']) {
foreach($taskvars['apply'] as $taskvar) {
showsetting($taskvar['name'], $taskvar['variable'], $taskvar['value'], $taskvar['type'], '', 0, $taskvar['description']);
}
}
showtitle('tasks_add_conditions');
if(count($escript) > 1 && preg_match('/^[\w\_:]+$/', $task['scriptname'])) {
include_once DISCUZ_ROOT.'./source/plugin/'.$escript[0].'/task/task_'.$escript[1].'.php';
$taskclass = 'task_'.$escript[1];
} else {
require_once libfile('task/'.$task['scriptname'], 'class');
$taskclass = 'task_'.$task['scriptname'];
}
$taskcv = new $taskclass;
if($taskvars['complete']) {
foreach($taskvars['complete'] as $taskvar) {
$taskcvar = $taskcv->conditions[$taskvar['variable']];
if(is_array($taskcvar['value'])) {
foreach($taskcvar['value'] as $k => $v) {
$taskcvar['value'][$k][1] = lang('task/'.$task['scriptname'], $taskcvar['value'][$k][1]);
}
}
$varname = in_array($taskvar['type'], array('mradio', 'mcheckbox', 'select', 'mselect')) ?
($taskvar['type'] == 'mselect' ? array($taskvar['variable'].'[]', $taskcvar['value']) : array($taskvar['variable'], $taskcvar['value']))
: $taskvar['variable'];
if(in_array($taskvar['type'], array('mcheckbox', 'mselect'))) {
$taskvar['value'] = dunserialize($taskvar['value']);
}
showsetting($taskvar['name'], $varname, $taskvar['value'], $taskvar['type'], '', 0, $taskvar['description']);
}
} else {
showtablerow('', 'class="td27" colspan="2"', cplang('nolimit'));
}
showsubmit('editsubmit', 'submit');
showtablefooter();
showformfooter();
} else {
$applyperm = $_GET['grouplimit'] == 'special' && is_array($_GET['applyperm']) ? implode("\t", $_GET['applyperm']) : $_GET['grouplimit'];
$_GET['starttime'] = strtotime($_GET['starttime']);
$_GET['endtime'] = strtotime($_GET['endtime']);
$reward = $_GET['reward'];
$prize = $_GET['prize_'.$reward];
$bonus = $_GET['bonus_'.$reward];
if(!$_GET['name'] || !$_GET['description']) {
cpmsg('tasks_basic_invalid', '', 'error');
} elseif(($_GET['starttime'] != $task['starttime'] || $_GET['endtime'] != $task['endtime']) && (($_GET['endtime'] && $_GET['endtime'] <= TIMESTAMP) || ($_GET['starttime'] && $_GET['endtime'] && $_GET['endtime'] <= $_GET['starttime']))) {
cpmsg('tasks_time_invalid', '', 'error');
} elseif($reward && (!$prize || ($reward == 'credit' && !$bonus))) {
cpmsg('tasks_reward_invalid', '', 'error');
}
if($task['available'] == '2' && ($_GET['starttime'] > TIMESTAMP || ($_GET['endtime'] && $_GET['endtime'] <= TIMESTAMP))) {
C::t('common_task')->update($id, array('available' => 1));
}
if($task['available'] == '1' && (!$_GET['starttime'] || $_GET['starttime'] <= TIMESTAMP) && (!$_GET['endtime'] || $_GET['endtime'] > TIMESTAMP)) {
C::t('common_task')->update($id, array('available' => 2));
}
$itemarray = array();
foreach(C::t('common_taskvar')->fetch_all_by_taskid($id, 'IS NOT NULL') as $taskvar) {
$itemarray[] = $taskvar['variable'];
}
C::t('common_task')->update($id, array(
'relatedtaskid' => $_GET['relatedtaskid'],
'exclusivetaskid' => $_GET['exclusivetaskid'],
'name' => $_GET['name'],
'description' => $_GET['description'],
'icon' => $_GET['iconnew'],
'tasklimits' => $_GET['tasklimits'],
'applyperm' => $applyperm,
'starttime' => $_GET['starttime'],
'endtime' => $_GET['endtime'],
'period' => $_GET['period'],
'periodtype' => $_GET['periodtype'],
'reward' => $reward,
'prize' => $prize,
'bonus' => $bonus,
));
foreach($itemarray as $item) {
$value = $_GET[''.$item];
if(in_array($item, array('num', 'time', 'threadid'))) {
$value = intval($value);
}
if($value !== null) {
C::t('common_taskvar')->update_by_taskid($id, $item, array('value' => is_array($value) ? serialize($value) : $value));
}
}
require_once libfile('class/task');
$tasklib = & task::instance();
$tasklib->update_available(1);
cpmsg('tasks_succeed', "action=tasks", 'succeed');
}
} elseif($operation == 'delete' && $id) {
if(!$_GET['confirmed']) {
cpmsg('tasks_del_confirm', "action=tasks&operation=delete&id=$id", 'form');
}
C::t('common_task')->delete($id);
C::t('common_taskvar')->delete_by_taskid($id);
C::t('common_mytask')->delete_mytask(0, $id);
require_once libfile('class/task');
$tasklib = & task::instance();
$tasklib->update_available(1);
cpmsg('tasks_del', 'action=tasks', 'succeed');
} elseif($operation == 'type') {
shownav('extended', 'nav_tasks');
showsubmenu('nav_tasks', array(
array('admin', 'tasks', 0),
$submenus ? array(array('menu' => 'add', 'submenu' => $submenus)) : array(),
array('nav_task_type', 'tasks&operation=type', 1)
));
showtips('tasks_tips_add_type');
$tasks = gettasks();
showtableheader('', 'fixpadding');
if($tasks) {
showsubtitle(array('name', 'tasks_version', 'copyright', ''));
foreach($tasks as $task) {
showtablerow('', '', array(
$task['name'].($task['filemtime'] > TIMESTAMP - 86400 ? ' <font color="red">New!</font>' : ''),
$task['version'],
$task['copyright'],
in_array($task['class'], $custom_scripts) ? "<a href=\"".ADMINSCRIPT."?action=tasks&operation=upgrade&script={$task['class']}\" class=\"act\">{$lang['tasks_upgrade']}</a> <a href=\"".ADMINSCRIPT."?action=tasks&operation=uninstall&script={$task['class']}\" class=\"act\">{$lang['tasks_uninstall']}</a><br />" : "<a href=\"".ADMINSCRIPT."?action=tasks&operation=install&script={$task['class']}\" class=\"act\">{$lang['tasks_install']}</a>"
));
}
} else {
showtablerow('', '', $lang['task_module_nonexistence']);
}
showtablefooter();
} elseif($operation == 'install' && $_GET['script']) {
if(C::t('common_task')->count_by_scriptname($_GET['script'])) {
cpmsg('tasks_install_duplicate', '', 'error');
}
$escript = explode(':', $_GET['script']);
if(count($escript) > 1 && preg_match('/^[\w\_:]+$/', $_GET['script'])) {
include_once DISCUZ_ROOT.'./source/plugin/'.$escript[0].'/task/task_'.$escript[1].'.php';
$taskclass = 'task_'.$escript[1];
} else {
require_once libfile('task/'.$_GET['script'], 'class');
$taskclass = 'task_'.$_GET['script'];
}
$task = new $taskclass;
if(method_exists($task, 'install')) {
$task->install();
}
$custom_types[$_GET['script']] = array('name' => lang('task/'.$_GET['script'], $task->name), 'version' => $task->version);
C::t('common_setting')->update_setting('tasktypes', $custom_types);
require_once libfile('class/task');
$tasklib = & task::instance();
$tasklib->update_available(1);
cpmsg('tasks_installed', 'action=tasks&operation=type', 'succeed');
} elseif($operation == 'uninstall' && $_GET['script']) {
if(!$_GET['confirmed']) {
cpmsg('tasks_uninstall_confirm', "action=tasks&operation=uninstall&script={$_GET['script']}", 'form');
}
$ids = array();
foreach(C::t('common_task')->fetch_all_by_scriptname($_GET['script']) as $task) {
$ids[] = $task['taskid'];
}
if($ids) {
C::t('common_task')->delete($ids);
C::t('common_taskvar')->delete_by_taskid($ids);
C::t('common_mytask')->delete_mytask(0, $ids);
}
$escript = explode(':', $_GET['script']);
if(count($escript) > 1 && preg_match('/^[\w\_:]+$/', $_GET['script'])) {
include_once DISCUZ_ROOT.'./source/plugin/'.$escript[0].'/task/task_'.$escript[1].'.php';
$taskclass = 'task_'.$escript[1];
} else {
require_once libfile('task/'.$_GET['script'], 'class');
$taskclass = 'task_'.$_GET['script'];
}
$task = new $taskclass;
if(method_exists($task, 'uninstall')) {
$task->uninstall();
}
unset($custom_types[$_GET['script']]);
C::t('common_setting')->update_setting('tasktypes', $custom_types);
require_once libfile('class/task');
$tasklib = & task::instance();
$tasklib->update_available(1);
cpmsg('tasks_uninstalled', 'action=tasks&operation=type', 'succeed');
} elseif($operation == 'upgrade' && $_GET['script']) {
$escript = explode(':', $_GET['script']);
if(count($escript) > 1 && preg_match('/^[\w\_:]+$/', $_GET['script'])) {
include_once DISCUZ_ROOT.'./source/plugin/'.$escript[0].'/task/task_'.$escript[1].'.php';
$taskclass = 'task_'.$escript[1];
} else {
require_once libfile('task/'.$_GET['script'], 'class');
$taskclass = 'task_'.$_GET['script'];
}
$task = new $taskclass;
if($custom_types[$_GET['script']]['version'] >= $task->version) {
cpmsg('tasks_newest', '', 'error');
}
if(method_exists($task, 'upgrade')) {
$task->upgrade();
}
$task->name = lang('task/'.$_GET['script'], $task->name);
$task->description = lang('task/'.$_GET['script'], $task->description);
C::t('common_task')->update_by_scriptname($_GET['script'], array('version' => $task->version));
$custom_types[$_GET['script']] = array('name' => $task->name, 'version' => $task->version);
C::t('common_setting')->update_setting('tasktypes', $custom_types);
require_once libfile('class/task');
$tasklib = & task::instance();
$tasklib->update_available(1);
cpmsg('tasks_updated', 'action=tasks&operation=type', 'succeed');
}
function gettasks() {
global $_G;
$checkdirs = array_merge(array(''), $_G['setting']['plugins']['available']);
$tasks = array();
foreach($checkdirs as $key) {
if($key) {
$dir = DISCUZ_ROOT.'./source/plugin/'.$key.'/task';
} else {
$dir = DISCUZ_ROOT.'./source/class/task';
}
if(!file_exists($dir)) {
continue;
}
$taskdir = dir($dir);
while($entry = $taskdir->read()) {
if(!in_array($entry, array('.', '..')) && preg_match("/^task\_[\w\.]+$/", $entry) && substr($entry, -4) == '.php' && strlen($entry) < 30 && is_file($dir.'/'.$entry)) {
@include_once $dir.'/'.$entry;
$taskclass = substr($entry, 0, -4);
if(class_exists($taskclass)) {
$task = new $taskclass();
$script = substr($taskclass, 5);
$script = ($key ? $key.':' : '').$script;
$tasks[$entry] = array(
'class' => $script,
'name' => lang('task/'.$script, $task->name),
'version' => $task->version,
'copyright' => lang('task/'.$script, $task->copyright),
'filemtime' => @filemtime($dir.'/'.$entry)
);
}
}
}
}
uasort($tasks, 'filemtimesort');
return $tasks;
}
?>

View File

@@ -0,0 +1,212 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_templates.php 29301 2012-04-01 02:55:08Z monkey $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
if(!isfounder()) cpmsg('noaccess_isfounder', '', 'error');
$isplugindeveloper = isset($_G['config']['plugindeveloper']) && $_G['config']['plugindeveloper'] > 0;
if(!$isplugindeveloper) {
cpmsg('undefined_action', '', 'error');
}
$operation = empty($operation) ? 'admin' : $operation;
if($operation == 'admin') {
if(!submitcheck('tplsubmit')) {
$templates = '';
foreach(C::t('common_template')->fetch_all_data() as $tpl) {
$basedir = basename($tpl['directory']);
$templates .= showtablerow('', array('class="td25"', '', 'class="td29"'), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" ".($tpl['templateid'] == 1 ? 'disabled ' : '')."value=\"{$tpl['templateid']}\">",
"<input type=\"text\" class=\"txt\" size=\"8\" name=\"namenew[{$tpl['templateid']}]\" value=\"{$tpl['name']}\">".
($basedir != 'default' ? '<a href="'.ADMINSCRIPT.'?action=cloudaddons&frame=no&id='.urlencode($basedir).'.template" target="_blank" title="'.$lang['cloudaddons_linkto'].'">'.$lang['view'].'</a>' : ''),
"<input type=\"text\" class=\"txt\" size=\"20\" name=\"directorynew[{$tpl['templateid']}]\" value=\"{$tpl['directory']}\">",
!empty($tpl['copyright']) ?
$tpl['copyright'] :
"<input type=\"text\" class=\"txt\" size=\"8\" name=\"copyrightnew[{$tpl['templateid']}]\" value=>"
), TRUE);
}
shownav('template', 'templates_admin');
showsubmenu('styles_admin', array(
array('templates_add', 'templates&operation=add', 0),
array('nav_templates', 'templates&operation=admin', 1),
array('cloudaddons_style_link', 'cloudaddons&frame=no&operation=templates&from=more', 0, 1),
));
showformheader('templates');
showtableheader();
showsubtitle(array('', 'templates_admin_name', 'dir', 'copyright'));
echo $templates;
echo '<tr><td>'.$lang['add_new'].'</td><td><input type="text" class="txt" size="8" name="newname"></td><td class="td29"><input type="text" class="txt" size="20" name="newdirectory"></td><td><input type="text" class="txt" size="25" name="newcopyright"></td><td>&nbsp;</td></tr>';
showsubmit('tplsubmit', 'submit', 'del');
showtablefooter();
showformfooter();
} else {
if($_GET['newname']) {
if(!$_GET['newdirectory']) {
cpmsg('tpl_new_directory_invalid', '', 'error');
} elseif(!istpldir($_GET['newdirectory'])) {
$directory = $_GET['newdirectory'];
cpmsg('tpl_directory_invalid', '', 'error', array('directory' => $directory));
}
C::t('common_template')->insert(array('name' => $_GET['newname'], 'directory' => $_GET['newdirectory'], 'copyright' => $_GET['newcopyright']));
}
foreach($_GET['directorynew'] as $id => $directory) {
if(!$_GET['delete'] || ($_GET['delete'] && !in_array($id, $_GET['delete']))) {
if(!istpldir($directory)) {
cpmsg('tpl_directory_invalid', '', 'error', array('directory' => $directory));
} elseif($id == 1 && $directory != './template/default') {
cpmsg('tpl_default_directory_invalid', '', 'error');
}
C::t('common_template')->update($id, array('name' => $_GET['namenew'][$id], 'directory' => $_GET['directorynew'][$id]));
if(!empty($_GET['copyrightnew'][$id])) {
$template = C::t('common_template')->fetch($id);
if(!$template['copyright']) {
C::t('common_template')->update($id, array('copyright' => $_GET['copyrightnew'][$id]));
}
}
}
}
if(is_array($_GET['delete'])) {
if(in_array('1', $_GET['delete'])) {
cpmsg('tpl_delete_invalid', '', 'error');
}
if($_GET['delete']) {
C::t('common_template')->delete_tpl($_GET['delete']);
C::t('common_style')->update($_GET['delete'], array('templateid' => 1));
}
}
updatecache('styles');
cpmsg('tpl_update_succeed', 'action=templates', 'succeed');
}
} elseif($operation == 'add') {
$predefinedvars = array('available' => array(), 'boardimg' => array(), 'searchimg' => array(), 'touchimg' => array(), 'imgdir' => array(), 'styleimgdir' => array(), 'stypeid' => array(),
'headerbgcolor' => array(0, $lang['styles_edit_type_bg']),
'bgcolor' => array(0),
'sidebgcolor' => array(0, '', '#FFF sidebg.gif repeat-y 100% 0'),
'titlebgcolor' => array(0),
'headerborder' => array(1, $lang['styles_edit_type_header'], '1px'),
'headertext' => array(0),
'footertext' => array(0),
'font' => array(1, $lang['styles_edit_type_font']),
'fontsize' => array(1),
'threadtitlefont' => array(1, $lang['styles_edit_type_thread_title']),
'threadtitlefontsize' => array(1),
'smfont' => array(1),
'smfontsize' => array(1),
'tabletext' => array(0),
'midtext' => array(0),
'lighttext' => array(0),
'link' => array(0, $lang['styles_edit_type_url']),
'highlightlink' => array(0),
'lightlink' => array(0),
'wrapbg' => array(0),
'wrapbordercolor' => array(0),
'msgfontsize' => array(1, $lang['styles_edit_type_post'], '14px'),
'contentwidth' => array(1),
'contentseparate' => array(0),
'menubgcolor' => array(0, $lang['styles_edit_type_menu']),
'menutext' => array(0),
'menuhoverbgcolor' => array(0),
'menuhovertext' => array(0),
'inputborder' => array(0, $lang['styles_edit_type_input']),
'inputborderdarkcolor' => array(0),
'inputbg' => array(0, '', '#FFF'),
'dropmenuborder' => array(0, $lang['styles_edit_type_dropmenu']),
'dropmenubgcolor' => array(0),
'floatbgcolor' => array(0, $lang['styles_edit_type_float']),
'floatmaskbgcolor' => array(0),
'commonborder' => array(0, $lang['styles_edit_type_other']),
'commonbg' => array(0),
'specialborder' => array(0),
'specialbg' => array(0),
'noticetext' => array(0),
);
if(!submitcheck('addsubmit')) {
shownav('template', 'templates_add');
showsubmenu('styles_admin', array(
array('templates_add', 'templates&operation=add', 1),
array('nav_templates', 'templates&operation=admin', 0),
array('cloudaddons_style_link', 'cloudaddons&frame=no&operation=templates&from=more', 0, 1),
));
showtips('templates_add_tips');
showformheader("templates&operation=add", '', 'configform');
showtableheader();
showsetting('templates_edit_name', 'namenew', '', 'text');
showsetting('templates_edit_copyright', 'copyrightnew', '', 'text');
showsetting('templates_edit_identifier', 'identifiernew', '', 'text');
$styleselect = array();
$styleselect[] = array(0, $lang['templates_empty']);
foreach(C::t('common_style')->fetch_all_data(true) as $value) {
$styleselect[] = array($value['styleid'], $value['name']);
}
showsetting('templates_edit_style', array('styleidnew', $styleselect), '', 'select');
showsubmit('addsubmit');
showtablefooter();
showformfooter();
} else {
$namenew = dhtmlspecialchars(trim($_GET['namenew']));
$identifiernew = trim($_GET['identifiernew']);
$copyrightnew = dhtmlspecialchars($_GET['copyrightnew']);
$styleidnew = dintval($_GET['styleidnew']);
if(!$namenew) {
cpmsg('templates_edit_name_invalid', '', 'error');
}
if(!ispluginkey($identifiernew)) {
cpmsg('templates_edit_identifier_invalid', '', 'error');
}
$templateid = C::t('common_template')->insert(array('name' => $namenew, 'directory' => './template/'.$identifiernew, 'copyright' => $copyrightnew), true);
$styleid = C::t('common_style')->insert(array('name' => $namenew, 'templateid' => $templateid), true);
if($styleidnew) {
foreach(C::t('common_stylevar')->fetch_all_by_styleid($styleidnew) as $stylevar) {
C::t('common_stylevar')->insert(array('styleid' => $styleid, 'variable' => $stylevar['variable'], 'substitute' => $stylevar['substitute']));
}
}else{
foreach(array_keys($predefinedvars) as $variable) {
$substitute = isset($predefinedvars[$variable][2]) ? $predefinedvars[$variable][2] : '';
C::t('common_stylevar')->insert(array('styleid' => $styleid, 'variable' => $variable, 'substitute' => $substitute));
}
}
dmkdir(DISCUZ_ROOT.'./template/'.$identifiernew.'/');
updatecache(array('setting', 'styles'));
loadcache('style_default', true);
updatecache('updatediytemplate');
cpmsg('templates_add_succeed', "action=styles", 'succeed');
}
}
?>

View File

@@ -0,0 +1,627 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_threads.php 33828 2013-08-20 02:29:32Z nemohou $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
require_once libfile('function/post');
cpheader();
$optype = $_GET['optype'];
$fromumanage = $_GET['fromumanage'] ? 1 : 0;
if((!$operation && !$optype) || ($operation == 'group' && empty($optype))) {
if(!submitcheck('searchsubmit', 1) && empty($_GET['search'])) {
$newlist = 1;
$_GET['intype'] = '';
$_GET['detail'] = 1;
$_GET['inforum'] = 'all';
$_GET['starttime'] = dgmdate(TIMESTAMP - 86400 * 30, 'Y-n-j');
}
$intypes = '';
if($_GET['inforum'] && $_GET['inforum'] != 'all' && $_GET['intype']) {
$foruminfo = C::t('forum_forumfield')->fetch($_GET['inforum']);
$forumthreadtype = $foruminfo['threadtypes'];
if($forumthreadtype) {
$forumthreadtype = dunserialize($forumthreadtype);
foreach($forumthreadtype['types'] as $typeid => $typename) {
$intypes .= '<option value="'.$typeid.'"'.($typeid == $_GET['intype'] ? ' selected' : '').'>'.$typename.'</option>';
}
}
}
require_once libfile('function/forumlist');
$forumselect = '<b>'.$lang['threads_search_forum'].':</b><br><br><select name="inforum" onchange="ajaxget(\'forum.php?mod=ajax&action=getthreadtypes&selectname=intype&fid=\' + this.value, \'forumthreadtype\')"><option value="all">&nbsp;&nbsp;> '.$lang['all'].'</option><option value="">&nbsp;</option>'.forumselect(FALSE, 0, 0, TRUE).'</select>';
$typeselect = $lang['threads_move_type'].' <span id="forumthreadtype"><select name="intype"><option value=""></option>'.$intypes.'</select></span>';
if(isset($_GET['inforum'])) {
$forumselect = preg_replace("/(\<option value=\"{$_GET['inforum']}\")(\>)/", "\\1 selected=\"selected\" \\2", $forumselect);
}
$sortselect = '';
$query = C::t('forum_threadtype')->fetch_all_for_order();
foreach($query as $type) {
if($type['special']) {
$sortselect .= '<option value="'.$type['typeid'].'">&nbsp;&nbsp;> '.$type['name'].'</option>';
}
}
if(isset($_GET['insort'])) {
$sortselect = preg_replace("/(\<option value=\"{$_GET['insort']}\")(\>)/", "\\1 selected=\"selected\" \\2", $sortselect);
}
$staticurl = STATICURL;
echo <<<EOT
<script type="text/javascript" src="{$staticurl}js/calendar.js"></script>
<script type="text/JavaScript">
function page(number) {
$('threadforum').page.value=number;
$('threadforum').searchsubmit.click();
}
</script>
EOT;
shownav('topic', 'nav_maint_threads'.($operation ? '_'.$operation : ''));
showsubmenusteps('nav_maint_threads'.($operation ? '_'.$operation : ''), empty($newlist) ? array(
array('threads_search', !$_GET['searchsubmit']),
array('nav_maint_threads', $_GET['searchsubmit'])
) : '', '', array(
array('newlist', 'threads'.($operation ? '&operation='.$operation : ''), !empty($newlist)),
array('search', 'threads'.($operation ? '&operation='.$operation : '').'&search=true', empty($newlist)),
));
if(empty($newlist)) {
$search_tips = 1;
showtips('threads_tips');
}
showtagheader('div', 'threadsearch', !submitcheck('searchsubmit', 1) && empty($newlist));
showformheader('threads'.($operation ? '&operation='.$operation : ''), '', 'threadforum');
showhiddenfields(array('page' => $page, 'pp' => $_GET['pp'] ? $_GET['pp'] : $_GET['perpage']));
showtableheader();
showsetting('threads_search_detail', 'detail', $_GET['detail'], 'radio');
if($operation != 'group') {
showtablerow('', array('class="rowform" colspan="2" style="width:auto;"'), array($forumselect.$typeselect));
}
showsetting('threads_search_perpage', '', $_GET['perpage'], "<select name='perpage'><option value='20'>{$lang['perpage_20']}</option><option value='50'>{$lang['perpage_50']}</option><option value='100'>{$lang['perpage_100']}</option></select>");
if(!$fromumanage && !submitcheck('searchsubmit', 1)) {
empty($_GET['starttime']) && $_GET['starttime'] = date('Y-m-d', time() - 86400 * 30);
}
echo '<input type="hidden" name="fromumanage" value="'.$fromumanage.'">';
showsetting('threads_search_time', array('starttime', 'endtime'), array($_GET['starttime'], $_GET['endtime']), 'daterange');
showsetting('threads_search_user', 'users', $_GET['users'], 'text');
showsetting('threads_search_keyword', 'keywords', $_GET['keywords'], 'text');
showtagheader('tbody', 'advanceoption');
showsetting('threads_search_sort', '', '', '<select name="insort"><option value="all">&nbsp;&nbsp;> '.$lang['all'].'</option><option value="">&nbsp;</option><option value="0">&nbsp;&nbsp;> '.$lang['threads_search_type_none'].'</option>'.$sortselect.'</select>');
showsetting('threads_search_viewrange', array('viewsmore', 'viewsless'), array($_GET['viewsmore'], $_GET['viewsless']), 'range');
showsetting('threads_search_replyrange', array('repliesmore', 'repliesless'), array($_GET['repliesmore'], $_GET['repliesless']), 'range');
showsetting('threads_search_readpermmore', 'readpermmore', $_GET['readpermmore'], 'text');
showsetting('threads_search_pricemore', 'pricemore', $_GET['pricemore'], 'text');
showsetting('threads_search_noreplyday', 'noreplydays', $_GET['noreplydays'], 'text');
showsetting('threads_search_type', array('specialthread', array(
array(0, cplang('unlimited'), array('showspecial' => 'none')),
array(1, cplang('threads_search_include_yes'), array('showspecial' => '')),
array(2, cplang('threads_search_include_no'), array('showspecial' => '')),
), TRUE), $_GET['specialthread'], 'mradio');
showtablerow('id="showspecial" style="display:'.($_GET['specialthread'] ? '' : 'none').'"', 'class="sub" colspan="2"', mcheckbox('special', array(
1 => cplang('thread_poll'),
2 => cplang('thread_trade'),
3 => cplang('thread_reward'),
4 => cplang('thread_activity'),
5 => cplang('thread_debate')
), $_GET['special'] ? $_GET['special'] : array(0)));
showsetting('threads_search_sticky', array('sticky', array(
array(0, cplang('unlimited')),
array(1, cplang('threads_search_include_yes')),
array(2, cplang('threads_search_include_no')),
), TRUE), $_GET['sticky'], 'mradio');
showsetting('threads_search_digest', array('digest', array(
array(0, cplang('unlimited')),
array(1, cplang('threads_search_include_yes')),
array(2, cplang('threads_search_include_no')),
), TRUE), $_GET['digest'], 'mradio');
showsetting('threads_search_attach', array('attach', array(
array(0, cplang('unlimited')),
array(1, cplang('threads_search_include_yes')),
array(2, cplang('threads_search_include_no')),
), TRUE), $_GET['attach'], 'mradio');
showsetting('threads_rate', array('rate', array(
array(0, cplang('unlimited')),
array(1, cplang('threads_search_include_yes')),
array(2, cplang('threads_search_include_no')),
), TRUE), $_GET['rate'], 'mradio');
showsetting('threads_highlight', array('highlight', array(
array(0, cplang('unlimited')),
array(1, cplang('threads_search_include_yes')),
array(2, cplang('threads_search_include_no')),
), TRUE), $_GET['highlight'], 'mradio');
showsetting('threads_save', 'savethread', $_GET['savethread'], 'radio');
if($operation != 'group') {
showsetting('threads_hide', 'hidethread', $_GET['hidethread'], 'radio');
}
showtagfooter('tbody');
showsubmit('searchsubmit', 'submit', '', 'more_options');
showtablefooter();
showformfooter();
showtagfooter('div');
if(submitcheck('searchsubmit', 1) || $newlist) {
$operation == 'group' && $_GET['inforum'] = 'isgroup';
$conditions['inforum'] = $_GET['inforum'] != '' && $_GET['inforum'] != 'all' && $_GET['inforum'] != 'isgroup' ? $_GET['inforum'] : '';
$conditions['isgroup'] = $_GET['inforum'] != '' && $_GET['inforum'] == 'isgroup' ? 1 : 0;
$conditions['intype'] = $_GET['intype'] !== '' ? $_GET['intype'] : '';
$conditions['insort'] = $_GET['insort'] != '' && $_GET['insort'] != 'all' ? $_GET['insort'] : '';
$conditions['viewsless'] = $_GET['viewsless'] != '' ? $_GET['viewsless'] : '';
$conditions['viewsmore'] = $_GET['viewsmore'] != '' ? $_GET['viewsmore'] : '';
$conditions['repliesless'] = $_GET['repliesless'] != '' ? $_GET['repliesless'] : '';
$conditions['repliesmore'] = $_GET['repliesmore'] != '' ? $_GET['repliesmore'] : '';
$conditions['readpermmore'] = $_GET['readpermmore'] != '' ? $_GET['readpermmore'] : '';
$conditions['pricemore'] = $_GET['pricemore'] != '' ? $_GET['pricemore'] : '';
$conditions['beforedays'] = $_GET['beforedays'] != '' ? $_GET['beforedays'] : '';
$conditions['noreplydays'] = $_GET['noreplydays'] != '' ? $_GET['noreplydays'] : '';
$conditions['starttime'] = !empty($_GET['starttime']) ? $_GET['starttime'] : '';
$conditions['endtime'] = !empty($_GET['endtime']) ? $_GET['endtime'] : '';
if(!empty($_GET['savethread'])) {
$conditions['sticky'] = 4;
$conditions['displayorder'] = -4;
}
if(!empty($_GET['hidethread'])) {
$conditions['hidden'] = 1;
}
if(trim($_GET['keywords'])) {
$conditions['keywords'] = $_GET['keywords'];
}
$conditions['users'] = trim($_GET['users']) ? $_GET['users'] : '';
if($_GET['sticky'] == 1) {
$conditions['sticky'] = 1;
} elseif($_GET['sticky'] == 2) {
$conditions['sticky'] = 2;
}
if($_GET['digest'] == 1) {
$conditions['digest'] = 1;
} elseif($_GET['digest'] == 2) {
$conditions['digest'] = 2;
}
if($_GET['attach'] == 1) {
$conditions['attach'] = 1;
} elseif($_GET['attach'] == 2) {
$conditions['attach'] = 2;
}
if($_GET['rate'] == 1) {
$conditions['rate'] = 1;
} elseif($_GET['rate'] == 2) {
$conditions['rate'] = 2;
}
if($_GET['highlight'] == 1) {
$conditions['highlight'] = 1;
} elseif($_GET['highlight'] == 2) {
$conditions['highlight'] = 2;
}
if(!empty($_GET['special'])) {
$specials = $comma = '';
foreach($_GET['special'] as $val) {
$specials .= $comma.'\''.$val.'\'';
$comma = ',';
}
$conditions['special'] = $_GET['special'];
if($_GET['specialthread'] == 1) {
$conditions['specialthread'] = 1;
} elseif($_GET['specialthread'] == 2) {
$conditions['specialthread'] = 2;
}
}
$fids = array();
$tids = $threadcount = '0';
if($conditions) {
if(empty($_GET['savethread']) && !isset($conditions['displayorder']) && !isset($conditions['sticky'])) {
$conditions['sticky'] = 5;
}
if($_GET['detail']) {
$_GET['perpage'] = intval($_GET['perpage']) < 1 ? 20 : intval($_GET['perpage']);
$perpage = $_GET['pp'] ? $_GET['pp'] : $_GET['perpage'];
$start = ($page - 1) * $perpage;
$threads = '';
$groupsname = $groupsfid = $threadlist = array();
$threadcount = C::t('forum_thread')->count_search($conditions);
if($threadcount) {
foreach(C::t('forum_thread')->fetch_all_search($conditions, 0, $start, $perpage, 'tid', 'DESC', ' FORCE INDEX(PRIMARY) ') as $thread) {
$fids[] = $thread['fid'];
if($thread['isgroup']) {
$groupsfid[$thread['fid']] = $thread['fid'];
}
$thread['lastpost'] = dgmdate($thread['lastpost']);
$threadlist[] = $thread;
}
if($groupsfid) {
$query = C::t('forum_forum')->fetch_all_by_fid($groupsfid);
foreach($query as $row) {
$groupsname[$row['fid']] = $row['name'];
}
}
if($threadlist) {
foreach($threadlist as $thread) {
$threads .= showtablerow('', array('class="td25"', '', '', '', 'class="td25"', 'class="td25"'), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"tidarray[]\" value=\"{$thread['tid']}\" />",
"<a href=\"forum.php?mod=viewthread&tid={$thread['tid']}".($thread['displayorder'] != -4 ? '' : '&modthreadkey='.modauthkey($thread['tid']))."\" target=\"_blank\">{$thread['subject']}</a>".($thread['readperm'] ? " - [{$lang['threads_readperm']} {$thread['readperm']}]" : '').($thread['price'] ? " - [{$lang['threads_price']} {$thread['price']}]" : ''),
"<a href=\"forum.php?mod=forumdisplay&fid={$thread['fid']}\" target=\"_blank\">".(empty($thread['isgroup']) ? $_G['cache']['forums'][$thread['fid']]['name'] : $groupsname[$thread['fid']])."</a>",
"<a href=\"home.php?mod=space&uid={$thread['authorid']}\" target=\"_blank\">{$thread['author']}</a>",
$thread['replies'],
$thread['views'],
$thread['lastpost']
), TRUE);
}
}
$multi = multi($threadcount, $perpage, $page, ADMINSCRIPT."?action=threads");
$multi = preg_replace("/href=\"".ADMINSCRIPT."\?action=threads&amp;page=(\d+)\"/", "href=\"javascript:page(\\1)\"", $multi);
$multi = str_replace("window.location='".ADMINSCRIPT."?action=threads&amp;page='+this.value", "page(this.value)", $multi);
}
} else {
$threadcount = C::t('forum_thread')->count_search($conditions);
if($threadcount) {
foreach(C::t('forum_thread')->fetch_all_search($conditions, 0, $start, $perpage, 'tid', 'DESC', ' FORCE INDEX(PRIMARY) ') as $thread) {
$fids[] = $thread['fid'];
$tids .= ','.$thread['tid'];
}
}
$multi = '';
}
}
$fids = implode(',', array_unique($fids));
showtagheader('div', 'threadlist', TRUE);
showformheader('threads&frame=no'.($operation ? '&operation='.$operation : ''), 'target="threadframe"');
showhiddenfields($_GET['detail'] ? array('fids' => $fids) : array('fids' => $fids, 'tids' => $tids));
if(!$search_tips) {
showtableheader(cplang('threads_new_result').' '.$threadcount);
} else {
showtableheader(cplang('threads_result').' '.$threadcount.' <a href="###" onclick="$(\'threadlist\').style.display=\'none\';$(\'threadsearch\').style.display=\'\';$(\'threadforum\').pp.value=\'\';$(\'threadforum\').page.value=\'\';" class="act lightlink normal">'.cplang('research').'</a>');
}
if(!$threadcount) {
showtablerow('', 'colspan="3"', cplang('threads_thread_nonexistence'));
} else {
if($_GET['detail']) {
showsubtitle(array('', 'subject', 'forum', 'author', 'threads_replies', 'threads_views', 'threads_lastpost'));
echo $threads;
showtablerow('', array('class="td25" colspan="7"'), array('<input name="chkall" id="chkall" type="checkbox" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'tidarray\', \'chkall\')" /><label for="chkall">'.cplang('select_all').'</label>'));
showtablefooter();
showtableheader('operation', 'notop');
}
showsubtitle(array('', 'operation', 'option'));
showtablerow('', array('class="td25"', 'class="td24"', 'class="rowform" style="width:auto;"'), array(
'<input class="radio" type="radio" id="optype_moveforum" name="optype" value="moveforum" onclick="this.form.modsubmit.disabled=false;">',
$lang['threads_move_forum'],
'<select name="toforum" id="toforum" onchange="$(\'optype_moveforum\').checked=\'checked\';ajaxget(\'forum.php?mod=ajax&action=getthreadtypes&fid=\' + this.value, \'threadtypes\')">'.forumselect(FALSE, 0, 0, TRUE).'</select>'.
$lang['threads_move_type'].' <span id="threadtypes"><select name="threadtypeid" onchange="$(\'optype_moveforum\').checked=\'checked\'"><option value="0"></option></select></span>'
));
if($operation != 'group') {
showtablerow('', array('class="td25"', 'class="td24"', 'class="rowform" style="width:auto;"'), array(
'<input class="radio" type="radio" id="optype_movesort" name="optype" value="movesort" onclick="this.form.modsubmit.disabled=false;">',
$lang['threads_move_sort'],
'<select name="tosort" onchange="$(\'optype_movesort\').checked=\'checked\';"><option value="0">&nbsp;&nbsp;> '.$lang['threads_search_type_none'].'</option>'.$sortselect.'</select>'
));
showtablerow('', array('class="td25"', 'class="td24"', 'class="rowform" style="width:auto;"'), array(
'<input class="radio" type="radio" id="optype_stick" name="optype" value="stick" onclick="this.form.modsubmit.disabled=false;">',
$lang['threads_stick'],
'<input class="radio" type="radio" name="stick_level" value="0" onclick="$(\'optype_stick\').checked=\'checked\'"> '.$lang['threads_remove'].' &nbsp; &nbsp;<input class="radio" type="radio" name="stick_level" value="1" onclick="$(\'optype_stick\').checked=\'checked\'"> '.$lang['threads_stick_one'].' &nbsp; &nbsp;<input class="radio" type="radio" name="stick_level" value="2" onclick="$(\'optype_stick\').checked=\'checked\'"> '.$lang['threads_stick_two'].' &nbsp; &nbsp;<input class="radio" type="radio" name="stick_level" value="3" onclick="$(\'optype_stick\').checked=\'checked\'"> '.$lang['threads_stick_three']
));
showtablerow('', array('class="td25"', 'class="td24"', 'class="rowform" style="width:auto;"'), array(
'<input class="radio" type="radio" id="optype_addstatus" name="optype" value="addstatus" onclick="this.form.modsubmit.disabled=false;">',
$lang['threads_open_close'],
'<input class="radio" type="radio" name="status" value="0" onclick="$(\'optype_addstatus\').checked=\'checked\'"> '.$lang['open'].' &nbsp; &nbsp;<input class="radio" type="radio" name="status" value="1" onclick="$(\'optype_addstatus\').checked=\'checked\'"> '.$lang['closed']
));
}
showtablerow('', array('class="td25"', 'class="td24"', 'class="rowform" style="width:auto;"'), array(
'<input class="radio" type="radio" id="optype_delete" name="optype" value="delete" onclick="this.form.modsubmit.disabled=false;">',
$lang['threads_delete'],
'<input class="checkbox" type="checkbox" name="donotupdatemember" id="donotupdatemember" value="1" /><label for="donotupdatemember"> '.$lang['threads_delete_no_update_member'].'</label>'
));
showtablerow('', array('class="td25"', 'class="td24"', 'class="rowform" style="width:auto;"'), array(
'<input class="radio" type="radio" name="optype" id="optype_adddigest" value="adddigest" onclick="this.form.modsubmit.disabled=false;">',
$lang['threads_add_digest'],
'<input class="radio" type="radio" name="digest_level" value="0" onclick="$(\'optype_adddigest\').checked=\'checked\'"> '.$lang['threads_remove'].' &nbsp; &nbsp;<input class="radio" type="radio" name="digest_level" value="1" onclick="$(\'optype_adddigest\').checked=\'checked\'"> '.$lang['threads_digest_one'].' &nbsp; &nbsp;<input class="radio" type="radio" name="digest_level" value="2" onclick="$(\'optype_adddigest\').checked=\'checked\'"> '.$lang['threads_digest_two'].' &nbsp; &nbsp;<input class="radio" type="radio" name="digest_level" value="3" onclick="$(\'optype_adddigest\').checked=\'checked\'"> '.$lang['threads_digest_three']
));
showtablerow('', array('class="td25"', 'class="td24"', 'class="rowform" style="width:auto;"'), array(
'<input class="radio" type="radio" name="optype" value="deleteattach" onclick="this.form.modsubmit.disabled=false;">',
$lang['threads_delete_attach'],
''
));
}
showsubmit('modsubmit', 'submit', '', '', $multi);
showtablefooter();
showformfooter();
echo '<script type="text/JavaScript">ajaxget(\'forum.php?mod=ajax&action=getthreadtypes&fid=\' + $("toforum").value, \'threadtypes\')</script>';
echo '<iframe name="threadframe" style="display:none"></iframe>';
showtagfooter('div');
}
} else {
$tidsarray = isset($_GET['tids']) ? explode(',', $_GET['tids']) : $_GET['tidarray'];
$tidsadd = 'tid IN ('.dimplode($tidsarray).')';
if($optype == 'moveforum') {
if(!C::t('forum_forum')->check_forum_exists($_GET['toforum'])) {
cpmsg('threads_move_invalid', '', 'error');
}
C::t('forum_thread')->update($tidsarray, array('fid'=>$_GET['toforum'], 'typeid'=>$_GET['threadtypeid'], 'isgroup'=>0));
loadcache('posttableids');
$posttableids = $_G['cache']['posttableids'] ? $_G['cache']['posttableids'] : array('0');
foreach($posttableids as $id) {
C::t('forum_post')->update_by_tid($id, $tidsarray, array('fid' => $_GET['toforum']));
}
foreach(explode(',', $_GET['fids'].','.$_GET['toforum']) as $fid) {
updateforumcount(intval($fid));
}
$cpmsg = cplang('threads_succeed');
} elseif($optype == 'movesort') {
if($_GET['tosort'] != 0) {
if(!C::t('forum_threadtype')->fetch($_GET['tosort'])) {
cpmsg('threads_move_invalid', '', 'error');
}
}
C::t('forum_thread')->update($tidsarray, array('sortid'=>$_GET['tosort']));
$cpmsg = cplang('threads_succeed');
} elseif($optype == 'delete') {
require_once libfile('function/delete');
deletethread($tidsarray, !$_GET['donotupdatemember'], !$_GET['donotupdatemember']);
if($_G['setting']['globalstick']) {
updatecache('globalstick');
}
foreach(explode(',', $_GET['fids']) as $fid) {
updateforumcount(intval($fid));
}
$cpmsg = cplang('threads_succeed');
} elseif($optype == 'deleteattach') {
require_once libfile('function/delete');
deleteattach($tidsarray, 'tid');
C::t('forum_thread')->update($tidsarray, array('attachment'=>0));
loadcache('posttableids');
$posttableids = $_G['cache']['posttableids'] ? $_G['cache']['posttableids'] : array('0');
foreach($posttableids as $id) {
C::t('forum_post')->update_by_tid($id, $tidsarray, array('attachment' => '0'));
}
$cpmsg = cplang('threads_succeed');
} elseif($optype == 'stick') {
C::t('forum_thread')->update($tidsarray, array('displayorder'=>$_GET['stick_level']));
$my_act = $_GET['stick_level'] ? 'sticky' : 'update';
if($_G['setting']['globalstick']) {
updatecache('globalstick');
}
$cpmsg = cplang('threads_succeed');
} elseif($optype == 'adddigest') {
foreach(C::t('forum_thread')->fetch_all_by_tid($tidsarray) as $thread) {
if($_GET['digest_level'] == $thread['digest']) continue;
$extsql = array();
if($_GET['digest_level'] > 0 && $thread['digest'] == 0) {
$extsql = array('digestposts' => 1);
}
if($_GET['digest_level'] == 0 && $thread['digest'] > 0) {
$extsql = array('digestposts' => -1);
}
updatecreditbyaction('digest', $thread['authorid'], $extsql, '', $_GET['digest_level'] - $thread['digest'], 1, $thread['fid']);
}
C::t('forum_thread')->update($tidsarray, array('digest'=>$_GET['digest_level']));
$my_act = $_GET['digest_level'] ? 'digest' : 'update';
$cpmsg = cplang('threads_succeed');
} elseif($optype == 'addstatus') {
C::t('forum_thread')->update($tidsarray, array('closed'=>$_GET['status']));
$my_opt = $_GET['status'] ? 'close' : 'open';
$cpmsg = cplang('threads_succeed');
} elseif($operation == 'forumstick') {
shownav('topic', 'threads_forumstick');
loadcache(array('forums', 'grouptype'));
$forumstickthreads = C::t('common_setting')->fetch_setting('forumstickthreads', true);
if(!submitcheck('forumsticksubmit')) {
showsubmenu('threads_forumstick', array(
array('admin', 'threads&operation=forumstick', !$do),
array('add', 'threads&operation=forumstick&do=add', $do == 'add'),
));
showtips('threads_forumstick_tips');
if(!$do) {
showformheader('threads&operation=forumstick');
showtableheader('admin', 'fixpadding');
showsubtitle(array('', 'subject', 'threads_forumstick_forum', 'threads_forumstick_group', 'edit'));
if(is_array($forumstickthreads)) {
foreach($forumstickthreads as $k => $v) {
$forumnames = array();
foreach($v['forums'] as $forum_id){
if($_G['cache']['forums'][$forum_id]['name']) {
$forumnames[] = $name = $_G['cache']['forums'][$forum_id]['name'];
} elseif($_G['cache']['grouptype']['first'][$forum_id]['name']) {
$grouptypes[] = $name = $_G['cache']['grouptype']['first'][$forum_id]['name'];
} elseif($_G['cache']['grouptype']['second'][$forum_id]['name']) {
$grouptypes[] = $name = $_G['cache']['grouptype']['second'][$forum_id]['name'];
}
}
showtablerow('', array('class="td25"'), array(
"<input type=\"checkbox\" class=\"checkbox\" name=\"delete[]\" value=\"$k\">",
"<a href=\"forum.php?mod=viewthread&tid={$v['tid']}\" target=\"_blank\">{$v['subject']}</a>",
(is_array($forumnames) ? implode(', ', $forumnames) : (string)$forumnames),
(is_array($grouptypes) ? implode(', ', $grouptypes) : (string)$grouptypes),
"<a href=\"".ADMINSCRIPT."?action=threads&operation=forumstick&do=edit&id=$k\">{$lang['threads_forumstick_targets_change']}</a>",
));
}
}
showsubmit('forumsticksubmit', 'submit', 'del');
showtablefooter();
showformfooter();
} elseif($do == 'add') {
require_once libfile('function/forumlist');
showformheader('threads&operation=forumstick&do=add');
showtableheader('add', 'fixpadding');
showsetting('threads_forumstick_threadurl', 'forumstick_url', '', 'text');
$targetsselect = '<select name="forumsticktargets[]" size="10" multiple="multiple">'.forumselect(FALSE, 0, 0, TRUE).'</select>';
require_once libfile('function/group');
$groupselect = '<select name="forumsticktargets[]" size="10" multiple="multiple">'.get_groupselect(0, 0, 0).'</select>';
showsetting('threads_forumstick_targets', '', '', $targetsselect);
showsetting('threads_forumstick_targetgroups', '', '', $groupselect);
echo '<input type="hidden" value="add" name="do" />';
showsubmit('forumsticksubmit', 'submit');
showtablefooter();
showformfooter();
} elseif($do == 'edit') {
require_once libfile('function/forumlist');
showformheader("threads&operation=forumstick&do=edit&id={$_GET['id']}");
showtableheader('edit', 'fixpadding');
$targetsselect = '<select name="forumsticktargets[]" size="10" multiple="multiple">'.forumselect(FALSE, 0, 0, TRUE).'</select>';
require_once libfile('function/group');
$groupselect = '<select name="forumsticktargets[]" size="10" multiple="multiple">'.get_groupselect(0, 0, 0).'</select>';
foreach($forumstickthreads[$_GET['id']]['forums'] as $target) {
$targetsselect = preg_replace("/(\<option value=\"$target\")([^\>]*)(\>)/", "\\1 \\2 selected=\"selected\" \\3", $targetsselect);
$groupselect = preg_replace("/(\<option value=\"$target\")([^\>]*)(\>)/", "\\1 \\2 selected=\"selected\" \\3", $groupselect);
}
showsetting('threads_forumstick_targets', '', '', $targetsselect);
showsetting('threads_forumstick_targetgroups', '', '', $groupselect);
echo '<input type="hidden" value="edit" name="do" />';
echo "<input type=\"hidden\" value=\"{$_GET['id']}\" name=\"id\" />";
showsubmit('forumsticksubmit', 'submit');
showtablefooter();
showformfooter();
}
} else {
if(!$do) {
$do = 'del';
}
if($do == 'del') {
if(!empty($_GET['delete']) && is_array($_GET['delete'])) {
$del_tids = array();
foreach($_GET['delete'] as $del_tid){
unset($forumstickthreads[$del_tid]);
$del_tids[] = $del_tid;
}
if($del_tids) {
C::t('forum_thread')->update($del_tids, array('displayorder'=>0));
}
} else {
cpmsg('threads_forumstick_del_nochoice', '', 'error');
}
} elseif($do == 'add') {
$_GET['forumstick_url'] = rawurldecode($_GET['forumstick_url']);
if(preg_match('/tid=(\d+)/i', $_GET['forumstick_url'], $matches)) {
$forumstick_tid = $matches[1];
} elseif(is_array($_G['setting']['rewritestatus']) && in_array('forum_viewthread', $_G['setting']['rewritestatus']) && $_G['setting']['rewriterule']['forum_viewthread']) {
preg_match_all('/(\{tid\})|(\{page\})|(\{prevpage\})/', $_G['setting']['rewriterule']['forum_viewthread'], $matches);
$matches = $matches[0];
$tidpos = array_search('{tid}', $matches);
if($tidpos === false) {
cpmsg('threads_forumstick_url_invalid', "action=threads&operation=forumstick&do=add", 'error');
}
$tidpos = $tidpos + 1;
$rewriterule = str_replace(
array('\\', '(', ')', '[', ']', '.', '*', '?', '+'),
array('\\\\', '\(', '\)', '\[', '\]', '\.', '\*', '\?', '\+'),
$_G['setting']['rewriterule']['forum_viewthread']
);
$rewriterule = str_replace(array('{tid}', '{page}', '{prevpage}'), '(\d+?)', $rewriterule);
$rewriterule = str_replace(array('{', '}'), array('\{', '\}'), $rewriterule);
preg_match("/$rewriterule/i", $_GET['forumstick_url'], $match_result);
$forumstick_tid = $match_result[$tidpos];
} elseif(is_array($_G['setting']['rewritestatus']) && in_array('all_script', $_G['setting']['rewritestatus']) && $_G['setting']['rewriterule']['all_script']) {
preg_match_all('/(\{script\})|(\{param\})/', $_G['setting']['rewriterule']['all_script'], $matches);
$matches = $matches[0];
$parampos = array_search('{param}', $matches);
if($parampos === false) {
cpmsg('threads_forumstick_url_invalid', "action=threads&operation=forumstick&do=add", 'error');
}
$parampos = $parampos + 1;
$rewriterule = str_replace(
array('\\', '(', ')', '[', ']', '.', '*', '?', '+'),
array('\\\\', '\(', '\)', '\[', '\]', '\.', '\*', '\?', '\+'),
$_G['setting']['rewriterule']['all_script']
);
$rewriterule = str_replace(array('{script}', '{param}'), '([\w\d\-=]+?)', $rewriterule);
$rewriterule = str_replace(array('{', '}'), array('\{', '\}'), $rewriterule);
$rewriterule = "/\\/$rewriterule/i";
preg_match($rewriterule, $_GET['forumstick_url'], $match_result);
$param = $match_result[$parampos];
if(preg_match('/viewthread-tid-(\d+)/i', $param, $tidmatch)) {
$forumstick_tid = $tidmatch[1];
} else {
cpmsg('threads_forumstick_url_invalid', "action=threads&operation=forumstick&do=add", 'error');
}
} else {
cpmsg('threads_forumstick_url_invalid', "action=threads&operation=forumstick&do=add", 'error');
}
if(empty($_GET['forumsticktargets'])) {
cpmsg('threads_forumstick_targets_empty', "action=threads&operation=forumstick&do=add", 'error');
}
$stickthread = C::t('forum_thread')->fetch_thread($forumstick_tid);
$stickthread_tmp = array(
'subject' => $stickthread['subject'],
'tid' => $forumstick_tid,
'forums' => $_GET['forumsticktargets'],
);
$forumstickthreads[$forumstick_tid] = $stickthread_tmp;
C::t('forum_thread')->update($forumstick_tid, array('displayorder'=>4));
} elseif($do == 'edit') {
if(empty($_GET['forumsticktargets'])) {
cpmsg('threads_forumstick_targets_empty', "action=threads&operation=forumstick&do=edit&id={$_GET['id']}", 'error');
}
$forumstickthreads[$_GET['id']]['forums'] = $_GET['forumsticktargets'];
C::t('forum_thread')->update($forumstick_tid, array('displayorder'=>4));
}
C::t('common_setting')->update_setting('forumstickthreads', $forumstickthreads);
updatecache(array('forumstick', 'setting'));
cpmsg('threads_forumstick_'.$do.'_succeed', "action=threads&operation=forumstick", 'succeed');
}
}
$_GET['tids'] && deletethreadcaches($_GET['tids']);
$cpmsg = $cpmsg ? "alert('$cpmsg');" : '';
echo '<script type="text/JavaScript">'.$cpmsg.'if(parent.$(\'threadforum\')) parent.$(\'threadforum\').searchsubmit.click();</script>';
}
function delete_position($select) {
if(empty($select) || !is_array($select)) {
cpmsg('select_thread_empty', '', 'error');
}
$tids = dimplode($select);
C::t('forum_postposition')->delete_by_tid($select);
C::t('forum_thread')->update_status_by_tid($tids, '1111111111111110', '&');
}
?>

View File

@@ -0,0 +1,453 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_threadsplit.php 29236 2012-03-30 05:34:47Z chenmengshu $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
@set_time_limit(0);
define('IN_DEBUG', false);
define('MAX_THREADS_MOVE', 100);
cpheader();
$topicperpage = 50;
if(empty($operation)) {
$operation = 'manage';
}
$settings = C::t('common_setting')->fetch_all_setting(array('threadtableids', 'threadtable_info'), true);
$threadtableids = $settings['threadtableids'] ? $settings['threadtableids'] : array();
$threadtable_info = $settings['threadtable_info'] ? $settings['threadtable_info'] : array();
if($operation == 'manage') {
shownav('founder', 'nav_threadsplit');
if(!submitcheck('threadsplit_update_submit')) {
showsubmenu('nav_threadsplit', array(
array('nav_threadsplit_manage', 'threadsplit&operation=manage', 1),
array('nav_threadsplit_move', 'threadsplit&operation=move', 0),
));
showtips('threadsplit_manage_tips');
showformheader('threadsplit&operation=manage');
showtableheader('threadsplit_manage_table_orig');
$thread_table_orig = C::t('forum_thread')->gettablestatus();
showsubtitle(array('threadsplit_manage_tablename', 'threadsplit_manage_threadcount', 'threadsplit_manage_datalength', 'threadsplit_manage_indexlength', 'threadsplit_manage_table_createtime', 'threadsplit_manage_table_memo', ''));
showtablerow('', array(), array($thread_table_orig['Name'], $thread_table_orig['Rows'], $thread_table_orig['Data_length'], $thread_table_orig['Index_length'], $thread_table_orig['Create_time'], "<input type=\"text\" class=\"txt\" name=\"memo[0]\" value=\"{$threadtable_info[0]['memo']}\" />", ''));
showtableheader('threadsplit_manage_table_archive');
showsubtitle(array('threadsplit_manage_tablename', 'threadsplit_manage_dislayname', 'threadsplit_manage_threadcount', 'threadsplit_manage_datalength', 'threadsplit_manage_indexlength', 'threadsplit_manage_table_createtime', 'threadsplit_manage_table_memo', ''));
foreach($threadtableids as $tableid) {
if(!$tableid) {
continue;
}
$tablename = "forum_thread_$tableid";
$table_info = C::t('forum_thread')->gettablestatus($tableid);
showtablerow('', array(), array($table_info['Name'], "<input type=\"text\" class=\"txt\" name=\"displayname[$tableid]\" value=\"{$threadtable_info[$tableid]['displayname']}\" />", $table_info['Rows'], $table_info['Data_length'], $table_info['Index_length'], $table_info['Create_time'], "<input type=\"text\" class=\"txt\" name=\"memo[$tableid]\" value=\"{$threadtable_info[$tableid]['memo']}\" />", "<a href=\"?action=threadsplit&operation=droptable&tableid=$tableid\">{$lang['delete']}</a>"));
}
showsubmit('threadsplit_update_submit', 'threadsplit_manage_update', '', '<a href="?action=threadsplit&operation=addnewtable" style="border-style: solid; border-width: 1px;" class="btn">'.$lang['threadsplit_manage_table_add'].'</a>&nbsp;<a href="?action=threadsplit&operation=forumarchive" style="border-style: solid; border-width: 1px;" class="btn">'.$lang['threadsplit_manage_forum_update'].'</a>');
showtablefooter();
showformfooter();
} else {
$threadtable_info = array();
$_GET['memo'] = !empty($_GET['memo']) ? $_GET['memo'] : array();
$_GET['displayname'] = !empty($_GET['displayname']) ? $_GET['displayname'] : array();
foreach(array_keys($_GET['memo']) as $tableid) {
$threadtable_info[$tableid]['memo'] = $_GET['memo'][$tableid];
}
foreach(array_keys($_GET['displayname']) as $tableid) {
$threadtable_info[$tableid]['displayname'] = $_GET['displayname'][$tableid];
}
C::t('common_setting')->update_setting('threadtable_info', $threadtable_info);
savecache('threadtable_info', $threadtable_info);
update_threadtableids();
updatecache('setting');
cpmsg('threadsplit_manage_update_succeed', 'action=threadsplit&operation=manage', 'succeed');
}
} elseif($operation == 'addnewtable') {
if(empty($threadtableids)) {
$maxtableid = 0;
} else {
$maxtableid = max($threadtableids);
}
C::t('forum_thread')->create_table($maxtableid + 1);
update_threadtableids();
updatecache('setting');
cpmsg('threadsplit_table_create_succeed', 'action=threadsplit&operation=manage', 'succeed');
} elseif($operation == 'droptable') {
$tableid = intval($_GET['tableid']);
$tablename = "forum_thread_$tableid";
$table_info = C::t('forum_thread')->gettablestatus($tableid);
if(!$tableid || !$table_info) {
cpmsg('threadsplit_table_no_exists', 'action=threadsplit&operation=manage', 'error');
}
if($table_info['Rows'] > 0) {
cpmsg('threadsplit_drop_table_no_empty_error', 'action=threadsplit&operation=manage', 'error');
}
C::t('forum_thread')->drop_table($tableid);
unset($threadtable_info[$tableid]);
update_threadtableids();
C::t('common_setting')->update_setting('threadtable_info', $threadtable_info);
savecache('threadtable_info', $threadtable_info);
updatecache('setting');
cpmsg('threadsplit_drop_table_succeed', 'action=threadsplit&operation=manage', 'succeed');
} elseif($operation == 'move') {
if(!$_G['setting']['bbclosed'] && !IN_DEBUG) {
cpmsg('threadsplit_forum_must_be_closed', 'action=threadsplit&operation=manage', 'error');
}
require_once libfile('function/forumlist');
$tableselect = '<select name="sourcetableid">';
foreach($threadtableids as $tableid) {
$selected = $_GET['sourcetableid'] == $tableid ? 'selected="selected"' : '';
$tableselect .= "<option value=\"$tableid\" $selected>".C::t('forum_thread')->get_table_name($tableid)."</option>";
}
$tableselect .= '</select>';
$forumselect = '<select name="inforum"><option value="all">&nbsp;&nbsp;> '.$lang['all'].'</option>'.
'<option value="">&nbsp;</option>'.forumselect(FALSE, 0, 0, TRUE).'</select>';
if(isset($_GET['inforum'])) {
$forumselect = preg_replace("/(\<option value=\"{$_GET['inforum']}\")(\>)/", "\\1 selected=\"selected\" \\2", $forumselect);
}
$typeselect = $sortselect = '';
$query = C::t('forum_threadtype')->fetch_all_for_order();
foreach($query as $type) {
if($type['special']) {
$sortselect .= '<option value="'.$type['typeid'].'">&nbsp;&nbsp;> '.$type['name'].'</option>';
} else {
$typeselect .= '<option value="'.$type['typeid'].'">&nbsp;&nbsp;> '.$type['name'].'</option>';
}
}
if(isset($_GET['insort'])) {
$sortselect = preg_replace("/(\<option value=\"{$_GET['insort']}\")(\>)/", "\\1 selected=\"selected\" \\2", $sortselect);
}
if(isset($_GET['intype'])) {
$typeselect = preg_replace("/(\<option value=\"{$_GET['intype']}\")(\>)/", "\\1 selected=\"selected\" \\2", $typeselect);
}
$staticurl = STATICURL;
echo <<<EOT
<script type="text/javascript" src="{$staticurl}js/calendar.js"></script>
<script type="text/JavaScript">
function page(number) {
$('threadform').page.value=number;
$('threadform').threadsplit_move_search.click();
}
</script>
EOT;
shownav('founder', 'nav_threadsplit');
if(!submitcheck('threadsplit_move_submit') && !$_GET['moving']) {
showsubmenu('nav_threadsplit', array(
array('nav_threadsplit_manage', 'threadsplit&operation=manage', 0),
array('nav_threadsplit_move', 'threadsplit&operation=move', 1),
));
showtips('threadsplit_move_tips');
showtagheader('div', 'threadsearch', !submitcheck('threadsplit_move_search'));
showformheader('threadsplit&operation=move', '', 'threadform');
showhiddenfields(array('page' => $_GET['page']));
showtableheader();
showsetting('threads_search_detail', 'detail', $_GET['detail'], 'radio');
showsetting('threads_search_sourcetable', '', '', $tableselect);
showsetting('threads_search_forum', '', '', $forumselect);
showsetting('threadsplit_move_tidrange', array('tidmin', 'tidmax'), array($_GET['tidmin'], $_GET['tidmax']), 'range');
showsetting('threads_search_noreplyday', 'noreplydays', isset($_GET['noreplydays']) ? $_GET['noreplydays'] : 365, 'text');
showtagheader('tbody', 'advanceoption');
showsetting('threads_search_time', array('starttime', 'endtime'), array($_GET['starttime'], $_GET['endtime']), 'daterange');
showsetting('threads_search_type', '', '', '<select name="intype"><option value="all">&nbsp;&nbsp;> '.$lang['all'].'</option><option value="">&nbsp;</option><option value="0">&nbsp;&nbsp;> '.$lang['threads_search_type_none'].'</option>'.$typeselect.'</select>');
showsetting('threads_search_sort', '', '', '<select name="insort"><option value="all">&nbsp;&nbsp;> '.$lang['all'].'</option><option value="">&nbsp;</option><option value="0">&nbsp;&nbsp;> '.$lang['threads_search_type_none'].'</option>'.$sortselect.'</select>');
showsetting('threads_search_viewrange', array('viewsmore', 'viewsless'), array($_GET['viewsmore'], $_GET['viewsless']), 'range');
showsetting('threads_search_replyrange', array('repliesmore', 'repliesless'), array($_GET['repliesmore'], $_GET['repliesless']), 'range');
showsetting('threads_search_readpermmore', 'readpermmore', $_GET['readpermmore'], 'text');
showsetting('threads_search_pricemore', 'pricemore', $_GET['pricemore'], 'text');
showsetting('threads_search_keyword', 'keywords', $_GET['keywords'], 'text');
showsetting('threads_search_user', 'users', $_GET['users'], 'text');
showsetting('threads_search_type', array('specialthread', array(
array(0, cplang('unlimited'), array('showspecial' => 'none')),
array(1, cplang('threads_search_include_yes'), array('showspecial' => '')),
array(2, cplang('threads_search_include_no'), array('showspecial' => '')),
), TRUE), isset($_GET['specialthread']) ? $_GET['specialthread'] : 2, 'mradio');
showtablerow('id="showspecial" style="display:'.($_GET['specialthread'] || !isset($_GET['specialthread']) ? '' : 'none').'"', 'class="sub" colspan="2"', mcheckbox('special', array(
1 => cplang('thread_poll'),
2 => cplang('thread_trade'),
3 => cplang('thread_reward'),
4 => cplang('thread_activity'),
5 => cplang('thread_debate')
), $_GET['special'] ? $_GET['special'] : array(1,2,3,4,5)));
showsetting('threads_search_sticky', array('sticky', array(
array(0, cplang('unlimited')),
array(1, cplang('threads_search_include_yes')),
array(2, cplang('threads_search_include_no')),
), TRUE), isset($_GET['sticky']) ? $_GET['sticky'] : 2, 'mradio');
showsetting('threads_search_digest', array('digest', array(
array(0, cplang('unlimited')),
array(1, cplang('threads_search_include_yes')),
array(2, cplang('threads_search_include_no')),
), TRUE), isset($_GET['digest']) ? $_GET['digest'] : 2, 'mradio');
showsetting('threads_search_attach', array('attach', array(
array(0, cplang('unlimited')),
array(1, cplang('threads_search_include_yes')),
array(2, cplang('threads_search_include_no')),
), TRUE), isset($_GET['attach']) ? $_GET['attach'] : 0, 'mradio');
showsetting('threads_rate', array('rate', array(
array(0, cplang('unlimited')),
array(1, cplang('threads_search_include_yes')),
array(2, cplang('threads_search_include_no')),
), TRUE), isset($_GET['rate']) ? $_GET['rate'] : 2, 'mradio');
showsetting('threads_highlight', array('highlight', array(
array(0, cplang('unlimited')),
array(1, cplang('threads_search_include_yes')),
array(2, cplang('threads_search_include_no')),
), TRUE), isset($_GET['highlight']) ? $_GET['highlight'] : 2, 'mradio');
showtagfooter('tbody');
showsubmit('threadsplit_move_search', 'submit', '', 'more_options');
showtablefooter();
showformfooter();
showtagfooter('div');
if(submitcheck('threadsplit_move_search')) {
$searchurladd = array();
$conditions = array(
'sourcetableid' => $_GET['sourcetableid'],
'inforum' => $_GET['inforum'],
'tidmin' => $_GET['tidmin'],
'tidmax' => $_GET['tidmax'],
'starttime' => $_GET['starttime'],
'endtime' => $_GET['endtime'],
'keywords' => $_GET['keywords'],
'users' => $_GET['users'],
'intype' => $_GET['intype'],
'insort' => $_GET['insort'],
'viewsmore' => $_GET['viewsmore'],
'viewsless' => $_GET['viewsless'],
'repliesmore' => $_GET['repliesmore'],
'repliesless' => $_GET['repliesless'],
'readpermmore' => $_GET['readpermmore'],
'pricemore' => $_GET['pricemore'],
'noreplydays' => $_GET['noreplydays'],
'specialthread' => $_GET['specialthread'],
'special' => $_GET['special'],
'sticky' => $_GET['sticky'],
'digest' => $_GET['digest'],
'attach' => $_GET['attach'],
'rate' => $_GET['rate'],
'highlight' => $_GET['highlight'],
);
if($_GET['detail']) {
$pagetmp = $page;
$threadlist = threadsplit_search_threads($conditions, ($pagetmp - 1) * $topicperpage, $topicperpage);
} else {
$threadtomove = threadsplit_search_threads($conditions, null, null, TRUE);
}
$fids = array();
$tids = '0';
if($_GET['detail']) {
$threads = '';
foreach($threadlist as $thread) {
$fids[] = $thread['fid'];
$thread['lastpost'] = dgmdate($thread['lastpost']);
$threads .= showtablerow('', array('class="td25"', '', '', '', '', ''), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"tidarray[]\" value=\"{$thread['tid']}\" checked=\"checked\" />",
"<a href=\"forum.php?mod=viewthread&tid={$thread['tid']}\" target=\"_blank\">{$thread['subject']}</a>",
"<a href=\"forum.php?mod=forumdisplay&fid={$thread['fid']}\" target=\"_blank\">{$_G['cache']['forums'][$thread['fid']]['name']}</a>",
"<a href=\"home.php?mod=space&uid={$thread['authorid']}\" target=\"_blank\">{$thread['author']}</a>",
$thread['replies'],
$thread['views']
), TRUE);
}
$multi = multi($threadcount, $topicperpage, $page, ADMINSCRIPT."?action=threadsplit&amp;operation=move");
$multi = preg_replace("/href=\"".ADMINSCRIPT."\?action=threadsplit&amp;operation=move&amp;page=(\d+)\"/", "href=\"javascript:page(\\1)\"", $multi);
$multi = str_replace("window.location='".ADMINSCRIPT."?action=threadsplit&amp;operation=move&amp;page='+this.value", "page(this.value)", $multi);
} else {
foreach($threadlist as $thread) {
$fids[] = $thread['fid'];
$tids .= ','.$thread['tid'];
}
$multi = '';
}
$fids = implode(',', array_unique($fids));
showtagheader('div', 'threadlist', TRUE);
showformheader("threadsplit&operation=move&sourcetableid={$_GET['sourcetableid']}&threadtomove=".$threadtomove);
showhiddenfields($_GET['detail'] ? array('fids' => $fids) : array('conditions' => serialize($conditions)));
showtableheader(cplang('threads_result').' '.$threadcount.' <a href="###" onclick="$(\'threadlist\').style.display=\'none\';$(\'threadsearch\').style.display=\'\';" class="act lightlink normal">'.cplang('research').'</a>', 'nobottom');
showsubtitle(array('', 'threadsplit_move_to', 'threadsplit_manage_threadcount', 'threadsplit_manage_datalength', 'threadsplit_manage_indexlength', 'threadsplit_manage_table_createtime', 'threadsplit_manage_table_memo'));
if(!$threadcount) {
showtablerow('', 'colspan="3"', cplang('threads_thread_nonexistence'));
} else {
$threadtable_orig = C::t('forum_thread')->gettablestatus();
$tableid = 0;
showtablerow('', array('class="td25"'), array("<input class=\"radio\" ".($_GET['sourcetableid'] == '0' ? 'disabled="disabled"' : '')." type=\"radio\" name=\"tableid\" value=\"0\" />", $threadtable_orig['Name'], $threadtable_orig['Rows'], $threadtable_orig['Data_length'], $threadtable_orig['Index_length'], $threadtable_orig['Create_time'], $threadtable_info[0]['memo']));
foreach($threadtableids as $tableid) {
if($tableid) {
$tablename = "forum_thread_$tableid";
$tablestatus = C::t('forum_thread')->gettablestatus($tableid);
showtablerow('', array(), array("<input class=\"radio\" ".($_GET['sourcetableid'] == $tableid ? 'disabled="disabled"' : '')." type=\"radio\" name=\"tableid\" value=\"$tableid\" />", $tablestatus['Name'].($threadtable_info[$tableid]['displayname'] ? " (".dhtmlspecialchars($threadtable_info[$tableid]['displayname']).")" : ''), $tablestatus['Rows'], $tablestatus['Data_length'], $tablestatus['Index_length'], $tablestatus['Create_time'], $threadtable_info[$tableid]['memo']));
}
}
if($_GET['detail']) {
showtablefooter();
showtableheader('threads_list', 'notop');
showsubtitle(array('', 'subject', 'forum', 'author', 'threads_replies', 'threads_views'));
echo $threads;
}
}
showtablefooter();
if($threadcount) {
showtableheader('');
showsetting('threadsplit_move_threads_per_time', 'threads_per_time', 200, 'text');
showtablefooter();
showsubmit('threadsplit_move_submit', 'submit', $_GET['detail'] ? '<input name="chkall" id="chkall" type="checkbox" class="checkbox" checked="checked" onclick="checkAll(\'prefix\', this.form, \'tidarray\', \'chkall\')" /><label for="chkall">'.cplang('select_all').'</label>' : '', '', $multi);
}
showformfooter();
showtagfooter('div');
}
} else {
if(!isset($_GET['tableid'])) {
cpmsg('threadsplit_no_target_table', '', 'error');
}
$continue = false;
$tidsarray = !empty($_GET['tidarray']) ? $_GET['tidarray'] : array();
if(empty($tidsarray) && !empty($_GET['conditions'])) {
$conditions = dunserialize($_GET['conditions']);
$max_threads_move = intval($_GET['threads_per_time']) ? intval($_GET['threads_per_time']) : MAX_THREADS_MOVE;
$threadlist = threadsplit_search_threads($conditions, 0, $max_threads_move);
foreach($threadlist as $thread) {
$tidsarray[] = $thread['tid'];
$continue = TRUE;
}
}
if(empty($tidsarray[0])) {
array_shift($tidsarray);
}
if(!empty($tidsarray)) {
$continue = true;
}
if($_GET['tableid'] == $_GET['sourcetableid']) {
cpmsg('threadsplit_move_source_target_no_same', 'action=threadsplit&operation=move', 'error');
}
if($continue) {
$threadtable_target = $_GET['tableid'] ? $_GET['tableid'] : 0;
$threadtable_source = $_GET['sourcetableid'] ? $_GET['sourcetableid'] : 0;
C::t('forum_thread')->move_thread_by_tid($tidsarray, $threadtable_source, $threadtable_target);
C::t('forum_forumrecommend')->delete($tidsarray);
$completed = intval($_GET['completed']) + count($tidsarray);
$nextstep = $step + 1;
cpmsg('threadsplit_moving', "action=threadsplit&operation=move&{$_GET['urladd']}&tableid={$_GET['tableid']}&completed=$completed&sourcetableid={$_GET['sourcetableid']}&threadtomove={$_GET['threadtomove']}&step=$nextstep&moving=1", 'loadingform', array('count' => $completed, 'total' => intval($_GET['threadtomove']), 'threads_per_time' => $_GET['threads_per_time'], 'conditions' => dhtmlspecialchars($_GET['conditions'])));
}
cpmsg('threadsplit_move_succeed', "action=threadsplit&operation=forumarchive", 'succeed');
}
} elseif($operation == 'forumarchive') {
$step = intval($_GET['step']);
$continue = false;
if(isset($threadtableids[$step])) {
$continue = true;
}
if($continue) {
$threadtableid = $threadtableids[$step];
C::t('forum_forum_threadtable')->update_by_threadtableid($threadtableid, array('threads' => '0', 'posts' => '0'));
$threadtable = $threadtableid ? $threadtableid : 0;
foreach(C::t('forum_thread')->count_group_by_fid($threadtable) as $row) {
C::t('forum_forum_threadtable')->insert(array(
'fid' => $row['fid'],
'threadtableid' => $threadtableid,
'threads' => $row['threads'],
'posts' => $row['posts'],
), false, true);
if($row['threads'] > 0) {
C::t('forum_forum')->update($row['fid'], array('archive' => '1'));
}
}
$nextstep = $step + 1;
cpmsg('threadsplit_manage_forum_processing', "action=threadsplit&operation=forumarchive&step=$nextstep", 'loading', array('table' => DB::table($threadtable)));
} else {
C::t('forum_forum_threadtable')->delete_none_threads();
$fids = array('0');
foreach(C::t('forum_forum_threadtable')->range() as $row) {
$fids[] = $row['fid'];
}
C::t('forum_forum')->update_archive($fids);
cpmsg('threadsplit_manage_forum_complete', 'action=threadsplit&operation=manage', 'succeed');
}
}
function threadsplit_search_threads($conditions, $offset = null, $length = null, $onlycount = FALSE) {
global $_G, $searchurladd, $page, $threadcount;
if($conditions) {
$conditions = daddslashes($conditions);
}
$sql = '';
$threadlist = array();
$sql = C::t('forum_thread')->search_condition($conditions, 't');
$searchurladd = C::t('forum_thread')->get_url_param();
if($sql || $conditions['sourcetableid']) {
$conditions['isgroup'] = 0;
$tableid = $conditions['sourcetableid'] ? $conditions['sourcetableid'] : 0;
$threadcount = C::t('forum_thread')->count_search($conditions, $tableid, 't');
if(isset($offset) && isset($length)) {
$sql .= " LIMIT $offset, $length";
}
if($onlycount) {
return $threadcount;
}
if($threadcount) {
foreach(C::t('forum_thread')->fetch_all_search($conditions, $tableid, $offset, $length) as $thread) {
$thread['lastpost'] = dgmdate($thread['lastpost']);
$threadlist[] = $thread;
}
}
}
return $threadlist;
}
function update_threadtableids() {
$threadtableids = C::t('forum_thread')->fetch_thread_table_ids();
C::t('common_setting')->update_setting('threadtableids', $threadtableids);
savecache('threadtableids', $threadtableids);
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,154 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_tools.php 33301 2013-05-23 03:10:20Z andyzheng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
if($operation == 'updatecache') {
$step = max(1, intval($_GET['step']));
shownav('tools', 'nav_updatecache');
showsubmenusteps('nav_updatecache', array(
array('nav_updatecache_confirm', $step == 1),
array('nav_updatecache_verify', $step == 2),
array('nav_updatecache_completed', $step == 3)
));
showtips('tools_updatecache_tips');
if($step == 1) {
cpmsg("<input type=\"checkbox\" name=\"type[]\" value=\"data\" id=\"datacache\" class=\"checkbox\" checked /><label for=\"datacache\">".$lang['tools_updatecache_data']."</label><input type=\"checkbox\" name=\"type[]\" value=\"tpl\" id=\"tplcache\" class=\"checkbox\" checked /><label for=\"tplcache\">".$lang['tools_updatecache_tpl']."</label><input type=\"checkbox\" name=\"type[]\" value=\"blockclass\" id=\"blockclasscache\" class=\"checkbox\" /><label for=\"blockclasscache\">".$lang['tools_updatecache_blockclass']."</label><input type=\"checkbox\" name=\"type[]\" value=\"csscache\" id=\"csscache\" class=\"checkbox\" /><label for=\"csscache\">".$lang['styles_csscache_update']."</label><input type=\"checkbox\" name=\"type[]\" value=\"searchindex\" id=\"searchindex\" class=\"checkbox\" /><label for=\"searchindex\">".$lang['tools_updatecache_searchindex'].'</label>', 'action=tools&operation=updatecache&step=2', 'form', '', FALSE);
} elseif($step == 2) {
$type = implode('_', (array)$_GET['type']);
cpmsg(cplang('tools_updatecache_waiting'), "action=tools&operation=updatecache&step=3&type=$type", 'loading', '', FALSE);
} elseif($step == 3) {
$type = explode('_', $_GET['type']);
if(in_array('data', $type)) {
updatecache();
require_once libfile('function/group');
$groupindex = array();
$groupindex['randgroupdata'] = $randgroupdata = grouplist('lastupdate', array('ff.membernum', 'ff.icon'), 80);
$groupindex['topgrouplist'] = $topgrouplist = grouplist('activity', array('f.commoncredits', 'ff.membernum', 'ff.icon'), 10);
$groupindex['updateline'] = TIMESTAMP;
$groupdata = C::t('forum_forum')->fetch_group_counter();
$groupindex['todayposts'] = $groupdata['todayposts'];
$groupindex['groupnum'] = $groupdata['groupnum'];
savecache('groupindex', $groupindex);
C::t('forum_groupfield')->truncate();
savecache('forum_guide', array());
if($_G['setting']['grid']['showgrid']) {
savecache('grids', array());
}
}
if((in_array('tpl', $type) && $_G['config']['output']['tplrefresh']) || in_array('csscache', $type)) {
cleartemplatecache();
}
if(in_array('blockclass', $type)) {
include_once libfile('function/block');
blockclass_cache();
}
if(in_array('csscache', $type)) {
updatecache(array('setting', 'styles'));
loadcache('style_default', true);
updatecache('updatediytemplate');
}
if(in_array('searchindex', $type)) {
require_once libfile('function/searchindex');
searchindex_cache();
}
cpmsg('update_cache_succeed', '', 'succeed', '', FALSE);
}
} elseif($operation == 'fileperms') {
$step = max(1, intval($_GET['step']));
shownav('tools', 'nav_fileperms');
showsubmenusteps('nav_fileperms', array(
array('nav_fileperms_confirm', $step == 1),
array('nav_fileperms_verify', $step == 2),
array('nav_fileperms_completed', $step == 3)
));
if($step == 1) {
cpmsg(cplang('fileperms_check_note'), 'action=tools&operation=fileperms&step=2', 'button', '', FALSE);
} elseif($step == 2) {
cpmsg(cplang('fileperms_check_waiting'), 'action=tools&operation=fileperms&step=3', 'loading', '', FALSE);
} elseif($step == 3) {
showtips('fileperms_tips');
$entryarray = array(
'data',
'data/attachment',
'data/attachment/album',
'data/attachment/category',
'data/attachment/common',
'data/attachment/forum',
'data/attachment/group',
'data/attachment/portal',
'data/attachment/profile',
'data/attachment/swfupload',
'data/attachment/temp',
'data/cache',
'data/log',
'data/template',
'data/threadcache',
'data/diy'
);
$result = '';
foreach($entryarray as $entry) {
$fullentry = DISCUZ_ROOT.'./'.$entry;
if(!is_dir($fullentry) && !file_exists($fullentry)) {
continue;
} else {
if(!dir_writeable($fullentry)) {
$result .= '<li class="error">'.(is_dir($fullentry) ? $lang['dir'] : $lang['file'])." ./$entry {$lang['fileperms_unwritable']}</li>";
}
}
}
$result = $result ? $result : '<li>'.$lang['fileperms_check_ok'].'</li>';
echo '<div class="colorbox"><ul class="fileperms">'.$result.'</ul></div>';
}
}
function jsinsertunit() {
?>
<script type="text/JavaScript">
function isUndefined(variable) {
return typeof variable == 'undefined' ? true : false;
}
function insertunit(text, obj) {
if(!obj) {
obj = 'jstemplate';
}
$(obj).focus();
if(!isUndefined($(obj).selectionStart)) {
var opn = $(obj).selectionStart + 0;
$(obj).value = $(obj).value.substr(0, $(obj).selectionStart) + text + $(obj).value.substr($(obj).selectionEnd);
} else if(document.selection && document.selection.createRange) {
var sel = document.selection.createRange();
sel.text = text.replace(/\r?\n/g, '\r\n');
sel.moveStart('character', -strlen(text));
} else {
$(obj).value += text;
}
}
</script>
<?php
}
?>

View File

@@ -0,0 +1,195 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_topic.php 32657 2013-02-28 06:11:29Z zhangguosheng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
require_once libfile('function/portalcp');
cpheader();
$operation = 'list';
shownav('portal', 'topic');
$searchctrl = '<span style="float: right; padding-right: 40px;">'
.'<a href="javascript:;" onclick="$(\'tb_search\').style.display=\'\';$(\'a_search_show\').style.display=\'none\';$(\'a_search_hide\').style.display=\'\';" id="a_search_show" style="display:none">'.cplang('show_search').'</a>'
.'<a href="javascript:;" onclick="$(\'tb_search\').style.display=\'none\';$(\'a_search_show\').style.display=\'\';$(\'a_search_hide\').style.display=\'none\';" id="a_search_hide">'.cplang('hide_search').'</a>'
.'</span>';
showsubmenu('topic', array(
array('list', 'topic', 1),
array('topic_add', 'portal.php?mod=portalcp&ac=topic', 0, 1, 1)
), $searchctrl);
if(submitcheck('opsubmit')) {
if(empty($_POST['ids'])) {
cpmsg('topic_choose_at_least_one_topic', 'action=topic', 'error');
}
if($_POST['optype'] == 'delete') {
require_once libfile('function/delete');
deleteportaltopic($_POST['ids']);
cpmsg('topic_delete_succeed', 'action=topic', 'succeed');
} elseif($_POST['optype'] == 'close') {
C::t('portal_topic')->update($_POST['ids'], array('closed' => 1));
cpmsg('topic_close_succeed', 'action=topic', 'succeed');
} elseif($_POST['optype'] == 'open') {
C::t('portal_topic')->update($_POST['ids'], array('closed' => 0));
cpmsg('topic_open_succeed', 'action=topic', 'succeed');
} else {
cpmsg('topic_choose_at_least_one_optype', 'action=topic', 'error');
}
} else {
$intkeys = array('topicid', 'uid', 'closed');
$strkeys = array();
$randkeys = array();
$likekeys = array('title', 'username');
$results = getwheres($intkeys, $strkeys, $randkeys, $likekeys);
foreach($likekeys as $k) {
$_GET[$k] = dhtmlspecialchars($_GET[$k]);
}
$wherearr = $results['wherearr'];
$mpurl = ADMINSCRIPT.'?action=topic';
$mpurl .= '&'.implode('&', $results['urls']);
if(strlen($_GET['closed'])) {
$statusarr[$_GET['closed']] = ' selected';
}
$orders = getorders(array('dateline'), 'topicid');
$ordersql = $orders['sql'];
if($orders['urls']) $mpurl .= '&'.implode('&', $orders['urls']);
$orderby = array($_GET['orderby']=>' selected');
$ordersc = array($_GET['ordersc']=>' selected');
$perpage = empty($_GET['perpage'])?0:intval($_GET['perpage']);
if(!in_array($perpage, array(10,20,50,100))) $perpage = 10;
$searchlang = array();
$keys = array('search', 'likesupport', 'resultsort', 'defaultsort', 'orderdesc', 'orderasc', 'perpage_10', 'perpage_20', 'perpage_50', 'perpage_100',
'topic_dateline', 'topic_id', 'topic_title', 'topic_uid', 'topic_username', 'topic_closed', 'nolimit', 'no', 'yes');
foreach ($keys as $key) {
$searchlang[$key] = cplang($key);
}
$adminscript = ADMINSCRIPT;
$staticurl = STATICURL;
echo <<<SEARCH
<form method="get" autocomplete="off" action="$adminscript" id="tb_search">
<table cellspacing="3" cellpadding="3" class="tb tb2">
<tr>
<th>{$searchlang['topic_id']}</th><td><input type="text" class="txt" name="topicid" value="{$_GET['topicid']}"></td>
<th>{$searchlang['topic_title']}*</th><td><input type="text" class="txt" name="title" value="{$_GET['title']}">*{$searchlang['likesupport']}</td>
</tr>
<tr>
<th>{$searchlang['topic_uid']}</th><td><input type="text" class="txt" name="uid" value="{$_GET['uid']}"></td>
<th>{$searchlang['topic_username']}*</th><td><input type="text" class="txt" name="username" value="{$_GET['username']}"></td>
</tr>
<tr>
<th>{$searchlang['topic_closed']}</th>
<td colspan="3">
<select name="closed">
<option value="">{$searchlang['nolimit']}</option>
<option value="0" {$statusarr[0]}>{$searchlang['no']}</option>
<option value="1" {$statusarr[1]}>{$searchlang['yes']}</option>
</select>
</td>
</tr>
<tr>
<th>{$searchlang['resultsort']}</th>
<td colspan="3">
<select name="orderby">
<option value="">{$searchlang['defaultsort']}</option>
<option value="dateline"{$orderby['dateline']}>{$searchlang['topic_dateline']}</option>
</select>
<select name="ordersc">
<option value="desc"{$ordersc['desc']}>{$searchlang['orderdesc']}</option>
<option value="asc"{$ordersc['asc']}>{$searchlang['orderasc']}</option>
</select>
<select name="perpage">
<option value="10"{$perpages[10]}>{$searchlang['perpage_10']}</option>
<option value="20"{$perpages[20]}>{$searchlang['perpage_20']}</option>
<option value="50"{$perpages[50]}>{$searchlang['perpage_50']}</option>
<option value="100"{$perpages[100]}>{$searchlang['perpage_100']}</option>
</select>
<input type="hidden" name="action" value="topic">
<input type="submit" name="searchsubmit" value="{$searchlang['search']}" class="btn">
</td>
</tr>
</table>
</form>
<script src="{$staticurl}js/makehtml.js?1" type="text/javascript"></script>
SEARCH;
$start = ($page-1)*$perpage;
$mpurl .= '&perpage='.$perpage;
$perpages = array($perpage => ' selected');
$maketopichtml = !empty($_G['setting']['makehtml']['flag']) && !empty($_G['setting']['makehtml']['topichtmldir']);
$subtitle = array('', 'topic_title', 'topic_domain', 'topic_name', 'topic_creator', 'topic_dateline');
if($maketopichtml) {
$subtitle[] = 'HTML';
}
$subtitle[] = 'operation';
showformheader('topic');
showtableheader('topic_list');
showsubtitle($subtitle);
$multipage = '';
$count = C::t('portal_topic')->count_by_search_where($wherearr);
if($count) {
require_once libfile('function/portal');
$repairs = array();
foreach(C::t('portal_topic')->fetch_all_by_search_where($wherearr, $ordersql, $start, $perpage) as $topicid => $value) {
if($maketopichtml && $value['htmlmade'] && ($htmlname = fetch_topic_url($value)) && !file_exists(DISCUZ_ROOT.'./'.$htmlname)) {
$value['htmlmade'] = 0;
$repairs[$topicid] = $topicid;
}
$tablerow = array(
"<input type=\"checkbox\" class=\"checkbox\" name=\"ids[]\" value=\"$topicid\">",
($value['htmlmade'] ? "[<a href='$htmlname' target='_blank'>HTML</a>]" : '')
."<a href=\"portal.php?mod=topic&topicid=$topicid\" target=\"_blank\">".$value['title']."</a>"
.($value['closed'] ? ' ['.cplang('topic_closed_yes').']' : ''),
$value['domain'] && !empty($_G['setting']['domain']['root']['topic']) ? $_G['scheme'].'://'.$value['domain'].'.'.$_G['setting']['domain']['root']['topic'] : '',
$value['name'],
"<a href=\"home.php?mod=space&uid={$value['uid']}&do=profile\" target=\"_blank\">{$value['username']}</a>",
dgmdate($value['dateline']),
);
if($maketopichtml) {
$tablerow[] = "<span id='mkhtml_{$value['topicid']}' style='color:".($value['htmlmade'] ? "blue;'>".cplang('setting_functions_makehtml_made') : "red;'>".cplang('setting_functions_makehtml_dismake'))."</span>";
}
$tablerow[] = ($maketopichtml ? ($maketopichtml && !$value['closed'] ? "<a href='javascript:void(0);' onclick=\"make_html('portal.php?mod=topic&topicid={$value['topicid']}', $('mkhtml_{$value['topicid']}'))\">".cplang('setting_functions_makehtml_make')."</a>" : cplang('setting_functions_makehtml_make_has_closed')) : '')
." <a href=\"portal.php?mod=portalcp&ac=topic&topicid=$topicid\" target=\"_blank\">".cplang('topic_edit')."</a>&nbsp;".
"<a href=\"portal.php?mod=topic&topicid=$topicid&diy=yes\" target=\"_blank\">DIY</a>".
'&nbsp;<a href="'.ADMINSCRIPT.'?action=diytemplate&operation=perm&targettplname=portal/portal_topic_content_'.$value['topicid'].'&tpldirectory='.getdiydirectory($value['primaltplname']).'">'.cplang('topic_perm').'</a>';
showtablerow('', array('class="td25"', 'class=""', 'class="td28"'), $tablerow);
}
$multipage = multi($count, $perpage, $page, $mpurl);
if($repairs) {
C::t('portal_topic')->repair_htmlmade($repairs);
}
}
$ops = cplang('operation').': '
."<input type='radio' class='radio' name='optype' value='open' id='op_close' /><label for='op_close'>".cplang('topic_closed_no')."</label>&nbsp;&nbsp;"
."<input type='radio' class='radio' name='optype' value='close' id='op_open' /><label for='op_open'>".cplang('topic_closed_yes')."</label>&nbsp;&nbsp;"
."<input type='radio' class='radio' name='optype' value='delete' id='op_delete' /><label for='op_delete'>".cplang('delete')."</label>&nbsp;&nbsp;";
showsubmit('', '', '', '<input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'ids\')" /><label for="chkall">'.cplang('select_all').'</label>&nbsp;&nbsp;'.$ops.'<input type="submit" class="btn" name="opsubmit" value="'.cplang('submit').'" />', $multipage);
showtablefooter();
showformfooter();
}
?>

View File

@@ -0,0 +1,71 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_tradelog.php 27054 2011-12-31 06:04:21Z monkey $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
require_once libfile('function/trade');
$language = lang('forum/misc');
cpheader();
$ppp = 20;
$start_limit = ($page - 1) * $ppp;
$filter = !isset($_GET['filter']) ? -1 : $_GET['filter'];
$count = C::t('forum_tradelog')->count_by_status($filter);
$multipage = multi($count['num'], $ppp, $page, ADMINSCRIPT."?action=tradelog&filter=$filter");
shownav('extended', 'nav_ec');
showsubmenu('nav_ec', array(
array('nav_ec_config', 'setting&operation=ec&mod=forum', 0),
array('nav_ec_qpay', 'ec&operation=qpay&mod=forum', 0),
array('nav_ec_wechat', 'ec&operation=wechat&mod=forum', 0),
array('nav_ec_alipay', 'ec&operation=alipay&mod=forum', 0),
array('nav_ec_credit', 'ec&operation=credit&mod=forum', 0),
array('nav_ec_orders', 'ec&operation=orders&mod=forum', 0),
array('nav_ec_tradelog', 'tradelog&mod=forum', 1),
array('nav_ec_inviteorders', 'ec&operation=inviteorders', 0),
array('nav_ec_paymentorders', 'ec&operation=paymentorders', 0),
array('nav_ec_transferorders', 'ec&operation=transferorders', 0)
));
showtableheader();
showsubtitle(array('tradelog_trade_no', 'tradelog_trade_name', 'tradelog_buyer', 'tradelog_seller', 'tradelog_money', $lang['tradelog_credit']."({$_G['setting']['extcredits'][$_G['setting']['creditstransextra'][5]]['title']})", 'tradelog_fee', 'tradelog_order_status'));
foreach(C::t('forum_tradelog')->fetch_all_by_status($filter, $start_limit, $ppp) as $tradelog) {
$tradelog['status'] = trade_getstatus($tradelog['status']);
$tradelog['lastupdate'] = dgmdate($tradelog['lastupdate']);
$tradelog['tradeno'] = $tradelog['offline'] ? $lang['tradelog_offline'] : $tradelog['tradeno'];
showtablerow('', '', array(
$tradelog['tradeno'],
'<a target="_blank" href="forum.php?mod=viewthread&do=tradeinfo&tid='.$tradelog['tid'].'&pid='.$tradelog['pid'].'">'.$tradelog['subject'].'</a>',
'<a target="_blank" href="home.php?mod=space&uid='.$tradelog['buyerid'].'">'.$tradelog['buyer'].'</a>',
'<a target="_blank" href="home.php?mod=space&uid='.$tradelog['sellerid'].'">'.$tradelog['seller'].'</a>',
$tradelog['price'],
$tradelog['credit'],
$tradelog['tax'],
'<a target="_blank" href="forum.php?mod=trade&orderid='.$tradelog['orderid'].'&tid='.$tradelog['tid'].'&modthreadkey='.modauthkey($tradelog['tid']).'">'.$tradelog['status'].'<br />'.$tradelog['lastupdate']
));
}
$statusselect = $lang['tradelog_order_status'].': <select onchange="location.href=\''.ADMINSCRIPT.'?action=tradelog&filter=\' + this.value"><option value="-1">'.$lang['tradelog_all_order'].'</option>';
$statuss = trade_getstatus(0, -1);
foreach($statuss as $key => $value) {
$statusselect .= "<option value=\"$key\" ".($filter == $key ? 'selected' : '').">$value</option>";
}
$statusselect .= '</select>';
showsubmit('', '', "{$lang['tradelog_order_count']} {$count['num']}, {$lang['tradelog_trade_total']} ".intval($count['pricesum'])." {$lang['rmb_yuan']}, {$lang['tradelog_trade_totalcredit']} {$_G['setting']['extcredits'][$_G['setting']['creditstransextra'][5]]['title']} {$count['creditsum']} {$_G['setting']['extcredits'][$_G['setting']['creditstransextra'][5]]['unit']}, {$lang['tradelog_fee_total']} ".intval($count['taxsum'])." {$lang['rmb_yuan']}", '', $multipage.$statusselect);
showtablefooter();
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,107 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_usertag.php 29214 2012-03-29 07:22:01Z monkey $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
shownav('user', 'usertag');
$lpp = empty($_GET['lpp']) ? 20 : $_GET['lpp'];
$start = ($page - 1) * $lpp;
if($operation == '') {
if($_GET['srchname']) {
$addurl = '&srchname='.$_GET['srchname'];
}
if(submitcheck('submit') && $_GET['tagids']) {
$class_tag = new tag();
if($_GET['operate_type'] == 'delete') {
$class_tag->delete_tag($_GET['tagids'], 'uid');
cpmsg('usertag_delete_succeed', 'action=usertag'.$addurl, 'succeed');
} elseif($_GET['operate_type'] == 'merge' && $_GET['newtag']) {
$data = $class_tag->merge_tag($_GET['tagids'], $_GET['newtag'], 'uid');
if($data != 'succeed') {
cpmsg($data);
}
cpmsg('usertag_merge_succeed', 'action=usertag'.$addurl, 'succeed');
}
}
showsubmenu('usertag', array(
array('usertag_list', 'usertag', 1),
array('usertag_add', 'usertag&operation=add', 0),
));
showboxheader();
echo '<form method="post">'. $lang['keywords'].': <input type="text" name="srchname" value="'.$_GET['srchname'].'" /> &nbsp;<input type="submit" name="usertag_search" value="'.$lang['search'].'" class="btn" /> </form>';
showboxfooter();
showformheader('usertag'.$addurl);
$tagcount = C::t('common_tag')->fetch_all_by_status(3, $_GET['srchname'], 0, 0, 1);
showtableheader(cplang('usertag_count', array('tagcount' => $tagcount)));
if($tagcount) {
showsubtitle(array('', 'tagname', 'usernum', 'operation'));
$query = C::t('common_tag')->fetch_all_by_status(3, $_GET['srchname'], $start, $lpp);
foreach($query as $row) {
showtablerow('', array('class="td25"', 'width=100', ''), array(
'<input type="checkbox" class="checkbox" name="tagids[]" value="'.$row['tagid'].'" />',
$row['tagname'],
'<span id="tag_'.$row['tagid'].'"><a href="javascript:;" onclick="ajaxget(\'misc.php?mod=tag&type=countitem&id='.$row['tagid'].'\', \'tag_'.$row['tagid'].'\');return false;">'.$lang['view'].'</a></span>',
'<a href="'.ADMINSCRIPT.'?action=members&operation=search&submit=1&tagid='.$row['tagid'].'" target="_blank">'.cplang('view').$lang['usertag_user'].'</a>&nbsp;|&nbsp;<a href="'.ADMINSCRIPT.'?action=members&operation=newsletter&tagid='.$row['tagid'].'&submit=1" target="_blank">'.$lang['usertag_send_notice'].'</a>'
));
}
$multipage = multi($tagcount, $lpp, $page, ADMINSCRIPT."?action=usertag$addurl&lpp=$lpp", 0, 3);
showtablerow('', array('class="td25" colspan="3"'), array('<input name="chkall" id="chkall" type="checkbox" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'tagids\', \'chkall\')" /><label for="chkall">'.cplang('select_all').'</label>'));
showtablerow('', array('class="td25"', 'colspan="2"'), array(
cplang('operation'),'<input class="radio" type="radio" name="operate_type" value="delete"> '.cplang('delete').' &nbsp; &nbsp;<input class="radio" type="radio" name="operate_type" value="merge"> '.cplang('mergeto').' <input name="newtag" value="" class="txt" type="text">'
));
showsubmit('submit', 'submit', '', '', $multipage);
}
showtablefooter();
showformfooter();
} elseif($operation == 'add') {
if(submitcheck('submit')) {
$uids = $tagarray = array();
if($_GET['usernames']) {
$_GET['usernames'] = trim(preg_replace("/\s*(\r\n|\n\r|\n|\r)\s*/", "\r\n", $_GET['usernames']));
$_GET['usernames'] = explode("\r\n", $_GET['usernames']);
$uids = C::t('common_member')->fetch_all_uid_by_username($_GET['usernames']);
}
if(empty($_GET['usernames']) || $uids) {
$class_tag = new tag();
$tagarray = $class_tag->add_tag($_GET['tags'], 0, 'uid', 1);
}
if($uids && $tagarray) {
foreach($uids as $uid) {
if(empty($uid)) continue;
foreach($tagarray as $tagid => $tagname) {
C::t('common_tagitem')->insert(array('tagid' => $tagid, 'itemid' => $uid, 'idtype' => 'uid'), 0, 1);
}
}
cpmsg('usertag_add_succeed', 'action=usertag&operation=add', 'succeed');
} else {
if($tagarray && empty($_GET['usernames'])) {
cpmsg('usertag_add_tag_succeed', 'action=usertag&operation=add', 'succeed');
} else {
cpmsg('usertag_add_error', 'action=usertag&operation=add', 'error');
}
}
}
showsubmenu('usertag', array(
array('usertag_list', 'usertag', 0),
array('usertag_add', 'usertag&operation=add', 1),
));
showtips('usertag_add_tips');
showformheader('usertag&operation=add');
showtableheader();
showsetting('usertag_add_tags', 'tags', '', 'text');
showsetting('usertag_add_usernames', 'usernames', '', 'textarea');
showsubmit('submit', 'submit');
showtablefooter();
showformfooter();
}
?>

View File

@@ -0,0 +1,708 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_verify.php 33455 2013-06-19 03:52:01Z andyzheng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
$operation = $operation ? $operation : '';
$anchor = in_array($_GET['anchor'], array('base', 'edit', 'verify', 'verify1', 'verify2', 'verify3', 'verify4', 'verify5', 'verify6', 'authstr', 'refusal', 'pass')) ? $_GET['anchor'] : 'base';
$current = array($anchor => 1);
$navmenu = array();
if($operation == 'verify') {
loadcache('profilesetting');
$vid = intval($_GET['do']);
$anchor = in_array($_GET['anchor'], array('authstr', 'refusal', 'pass', 'add')) ? $_GET['anchor'] : 'authstr';
$current = array($anchor => 1);
if($anchor == 'add') {
if(!submitcheck('addverifysubmit') || $vid < 0 || $vid > 6) {
$navmenu[0] = array('members_verify_nav_authstr', 'verify&operation=verify&anchor=authstr&do='.$vid, 0);
$navmenu[1] = array('members_verify_nav_refusal', 'verify&operation=verify&anchor=refusal&do='.$vid, 0);
$navmenu[2] = array('members_verify_nav_pass', 'verify&operation=verify&anchor=pass&do='.$vid, 0);
$navmenu[3] = array('members_verify_nav_add', 'verify&operation=verify&anchor=add&do='.$vid, 1);
$vid ? shownav('user', 'nav_members_verify', $_G['setting']['verify'][$vid]['title']) : shownav('user', $_G['setting']['verify'][$vid]['title']);
showsubmenu($lang['members_verify_add'].'-'.$_G['setting']['verify'][$vid]['title'], $navmenu);
showformheader("verify&operation=verify&anchor=add&do=$vid", 'enctype');
showtableheader();
showsetting('members_verify_userlist', 'users', $member['users'], 'textarea');
showsubmit('addverifysubmit');
showtablefooter();
showformfooter();
} else {
$userlist = explode("\r\n", $_GET['users']);
$insert = array();
$haveuser = false;
$members = C::t('common_member')->fetch_all_by_username($userlist);
$vuids = array();
foreach($members as $value) {
$vuids[$value['uid']] = $value['uid'];
}
$verifyusers = C::t('common_member_verify')->fetch_all($vuids);
foreach($members as $member) {
if(isset($verifyusers[$member['uid']])) {
C::t('common_member_verify')->update($member['uid'], array("verify$vid" => 1));
} else {
C::t('common_member_verify')->insert(array('uid'=>$member['uid'], "verify$vid" => 1));
}
$haveuser = true;
}
if($haveuser) {
cpmsg('members_verify_add_user_succeed', 'action=verify&operation=verify&do='.$vid.'&anchor=pass', 'succeed');
} else {
cpmsg_error('members_verify_add_user_failure', 'action=verify&operation=add&vid='.$vid);
}
}
} else {
if($anchor != 'pass') {
$_GET['verifytype'] = $vid;
} else {
$_GET['verify'.$vid] = 1;
$_GET['orderby'] = 'uid';
}
require_once libfile('function/profile');
if(!submitcheck('verifysubmit', true)) {
$menutitle = $vid ? $_G['setting']['verify'][$vid]['title'] : $lang['members_verify_profile'];
$navmenu[0] = array('members_verify_nav_authstr', 'verify&operation=verify&anchor=authstr&do='.$vid, $current['authstr']);
$navmenu[1] = array('members_verify_nav_refusal', 'verify&operation=verify&anchor=refusal&do='.$vid, $current['refusal']);
if($vid) {
$navmenu[2] = array('members_verify_nav_pass', 'verify&operation=verify&anchor=pass&do='.$vid, $current['pass']);
$navmenu[3] = array('members_verify_nav_add', 'verify&operation=verify&anchor=add&do='.$vid, $current['add']);
}
$vid ? shownav('user', 'nav_members_verify', $menutitle) : shownav('user', $menutitle);
showsubmenu($lang['members_verify_verify'].($vid ? '-'.$menutitle : ''), $navmenu);
$searchlang = array();
$keys = array('search', 'likesupport', 'resultsort', 'defaultsort', 'orderdesc', 'orderasc', 'perpage_10', 'perpage_20', 'perpage_50', 'perpage_100',
'members_verify_dateline', 'members_verify_uid', 'members_verify_username', 'members_verify_fieldid');
foreach ($keys as $key) {
$searchlang[$key] = cplang($key);
}
$orderby = isset($_GET['orderby']) ? $_GET['orderby'] : '';
$orderby = array($orderby => ' selected');
$datehtml = $orderbyhtml = '';
if($anchor != 'pass') {
$datehtml = "<tr><th>{$searchlang['members_verify_dateline']}</th><td colspan=\"3\">
<input type=\"text\" name=\"dateline1\" value=\"{$_GET['dateline1']}\" size=\"10\" onclick=\"showcalendar(event, this)\"> ~
<input type=\"text\" name=\"dateline2\" value=\"{$_GET['dateline2']}\" size=\"10\" onclick=\"showcalendar(event, this)\"> (YYYY-MM-DD)
</td></tr>";
$orderbyhtml = "<select name=\"orderby\"><option value=\"dateline\"{$orderby['dateline']}>{$searchlang['members_verify_dateline']}</option> </select>";
} else {
$orderbyhtml = "<select name=\"orderby\"><option value=\"uid\"{$orderby['dateline']}>{$searchlang['members_verify_uid']}</option> </select>";
}
$ordersc = isset($_GET['ordersc']) ? $_GET['ordersc'] : '';
$perpages = isset($_GET['perpage']) ? $_GET['perpage'] : '';
$ordersc = array($ordersc => ' selected');
$perpages = array($perpages => ' selected');
$adminscript = ADMINSCRIPT;
$staticurl = STATICURL;
$expertsearch = $vid ? '&nbsp;<a href="'.ADMINSCRIPT.'?action=members&operation=search&more=1&vid='.$vid.'" target="_top">'.cplang('search_higher').'</a>' : '';
echo <<<EOF
<form method="get" autocomplete="off" action="$adminscript">
<div class="dbox"><div class="boxbody">
<table cellspacing="3" cellpadding="3" class="tb tb2">
<tr>
<th>{$searchlang['members_verify_username']}* </th><td><input type="text" name="username" value="{$_GET['username']}"></td>
<th>{$searchlang['members_verify_uid']}</th><td><input type="text" name="uid" value="{$_GET['uid']}"> *{$searchlang['likesupport']}</td>
</tr>
$datehtml
<tr>
<th>{$searchlang['resultsort']}</th>
<td colspan="3">
$orderbyhtml
<select name="ordersc">
<option value="desc"{$ordersc['desc']}>{$searchlang['orderdesc']}</option>
<option value="asc"{$ordersc['asc']}>{$searchlang['orderasc']}</option>
</select>
<select name="perpage">
<option value="10"{$perpages[10]}>{$searchlang['perpage_10']}</option>
<option value="20"{$perpages[20]}>{$searchlang['perpage_20']}</option>
<option value="50"{$perpages[50]}>{$searchlang['perpage_50']}</option>
<option value="100"{$perpages[100]}>{$searchlang['perpage_100']}</option>
</select>
<input type="hidden" name="action" value="verify">
<input type="hidden" name="operation" value="verify">
<input type="hidden" name="do" value="$vid">
<input type="hidden" name="anchor" value="$anchor">
<input type="submit" name="searchsubmit" value="{$searchlang['search']}" class="btn">$expertsearch
</td>
</tr>
</table>
</div></div>
</form>
<iframe id="frame_profile" name="frame_profile" style="display: none"></iframe>
<script type="text/javascript" src="{$staticurl}js/calendar.js"></script>
<script type="text/javascript">
function showreason(vid, flag) {
var reasonobj = $('reason_'+vid);
if(reasonobj) {
reasonobj.style.display = flag ? '' : 'none';
}
if(!flag && $('verifyitem_' + vid) != null) {
var checkboxs = $('verifyitem_' + vid).getElementsByTagName('input');
for(var i in checkboxs) {
if(checkboxs[i].type == 'checkbox') {
checkboxs[i].checked = '';
}
}
}
}
function mod_setbg(vid, value) {
$('mod_' + vid + '_row').className = 'mod_' + value;
}
function mod_setbg_all(value) {
checkAll('option', $('cpform'), value);
var trs = $('cpform').getElementsByTagName('TR');
for(var i in trs) {
if(trs[i].id && trs[i].id.substr(0, 4) == 'mod_') {
trs[i].className = 'mod_' + value;
showreason(trs[i].getAttribute('verifyid'), value == 'refusal' ? 1 : 0);
}
}
}
function mod_cancel_all() {
var inputs = $('cpform').getElementsByTagName('input');
for(var i in inputs) {
if(inputs[i].type == 'radio') {
inputs[i].checked = '';
}
}
var trs = $('cpform').getElementsByTagName('TR');
for(var i in trs) {
if(trs[i].id && trs[i].id.match(/^mod_(\d+)_row$/)) {
trs[i].className = "mod_cancel";
showreason(trs[i].getAttribute('verifyid'), 0)
}
}
}
function singleverify(vid) {
var formobj = $('cpform');
var oldaction = formobj.action;
formobj.action = oldaction+'&frame=no&singleverify='+vid;
formobj.target = "frame_profile";
formobj.submit();
formobj.action = oldaction;
formobj.target = "";
}
</script>
EOF;
$mpurl = ADMINSCRIPT.'?action=verify&operation=verify&anchor='.$anchor.'&do='.$vid;
if($anchor == 'refusal') {
$_GET['flag'] = -1;
} elseif ($anchor == 'authstr') {
$_GET['flag'] = 0;
}
$intkeys = array('uid', 'verifytype', 'flag', 'verify1', 'verify2', 'verify3', 'verify4', 'verify5', 'verify6');
$strkeys = array();
$randkeys = array();
$likekeys = array('username');
$results = getwheres($intkeys, $strkeys, $randkeys, $likekeys, 'v.');
foreach($likekeys as $k) {
$_GET[$k] = dhtmlspecialchars($_GET[$k]);
}
$mpurl .= '&'.implode('&', $results['urls']);
$wherearr = $results['wherearr'];
if($_GET['dateline1']){
$wherearr[] = "v.dateline >= '".strtotime($_GET['dateline1'])."'";
$mpurl .= '&dateline1='.$_GET['dateline1'];
}
if($_GET['dateline2']){
$wherearr[] = "v.dateline <= '".strtotime($_GET['dateline2'])."'";
$mpurl .= '&dateline2='.$_GET['dateline2'];
}
$wheresql = empty($wherearr)?'1':implode(' AND ', $wherearr);
$orders = getorders(array('dateline', 'uid'), 'dateline', 'v.');
$ordersql = $orders['sql'];
if($orders['urls']) $mpurl .= '&'.implode('&', $orders['urls']);
$orderby = array($_GET['orderby']=>' selected');
$ordersc = array($_GET['ordersc']=>' selected');
$orders = in_array($_G['orderby'], array('dateline', 'uid')) ? $_G['orderby'] : 'dateline';
$ordersc = in_array(strtolower($_GET['ordersc']), array('asc', 'desc')) ? $_GET['ordersc'] : 'desc';
$perpage = empty($_GET['perpage']) ? 0 : intval($_GET['perpage']);
if(!in_array($perpage, array(10, 20,50,100))) $perpage = 10;
$perpages = array($perpage=>' selected');
$mpurl .= '&perpage='.$perpage;
$page = empty($_GET['page'])?1:intval($_GET['page']);
if($page<1) $page = 1;
$start = ($page-1)*$perpage;
$multipage = '';
showformheader("verify&operation=verify&do=".$vid.'&anchor='.$anchor);
echo "<script>disallowfloat = '{$_G['setting']['disallowfloat']}';</script><input type=\"hidden\" name=\"verifysubmit\" value=\"trun\" />";
showtableheader('members_verify_manage', 'fixpadding');
if($anchor != 'pass') {
$cssarr = array('width="90"', 'width="120"', 'width="120"', '');
$titlearr = array($lang['members_verify_username'], $lang['members_verify_type'], $lang['members_verify_dateline'], $lang['members_verify_info']);
showtablerow('class="header"', $cssarr, $titlearr);
$count = C::t('common_member_verify_info')->count_by_search($_GET['uid'], $vid, $_GET['flag'], $_GET['username'], strtotime($_GET['dateline1']), strtotime($_GET['dateline2']));
} else {
$cssarr = array('width="80"', 'width="90"', 'width="120"', '');
$titlearr = array('', $lang['members_verify_username'], $lang['members_verify_type'], $lang['members_verify_info']);
showtablerow('class="header"', $cssarr, $titlearr);
$wheresql = (!empty($_GET['username']) ? str_replace('v.username', 'm.username', $wheresql) : $wheresql) . ' AND v.uid=m.uid ';
$count = C::t('common_member_verify')->count_by_search($_GET['uid'], $vid, $_GET['username']);
}
if($count) {
if($anchor != 'pass') {
$verifyusers = C::t('common_member_verify_info')->fetch_all_search($_GET['uid'], $vid, $_GET['flag'], $_GET['username'], strtotime($_GET['dateline1']), strtotime($_GET['dateline2']), $orders, $start, $perpage, $ordersc);
} else {
$verifyusers = C::t('common_member_verify')->fetch_all_search($_GET['uid'], $vid, $_GET['username'], 'v.uid', $start, $perpage, $ordersc);
$verifyuids = array_keys($verifyusers);
$profiles = C::t('common_member_profile')->fetch_all($verifyuids, false, 0);
}
foreach($verifyusers as $uid => $value) {
if($anchor == 'pass') {
$value = array_merge($value, $profiles[$uid]);
}
$value['username'] = '<a href="home.php?mod=space&uid='.$value['uid'].'&do=profile" target="_blank">'.avatar($value['uid'], "small").'<br/>'.$value['username'].'</a>';
if($anchor != 'pass') {
$fields = $anchor != 'pass' ? dunserialize($value['field']) : $_G['setting']['verify'][$vid]['field'];
$verifytype = $value['verifytype'] ? $_G['setting']['verify'][$value['verifytype']]['title'] : $lang['members_verify_profile'];
$fieldstr = '<table width="96%">';
$i = 0;
$fieldstr .= '<tr>'.($anchor == 'authstr' ? '<td width="26">'.$lang['members_verify_refusal'].'</td>' : '').'<td width="100">'.$lang['members_verify_fieldid'].'</td><td>'.$lang['members_verify_newvalue'].'</td></tr><tbody id="verifyitem_'.$value['vid'].'">';
$i++;
foreach($fields as $key => $field) {
if(in_array($key, array('constellation', 'zodiac', 'birthyear', 'birthmonth', 'birthcountry', 'birthprovince', 'birthdist', 'birthcommunity', 'residecountry', 'resideprovince', 'residedist', 'residecommunity'))) {
continue;
}
if($_G['cache']['profilesetting'][$key]['formtype'] == 'file') {
if($field) {
$field = '<a href="'.(getglobal('setting/attachurl').'./profile/'.$field).'" target="_blank"><img src="'.(getglobal('setting/attachurl').'./profile/'.$field).'" class="verifyimg" /></a>';
} else {
$field = cplang('members_verify_pic_removed');
}
} elseif(in_array($key, array('gender', 'birthday', 'birthcity', 'residecity'))) {
$field = profile_show($key, $fields);
}
$fieldstr .= '<tr>'.($anchor == 'authstr' ? '<td><input type="checkbox" name="refusal['.$value['vid'].']['.$key.']" value="'.$key.'" onclick="$(\'refusal'.$value['vid'].'\').click();" /></td>' : '').'<td>'.$_G['cache']['profilesetting'][$key]['title'].':</td><td>'.$field.'</td></tr>';
$i++;
}
$opstr = "";
if($anchor == 'authstr') {
$opstr .= "<label><input class=\"radio\" type=\"radio\" name=\"verify[{$value['vid']}]\" value=\"validate\" onclick=\"mod_setbg({$value['vid']}, 'validate');showreason({$value['vid']}, 0);\">{$lang['validate']}</label>&nbsp;<label><input class=\"radio\" type=\"radio\" name=\"verify[{$value['vid']}]\" value=\"refusal\" id=\"refusal{$value['vid']}\" onclick=\"mod_setbg({$value['vid']}, 'refusal');showreason({$value['vid']}, 1);\">{$lang['members_verify_refusal']}</label>";
} elseif ($anchor == 'refusal') {
$opstr .= "<label><input class=\"radio\" type=\"radio\" name=\"verify[{$value['vid']}]\" value=\"validate\" onclick=\"mod_setbg({$value['vid']}, 'validate');\">{$lang['validate']}</label>";
}
$fieldstr .= "</tbody><tr><td colspan=\"5\">$opstr &nbsp;<span id=\"reason_{$value['vid']}\" style=\"display: none;\">{$lang['moderate_reasonpm']}&nbsp; <input type=\"text\" class=\"txt\" name=\"reason[{$value['vid']}]\" style=\"margin: 0px;\"></span>&nbsp;<input type=\"button\" value=\"{$lang['moderate']}\" name=\"singleverifysubmit\" class=\"btn\" onclick=\"singleverify({$value['vid']});\"></td></tr></table>";
$valuearr = array($value['username'], $verifytype, dgmdate($value['dateline'], 'dt'), $fieldstr);
showtablerow("id=\"mod_{$value['vid']}_row\" verifyid=\"{$value['vid']}}\"", $cssarr, $valuearr);
} else {
$fields = $_G['setting']['verify'][$vid]['field'];
$verifytype = $vid ? $_G['setting']['verify'][$vid]['title'] : $lang['members_verify_profile'];
$fieldstr = '<table width="96%">';
$fieldstr .= '<tr><td width="100">'.$lang['members_verify_fieldid'].'</td><td>'.$lang['members_verify_newvalue'].'</td></tr>';
foreach($fields as $key => $field) {
if(!in_array($key, array('constellation', 'zodiac', 'birthyear', 'birthmonth', 'birthcountry', 'birthprovince', 'birthdist', 'birthcommunity', 'residecountry', 'resideprovince', 'residedist', 'residecommunity'))) {
if(in_array($key, array('gender', 'birthday', 'birthcity', 'residecity'))) {
$value[$field] = profile_show($key, $value);
}
if($_G['cache']['profilesetting'][$key]['formtype'] == 'file') {
if($value[$field]) {
$value[$field] = '<a href="'.(getglobal('setting/attachurl').'./profile/'.$value[$field]).'" target="_blank"><img src="'.(getglobal('setting/attachurl').'./profile/'.$value[$field]).'" class="verifyimg" /></a>';
} else {
$value[$field] = cplang('members_verify_pic_removed');
}
}
$fieldstr .= '<tr><td width="100">'.$_G['cache']['profilesetting'][$key]['title'].':</td><td>'.$value[$field].'</td></tr>';
}
}
$fieldstr .= "</table>";
$opstr = "<ul class=\"nofloat\"><li><label><input class=\"radio\" type=\"radio\" name=\"verify[{$value['uid']}]\" value=\"export\" onclick=\"mod_setbg({$value['uid']}, 'validate');\">{$lang['export']}</label></li><li><label><input class=\"radio\" type=\"radio\" name=\"verify[{$value['uid']}]\" value=\"refusal\" onclick=\"mod_setbg({$value['uid']}, 'refusal');\">{$lang['members_verify_refusal']}</label></li></ul>";
$valuearr = array($opstr, $value['username'], $verifytype, $fieldstr);
showtablerow("id=\"mod_{$value['uid']}_row\"", $cssarr, $valuearr);
}
}
$multipage = multi($count, $perpage, $page, $mpurl);
if($anchor != 'pass') {
showsubmit('batchverifysubmit', 'submit', '', '<a href="#all" onclick="mod_setbg_all(\'validate\')">'.cplang('moderate_all_validate').'</a>'. ($anchor == 'authstr' ? ' &nbsp;<a href="#all" onclick="mod_setbg_all(\'refusal\')">'.cplang('moderate_refusal_all').'</a>' : '').' &nbsp;<a href="#all" onclick="mod_cancel_all();">'.cplang('moderate_cancel_all').'</a>', $multipage, false);
} else {
showsubmit('batchverifysubmit', 'submit', '', '<a href="#all" onclick="mod_setbg_all(\'export\')">'.cplang('moderate_export_all').'</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'refusal\')">'.cplang('moderate_refusal_all').'</a> &nbsp;<a href="#all" onclick="mod_cancel_all();">'.cplang('moderate_cancel_all').'</a> &nbsp;|&nbsp;<a href="'.ADMINSCRIPT.'?action=verify&operation=verify&do='.$vid.'&anchor=pass&verifysubmit=true">'.cplang('moderate_export_getall').'</a>', $multipage, false);
}
} else {
showtablerow('', 'colspan="'.count($cssarr).'"', '<strong>'.cplang('moderate_nodata').'</strong>');
}
showtablefooter();
showformfooter();
} else {
if($anchor == 'pass') {
$verifyuids = array();
$note_values = array(
'verify' => $vid ? '<a href="home.php?mod=spacecp&ac=profile&op=verify&vid='.$vid.'" target="_blank">'.$_G['setting']['verify'][$vid]['title'].'</a>' : ''
);
foreach($_GET['verify'] as $uid => $type) {
if($type == 'export') {
$verifyuids['export'][] = $uid;
} elseif($type == 'refusal') {
$verifyuids['refusal'][] = $uid;
notification_add($uid, 'verify', 'profile_verify_pass_refusal', $note_values, 1);
}
}
if(is_array($verifyuids['refusal']) && !empty($verifyuids['refusal'])) {
C::t('common_member_verify')->update($verifyuids['refusal'], array("verify$vid" => '0'));
}
if(is_array($verifyuids['export']) && !empty($verifyuids['export']) || empty($verifyuids['refusal'])) {
$uids = array();
if(is_array($verifyuids['export']) && !empty($verifyuids['export'])) {
$uids = $verifyuids['export'];
}
$fields = $_G['setting']['verify'][$vid]['field'];
$fields = array_reverse($fields);
$fields['username'] = 'username';
$fields = array_reverse($fields);
$title = $verifylist = '';
$showtitle = true;
$verifyusers = C::t('common_member_verify')->fetch_all_by_vid($vid, 1, $uids);
$verifyuids = array_keys($verifyusers);
$members = C::t('common_member')->fetch_all($verifyuids, false, 0);
$profiles = C::t('common_member_profile')->fetch_all($verifyuids, false, 0);
foreach($verifyusers as $uid => $value) {
$value = array_merge($value, $members[$uid], $profiles[$uid]);
$str = $common = '';
foreach($fields as $key => $field) {
if(in_array($key, array('constellation', 'zodiac', 'birthyear', 'birthmonth', 'birthcountry', 'birthprovince', 'birthdist', 'birthcommunity', 'residecountry', 'resideprovince', 'residedist', 'residecommunity'))) {
continue;
}
if($showtitle) {
$title .= $common.($key == 'username' ? $lang['username'] : $_G['cache']['profilesetting'][$key]['title']);
}
if(in_array($key, array('gender', 'birthday', 'birthcity', 'residecity'))) {
$value[$field] = profile_show($key, $value);
}
$str .= $common.$value[$field];
$common = "\t";
}
$verifylist .= $str."\n";
$showtitle = false;
}
$verifylist = $title."\n".$verifylist;
$filename = date('Ymd', TIMESTAMP).'.xls';
define('FOOTERDISABLED', true);
ob_end_clean();
header("Content-type:application/vnd.ms-excel");
header('Content-Encoding: none');
header('Content-Disposition: attachment; filename='.$filename);
header('Pragma: no-cache');
header('Expires: 0');
if($_G['charset'] != 'gbk') {
$verifylist = diconv($verifylist, $_G['charset'], 'GBK');
}
echo $verifylist;
exit();
} else {
cpmsg('members_verify_succeed', 'action=verify&operation=verify&do='.$vid.'&anchor=pass', 'succeed');
}
} else {
$vids = array();
$single = intval($_GET['singleverify']);
$verifyflag = empty($_GET['verify']) ? false : true;
if($verifyflag) {
if($single) {
$_GET['verify'] = array($single => $_GET['verify'][$single]);
}
foreach($_GET['verify'] as $id => $type) {
$vids[] = $id;
}
$verifysetting = $_G['setting']['verify'];
$verify = $refusal = array();
foreach(C::t('common_member_verify_info')->fetch_all($vids) as $value) {
if(in_array($_GET['verify'][$value['vid']], array('refusal', 'validate'))) {
$fields = dunserialize($value['field']);
$verifysetting = $_G['setting']['verify'][$value['verifytype']];
if($_GET['verify'][$value['vid']] == 'refusal') {
$refusalfields = !empty($_GET['refusal'][$value['vid']]) ? $_GET['refusal'][$value['vid']] : $verifysetting['field'];
$fieldtitle = $common = '';
$deleteverifyimg = false;
foreach($refusalfields as $key => $field) {
$fieldtitle .= $common.$_G['cache']['profilesetting'][$field]['title'];
$common = ',';
if($_G['cache']['profilesetting'][$field]['formtype'] == 'file') {
$deleteverifyimg = true;
@unlink(getglobal('setting/attachdir').'./profile/'.$fields[$key]);
$fields[$field] = '';
}
}
if($deleteverifyimg) {
C::t('common_member_verify_info')->update($value['vid'], array('field' => serialize($fields)));
}
if($value['verifytype']) {
$verify["verify"]['-1'][] = $value['uid'];
}
$verify['flag'][] = $value['vid'];
$note_values = array(
'verify' => $vid ? '<a href="home.php?mod=spacecp&ac=profile&op=verify&vid='.$vid.'" target="_blank">'.$verifysetting['title'].'</a>' : '',
'profile' => $fieldtitle,
'reason' => $_GET['reason'][$value['vid']],
);
$note_lang = 'profile_verify_error';
} else {
if($_G['setting']['profilehistory']) {
C::t('common_member_profile_history')->insert(array_merge(C::t('common_member_profile')->fetch(intval($value['uid'])), array('dateline' => time())));
}
C::t('common_member_profile')->update(intval($value['uid']), $fields);
$verify['delete'][] = $value['vid'];
if($value['verifytype']) {
$verify["verify"]['1'][] = $value['uid'];
}
$note_values = array(
'verify' => $vid ? '<a href="home.php?mod=spacecp&ac=profile&op=verify&vid='.$vid.'" target="_blank">'.$verifysetting['title'].'</a>' : ''
);
$note_lang = 'profile_verify_pass';
}
notification_add($value['uid'], 'verify', $note_lang, $note_values, 1);
}
}
if($vid && !empty($verify["verify"])) {
foreach($verify["verify"] as $flag => $uids) {
$flag = intval($flag);
C::t('common_member_verify')->update($uids, array("verify$vid" => $flag));
}
}
if(!empty($verify['delete'])) {
C::t('common_member_verify_info')->delete($verify['delete']);
}
if(!empty($verify['flag'])) {
C::t('common_member_verify_info')->update($verify['flag'], array('flag' => '-1'));
}
}
if($single && $_GET['frame'] == 'no') {
echo "<script type=\"text/javascript\">var trObj = parent.$('mod_{$single}_row');trObj.parentNode.removeChild(trObj);</script>";
} else {
cpmsg('members_verify_succeed', 'action=verify&operation=verify&do='.$vid.'&anchor='.$_GET['anchor'], 'succeed');
}
}
}
}
} elseif($operation == 'edit') {
shownav('user', 'nav_members_verify');
$vid = $_GET['vid'] < 8 ? intval($_GET['vid']) : 0;
showsubmenu($lang['members_verify'].'-verify'.$vid);
$verifyarr = $_G['setting']['verify'][$vid];
if(!submitcheck('verifysubmit')) {
if($vid == 7) {
showtips('members_verify_setting_tips');
}
showformheader("verify&operation=edit&vid=$vid", 'enctype');
showtableheader();
$readonly = $vid == 6 || $vid == 7 ? 'readonly' : '';
showsetting('members_verify_title', "verify[title]", $verifyarr['title'], 'text', $readonly);
showsetting('members_verify_enable', "verify[available]", $verifyarr['available'], 'radio');
$verificonhtml = '';
if($verifyarr['icon']) {
$icon_url = parse_url($verifyarr['icon']);
$prefix = !$icon_url['host'] && strpos($verifyarr['icon'], $_G['setting']['attachurl'].'common/') === false ? $_G['setting']['attachurl'].'common/' : '';
$verificonhtml = '<label><input type="checkbox" class="checkbox" name="deleteicon['.$vid.']" value="yes" /> '.$lang['delete'].'</label><br /><img src="'.$prefix.$verifyarr['icon'].'" />';
}
$unverifyiconhtml = '';
if($verifyarr['unverifyicon']) {
$unverifyiconurl = parse_url($verifyarr['unverifyicon']);
$prefix = !$unverifyiconurl['host'] && strpos($verifyarr['unverifyicon'], $_G['setting']['attachurl'].'common/') === false ? $_G['setting']['attachurl'].'common/' : '';
$unverifyiconhtml = '<label><input type="checkbox" class="checkbox" name="delunverifyicon['.$vid.']" value="yes" /> '.$lang['delete'].'</label><br /><img src="'.$prefix.$verifyarr['unverifyicon'].'" />';
}
showsetting('members_verify_showicon', "verify[showicon]", $verifyarr['showicon'], 'radio', '', 1);
showsetting('members_unverify_icon', 'unverifyiconnew', (!$unverifyiconurl['host'] ? str_replace($_G['setting']['attachurl'].'common/', '', $verifyarr['unverifyicon']) : $verifyarr['unverifyicon']), 'filetext', '', 0, $unverifyiconhtml);
showsetting('members_verify_icon', 'iconnew', (!$icon_url['host'] ? str_replace($_G['setting']['attachurl'].'common/', '', $verifyarr['icon']) : $verifyarr['icon']), 'filetext', '', 0, $verificonhtml);
showtagfooter('tbody');
if($vid == 6) {
showsetting('members_verify_view_real_name', "verify[viewrealname]", $verifyarr['viewrealname'], 'radio');
}
if($vid) {
$varname = array('verify[field]', array(), 'isfloat');
foreach(C::t('common_member_profile_setting')->fetch_all_by_available(1) as $value) {
if(!in_array($value['fieldid'], array('constellation', 'zodiac', 'birthyear', 'birthmonth', 'birthcountry', 'birthprovince', 'birthdist', 'birthcommunity', 'residecountry', 'resideprovince', 'residedist', 'residecommunity'))) {
$varname[1][] = array($value['fieldid'], $value['title'], $value['fieldid']);
}
}
showsetting('members_verify_setting_field', $varname, $verifyarr['field'], 'omcheckbox');
}
$groupselect = array();
foreach(C::t('common_usergroup')->fetch_all_not(array(6, 7)) as $group) {
$group['type'] = $group['type'] == 'special' && $group['radminid'] ? 'specialadmin' : $group['type'];
$groupselect[$group['type']] .= "<option value=\"{$group['groupid']}\" ".((is_array($verifyarr['groupid']) && in_array($group['groupid'], $verifyarr['groupid'])) ? 'selected' : '').">{$group['grouptitle']}</option>\n";
}
$groupselect = '<optgroup label="'.$lang['usergroups_member'].'">'.$groupselect['member'].'</optgroup>'.
($groupselect['special'] ? '<optgroup label="'.$lang['usergroups_special'].'">'.$groupselect['special'].'</optgroup>' : '').
($groupselect['specialadmin'] ? '<optgroup label="'.$lang['usergroups_specialadmin'].'">'.$groupselect['specialadmin'].'</optgroup>' : '').
'<optgroup label="'.$lang['usergroups_system'].'">'.$groupselect['system'].'</optgroup>';
showsetting('members_verify_group', '', '', '<select name="verify[groupid][]" multiple="multiple" size="10">'.$groupselect.'</select>');
showsubmit('verifysubmit');
showtablefooter();
showformfooter();
} else {
foreach( $_G['setting']['verify'] AS $key => $value) {
if(!is_array($value)) {
continue;
}
$_G['setting']['verify'][$key]['icon'] = str_replace($_G['setting']['attachurl'].'common/', '', $value['icon']);
$_G['setting']['verify'][$key]['unverifyicon'] = str_replace($_G['setting']['attachurl'].'common/', '', $value['unverifyicon']);
}
$verifynew = getgpc('verify');
if($vid == 6 || $vid == 7) {
$verifynew['title'] = $_G['setting']['verify'][$vid]['title'];
}
if($verifynew['available'] == 1 && !trim($verifynew['title'])) {
cpmsg('members_verify_update_title_error', '', 'error');
}
$verifynew['icon'] = getverifyicon('iconnew', $vid);
$verifynew['unverifyicon'] = getverifyicon('unverifyiconnew', $vid, 'unverify_icon');
if($_GET['deleteicon']) {
$verifynew['icon'] = delverifyicon($verifyarr['icon']);
}
if($_GET['delunverifyicon']) {
$verifynew['unverifyicon'] = delverifyicon($verifyarr['unverifyicon']);
}
if(!empty($verifynew['field']['residecity'])) {
$verifynew['field']['residecountry'] = 'residecountry';
$verifynew['field']['resideprovince'] = 'resideprovince';
$verifynew['field']['residedist'] = 'residedist';
$verifynew['field']['residecommunity'] = 'residecommunity';
}
if(!empty($verifynew['field']['birthday'])) {
$verifynew['field']['birthyear'] = 'birthyear';
$verifynew['field']['birthmonth'] = 'birthmonth';
}
if(!empty($verifynew['field']['birthcity'])) {
$verifynew['field']['birthcountry'] = 'birthcountry';
$verifynew['field']['birthprovince'] = 'birthprovince';
$verifynew['field']['birthdist'] = 'birthdist';
$verifynew['field']['birthcommunity'] = 'birthcommunity';
}
$verifynew['groupid'] = !empty($verifynew['groupid']) && is_array($verifynew['groupid']) ? $verifynew['groupid'] : array();
$_G['setting']['verify'][$vid] = $verifynew;
$_G['setting']['verify']['enabled'] = false;
for($i = 1; $i < 8; $i++) {
if($_G['setting']['verify'][$i]['available'] && !$_G['setting']['verify']['enabled']) {
$_G['setting']['verify']['enabled'] = true;
}
if($_G['setting']['verify'][$i]['icon']) {
$icon_url = parse_url($_G['setting']['verify'][$i]['icon']);
}
$_G['setting']['verify'][$i]['icon'] = !$icon_url['host'] ? str_replace($_G['setting']['attachurl'].'common/', '', $_G['setting']['verify'][$i]['icon']) : $_G['setting']['verify'][$i]['icon'] ;
}
C::t('common_setting')->update_setting('verify', $_G['setting']['verify']);
if(isset($verifynew['viewrealname']) && !$verifynew['viewrealname']) {
C::t('common_member_profile_setting')->update('realname', array('showinthread' => 0));
$custominfo = C::t('common_setting')->fetch_setting('customauthorinfo', true);
if(isset($custominfo[0]['field_realname'])) {
unset($custominfo[0]['field_realname']);
C::t('common_setting')->update_setting('customauthorinfo', $custominfo);
updatecache(array('custominfo'));
}
}
updatecache(array('setting'));
cpmsg('members_verify_update_succeed', 'action=verify', 'succeed');
}
} else {
shownav('user', 'nav_members_verify');
showsubmenu('members_verify_setting');
if(!submitcheck('verifysubmit')) {
showformheader("verify");
showtableheader('members_verify_setting', 'fixpadding');
showsubtitle(array('members_verify_available', 'members_verify_id', 'members_verify_title', ''), 'header');
for($i = 1; $i < 7; $i++) {
$readonly = $i == 6 ? true : false;
$url = parse_url($_G['setting']['verify'][$i]['icon']);
if(!$url['host'] && $_G['setting']['verify'][$i]['icon'] && strpos($_G['setting']['verify'][$i]['icon'], $_G['setting']['attachurl'].'common/') === false) {
$_G['setting']['verify'][$i]['icon'] = $_G['setting']['attachurl'].'common/'.$_G['setting']['verify'][$i]['icon'];
}
showtablerow('', array('class="td25"', '', '', 'class="td25"'), array(
"<input class=\"checkbox\" type=\"checkbox\" name=\"settingnew[verify][$i][available]\" value=\"1\" ".($_G['setting']['verify'][$i]['available'] ? 'checked' : '')." />",
'verify'.$i,
($readonly ? $_G['setting']['verify'][$i]['title']."<input type=\"hidden\" name=\"settingnew[verify][$i][title]\" value=\"{$_G['setting']['verify'][$i]['title']}\" readonly>&nbsp;":"<input type=\"text\" class=\"txt\" size=\"8\" name=\"settingnew[verify][$i][title]\" value=\"{$_G['setting']['verify'][$i]['title']}\">").
($_G['setting']['verify'][$i]['icon'] ? '<img src="'.$_G['setting']['verify'][$i]['icon'].'" />' : ''),
"<a href=\"".ADMINSCRIPT."?action=verify&operation=edit&anchor=base&vid=$i\">".$lang['edit']."</a>"
));
}
showsubmit('verifysubmit');
showtablefooter();
showformfooter();
} else {
$settingnew = getgpc('settingnew');
$enabled = false;
foreach($settingnew['verify'] as $key => $value) {
if($value['available'] && !$value['title']) {
cpmsg('members_verify_title_invalid', '', 'error');
}
if($value['available']) {
$enabled = true;
}
$_G['setting']['verify'][$key]['available'] = intval($value['available']);
$_G['setting']['verify'][$key]['title'] = $value['title'];
}
$_G['setting']['verify']['enabled'] = $enabled;
C::t('common_setting')->update_setting('verify', $_G['setting']['verify']);
updatecache(array('setting'));
updatemenu('user');
cpmsg('members_verify_update_succeed', 'action=verify', 'succeed');
}
}
function getverifyicon($iconkey = 'iconnew', $vid = 1, $extstr = 'verify_icon') {
global $_G, $_FILES;
if($_FILES[$iconkey]) {
$data = array('extid' => "$vid");
$iconnew = upload_icon_banner($data, $_FILES[$iconkey], $extstr);
} else {
$iconnew = $_GET[''.$iconkey];
}
return $iconnew;
}
function delverifyicon($icon) {
global $_G;
$valueparse = parse_url($icon);
if(!isset($valueparse['host']) && preg_match('/^'.preg_quote($_G['setting']['attachurl'].'common/', '/').'/', $icon)) {
@unlink($icon);
}
return '';
}
?>

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,442 @@
template/default/common/extcredits.htm *<!--{hook/spacecp_credit_extra}-->
template/default/common/faq.htm *<!--{hook/faq_extra}-->
template/default/common/footer.htm *<!--{hook/global_footer}-->
template/default/common/footer.htm *<!--{hook/global_footerlink}-->
template/default/common/header.htm *<!--{hook/global_cpnav_top}-->
template/default/common/header.htm *<!--{hook/global_cpnav_extra1}-->
template/default/common/header.htm *<!--{hook/global_cpnav_extra2}-->
template/default/common/header.htm *<!--{hook/global_myitem_extra}-->
template/default/common/header.htm *<!--{hook/global_nav_extra}-->
template/default/common/header.htm *<!--{hook/global_header}-->
template/default/common/header_qmenu.htm *<!--{hook/global_qmenu_top}-->
template/default/common/header_qmenu.htm *<!--{hook/global_qmenu_bottom}-->
template/default/common/header_userstatus.htm *<!--{hook/global_usernav_extra1}-->
template/default/common/header_userstatus.htm *<!--{hook/global_usernav_extra4}-->
template/default/common/header_userstatus.htm *<!--{hook/global_usernav_extra2}-->
template/default/common/header_userstatus.htm *<!--{hook/global_usernav_extra3}-->
template/default/common/header_userstatus.htm *<!--{hook/global_usernav_extra1}-->
template/default/common/userabout.htm *<!--{hook/global_userabout_top $_G['basescript'].'::'.CURMODULE}-->
template/default/common/userabout.htm *<!--{hook/global_userabout_bottom $_G['basescript'].'::'.CURMODULE}-->
template/default/forum/collection_all.htm *<!--{hook/collection_index_top}-->
template/default/forum/collection_all.htm *<!--{hook/collection_index_bottom}-->
template/default/forum/collection_comment.htm *<!--{hook/collection_nav_extra}-->
template/default/forum/collection_index.htm *<!--{hook/collection_index_top}-->
template/default/forum/collection_index.htm *<!--{hook/collection_index_bottom}-->
template/default/forum/collection_mycollection.htm *<!--{hook/collection_index_top}-->
template/default/forum/collection_mycollection.htm *<!--{hook/collection_index_bottom}-->
template/default/forum/collection_nav.htm *<!--{hook/collection_nav_extra}-->
template/default/forum/collection_view.htm *<!--{hook/collection_viewoptions}-->
template/default/forum/collection_view.htm *<!--{hook/collection_view_top}-->
template/default/forum/collection_view.htm *<!--{hook/collection_threadlistbottom}-->
template/default/forum/collection_view.htm *<!--{hook/collection_relatedop}-->
template/default/forum/collection_view.htm *<!--{hook/collection_view_bottom}-->
template/default/forum/collection_view.htm *<!--{hook/collection_side_bottom}-->
template/default/forum/discuz.htm *<!--{hook/index_status_extra}-->
template/default/forum/discuz.htm *<!--{hook/index_nav_extra}-->
template/default/forum/discuz.htm *<!--{hook/index_top}-->
template/default/forum/discuz.htm *<!--{hook/index_catlist_top}-->
template/default/forum/discuz.htm *<!--{hook/index_followcollection_extra $colletion['ctid']}-->
template/default/forum/discuz.htm *<!--{hook/index_favforum_extra $forum['fid']}-->
template/default/forum/discuz.htm *<!--{hook/index_favforum_extra $forum['fid']}-->
template/default/forum/discuz.htm *<!--{hook/index_catlist $cat['fid']}-->
template/default/forum/discuz.htm *<!--{hook/index_forum_extra $forum['fid']}-->
template/default/forum/discuz.htm *<!--{hook/index_forum_extra $forum['fid']}-->
template/default/forum/discuz.htm *<!--{hook/index_datacollection_extra $colletion['ctid']}-->
template/default/forum/discuz.htm *<!--{hook/index_middle}-->
template/default/forum/discuz.htm *<!--{hook/index_bottom}-->
template/default/forum/discuz.htm *<!--{hook/index_side_top}-->
template/default/forum/discuz.htm *<!--{hook/index_side_bottom}-->
template/default/forum/editor_menu_forum.htm *<!--{hook/post_image_btn_extra}-->
template/default/forum/editor_menu_forum.htm *<!--{hook/post_image_tab_extra}-->
template/default/forum/editor_menu_forum.htm *<!--{hook/post_attach_btn_extra}-->
template/default/forum/editor_menu_forum.htm *<!--{hook/post_attach_tab_extra}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_leftside_top}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_leftside_bottom}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_forumaction}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_modlink}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_top}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_middle}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_postbutton_top}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_threadtype_inner}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_filter_extra}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_threadtype_extra}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_bottom}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_side_top}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_side_bottom}-->
template/default/forum/forumdisplay_fastpost.htm *<!--{hook/forumdisplay_fastpost_content}-->
template/default/forum/forumdisplay_fastpost.htm *<!--{hook/forumdisplay_fastpost_func_extra}-->
template/default/forum/forumdisplay_fastpost.htm *<!--{hook/forumdisplay_fastpost_ctrl_extra}-->
template/default/forum/forumdisplay_fastpost.htm *<!--{hook/global_login_text}-->
template/default/forum/forumdisplay_fastpost.htm *<!--{hook/forumdisplay_fastpost_upload_extend}-->
template/default/forum/forumdisplay_fastpost.htm *<!--{hook/forumdisplay_fastpost_btn_extra}-->
template/default/forum/forumdisplay_fastpost.htm *<!--{hook/forumdisplay_fastpost_sync_method}-->
template/default/forum/forumdisplay_list.htm *<!--{hook/forumdisplay_filter_extra}-->
template/default/forum/forumdisplay_list.htm *<!--{hook/forumdisplay_thread $key}-->
template/default/forum/forumdisplay_list.htm *<!--{hook/forumdisplay_thread_subject $key}-->
template/default/forum/forumdisplay_list.htm *<!--{hook/forumdisplay_author $key}-->
template/default/forum/forumdisplay_list.htm *<!--{hook/forumdisplay_thread $key}-->
template/default/forum/forumdisplay_list.htm *<!--{hook/forumdisplay_author $key}-->
template/default/forum/forumdisplay_list.htm *<!--{hook/forumdisplay_threadlist_bottom}-->
template/default/forum/forumdisplay_list.htm *<!--{hook/forumdisplay_postbutton_bottom}-->
template/default/forum/forumdisplay_sort.htm *<!--{hook/forumdisplay_postbutton_bottom}-->
template/default/forum/forumdisplay_subforum.htm *<!--{hook/forumdisplay_subforum_extra $sub['fid']}-->
template/default/forum/forumdisplay_subforum.htm *<!--{hook/forumdisplay_subforum_extra $sub['fid']}-->
template/default/forum/guide.htm *<!--{hook/guide_nav_extra}-->
template/default/forum/guide.htm *<!--{hook/guide_top}-->
template/default/forum/guide.htm *<!--{hook/guide_bottom}-->
template/default/forum/index_navbar.htm *<!--{hook/index_navbar}-->
template/default/forum/post.htm *<!--{hook/post_top}-->
template/default/forum/post.htm *<!--{hook/post_middle}-->
template/default/forum/post.htm *<!--{hook/post_btn_extra}-->
template/default/forum/post.htm *<!--{hook/post_sync_method}-->
template/default/forum/post.htm *<!--{hook/post_bottom}-->
template/default/forum/post.htm *<!--{hook/post_upload_extend}-->
template/default/forum/post_activity.htm *<!--{hook/post_activity_extra}-->
template/default/forum/post_debate.htm *<!--{hook/post_debate_extra}-->
template/default/forum/post_editor_attribute.htm *<!--{hook/post_attribute_extra}-->
template/default/forum/post_editor_attribute.htm *<!--{hook/post_attribute_extra_body}-->
template/default/forum/post_editor_body.htm *<!--{hook/post_editorctrl_right}-->
template/default/forum/post_editor_body.htm *<!--{hook/post_editorctrl_left}-->
template/default/forum/post_editor_body.htm *<!--{hook/post_editorctrl_top}-->
template/default/forum/post_editor_body.htm *<!--{hook/post_editorctrl_bottom}-->
template/default/forum/post_infloat.htm *<!--{hook/post_infloat_top}-->
template/default/forum/post_infloat.htm *<!--{hook/post_infloat_middle}-->
template/default/forum/post_infloat.htm *<!--{hook/post_infloat_btn_extra}-->
template/default/forum/post_poll.htm *<!--{hook/post_poll_extra}-->
template/default/forum/post_poll.htm *<!--{hook/post_poll_upload_extend}-->
template/default/forum/post_reward.htm *<!--{hook/post_reward_extra}-->
template/default/forum/post_trade.htm *<!--{hook/post_trade_extra}-->
template/default/forum/topicadmin_modlayer.htm *<!--{hook/forumdisplay_modlayer}-->
template/default/forum/topicadmin_modlayer.htm *<!--{hook/modcp_modlayer}-->
template/default/forum/trade_info.htm *<!--{hook/viewthread_tradeinfo_extra}-->
template/default/forum/viewthread.htm *<!--{hook/viewthread_top}-->
template/default/forum/viewthread.htm *<!--{hook/viewthread_postbutton_top}-->
template/default/forum/viewthread.htm *<!--{hook/viewthread_modoption}-->
template/default/forum/viewthread.htm *<!--{hook/viewthread_beginline}-->
template/default/forum/viewthread.htm *<!--{hook/viewthread_title_extra}-->
template/default/forum/viewthread.htm *<!--{hook/viewthread_title_row}-->
template/default/forum/viewthread.htm *<!--{hook/viewthread_middle}-->
template/default/forum/viewthread.htm *<!--{hook/viewthread_bottom}-->
template/default/forum/viewthread_activity.htm *<!--{hook/viewthread_activity_extra1}-->
template/default/forum/viewthread_activity.htm *<!--{hook/viewthread_activity_extra2}-->
template/default/forum/viewthread_album.htm *<!--{hook/viewthread_beginline}-->
template/default/forum/viewthread_album.htm *<!--{hook/viewthread_useraction_prefix}-->
template/default/forum/viewthread_album.htm *<!--{hook/viewthread_useraction}-->
template/default/forum/viewthread_album.htm *<!--{hook/viewthread_bottom}-->
template/default/forum/viewthread_fastpost.htm *<!--{hook/viewthread_fastpost_side}-->
template/default/forum/viewthread_fastpost.htm *<!--{hook/viewthread_fastpost_content}-->
template/default/forum/viewthread_fastpost.htm *<!--{hook/viewthread_fastpost_func_extra}-->
template/default/forum/viewthread_fastpost.htm *<!--{hook/viewthread_fastpost_ctrl_extra}-->
template/default/forum/viewthread_fastpost.htm *<!--{hook/global_login_text}-->
template/default/forum/viewthread_fastpost.htm *<!--{hook/viewthread_fastpost_upload_extend}-->
template/default/forum/viewthread_fastpost.htm *<!--{hook/viewthread_fastpost_btn_extra}-->
template/default/forum/viewthread_from_node.htm *<!--{hook/viewthread_postheader $postcount}-->
template/default/forum/viewthread_from_node.htm *<!--{hook/viewthread_postheader $postcount}-->
template/default/forum/viewthread_from_node.htm *<!--{hook/viewthread_postheader $postcount}-->
template/default/forum/viewthread_from_node.htm *<!--{hook/viewthread_endline $postcount}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_profileside $postcount}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_imicons $postcount}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_magic_user $postcount}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_avatartop $postcount}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_avatar $postcount}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_sidetop $postcount}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_sidebottom $postcount}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_postheader $postcount}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_share_method}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_useraction}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_postsightmlafter $postcount}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_postfooter $postcount}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_postaction $postcount}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_magic_thread}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_magic_post $postcount}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_endline $postcount}-->
template/default/forum/viewthread_node_body.htm *<!--{hook/viewthread_posttop $postcount}-->
template/default/forum/viewthread_node_body.htm *<!--{hook/global_login_text}-->
template/default/forum/viewthread_node_body.htm *<!--{hook/viewthread_modaction}-->
template/default/forum/viewthread_node_body.htm *<!--{hook/global_login_text}-->
template/default/forum/viewthread_node_body.htm *<!--{hook/viewthread_postbottom $postcount}-->
template/default/forum/viewthread_poll.htm *<!--{hook/viewthread_poll_top}-->
template/default/forum/viewthread_poll.htm *<!--{hook/viewthread_poll_bottom}-->
template/default/forum/viewthread_portal.htm *<!--{hook/viewthread_useraction_prefix}-->
template/default/forum/viewthread_portal.htm *<!--{hook/viewthread_useraction}-->
template/default/forum/viewthread_portal.htm *<!--{hook/viewthread_side_bottom}-->
template/default/forum/viewthread_preview_node.htm *<!--{hook/viewthread_postheader $postcount}-->
template/default/forum/viewthread_preview_node.htm *<!--{hook/viewthread_postheader $postcount}-->
template/default/forum/viewthread_preview_node.htm *<!--{hook/viewthread_postheader $postcount}-->
template/default/forum/viewthread_preview_node.htm *<!--{hook/viewthread_endline $postcount}-->
template/default/forum/viewthread_trade.htm *<!--{hook/viewthread_trade_extra $key}-->
template/default/group/group.htm *<!--{hook/group_navlink}-->
template/default/group/group.htm *<!--{hook/forumdisplay_navlink}-->
template/default/group/group.htm *<!--{hook/group_navlink}-->
template/default/group/group.htm *<!--{hook/forumdisplay_navlink}-->
template/default/group/group.htm *<!--{hook/group_top}-->
template/default/group/group.htm *<!--{hook/forumdisplay_top}-->
template/default/group/group.htm *<!--{hook/group_nav_extra}-->
template/default/group/group.htm *<!--{hook/forumdisplay_nav_extra}-->
template/default/group/group.htm *<!--{hook/group_bottom}-->
template/default/group/group.htm *<!--{hook/forumdisplay_bottom}-->
template/default/group/group.htm *<!--{hook/group_side_bottom}-->
template/default/group/group.htm *<!--{hook/forumdisplay_side_bottom}-->
template/default/group/group_list.htm *<!--{hook/forumdisplay_postbutton_top}-->
template/default/group/group_list.htm *<!--{hook/forumdisplay_filter_extra}-->
template/default/group/group_list.htm *<!--{hook/forumdisplay_thread $key}-->
template/default/group/group_list.htm *<!--{hook/forumdisplay_postbutton_bottom}-->
template/default/group/group_my.htm *<!--{hook/my_header}-->
template/default/group/group_my.htm *<!--{hook/my_bottom}-->
template/default/group/group_my.htm *<!--{hook/my_side_top}-->
template/default/group/group_my.htm *<!--{hook/my_side_bottom}-->
template/default/group/group_right.htm *<!--{hook/group_index_side}-->
template/default/group/group_right.htm *<!--{hook/group_side_top}-->
template/default/group/group_right.htm *<!--{hook/forumdisplay_side_top}-->
template/default/group/index.htm *<!--{hook/index_header}-->
template/default/group/index.htm *<!--{hook/index_top}-->
template/default/group/index.htm *<!--{hook/index_bottom}-->
template/default/group/index.htm *<!--{hook/index_side_top}-->
template/default/group/index.htm *<!--{hook/index_side_bottom}-->
template/default/group/type.htm *<!--{hook/index_top}-->
template/default/group/type.htm *<!--{hook/index_grouplist $fid}-->
template/default/group/type.htm *<!--{hook/index_bottom}-->
template/default/group/type.htm *<!--{hook/index_side_top}-->
template/default/group/type.htm *<!--{hook/index_side_bottom}-->
template/default/home/editor_image_menu.htm *<!--{hook/spacecp_blog_upload_extend}-->
template/default/home/editor_image_menu.htm *<!--{hook/portalcp_top_upload_extend}-->
template/default/home/follow_feed.htm *<!--{hook/follow_nav_extra}-->
template/default/home/follow_feed.htm *<!--{hook/follow_top}-->
template/default/home/follow_feed.htm *<!--{hook/follow_upload_extend}-->
template/default/home/follow_feed.htm *<!--{hook/follow_nav_extra}-->
template/default/home/spacecp_avatar.htm *<!--{hook/spacecp_avatar_top}-->
template/default/home/spacecp_avatar.htm *<!--{hook/spacecp_avatar_bottom}-->
template/default/home/spacecp_blog.htm *<!--{hook/spacecp_blog_top}-->
template/default/home/spacecp_blog.htm *<!--{hook/spacecp_blog_middle}-->
template/default/home/spacecp_blog.htm *<!--{hook/spacecp_blog_bottom}-->
template/default/home/spacecp_credit_base.htm *<!--{hook/spacecp_credit_top}-->
template/default/home/spacecp_credit_base.htm *<!--{hook/spacecp_credit_extra}-->
template/default/home/spacecp_credit_base.htm *<!--{hook/spacecp_credit_bottom}-->
template/default/home/spacecp_credit_log.htm *<!--{hook/spacecp_credit_top}-->
template/default/home/spacecp_credit_log.htm *<!--{hook/spacecp_credit_bottom}-->
template/default/home/spacecp_payment_order.htm *<!--{hook/spacecp_payment_top}-->
template/default/home/spacecp_payment_order.htm *<!--{hook/spacecp_payment_bottom}-->
template/default/home/spacecp_payment_pay.htm *<!--{hook/spacecp_payment_top}-->
template/default/home/spacecp_payment_pay.htm *<!--{hook/spacecp_payment_bottom}-->
template/default/home/spacecp_payment_redirect.htm *<!--{hook/spacecp_payment_redirect_extend}-->
template/default/home/spacecp_privacy.htm *<!--{hook/spacecp_privacy_top}-->
template/default/home/spacecp_privacy.htm *<!--{hook/spacecp_privacy_base_extra}-->
template/default/home/spacecp_privacy.htm *<!--{hook/spacecp_privacy_feed_extra}-->
template/default/home/spacecp_privacy.htm *<!--{hook/spacecp_privacy_other_extra}-->
template/default/home/spacecp_privacy.htm *<!--{hook/spacecp_privacy_bottom}-->
template/default/home/spacecp_profile.htm *<!--{hook/spacecp_profile_top}-->
template/default/home/spacecp_profile.htm *<!--{hook/spacecp_profile_extra}-->
template/default/home/spacecp_profile.htm *<!--{hook/spacecp_profile_bottom}-->
template/default/home/spacecp_promotion.htm *<!--{hook/spacecp_promotion_top}-->
template/default/home/spacecp_promotion.htm *<!--{hook/spacecp_promotion_bottom}-->
template/default/home/spacecp_upload.htm *<!--{hook/spacecp_upload_extend}-->
template/default/home/spacecp_usergroup.htm *<!--{hook/spacecp_usergroup_top}-->
template/default/home/spacecp_usergroup.htm *<!--{hook/spacecp_usergroup_bottom}-->
template/default/home/spacecp_usergroup.htm *<!--{hook/spacecp_usergroup_top}-->
template/default/home/spacecp_usergroup.htm *<!--{hook/spacecp_usergroup_bottom}-->
template/default/home/spacecp_usergroup.htm *<!--{hook/spacecp_usergroup_top}-->
template/default/home/spacecp_usergroup.htm *<!--{hook/spacecp_usergroup_bottom}-->
template/default/home/space_album_pic.htm *<!--{hook/space_album_pic_top}-->
template/default/home/space_album_pic.htm *<!--{hook/space_album_pic_op_extra}-->
template/default/home/space_album_pic.htm *<!--{hook/space_album_pic_bottom}-->
template/default/home/space_album_pic.htm *<!--{hook/space_album_pic_face_extra}-->
template/default/home/space_album_view.htm *<!--{hook/space_album_op_extra}-->
template/default/home/space_blog_list.htm *<!--{hook/space_blog_list_status $k}-->
template/default/home/space_blog_view.htm *<!--{hook/space_blog_title}-->
template/default/home/space_blog_view.htm *<!--{hook/space_blog_share_method}-->
template/default/home/space_blog_view.htm *<!--{hook/space_blog_op_extra}-->
template/default/home/space_blog_view.htm *<!--{hook/space_blog_face_extra}-->
template/default/home/space_card.htm *<!--{hook/space_card_top}-->
template/default/home/space_card.htm *<!--{hook/space_card_baseinfo_middle}-->
template/default/home/space_card.htm *<!--{hook/space_card_baseinfo_bottom}-->
template/default/home/space_card.htm *<!--{hook/space_card_option}-->
template/default/home/space_card.htm *<!--{hook/space_card_magic_user}-->
template/default/home/space_card.htm *<!--{hook/space_card_bottom}-->
template/default/home/space_comment_li.htm *<!--{hook/global_space_comment_op $k}-->
template/default/home/space_comment_li.htm *<!--{hook/global_comment_bottom}-->
template/default/home/space_doing.htm *<!--{hook/space_doing_top}-->
template/default/home/space_doing.htm *<!--{hook/space_doing_bottom}-->
template/default/home/space_favorite.htm *<!--{hook/space_favorite_nav_extra}-->
template/default/home/space_friend.htm *<!--{hook/space_interaction_extra}-->
template/default/home/space_header.htm *<!--{hook/global_usernav_extra1}-->
template/default/home/space_header.htm *<!--{hook/global_usernav_extra2}-->
template/default/home/space_home.htm *<!--{hook/space_home_navlink}-->
template/default/home/space_home.htm *<!--{hook/space_home_side_top}-->
template/default/home/space_home.htm *<!--{hook/space_home_side_bottom}-->
template/default/home/space_home.htm *<!--{hook/space_home_top}-->
template/default/home/space_home.htm *<!--{hook/space_home_navlink}-->
template/default/home/space_home.htm *<!--{hook/space_home_bottom}-->
template/default/home/space_magic.htm *<!--{hook/magic_nav_extra}-->
template/default/home/space_medal.htm *<!--{hook/medal_nav_extra}-->
template/default/home/space_menu.htm *<!--{hook/space_menu_extra}-->
template/default/home/space_profile_body.htm *<!--{hook/space_profile_baseinfo_top}-->
template/default/home/space_profile_body.htm *<!--{hook/follow_profile_baseinfo_top}-->
template/default/home/space_profile_body.htm *<!--{hook/space_profile_baseinfo_middle}-->
template/default/home/space_profile_body.htm *<!--{hook/follow_profile_baseinfo_middle}-->
template/default/home/space_profile_body.htm *<!--{hook/space_profile_baseinfo_bottom}-->
template/default/home/space_profile_body.htm *<!--{hook/follow_profile_baseinfo_bottom}-->
template/default/home/space_profile_body.htm *<!--{hook/space_profile_extrainfo}-->
template/default/home/space_profile_body.htm *<!--{hook/follow_profile_extrainfo}-->
template/default/home/space_share_li.htm *<!--{hook/space_share_comment_op $k}-->
template/default/home/space_status.htm *<!--{hook/space_home_doing_sync_method}-->
template/default/home/space_wall.htm *<!--{hook/space_wall_face_extra}-->
template/default/member/login.htm *<!--{hook/logging_side_top}-->
template/default/member/login.htm *<!--{hook/logging_top}-->
template/default/member/login.htm *<!--{hook/logging_input}-->
template/default/member/login.htm *<!--{hook/logging_method}-->
template/default/member/login_simple.htm *<!--{hook/global_login_extra}-->
template/default/member/register.htm *<!--{hook/register_side_top}-->
template/default/member/register.htm *<!--{hook/register_top}-->
template/default/member/register.htm *<!--{hook/register_input}-->
template/default/member/register.htm *<!--{hook/register_logging_method}-->
template/default/member/register.htm *<!--{hook/register_bottom}-->
template/default/portal/portalcp_article.htm *<!--{hook/portalcp_top}-->
template/default/portal/portalcp_article.htm *<!--{hook/portalcp_extend}-->
template/default/portal/portalcp_article.htm *<!--{hook/portalcp_middle}-->
template/default/portal/portalcp_article.htm *<!--{hook/portalcp_bottom}-->
template/default/portal/view.htm *<!--{hook/view_article_top}-->
template/default/portal/view.htm *<!--{hook/view_article_subtitle}-->
template/default/portal/view.htm *<!--{hook/view_article_summary}-->
template/default/portal/view.htm *<!--{hook/view_article_content}-->
template/default/portal/view.htm *<!--{hook/view_share_method}-->
template/default/portal/view.htm *<!--{hook/view_article_op_extra}-->
template/default/portal/view.htm *<!--{hook/view_article_side_top}-->
template/default/portal/view.htm *<!--{hook/view_article_side_bottom}-->
template/default/ranklist/side_left.htm *<!--{hook/ranklist_nav_extra}-->
template/default/search/album.htm *<!--{hook/album_top}-->
template/default/search/album.htm *<!--{hook/album_bottom}-->
template/default/search/blog.htm *<!--{hook/blog_top}-->
template/default/search/blog.htm *<!--{hook/blog_bottom}-->
template/default/search/collection.htm *<!--{hook/collection_top}-->
template/default/search/collection.htm *<!--{hook/collection_bottom}-->
template/default/search/footer.htm *<!--{hook/global_footer}-->
template/default/search/footer.htm *<!--{hook/global_footerlink}-->
template/default/search/forum.htm *<!--{hook/forum_top}-->
template/default/search/forum.htm *<!--{hook/forum_bottom}-->
template/default/search/group.htm *<!--{hook/group_top}-->
template/default/search/group.htm *<!--{hook/group_bottom}-->
template/default/search/header.htm *<!--{hook/global_usernav_extra1}-->
template/default/search/header.htm *<!--{hook/global_usernav_extra2}-->
template/default/search/portal.htm *<!--{hook/portal_top}-->
template/default/search/portal.htm *<!--{hook/portal_bottom}-->
template/default/touch/common/footer.htm *<!--{hook/global_footer_mobile}-->
template/default/touch/common/header.htm *<!--{hook/global_header_mobile}-->
template/default/touch/forum/collection_all.htm *<!--{hook/collection_index_top}-->
template/default/touch/forum/collection_all.htm *<!--{hook/collection_index_bottom}-->
template/default/touch/forum/collection_comment.htm *<!--{hook/collection_viewoptions}-->
template/default/touch/forum/collection_comment.htm *<!--{hook/collection_view_top}-->
template/default/touch/forum/collection_comment.htm *<!--{hook/collection_side_bottom}-->
template/default/touch/forum/collection_followers.htm *<!--{hook/collection_viewoptions}-->
template/default/touch/forum/collection_followers.htm *<!--{hook/collection_view_top}-->
template/default/touch/forum/collection_followers.htm *<!--{hook/collection_side_bottom}-->
template/default/touch/forum/collection_index.htm *<!--{hook/collection_index_top}-->
template/default/touch/forum/collection_index.htm *<!--{hook/collection_index_bottom}-->
template/default/touch/forum/collection_mycollection.htm *<!--{hook/collection_index_top}-->
template/default/touch/forum/collection_mycollection.htm *<!--{hook/collection_index_bottom}-->
template/default/touch/forum/collection_nav.htm *<!--{hook/collection_nav_extra}-->
template/default/touch/forum/collection_view.htm *<!--{hook/collection_viewoptions}-->
template/default/touch/forum/collection_view.htm *<!--{hook/collection_view_top}-->
template/default/touch/forum/collection_view.htm *<!--{hook/collection_threadlistbottom}-->
template/default/touch/forum/collection_view.htm *<!--{hook/collection_relatedop}-->
template/default/touch/forum/collection_view.htm *<!--{hook/collection_side_bottom}-->
template/default/touch/forum/discuz.htm *<!--{hook/index_top}-->
template/default/touch/forum/discuz.htm *<!--{hook/index_catlist_top}-->
template/default/touch/forum/discuz.htm *<!--{hook/index_top_mobile}-->
template/default/touch/forum/discuz.htm *<!--{hook/index_middle_mobile}-->
template/default/touch/forum/find.htm *<!--{hook/index_find_extra_mobile}-->
template/default/touch/forum/forumdisplay.htm *<!--{hook/forumdisplay_top_mobile}-->
template/default/touch/forum/forumdisplay.htm *<!--{hook/forumdisplay_nav_mobile}-->
template/default/touch/forum/forumdisplay.htm *<!--{hook/forumdisplay_middle}-->
template/default/touch/forum/forumdisplay.htm *<!--{hook/forumdisplay_thread_mobile $key}-->
template/default/touch/forum/forumdisplay.htm *<!--{hook/forumdisplay_thread_content_mobile $key}-->
template/default/touch/forum/forumdisplay.htm *<!--{hook/forumdisplay_thread_foot_mobile $key}-->
template/default/touch/forum/forumdisplay.htm *<!--{hook/forumdisplay_bottom_mobile}-->
template/default/touch/forum/forumdisplay_fastpost.htm *<!--{hook/viewthread_fastpost_button_mobile}-->
template/default/touch/forum/forumdisplay_subforum.htm *<!--{hook/forumdisplay_subforum_extra_mobile $sub['fid']}-->
template/default/touch/forum/post.htm *<!--{hook/post_top_mobile}-->
template/default/touch/forum/post.htm *<!--{hook/post_middle_mobile}-->
template/default/touch/forum/post.htm *<!--{hook/post_bottom_mobile}-->
template/default/touch/forum/post.htm *<!--{hook/post_btn_extra_mobile}-->
template/default/touch/forum/post_activity.htm *<!--{hook/post_activity_extra}-->
template/default/touch/forum/post_debate.htm *<!--{hook/post_debate_extra}-->
template/default/touch/forum/post_editor_attribute.htm *<!--{hook/post_attribute_extra_mobile}-->
template/default/touch/forum/post_editor_attribute.htm *<!--{hook/post_attribute_extra_body_mobile}-->
template/default/touch/forum/post_poll.htm *<!--{hook/post_poll_extra}-->
template/default/touch/forum/post_reward.htm *<!--{hook/post_reward_extra}-->
template/default/touch/forum/post_trade.htm *<!--{hook/post_trade_extra}-->
template/default/touch/forum/trade_info.htm *<!--{hook/viewthread_tradeinfo_extra_mobile}-->
template/default/touch/forum/viewthread.htm *<!--{hook/viewthread_top_mobile}-->
template/default/touch/forum/viewthread.htm *<!--{hook/viewthread_posttop_mobile $postcount}-->
template/default/touch/forum/viewthread.htm *<!--{hook/viewthread_postfooter_mobile $postcount}-->
template/default/touch/forum/viewthread.htm *<!--{hook/viewthread_postbottom_mobile $postcount}-->
template/default/touch/forum/viewthread.htm *<!--{hook/viewthread_bottom_mobile}-->
template/default/touch/group/group.htm *<!--{hook/forumdisplay_top_mobile}-->
template/default/touch/group/group_list.htm *<!--{hook/forumdisplay_thread_mobile $key}-->
template/default/touch/home/spacecp_avatar.htm *<!--{hook/spacecp_avatar_top_mobile}-->
template/default/touch/home/spacecp_avatar.htm *<!--{hook/spacecp_avatar_bottom}-->
template/default/touch/home/spacecp_blog.htm *<!--{hook/spacecp_blog_top_mobile}-->
template/default/touch/home/spacecp_blog.htm *<!--{hook/spacecp_blog_middle_mobile}-->
template/default/touch/home/spacecp_blog.htm *<!--{hook/spacecp_blog_bottom_mobile}-->
template/default/touch/home/spacecp_credit_buy.htm *<!--{hook/spacecp_credit_top}-->
template/default/touch/home/spacecp_credit_buy.htm *<!--{hook/spacecp_credit_bottom}-->
template/default/touch/home/spacecp_credit_exchange.htm *<!--{hook/spacecp_credit_top}-->
template/default/touch/home/spacecp_credit_exchange.htm *<!--{hook/spacecp_credit_bottom}-->
template/default/touch/home/spacecp_credit_log.htm *<!--{hook/spacecp_credit_top}-->
template/default/touch/home/spacecp_credit_log.htm *<!--{hook/spacecp_credit_bottom}-->
template/default/touch/home/spacecp_credit_rule.htm *<!--{hook/spacecp_credit_top}-->
template/default/touch/home/spacecp_credit_rule.htm *<!--{hook/spacecp_credit_bottom}-->
template/default/touch/home/spacecp_credit_transfer.htm *<!--{hook/spacecp_credit_top}-->
template/default/touch/home/spacecp_credit_transfer.htm *<!--{hook/spacecp_credit_bottom}-->
template/default/touch/home/spacecp_payment_redirect.htm *<!--{hook/spacecp_payment_redirect_extend}-->
template/default/touch/home/spacecp_privacy.htm *<!--{hook/spacecp_privacy_top}-->
template/default/touch/home/spacecp_privacy.htm *<!--{hook/spacecp_privacy_base_extra}-->
template/default/touch/home/spacecp_privacy.htm *<!--{hook/spacecp_privacy_feed_extra}-->
template/default/touch/home/spacecp_privacy.htm *<!--{hook/spacecp_privacy_other_extra}-->
template/default/touch/home/spacecp_privacy.htm *<!--{hook/spacecp_privacy_bottom}-->
template/default/touch/home/spacecp_profile.htm *<!--{hook/spacecp_profile_top}-->
template/default/touch/home/spacecp_profile.htm *<!--{hook/spacecp_profile_extra}-->
template/default/touch/home/spacecp_profile.htm *<!--{hook/spacecp_profile_bottom}-->
template/default/touch/home/spacecp_promotion.htm *<!--{hook/spacecp_promotion_top}-->
template/default/touch/home/spacecp_promotion.htm *<!--{hook/spacecp_promotion_bottom}-->
template/default/touch/home/spacecp_usergroup.htm *<!--{hook/spacecp_usergroup_top}-->
template/default/touch/home/spacecp_usergroup.htm *<!--{hook/spacecp_usergroup_top}-->
template/default/touch/home/spacecp_usergroup.htm *<!--{hook/spacecp_usergroup_top}-->
template/default/touch/home/spacecp_usergroup.htm *<!--{hook/spacecp_usergroup_bottom}-->
template/default/touch/home/spacecp_usergroup.htm *<!--{hook/spacecp_usergroup_top}-->
template/default/touch/home/spacecp_usergroup.htm *<!--{hook/spacecp_usergroup_bottom}-->
template/default/touch/home/spacecp_usergroup.htm *<!--{hook/spacecp_usergroup_top}-->
template/default/touch/home/spacecp_usergroup.htm *<!--{hook/spacecp_usergroup_bottom}-->
template/default/touch/home/space_comment_li.htm *<!--{hook/global_space_comment_op_mobile $k}-->
template/default/touch/home/space_comment_li.htm *<!--{hook/global_comment_bottom_mobile}-->
template/default/touch/home/space_favorite.htm *<!--{hook/space_favorite_nav_extra_mobile}-->
template/default/touch/home/space_profile.htm *<!--{hook/space_profile_top_mobile}-->
template/default/touch/home/space_profile.htm *<!--{hook/space_profile_nav_extra_mobile}-->
template/default/touch/home/space_profile.htm *<!--{hook/space_profile_baseinfo_top_mobile}-->
template/default/touch/home/space_profile.htm *<!--{hook/space_profile_baseinfo_bottom_mobile}-->
template/default/touch/home/space_profile.htm *<!--{hook/space_profile_extrainfo_mobile}-->
template/default/touch/home/space_share_li.htm *<!--{hook/space_share_comment_op $k}-->
template/default/touch/member/login.htm *<!--{hook/logging_top_mobile}-->
template/default/touch/member/login.htm *<!--{hook/logging_bottom_mobile}-->
template/default/touch/member/register.htm *<!--{hook/register_top_mobile}-->
template/default/touch/member/register.htm *<!--{hook/register_input_mobile}-->
template/default/touch/member/register.htm *<!--{hook/register_bottom_mobile}-->
template/default/touch/portal/index.htm *<!--{hook/portal_index_top_mobile}-->
template/default/touch/portal/index.htm *<!--{hook/portal_index_middle_mobile}-->
template/default/touch/portal/index.htm *<!--{hook/portal_index_bottom_mobile}-->
template/default/touch/portal/view.htm *<!--{hook/view_article_top_mobile}-->
template/default/touch/portal/view.htm *<!--{hook/view_article_subtitle_mobile}-->
template/default/touch/portal/view.htm *<!--{hook/view_article_summary_mobile}-->
template/default/touch/portal/view.htm *<!--{hook/view_article_content_mobile}-->
template/default/touch/ranklist/side_top.htm *<!--{hook/ranklist_nav_extra}-->
template/default/touch/search/album.htm *<!--{hook/album_top}-->
template/default/touch/search/album.htm *<!--{hook/album_bottom}-->
template/default/touch/search/blog.htm *<!--{hook/blog_top}-->
template/default/touch/search/blog.htm *<!--{hook/blog_bottom}-->
template/default/touch/search/collection.htm *<!--{hook/collection_top}-->
template/default/touch/search/collection.htm *<!--{hook/collection_bottom}-->
template/default/touch/search/forum.htm *<!--{hook/forum_top}-->
template/default/touch/search/forum.htm *<!--{hook/forum_bottom}-->
template/default/touch/search/group.htm *<!--{hook/group_top}-->
template/default/touch/search/group.htm *<!--{hook/group_bottom}-->
template/default/touch/search/portal.htm *<!--{hook/portal_top}-->
template/default/touch/search/portal.htm *<!--{hook/portal_bottom}-->

1
source/admincp/index.htm Normal file
View File

@@ -0,0 +1 @@

View File

View File

@@ -0,0 +1,157 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: moderate_article.php 25764 2011-11-22 03:39:57Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
if(!submitcheck('modsubmit') && !$_GET['fast']) {
shownav('topic', $lang['moderate_articles']);
showsubmenu('nav_moderate_articles', $submenu);
$select[$_GET['tpp']] = $_GET['tpp'] ? "selected='selected'" : '';
$tpp_options = "<option value='20' $select[20]>20</option><option value='50' $select[50]>50</option><option value='100' $select[100]>100</option>";
$tpp = !empty($_GET['tpp']) ? $_GET['tpp'] : '20';
$start_limit = ($page - 1) * $ppp;
$dateline = $_GET['dateline'] ? $_GET['dateline'] : '604800';
$dateline_options = '';
foreach(array('all', '604800', '2592000', '7776000') as $v) {
$selected = '';
if($dateline == $v) {
$selected = "selected='selected'";
}
$dateline_options .= "<option value=\"$v\" $selected>".cplang("dateline_$v");
}
$cat_select = '<option value="">'.$lang['all'].'</option>';
loadcache('portalcategory');
foreach($_G['cache']['portalcategory'] as $cat) {
$selected = '';
if($cat['catid'] == $_GET['catid']) {
$selected = 'selected="selected"';
}
$cat_select .= "<option value=\"{$cat['catid']}\" $selected>{$cat['catname']}</option>";
}
$article_status = 1;
if($_GET['filter'] == 'ignore') {
$article_status = 2;
}
showformheader("moderate&operation=articles");
showboxheader('search');
showtableheader();
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
cplang('username'), "<input size=\"15\" name=\"username\" type=\"text\" value=\"{$_GET['username']}\" />",
cplang('moderate_article_category'), "<select name=\"catid\">$cat_select</select>",
)
);
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
"{$lang['perpage']}",
"<select name=\"tpp\">$tpp_options</select><label><input name=\"showcensor\" type=\"checkbox\" class=\"checkbox\" value=\"yes\" ".($showcensor ? ' checked="checked"' : '')."/> {$lang['moderate_showcensor']}</label>",
"{$lang['moderate_bound']}",
"<select name=\"filter\">$filteroptions</select>
<select name=\"dateline\">$dateline_options</select>
<input class=\"btn\" type=\"submit\" value=\"{$lang['search']}\" />"
)
);
showtablefooter();
showboxfooter();
$pagetmp = $page;
$sqlwhere = "";
$modcount = C::t('common_moderate')->fetch_all_for_article($moderatestatus, $_GET['catid'], $_GET['username'], $dateline, 1);
do {
$start_limit = ($pagetmp - 1) * $tpp;
$query = C::t('common_moderate')->fetch_all_for_article($moderatestatus, $_GET['catid'], $_GET['username'], $dateline, 0, $start_limit, $tpp);
$pagetmp = $pagetmp - 1;
} while($pagetmp > 0 && count($query) == 0);
$page = $pagetmp + 1;
$multipage = multi($modcount, $tpp, $page, ADMINSCRIPT."?action=moderate&operation=articles&filter=$filter&catid={$_GET['catid']}&dateline={$_GET['dateline']}&username={$_GET['username']}&keyword={$_GET['keyword']}&tpp=$tpp&showcensor=$showcensor");
showtableheader('', 'nobottom');
echo '<tr><td><p class="margintop marginbot"><a href="javascript:;" onclick="expandall();">'.cplang('moderate_all_expand').'</a> &nbsp;<a href="javascript:;" onclick="foldall();">'.cplang('moderate_all_fold').'</a></p></td></tr>';
showtablefooter();
showtableheader();
$censor = & discuz_censor::instance();
$censor->highlight = '#FF0000';
require_once libfile('function/misc');
foreach($query as $article) {
$article['dateline'] = dgmdate($article['dateline']);
if($showcensor) {
$censor->check($article['title']);
$censor->check($article['summary']);
}
$article_censor_words = $censor->words_found;
if(count($article_censor_words) > 3) {
$article_censor_words = array_slice($article_censor_words, 0, 3);
}
$article['censorwords'] = implode(', ', $article_censor_words);
$article['modarticlekey'] = modauthkey($article['aid']);
if(count($article_censor_words)) {
$article_censor_text = "<span style=\"color: red;\">({$article['censorwords']})</span>";
} else {
$article_censor_text = '';
}
showtagheader('tbody', '', true, 'hover');
showtablerow("id=\"mod_{$article['aid']}_row1\"", array("id=\"mod_{$article['aid']}_row1_op\" rowspan=\"3\" class=\"rowform threadopt\" style=\"width:80px;\"", '', 'width="120"', 'width="55"'), array(
"<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$article['aid']}]\" id=\"mod_{$article['aid']}_1\" value=\"validate\" onclick=\"mod_setbg({$article['aid']}, 'validate');\"><label for=\"mod_{$article['aid']}_1\">{$lang['validate']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$article['aid']}]\" id=\"mod_{$article['aid']}_2\" value=\"delete\" onclick=\"mod_setbg({$article['aid']}, 'delete');\"><label for=\"mod_{$article['aid']}_2\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$article['aid']}]\" id=\"mod_{$article['aid']}_3\" value=\"ignore\" onclick=\"mod_setbg({$article['aid']}, 'ignore');\"><label for=\"mod_{$article['aid']}_3\">{$lang['ignore']}</label></li></ul>",
"<h3><a href=\"javascript:;\" onclick=\"display_toggle({$article['aid']});\">{$article['title']} $article_censor_text</a></h3>",
"<p><a target=\"_blank\" href=\"".ADMINSCRIPT."?action=members&operation=search&uid={$article['uid']}&submit=yes\">{$article['username']}</a></p> <p>{$article['dateline']}</p>",
"<a target=\"_blank\" href=\"portal.php?mod=view&aid={$article['aid']}&modarticlekey={$article['modarticlekey']}\">{$lang['view']}</a>&nbsp;<a href=\"portal.php?mod=portalcp&ac=article&op=edit&aid={$article['aid']}&modarticlekey={$article['modarticlekey']}\" target=\"_blank\">{$lang['edit']}</a>",
));
showtablerow("id=\"mod_{$article['aid']}_row2\"", 'colspan="4" style="padding: 10px; line-height: 180%;"', '<div style="overflow: auto; overflow-x: hidden; max-height:120px; height:auto !important; height:100px; word-break: break-all;">'.$article['summary'].'</div>');
showtablerow("id=\"mod_{$article['aid']}_row3\"", 'class="threadopt threadtitle" colspan="4"', "<a href=\"?action=moderate&operation=articles&fast=1&aid={$article['aid']}&moderate[{$article['aid']}]=validate&page=$page&frame=no\" target=\"fasthandle\">{$lang['validate']}</a> | <a href=\"?action=moderate&operation=articles&fast=1&aid={$article['aid']}&moderate[{$article['aid']}]=delete&page=$page&frame=no\" target=\"fasthandle\">{$lang['delete']}</a> | <a href=\"?action=moderate&operation=articles&fast=1&aid={$article['aid']}&moderate[{$article['aid']}]=ignore&page=$page&frame=no\" target=\"fasthandle\">{$lang['ignore']}</a>");
showtagfooter('tbody');
}
showsubmit('modsubmit', 'submit', '', '<a href="#all" onclick="mod_setbg_all(\'validate\')">'.cplang('moderate_all_validate').'</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'delete\')">'.cplang('moderate_all_delete').'</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'ignore\')">'.cplang('moderate_all_ignore').'</a> &nbsp;<a href="#all" onclick="mod_cancel_all();">'.cplang('moderate_all_cancel').'</a>', $multipage, false);
showtablefooter();
showformfooter();
} else {
$moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
$validates = $deletes = $ignores = 0;
if(is_array($moderate)) {
foreach($moderate as $aid => $act) {
$moderation[$act][] = $aid;
}
}
if($validate_aids = dimplode($moderation['validate'])) {
$validates = C::t('portal_article_title')->update($moderation['validate'], array('status' => '0'));
updatemoderate('aid', $moderation['validate'], 2);
}
if(!empty($moderation['delete'])) {
require_once libfile('function/delete');
$articles = deletearticle($moderation['delete']);
$deletes = count($articles);
updatemoderate('aid', $moderation['delete'], 2);
}
if($ignore_aids = dimplode($moderation['ignore'])) {
$ignores = C::t('portal_article_title')->update($moderation['ignore'], array('status' => '2'));
updatemoderate('aid', $moderation['ignore'], 1);
}
if($_GET['fast']) {
echo callback_js($_GET['aid']);
exit;
} else {
cpmsg('moderate_articles_succeed', "action=moderate&operation=articles&page=$page&filter=$filter&catid={$_GET['catid']}&dateline={$_GET['dateline']}&username={$_GET['username']}&keyword={$_GET['keyword']}&idtype={$_GET['idtype']}&tpp={$_GET['tpp']}&showcensor=$showcensor", 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'deletes' => $deletes));
}
}
?>

View File

@@ -0,0 +1,157 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: moderate_blog.php 31710 2012-09-24 07:24:52Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
if(!submitcheck('modsubmit') && !$_GET['fast']) {
require_once libfile('function/discuzcode');
shownav('topic', $lang['moderate_blogs']);
showsubmenu('nav_moderate_blogs', $submenu);
$select[$_GET['tpp']] = $_GET['tpp'] ? "selected='selected'" : '';
$tpp_options = "<option value='20' $select[20]>20</option><option value='50' $select[50]>50</option><option value='100' $select[100]>100</option>";
$tpp = !empty($_GET['tpp']) ? $_GET['tpp'] : '20';
$start_limit = ($page - 1) * $ppp;
$dateline = $_GET['dateline'] ? $_GET['dateline'] : '604800';
$dateline_options = '';
foreach(array('all', '604800', '2592000', '7776000') as $v) {
$selected = '';
if($dateline == $v) {
$selected = "selected='selected'";
}
$dateline_options .= "<option value=\"$v\" $selected>".cplang("dateline_$v");
}
$blog_status = 1;
if($_GET['filter'] == 'ignore') {
$blog_status = 2;
}
showformheader("moderate&operation=blogs");
showboxheader('search');
showtableheader();
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
cplang('username'), "<input size=\"15\" name=\"username\" type=\"text\" value=\"{$_GET['username']}\" />",
cplang('moderate_title_keyword'), "<input size=\"15\" name=\"title\" type=\"text\" value=\"{$_GET['title']}\" />",
)
);
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
"{$lang['perpage']}",
"<select name=\"tpp\">$tpp_options</select><label><input name=\"showcensor\" type=\"checkbox\" class=\"checkbox\" value=\"yes\" ".($showcensor ? ' checked="checked"' : '')."/> {$lang['moderate_showcensor']}</label>",
"{$lang['moderate_bound']}",
"<select name=\"filter\">$filteroptions</select>
<select name=\"dateline\">$dateline_options</select>
<input class=\"btn\" type=\"submit\" value=\"{$lang['search']}\" />"
)
);
showtablefooter();
showboxfooter();
$pagetmp = $page;
$modcount = C::t('common_moderate')->count_by_search_for_blog($moderatestatus, $_GET['username'], (($dateline && $dateline != 'all') ? (TIMESTAMP - $dateline) : null), $_GET['title']);
do {
$start_limit = ($pagetmp - 1) * $tpp;
$blogarr = C::t('common_moderate')->fetch_all_by_search_for_blog($moderatestatus, $_GET['username'], (($dateline && $dateline != 'all') ? (TIMESTAMP - $dateline) : null), $_GET['title'], $start_limit, $tpp);
$pagetmp = $pagetmp - 1;
} while($pagetmp > 0 && empty($blogarr));
$page = $pagetmp + 1;
$multipage = multi($modcount, $tpp, $page, ADMINSCRIPT."?action=moderate&operation=blogs&filter=$filter&modfid=$modfid&ppp=$tpp&showcensor=$showcensor&dateline=$dateline");
showtableheader('', 'nobottom');
echo '<tr><td><p class="margintop marginbot"><a href="javascript:;" onclick="expandall();">'.cplang('moderate_all_expand').'</a> &nbsp;<a href="javascript:;" onclick="foldall();">'.cplang('moderate_all_fold').'</a></p></td></tr>';
showtablefooter();
showtableheader();
$censor = & discuz_censor::instance();
$censor->highlight = '#FF0000';
require_once libfile('function/misc');
foreach($blogarr as $blog) {
$blog['dateline'] = dgmdate($blog['dateline']);
$blog['subject'] = $blog['subject'] ? '<b>'.$blog['subject'].'</b>' : '<i>'.$lang['nosubject'].'</i>';
if($showcensor) {
$censor->check($blog['subject']);
$censor->check($blog['message']);
}
$blog_censor_words = $censor->words_found;
if(count($blog_censor_words) > 3) {
$blog_censor_words = array_slice($blog_censor_words, 0, 3);
}
$blog['censorwords'] = implode(', ', $blog_censor_words);
$blog['modblogkey'] = modauthkey($blog['blogid']);
$blog['postip'] = $blog['postip'] . '-' . convertip($blog['postip']);
if(count($blog_censor_words)) {
$blog_censor_text = "<span style=\"color: red;\">({$blog['censorwords']})</span>";
} else {
$blog_censor_text = '';
}
showtagheader('tbody', '', true, 'hover');
showtablerow("id=\"mod_{$blog['blogid']}_row1\"", array("id=\"mod_{$blog['blogid']}_row1_op\" rowspan=\"3\" class=\"rowform threadopt\" style=\"width:80px;\"", '', 'width="120"', 'width="120"', 'width="55"'), array(
"<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$blog['blogid']}]\" id=\"mod_{$blog['blogid']}_1\" value=\"validate\" onclick=\"mod_setbg({$blog['blogid']}, 'validate');\"><label for=\"mod_{$blog['blogid']}_1\">{$lang['validate']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$blog['blogid']}]\" id=\"mod_{$blog['blogid']}_2\" value=\"delete\" onclick=\"mod_setbg({$blog['blogid']}, 'delete');\"><label for=\"mod_{$blog['blogid']}_2\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$blog['blogid']}]\" id=\"mod_{$blog['blogid']}_3\" value=\"ignore\" onclick=\"mod_setbg({$blog['blogid']}, 'ignore');\"><label for=\"mod_{$blog['blogid']}_3\">{$lang['ignore']}</label></li></ul>",
"<h3><a href=\"javascript:;\" onclick=\"display_toggle('{$blog['blogid']}');\">{$blog['subject']}</a> $blog_censor_text</h3><p>{$blog['postip']}</p>",
$blog['classname'],
"<p><a target=\"_blank\" href=\"".ADMINSCRIPT."?action=members&operation=search&uid={$blog['uid']}&submit=yes\">{$blog['username']}</a></p> <p>{$blog['dateline']}</p>",
"<a href=\"home.php?mod=space&uid={$blog['uid']}&do=blog&id={$blog['blogid']}&modblogkey={$blog['modblogkey']}\" target=\"_blank\">{$lang['view']}</a>&nbsp;<a href=\"home.php?mod=spacecp&ac=blog&blogid={$blog['blogid']}&modblogkey={$blog['modblogkey']}\" target=\"_blank\">{$lang['edit']}</a>",
));
showtablerow("id=\"mod_{$blog['blogid']}_row2\"", 'colspan="4" style="padding: 10px; line-height: 180%;"', '<div style="overflow: auto; overflow-x: hidden; max-height:120px; height:auto !important; height:100px; word-break: break-all;">'.$blog['message'].'</div>');
showtablerow("id=\"mod_{$blog['blogid']}_row3\"", 'class="threadopt threadtitle" colspan="4"', "<a href=\"?action=moderate&operation=blogs&fast=1&blogid={$blog['blogid']}&moderate[{$blog['blogid']}]=validate&page=$page&frame=no\" target=\"fasthandle\">{$lang['validate']}</a> | <a href=\"?action=moderate&operation=blogs&fast=1&blogid={$blog['blogid']}&moderate[{$blog['blogid']}]=delete&page=$page&frame=no\" target=\"fasthandle\">{$lang['delete']}</a> | <a href=\"?action=moderate&operation=blogs&fast=1&blogid={$blog['blogid']}&moderate[{$blog['blogid']}]=ignore&page=$page&frame=no\" target=\"fasthandle\">{$lang['ignore']}</a>");
showtagfooter('tbody');
}
showsubmit('modsubmit', 'submit', '', '<a href="#all" onclick="mod_setbg_all(\'validate\')">'.cplang('moderate_all_validate').'</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'delete\')">'.cplang('moderate_all_delete').'</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'ignore\')">'.cplang('moderate_all_ignore').'</a> &nbsp;<a href="#all" onclick="mod_cancel_all();">'.cplang('moderate_all_cancel').'</a>', $multipage, false);
showtablefooter();
showformfooter();
} else {
$moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
$validates = $deletes = $ignores = 0;
if(is_array($moderate)) {
foreach($moderate as $blogid => $act) {
$moderate[$act][] = $blogid;
}
}
if($moderate['validate']) {
$validates = C::t('home_blog')->update($moderate['validate'], array('status' => '0'));
$query_t = C::t('home_blog')->count_uid_by_blogid($moderate['validate']);
foreach($query_t as $blog_user) {
$credit_times = $blog_user['count'];
updatecreditbyaction('publishblog', $blog_user['uid'], array('blogs' => 1), '', $credit_times);
}
updatemoderate('blogid', $moderate['validate'], 2);
}
if($moderate['delete']) {
require_once libfile('function/delete');
$delete_blogs = deleteblogs($moderate['delete']);
$deletes = count($delete_blogs);
updatemoderate('blogid', $moderate['delete'], 2);
}
if($moderate['ignore']) {
$ignores = C::t('home_blog')->update($moderate['ignore'], array('status' => '2'));
updatemoderate('blogid', $moderate['ignore'], 1);
}
if($_GET['fast']) {
echo callback_js($_GET['blogid']);
exit;
} else {
cpmsg('moderate_blogs_succeed', "action=moderate&operation=blogs&page=$page&filter=$filter&dateline={$_GET['dateline']}&username={$_GET['username']}&title={$_GET['title']}&tpp={$_GET['tpp']}&showcensor=$showcensor", 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'recycles' => $recycles, 'deletes' => $deletes));
}
}
?>

View File

@@ -0,0 +1,191 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: moderate_comment.php 31996 2012-10-30 06:15:14Z liulanbo $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
if(!submitcheck('modsubmit') && !$_GET['fast']) {
shownav('topic', $lang['moderate_comments']);
showsubmenu('nav_moderate_comments', $submenu);
$select[$_GET['tpp']] = $_GET['tpp'] ? "selected='selected'" : '';
$tpp_options = "<option value='20' $select[20]>20</option><option value='50' $select[50]>50</option><option value='100' $select[100]>100</option>";
$tpp = !empty($_GET['tpp']) ? $_GET['tpp'] : '20';
$start_limit = ($page - 1) * $ppp;
$dateline = $_GET['dateline'] ? $_GET['dateline'] : '604800';
$dateline_options = '';
foreach(array('all', '604800', '2592000', '7776000') as $v) {
$selected = '';
if($dateline == $v) {
$selected = "selected='selected'";
}
$dateline_options .= "<option value=\"$v\" $selected>".cplang("dateline_$v");
}
$idtype_select = '<option value="">'.$lang['all'].'</option>';
foreach(array('uid', 'blogid', 'picid', 'sid') as $v) {
$selected = '';
if($_GET['idtype'] == $v) {
$selected = 'selected="selected"';
}
$idtype_select .= "<option value=\"$v\" $selected>".$lang["comment_$v"]."</option>";
}
$comment_status = 1;
if($_GET['filter'] == 'ignore') {
$comment_status = 2;
}
showformheader("moderate&operation=comments");
showboxheader('search');
showtableheader();
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
cplang('username'), "<input size=\"15\" name=\"username\" type=\"text\" value=\"{$_GET['username']}\" />",
cplang('moderate_content_keyword'), "<input size=\"15\" name=\"keyword\" type=\"text\" value=\"{$_GET['keyword']}\" />",
)
);
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
"{$lang['perpage']}",
"<select name=\"tpp\">$tpp_options</select><label><input name=\"showcensor\" type=\"checkbox\" class=\"checkbox\" value=\"yes\" ".($showcensor ? ' checked="checked"' : '')."/> {$lang['moderate_showcensor']}</label>",
"{$lang['moderate_bound']}",
"<select name=\"filter\">$filteroptions</select>
<select name=\"idtype\">$idtype_select</select>
<select name=\"dateline\">$dateline_options</select>
<input class=\"btn\" type=\"submit\" value=\"{$lang['search']}\" />"
)
);
showtablefooter();
showboxfooter();
$pagetmp = $page;
$modcount = C::t('common_moderate')->count_by_search_for_commnet($_GET['idtype'], $moderatestatus, $_GET['username'], (($dateline && $dateline != 'all') ? (TIMESTAMP - $dateline) : null), $_GET['keyword']);
do {
$start_limit = ($pagetmp - 1) * $tpp;
$commentarr = C::t('common_moderate')->fetch_all_by_search_for_comment($_GET['idtype'], $moderatestatus, $_GET['username'], (($dateline && $dateline != 'all') ? (TIMESTAMP - $dateline) : null), $_GET['keyword'], $start_limit, $tpp);
$pagetmp = $pagetmp - 1;
} while($pagetmp > 0 && empty($commentarr));
$page = $pagetmp + 1;
$multipage = multi($modcount, $tpp, $page, ADMINSCRIPT."?action=moderate&operation=comments&filter=$filter&dateline={$_GET['dateline']}&username={$_GET['username']}&keyword={$_GET['keyword']}&idtype={$_GET['idtype']}&ppp=$tpp&showcensor=$showcensor");
showtableheader('', 'nobottom');
echo '<tr><td><p class="margintop marginbot"><a href="javascript:;" onclick="expandall();">'.cplang('moderate_all_expand').'</a> &nbsp;<a href="javascript:;" onclick="foldall();">'.cplang('moderate_all_fold').'</a></p></td></tr>';
showtablefooter();
showtableheader();
$censor = & discuz_censor::instance();
$censor->highlight = '#FF0000';
require_once libfile('function/misc');
foreach($commentarr as $comment) {
$comment['dateline'] = dgmdate($comment['dateline']);
$short_desc = cutstr($comment['message'], 75);
if($showcensor) {
$censor->check($short_desc);
$censor->check($comment['message']);
}
$comment_censor_words = $censor->words_found;
if(count($comment_censor_words) > 3) {
$comment_censor_words = array_slice($comment_censor_words, 0, 3);
}
$comment['censorwords'] = implode(', ', $comment_censor_words);
$comment['ip'] = $comment['ip'] . ' - ' . convertip($comment['ip']);
$comment['modkey'] = modauthkey($comment['id']);
$comment['modcommentkey'] = modauthkey($comment['cid']);
if($showcensor) {
if(count($comment_censor_words)) {
$comment_censor_text = "<span style=\"color: red;\">({$comment['censorwords']})</span>";
} else {
$comment_censor_text = lang('admincp', 'no_censor_word');
}
}
$viewurl = '';
$commenttype = '';
$editurl = "home.php?mod=spacecp&ac=comment&op=edit&cid={$comment['cid']}&modcommentkey={$comment['modcommentkey']}";
switch($comment['idtype']) {
case 'uid':
$commenttype = lang('admincp', 'comment_uid');
$viewurl = "home.php?mod=space&uid={$comment['uid']}&do=wall#comment_anchor_{$comment['cid']}";
break;
case 'blogid':
$commenttype = lang('admincp', 'comment_blogid');
$viewurl = "home.php?mod=space&uid={$comment['uid']}&do=blog&id={$comment['id']}&modblogkey={$comment['modkey']}#comment_anchor_{$comment['cid']}";
break;
case 'picid':
$commenttype = lang('admincp', 'comment_picid');
$viewurl = "home.php?mod=space&uid={$comment['uid']}&do=album&picid={$comment['id']}&modpickey={$comment['modkey']}#comment_anchor_{$comment['cid']}";
break;
case 'sid':
$commenttype = lang('admincp', 'comment_sid');
$viewurl = "home.php?mod=space&uid={$comment['uid']}&do=share&id={$comment['id']}#comment_anchor_{$comment['cid']}";
break;
}
showtagheader('tbody', '', true, 'hover');
showtablerow("id=\"mod_{$comment['cid']}_row1\"", array("id=\"mod_{$comment['cid']}_row1_op\" rowspan=\"3\" class=\"rowform threadopt\" style=\"width:80px;\"", '', 'width="120"', 'width="120"', 'width="55"', 'width="55"'), array(
"<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$comment['cid']}]\" id=\"mod_{$comment['cid']}_1\" value=\"validate\" onclick=\"mod_setbg({$comment['cid']}, 'validate');\"><label for=\"mod_{$comment['cid']}_1\">{$lang['validate']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$comment['cid']}]\" id=\"mod_{$comment['cid']}_2\" value=\"delete\" onclick=\"mod_setbg({$comment['cid']}, 'delete');\"><label for=\"mod_{$comment['cid']}_2\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$comment['cid']}]\" id=\"mod_{$comment['cid']}_3\" value=\"ignore\" onclick=\"mod_setbg({$comment['cid']}, 'ignore');\"><label for=\"mod_{$comment['cid']}_3\">{$lang['ignore']}</label></li></ul>",
"<h3><a href=\"javascript:;\" onclick=\"display_toggle({$comment['cid']});\"> $short_desc $comment_censor_text</a></h3><p>{$comment['ip']}</p>",
$commenttype.'<input name="idtypes['.$comment['cid'].']}" type="hidden" value="'.$comment['idtype'].'">',
"<p><a target=\"_blank\" href=\"".ADMINSCRIPT."?action=members&operation=search&uid={$comment['authorid']}&submit=yes\">{$comment['author']}</a></p> <p>{$comment['dateline']}</p>",
"<a target=\"_blank\" href=\"$viewurl\">{$lang['view']}</a>&nbsp;<a href=\"$editurl\" target=\"_blank\">{$lang['edit']}</a>",
));
showtablerow("id=\"mod_{$comment['cid']}_row2\"", 'colspan="4" style="padding: 10px; line-height: 180%;"', '<div style="overflow: auto; overflow-x: hidden; max-height:120px; height:auto !important; height:100px; word-break: break-all;">'.$comment['message'].'</div>');
showtablerow("id=\"mod_{$comment['cid']}_row3\"", 'class="threadopt threadtitle" colspan="4"', "<a href=\"?action=moderate&operation=comments&fast=1&cid={$comment['cid']}&moderate[{$comment['cid']}]=validate&idtypes[{$comment['cid']}]={$comment['idtype']}&page=$page&frame=no\" target=\"fasthandle\">{$lang['validate']}</a> | <a href=\"?action=moderate&operation=comments&fast=1&cid={$comment['cid']}&moderate[{$comment['cid']}]=delete&idtypes[{$comment['cid']}]={$comment['idtype']}&page=$page&frame=no\" target=\"fasthandle\">{$lang['delete']}</a> | <a href=\"?action=moderate&operation=comments&fast=1&cid={$comment['cid']}&moderate[{$comment['cid']}]=ignore&idtypes[{$comment['cid']}]={$comment['idtype']}&page=$page&frame=no\" target=\"fasthandle\">{$lang['ignore']}</a>");
showtagfooter('tbody');
}
showsubmit('modsubmit', 'submit', '', '<a href="#all" onclick="mod_setbg_all(\'validate\')">'.cplang('moderate_all_validate').'</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'delete\')">'.cplang('moderate_all_delete').'</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'ignore\')">'.cplang('moderate_all_ignore').'</a> &nbsp;<a href="#all" onclick="mod_cancel_all();">'.cplang('moderate_all_cancel').'</a>', $multipage, false);
showtablefooter();
showformfooter();
} else {
$moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
$validates = $deletes = $ignores = 0;
$moderatedata = array();
if(is_array($moderate)) {
foreach($moderate as $cid => $act) {
$moderation[$act][] = $cid;
$moderatedata[$act][$_GET['idtypes'][$cid]][] = $cid;
}
}
foreach($moderatedata as $act => $typeids) {
foreach($typeids as $idtype => $ids) {
$op = $act == 'ignore' ? 1 : 2;
updatemoderate($idtype.'_cid', $ids, $op);
}
}
if($moderation['validate']) {
$validates = C::t('home_comment')->update_comment($moderation['validate'], array('status' => '0'));
}
if(!empty($moderation['delete'])) {
require_once libfile('function/delete');
$comments = deletecomments($moderation['delete']);
$deletes = count($comments);
}
if($moderation['ignore']) {
$ignores = C::t('home_comment')->update_comment($moderation['ignore'], array('status' => '2'));
}
if($_GET['fast']) {
echo callback_js($_GET['cid']);
exit;
} else {
cpmsg('moderate_comments_succeed', "action=moderate&operation=comments&page=$page&filter=$filter&dateline={$_GET['dateline']}&username={$_GET['username']}&keyword={$_GET['keyword']}&idtype={$_GET['idtype']}&tpp={$_GET['tpp']}&showcensor=$showcensor", 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'deletes' => $deletes));
}
}
?>

View File

@@ -0,0 +1,169 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: moderate_doing.php 28057 2012-02-21 22:19:33Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
if(!submitcheck('modsubmit') && !$_GET['fast']) {
shownav('topic', $lang['moderate_doings']);
showsubmenu('nav_moderate_doings', $submenu);
$select[$_GET['tpp']] = $_GET['tpp'] ? "selected='selected'" : '';
$tpp_options = "<option value='20' $select[20]>20</option><option value='50' $select[50]>50</option><option value='100' $select[100]>100</option>";
$tpp = !empty($_GET['tpp']) ? $_GET['tpp'] : '20';
$start_limit = ($page - 1) * $ppp;
$dateline = $_GET['dateline'] ? $_GET['dateline'] : '604800';
$dateline_options = '';
foreach(array('all', '604800', '2592000', '7776000') as $v) {
$selected = '';
if($dateline == $v) {
$selected = "selected='selected'";
}
$dateline_options .= "<option value=\"$v\" $selected>".cplang("dateline_$v");
}
$doing_status = 1;
if($_GET['filter'] == 'ignore') {
$doing_status = 2;
}
showformheader("moderate&operation=doings");
showboxheader('search');
showtableheader();
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
cplang('username'), "<input size=\"15\" name=\"username\" type=\"text\" value=\"{$_GET['username']}\" />",
cplang('moderate_content_keyword'), "<input size=\"15\" name=\"keyword\" type=\"text\" value=\"{$_GET['keyword']}\" />",
)
);
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
"{$lang['perpage']}",
"<select name=\"tpp\">$tpp_options</select><label><input name=\"showcensor\" type=\"checkbox\" class=\"checkbox\" value=\"yes\" ".($showcensor ? ' checked="checked"' : '')."/> {$lang['moderate_showcensor']}</label>",
"{$lang['moderate_bound']}",
"<select name=\"filter\">$filteroptions</select>
<select name=\"dateline\">$dateline_options</select>
<input class=\"btn\" type=\"submit\" value=\"{$lang['search']}\" />"
)
);
showtablefooter();
showboxfooter();
$pagetmp = $page;
$modcount = C::t('common_moderate')->count_by_search_for_doing($moderatestatus, $_GET['username'], (($dateline && $dateline != 'all') ? (TIMESTAMP - $dateline) : null), $_GET['keyword']);
do {
$start_limit = ($pagetmp - 1) * $tpp;
$doingarr = C::t('common_moderate')->fetch_all_by_search_for_doing($moderatestatus, $_GET['username'], (($dateline && $dateline != 'all') ? (TIMESTAMP - $dateline) : null), $_GET['keyword'], $start_limit, $tpp);
$pagetmp = $pagetmp - 1;
} while($pagetmp > 0 && empty($doingarr));
$page = $pagetmp + 1;
$multipage = multi($modcount, $tpp, $page, ADMINSCRIPT."?action=moderate&operation=doings&filter=$filter&dateline={$_GET['dateline']}&username={$_GET['username']}&keyword={$_GET['keyword']}&tpp=$tpp&showcensor=$showcensor");
showtableheader('', 'nobottom');
echo '<tr><td><p class="margintop marginbot"><a href="javascript:;" onclick="expandall();">'.cplang('moderate_all_expand').'</a> &nbsp;<a href="javascript:;" onclick="foldall();">'.cplang('moderate_all_fold').'</a></p></td></tr>';
showtablefooter();
showtableheader();
$censor = & discuz_censor::instance();
$censor->highlight = '#FF0000';
require_once libfile('function/misc');
foreach($doingarr as $doing) {
$doing['dateline'] = dgmdate($doing['dateline']);
$short_desc = cutstr($doing['message'], 75);
if($showcensor) {
$censor->check($short_desc);
$censor->check($doing['message']);
}
$doing_censor_words = $censor->words_found;
if(count($post_censor_words) > 3) {
$doing_censor_words = array_slice($doing_censor_words, 0, 3);
}
$doing['censorwords'] = implode(', ', $doing_censor_words);
$doing['ip'] = $doing['ip'] . '-' . convertip($doing['ip']);
if(count($doing_censor_words)) {
$doing_censor_text = "<span style=\"color: red;\">({$doing['censorwords']})</span>";
} else {
$doing_censor_text = '';
}
showtagheader('tbody', '', true, 'hover');
showtablerow("id=\"mod_{$doing['doid']}_row1\"", array("id=\"mod_{$doing['doid']}_row1_op\" rowspan=\"3\" class=\"rowform threadopt\" style=\"width:80px;\"", '', 'width="120"'), array(
"<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$doing['doid']}]\" id=\"mod_{$doing['doid']}_1\" value=\"validate\" onclick=\"mod_setbg({$doing['doid']}, 'validate');\"><label for=\"mod_{$doing['doid']}_1\">{$lang['validate']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$doing['doid']}]\" id=\"mod_{$doing['doid']}_2\" value=\"delete\" onclick=\"mod_setbg({$doing['doid']}, 'delete');\"><label for=\"mod_{$doing['doid']}_2\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$doing['doid']}]\" id=\"mod_{$doing['doid']}_3\" value=\"ignore\" onclick=\"mod_setbg({$doing['doid']}, 'ignore');\"><label for=\"mod_{$doing['doid']}_3\">{$lang['ignore']}</label></li></ul>",
"<h3><a href=\"javascript:;\" onclick=\"display_toggle({$doing['doid']});\">$short_desc $doing_censor_text</a></h3><p>{$doing['ip']}</p>",
"<p><a target=\"_blank\" href=\"".ADMINSCRIPT."?action=members&operation=search&uid={$doing['uid']}&submit=yes\">{$doing['username']}</a></p> <p>{$doing['dateline']}</p>",
));
showtablerow("id=\"mod_{$doing['doid']}_row2\"", 'colspan="4" style="padding: 10px; line-height: 180%;"', '<div style="overflow: auto; overflow-x: hidden; max-height:120px; height:auto !important; height:100px; word-break: break-all;">'.$doing['message'].'</div>');
showtablerow("id=\"mod_{$doing['doid']}_row3\"", 'class="threadopt threadtitle" colspan="4"', "<a href=\"?action=moderate&operation=doings&fast=1&doid={$doing['doid']}&moderate[{$doing['doid']}]=validate&page=$page&frame=no\" target=\"fasthandle\">{$lang['validate']}</a> | <a href=\"?action=moderate&operation=doings&fast=1&doid={$doing['doid']}&moderate[{$doing['doid']}]=delete&page=$page&frame=no\" target=\"fasthandle\">{$lang['delete']}</a> | <a href=\"?action=moderate&operation=doings&fast=1&doid={$doing['doid']}&moderate[{$doing['doid']}]=ignore&page=$page&frame=no\" target=\"fasthandle\">{$lang['ignore']}</a>");
showtagfooter('tbody');
}
showsubmit('modsubmit', 'submit', '', '<a href="#all" onclick="mod_setbg_all(\'validate\')">'.cplang('moderate_all_validate').'</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'delete\')">'.cplang('moderate_all_delete').'</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'ignore\')">'.cplang('moderate_all_ignore').'</a> &nbsp;<a href="#all" onclick="mod_cancel_all();">'.cplang('moderate_all_cancel').'</a>', $multipage, false);
showtablefooter();
showformfooter();
} else {
$moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
$validates = $deletes = $ignores = 0;
if(is_array($moderate)) {
foreach($moderate as $doid => $act) {
$moderation[$act][] = $doid;
}
}
if($moderation['validate']) {
C::t('home_doing')->update($moderation['validate'], array('status' => '0'));
$query_t = C::t('home_doing')->fetch_all($moderation['validate']);
if(helper_access::check_module('feed')) {
foreach ($query_t as $doing) {
$feedarr = array(
'icon' => 'doing',
'uid' => $doing['uid'],
'username' => $doing['username'],
'dateline' => $doing['dateline'],
'title_template' => lang('feed', 'feed_doing_title'),
'title_data' => serialize(array('message'=>$doing['message'])),
'body_template' => '',
'body_data' => '',
'id' => $doing['doid'],
'idtype' => 'doid'
);
$validates += C::t('home_feed')->insert($feedarr);
}
}
updatemoderate('doid', $moderation['validate'], 2);
}
if(!empty($moderation['delete'])) {
require_once libfile('function/delete');
$doings = deletedoings($moderation['delete']);
$deletes = count($doings);
updatemoderate('doid', $moderation['delete'], 2);
}
if($moderation['ignore']) {
$ignores = C::t('home_doing')->update($moderation['ignore'], array('status' => '2'));
updatemoderate('doid', $moderation['ignore'], 1);
}
if($_GET['fast']) {
echo callback_js($_GET['doid']);
exit;
} else {
cpmsg('moderate_doings_succeed', "action=moderate&operation=doings&page=$page&filter=$filter&dateline={$_GET['dateline']}&username={$_GET['username']}&keyword={$_GET['keyword']}&tpp={$_GET['tpp']}&showcensor=$showcensor", 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'deletes' => $deletes));
}
}
?>

View File

@@ -0,0 +1,321 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: moderate_member.php 33688 2013-08-02 03:00:15Z nemohou $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
$do = empty($do) ? 'mod' : $do;
if($do == 'mod') {
if(!submitcheck('modsubmit')) {
$count = C::t('common_member_validate')->fetch_all_status_by_count();
$sendemail = isset($_GET['sendemail']) ? $_GET['sendemail'] : 0;
$checksendemail = $sendemail ? 'checked' : '';
$start_limit = ($page - 1) * $_G['setting']['memberperpage'];
$validatenum = C::t('common_member_validate')->count_by_status(0);
$members = '';
if($validatenum) {
$multipage = multi($validatenum, $_G['setting']['memberperpage'], $page, ADMINSCRIPT.'?action=moderate&operation=members&sendemail='.$sendemail);
$vuids = array();
loadcache('fields_register');
require_once libfile('function/profile');
loadcache('usergroups');
$allvalidate = C::t('common_member_validate')->fetch_all_invalidate($start_limit, $_G['setting']['memberperpage']);
$uids = array_keys($allvalidate);
$allmember = C::t('common_member')->fetch_all($uids, false, 0);
$allmemberstatus = C::t('common_member_status')->fetch_all($uids, false, 0);
$allmemberprofile = C::t('common_member_profile')->fetch_all($uids, false, 0);
foreach($allvalidate as $uid => $member) {
$member = array_merge((array)$member, (array)$allmember[$uid], (array)$allmemberstatus[$uid], (array)$allmemberprofile[$uid]);
if($member['groupid'] != 8 && !in_array($member['freeze'], array(-1, 2))) {
$vuids[$uid] = $uid;
continue;
}
$fields = !empty($member['field']) ? dunserialize($member['field']) : array();
$str = '';
foreach($_G['cache']['fields_register'] as $field) {
if(!$field['available'] || in_array($field['fieldid'], array('uid', 'constellation', 'zodiac', 'birthmonth', 'birthyear', 'birthcountry', 'birthprovince', 'birthdist', 'birthcommunity', 'residecountry', 'resideprovince', 'residedist', 'residecommunity'))) {
continue;
}
$member[$field['fieldid']] = !empty($member[$field['fieldid']]) ? $member[$field['fieldid']] : $fields[$field['fieldid']];
if($member[$field['fieldid']]) {
$fieldstr = profile_show($field['fieldid'], $member);
$str .= $field['title'].':'.$fieldstr."<br/>";
}
}
$str = !empty($str) ? '<br/>'.$str : '';
$member['regdate'] = dgmdate($member['regdate']);
$member['submitdate'] = dgmdate($member['submitdate']);
$member['moddate'] = $member['moddate'] ? dgmdate($member['moddate']) : $lang['none'];
$member['admin'] = $member['admin'] ? "<a href=\"home.php?mod=space&username=".rawurlencode($member['admin'])."\" target=\"_blank\">{$member['admin']}</a>" : $lang['none'];
$members .= "<tr class=\"hover\" id=\"mod_uid_{$member['uid']}\"><td class=\"rowform\" style=\"width:80px;\"><ul class=\"nofloat\"><li><input id=\"mod_uid_{$member['uid']}_1\" class=\"radio\" type=\"radio\" name=\"modtype[{$member['uid']}]\" value=\"invalidate\" onclick=\"set_bg('invalidate', {$member['uid']});\"><label for=\"mod_uid_{$member['uid']}_1\">{$lang['invalidate']}</label></li><li><input id=\"mod_uid_{$member['uid']}_2\" class=\"radio\" type=\"radio\" name=\"modtype[{$member['uid']}]\" value=\"validate\" onclick=\"set_bg('validate', {$member['uid']});\"><label for=\"mod_uid_{$member['uid']}_2\">{$lang['validate']}</label></li>\n".
"<li>".($member['groupid'] == 8 ? "<input id=\"mod_uid_{$member['uid']}_3\" class=\"radio\" type=\"radio\" name=\"modtype[{$member['uid']}]\" value=\"delete\" onclick=\"set_bg('delete', {$member['uid']});\"><label for=\"mod_uid_{$member['uid']}_3\">{$lang['delete']}</label>" : "<input disabled class=\"radio\" type=\"radio\" />{$lang['delete']}")."</li><li><input id=\"mod_uid_{$member['uid']}_4\" class=\"radio\" type=\"radio\" name=\"modtype[{$member['uid']}]\" value=\"ignore\" onclick=\"set_bg('ignore', {$member['uid']});\"><label for=\"mod_uid_{$member['uid']}_4\">{$lang['ignore']}</label></li></ul></td><td><b><a href=\"home.php?mod=space&uid={$member['uid']}\" target=\"_blank\">{$member['username']}</a></b>\n".$_G['cache']['usergroups'][$member['groupid']]['grouptitle'].
"<br />{$lang['members_edit_regdate']}: {$member['regdate']}<br />{$lang['members_edit_regip']}: {$member['regip']} ".convertip($member['regip'])."<br />{$lang['members_edit_lastip']}: {$member['lastip']} ".convertip($member['lastip'])."<br />Email: {$member['email']}$str</td>\n".
"<td align=\"center\"><textarea rows=\"4\" name=\"userremark[{$member['uid']}]\" style=\"width: 95%; word-break: break-all\">{$member['message']}</textarea></td>\n".
"<td>{$lang['moderate_members_submit_times']}: {$member['submittimes']}<br />{$lang['moderate_members_submit_time']}: {$member['submitdate']}<br />{$lang['moderate_members_admin']}: {$member['admin']}<br />\n".
"{$lang['moderate_members_mod_time']}: {$member['moddate']}</td><td><textarea rows=\"4\" id=\"remark[{$member['uid']}]\" name=\"remark[{$member['uid']}]\" style=\"width: 95%; word-break: break-all\">{$member['remark']}</textarea></td></tr>\n";
}
if(!empty($vuids)) {
C::t('common_member_validate')->delete($vuids);
}
}
shownav('user', 'nav_modmembers');
showsubmenu('nav_moderate_users', array(
array('nav_moderate_users_mod', 'moderate&operation=members&do=mod', 1),
array('clean', 'moderate&operation=members&do=del', 0)
));
showtips('moderate_members_tips');
$moderate_members_bad_reason = cplang('moderate_members_bad_reason');
$moderate_members_succeed = cplang('moderate_members_succeed');
echo <<<EOT
<script type="text/javascript">
function set_bg(operation, uid) {
if(operation == 'invalidate') {
$('mod_uid_' + uid).className = "mod_invalidate";
$('remark[' + uid + ']').value = '$moderate_members_bad_reason';
} else if(operation == 'validate') {
$('mod_uid_' + uid).className = "mod_validate";
$('remark[' + uid + ']').value = '$moderate_members_succeed';
} else if(operation == 'ignore') {
$('mod_uid_' + uid).className = "mod_ignore";
$('remark[' + uid + ']').value = '';
} else if(operation == 'delete') {
$('mod_uid_' + uid).className = "mod_delete";
$('remark[' + uid + ']').value = '';
}
$('chk_apply_all').disabled = true;
$('chk_apply_all').checked = false;
}
function set_bg_all(operation) {
var trs = $('cpform').getElementsByTagName('TR');
for(var i in trs) {
if(trs[i].id && trs[i].id.substr(0, 8) == 'mod_uid_') {
uid = trs[i].id.substr(8);
if(operation == 'invalidate') {
trs[i].className = 'mod_invalidate';
$('remark[' + uid + ']').value = '$moderate_members_bad_reason';
} else if(operation == 'validate') {
trs[i].className = 'mod_validate';
$('remark[' + uid + ']').value = '$moderate_members_succeed';
} else if(operation == 'ignore') {
trs[i].className = 'mod_ignore';
$('remark[' + uid + ']').value = '';
} else if(operation == 'delete') {
trs[i].className = 'mod_delete';
$('remark[' + uid + ']').value = '';
}else if(operation == 'cancel') {
trs[i].className = '';
$('remark[' + uid + ']').value = '';
}
}
}
if(operation != 'cancel') {
$('chk_apply_all').disabled = false;
$('chk_apply_all').value = operation;
} else {
$('chk_apply_all').disabled = true;
$('chk_apply_all').checked = false;
}
}
function cancelallcheck() {
var form = $('cpform');
var checkall = 'chkall';
for(var i = 0; i < form.elements.length; i++) {
var e = form.elements[i];
if(e.type == 'radio') {
e.checked = '';
}
}
}
</script>
EOT;
showformheader('moderate&operation=members&do=mod');
showtableheader('moderate_members', 'fixpadding');
showsubtitle(array('operation', 'members_edit_info', 'moderate_members_message', 'moderate_members_info', 'moderate_members_remark'));
echo $members;
showsubmit('modsubmit', 'submit', '', '<a href="#all" onclick="checkAll(\'option\', $(\'cpform\'), \'invalidate\');set_bg_all(\'invalidate\');">'.cplang('moderate_all_invalidate').'</a> &nbsp;<a href="#all" onclick="checkAll(\'option\', $(\'cpform\'), \'validate\');set_bg_all(\'validate\');">'.cplang('moderate_all_validate').'</a> &nbsp;<a href="#all" onclick="checkAll(\'option\', $(\'cpform\'), \'delete\');set_bg_all(\'delete\');">'.cplang('moderate_all_delete').'</a> &nbsp;<a href="#all" onclick="checkAll(\'option\', $(\'cpform\'), \'ignore\');set_bg_all(\'ignore\');">'.cplang('moderate_all_ignore').'</a> &nbsp;<a href="#all" onclick="cancelallcheck();set_bg_all(\'cancel\');">'.cplang('moderate_all_cancel').'</a><input class="checkbox" type="checkbox" name="apply_all" id="chk_apply_all" value="1" disabled="disabled" />'.cplang('moderate_apply_all').' &nbsp;<input class="checkbox" type="checkbox" name="sendemail" id="sendemail" value="1" '.$checksendemail.' /><label for="sendemail"> '.cplang('moderate_members_email').'</label>', $multipage);
showtablefooter();
showformfooter();
} else {
$moderation = array('invalidate' => array(), 'validate' => array(), 'delete' => array(), 'ignore' => array());
$uids = array();
$uidsql = '';
if(!$_GET['apply_all']) {
if(is_array($_GET['modtype'])) {
foreach($_GET['modtype'] as $uid => $act) {
$uid = intval($uid);
$uids[$uid] = $uid;
$moderation[$act][$uid] = $uid;
}
$uidsql = 'v.uid IN ('.dimplode($uids).') AND';
}
}
$members = array();
$allmembervalidate = $uids ? C::t('common_member_validate')->fetch_all($uids) : C::t('common_member_validate')->range();
foreach(C::t('common_member')->fetch_all(array_keys($allmembervalidate), false, 0) as $uid => $member) {
if($member['groupid'] == 8 || $member['freeze'] == 2 || $member['freeze'] == -1) {
$members[$uid] = $member;
}
}
$alluids = array_keys($members);
if($_GET['apply_all']) {
$moderation[$_GET['apply_all']] = array_merge($alluids, $moderation[$_GET['apply_all']]);
}
if(!empty($members)) {
$numdeleted = $numinvalidated = $numvalidated = 0;
if(!empty($moderation['delete']) && is_array($moderation['delete'])) {
$deluids = array_intersect($moderation['delete'], $alluids);
$numdeleted = count($deluids);
C::t('common_member')->delete_no_validate($deluids);
loaducenter();
uc_user_delete($deluids);
} else {
$moderation['delete'] = array();
}
if(!empty($moderation['validate']) && is_array($moderation['validate'])) {
$validateuids = array_intersect($moderation['validate'], $alluids);
C::t('common_member')->update($validateuids, array('adminid' => 0, 'groupid' => $_G['setting']['newusergroupid'], 'freeze' => 0));
$numvalidated = count($validateuids);
C::t('common_member_validate')->delete($validateuids);
} else {
$moderation['validate'] = array();
}
if(!empty($moderation['invalidate']) && is_array($moderation['invalidate'])) {
$invalidateuids = array_intersect($moderation['invalidate'], $alluids);
$numinvalidated = count($invalidateuids);
foreach($invalidateuids as $uid) {
C::t('common_member_validate')->update($uid, array('moddate' => $_G['timestamp'], 'admin' => $_G['username'], 'status' => '1', 'remark' => dhtmlspecialchars($_GET['remark'][$uid])));
}
} else {
$moderation['invalidate'] = array();
}
foreach(array('validate', 'invalidate') as $o) {
foreach($moderation[$o] as $uid) {
if($_GET['remark'][$uid]) {
switch($o) {
case 'validate':
notification_add($uid, 'mod_member', 'member_moderate_validate', array('remark' => $_GET['remark'][$uid]));
break;
case 'invalidate':
notification_add($uid, 'mod_member', 'member_moderate_invalidate', array('remark' => $_GET['remark'][$uid]));
break;
}
} else {
switch($o) {
case 'validate':
notification_add($uid, 'mod_member', 'member_moderate_validate_no_remark');
break;
case 'invalidate':
notification_add($uid, 'mod_member', 'member_moderate_invalidate_no_remark');
break;
}
}
}
}
if($_GET['sendemail']) {
if(!function_exists('sendmail')) {
include libfile('function/mail');
}
foreach(array('delete', 'validate', 'invalidate') as $o) {
foreach($moderation[$o] as $uid) {
if(isset($members[$uid])) {
$member = $members[$uid];
$member['regdate'] = dgmdate($member['regdate']);
$member['submitdate'] = dgmdate($member['submitdate']);
$member['moddate'] = dgmdate(TIMESTAMP);
$member['operation'] = $o;
$member['remark'] = $_GET['remark'][$uid] ? dhtmlspecialchars($_GET['remark'][$uid]) : $lang['none'];
$moderate_member_message = array(
'tpl' => 'moderate_member',
'var' => array(
'username' => $member['username'],
'bbname' => $_G['setting']['bbname'],
'regdate' => $member['regdate'],
'submitdate' => $member['submitdate'],
'submittimes' => $allmembervalidate[$uid]['submittimes'],
'message' => $allmembervalidate[$uid]['message'],
'modresult' => lang('email', 'moderate_member_'.$member['operation']),
'moddate' => $member['moddate'],
'adminusername' => $_G['member']['username'],
'remark' => $member['remark'],
'siteurl' => $_G['siteurl'],
)
);
if(!sendmail("{$member['username']} <{$member['email']}>", $moderate_member_message)) {
runlog('sendmail', "{$member['email']} sendmail failed.");
}
}
}
}
}
}
cpmsg('moderate_members_op_succeed', "action=moderate&operation=members&page=$page", 'succeed', array('numvalidated' => $numvalidated, 'numinvalidated' => $numinvalidated, 'numdeleted' => $numdeleted));
}
} elseif($do == 'del') {
if(!submitcheck('prunesubmit', 1)) {
shownav('user', 'nav_modmembers');
showsubmenu('nav_moderate_users', array(
array('nav_moderate_users_mod', 'moderate&operation=members&do=mod', 0),
array('clean', 'moderate&operation=members&do=del', 1)
));
showtips('moderate_members_tips');
showformheader('moderate&operation=members&do=del');
showtableheader('moderate_members_prune');
showsetting('moderate_members_prune_submitmore', 'submitmore', '5', 'text');
showsetting('moderate_members_prune_regbefore', 'regbefore', '30', 'text');
showsetting('moderate_members_prune_modbefore', 'modbefore', '15', 'text');
showsetting('moderate_members_prune_regip', 'regip', '', 'text');
showsubmit('prunesubmit');
showtablefooter();
showformfooter();
} else {
$uids = C::t('common_member_validate')->fetch_all_validate_uid($_GET['submitmore'], $_GET['regbefore'], $_GET['modbefore'], $_GET['regip']);
if((!$membernum = count($uids))) {
cpmsg('members_search_noresults', '', 'error');
} elseif(!$_GET['confirmed']) {
cpmsg('members_delete_confirm', "action=moderate&operation=members&do=del&submitmore=".rawurlencode($_GET['submitmore'])."&regbefore=".rawurlencode($_GET['regbefore'])."&modbefore=".rawurlencode($_GET['modbefore'])."&regip=".rawurlencode($_GET['regip'])."&prunesubmit=yes", 'form', array('membernum' => $membernum));
} else {
$numdeleted = C::t('common_member')->delete_no_validate(array_keys($uids));
cpmsg('members_delete_succeed', '', 'succeed', array('numdeleted' => $numdeleted));
}
}
}
?>

View File

@@ -0,0 +1,158 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: moderate_picture.php 25728 2011-11-21 03:52:01Z chenmengshu $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
if(!submitcheck('modsubmit') && !$_GET['fast']) {
shownav('topic', $lang['moderate_pictures']);
showsubmenu('nav_moderate_pictures', $submenu);
$select[$_GET['tpp']] = $_GET['tpp'] ? "selected='selected'" : '';
$tpp_options = "<option value='20' $select[20]>20</option><option value='50' $select[50]>50</option><option value='100' $select[100]>100</option>";
$tpp = !empty($_GET['tpp']) ? $_GET['tpp'] : '20';
$start_limit = ($page - 1) * $tpp;
$dateline = $_GET['dateline'] ? $_GET['dateline'] : '604800';
$dateline_options = '';
foreach(array('all', '604800', '2592000', '7776000') as $v) {
$selected = '';
if($dateline == $v) {
$selected = "selected='selected'";
}
$dateline_options .= "<option value=\"$v\" $selected>".cplang("dateline_$v");
}
$pic_status = 1;
if($_GET['filter'] == 'ignore') {
$pic_status = 2;
}
showformheader("moderate&operation=pictures");
showboxheader('search');
showtableheader();
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
cplang('username'), "<input size=\"15\" name=\"username\" type=\"text\" value=\"{$_GET['username']}\" />",
cplang('moderate_title_keyword'), "<input size=\"15\" name=\"title\" type=\"text\" value=\"{$_GET['title']}\" />",
)
);
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
"{$lang['perpage']}",
"<select name=\"tpp\">$tpp_options</select><label><input name=\"showcensor\" type=\"checkbox\" class=\"checkbox\" value=\"yes\" ".($showcensor ? ' checked="checked"' : '')."/> {$lang['moderate_showcensor']}</label>",
"{$lang['moderate_bound']}",
"<select name=\"filter\">$filteroptions</select>
<select name=\"dateline\">$dateline_options</select>
<input class=\"btn\" type=\"submit\" value=\"{$lang['search']}\" />"
)
);
showtablefooter();
showboxfooter();
$pagetmp = $page;
$modcount = C::t('common_moderate')->count_by_search_for_pic($moderatestatus, $_GET['username'], (($dateline && $dateline != 'all') ? (TIMESTAMP - $dateline) : null), $_GET['title']);
do {
$start_limit = ($pagetmp - 1) * $tpp;
$picarr = C::t('common_moderate')->fetch_all_by_search_for_pic($moderatestatus, $_GET['username'], (($dateline && $dateline != 'all') ? (TIMESTAMP - $dateline) : null), $_GET['title'], $start_limit, $tpp);
$pagetmp = $pagetmp - 1;
} while($pagetmp > 0 && empty($picarr));
$page = $pagetmp + 1;
$multipage = multi($modcount, $tpp, $page, ADMINSCRIPT."?action=moderate&operation=pictures&filter=$filter&dateline={$_GET['dateline']}&username={$_GET['username']}&title={$_GET['title']}&tpp=$tpp&showcensor=$showcensor");
showtableheader('', 'nobottom');
echo '<tr><td><p class="margintop marginbot"><a href="javascript:;" onclick="expandall();">'.cplang('moderate_all_expand').'</a> &nbsp;<a href="javascript:;" onclick="foldall();">'.cplang('moderate_all_fold').'</a></p></td></tr>';
showtablefooter();
showtableheader();
$censor = & discuz_censor::instance();
$censor->highlight = '#FF0000';
require_once libfile('function/misc');
require_once libfile('function/home');
foreach($picarr as $pic) {
$pic['dateline'] = dgmdate($pic['dateline']);
$pic['title'] = $pic['title'] ? '<b>'.$pic['title'].'</b>' : '<i>'.$lang['nosubject'].'</i>';
if($showcensor) {
$censor->check($pic['title']);
}
$pic_censor_words = $censor->words_found;
if(count($pic_censor_words) > 3) {
$pic_censor_words = array_slice($pic_censor_words, 0, 3);
}
$pic['censorwords'] = implode(', ', $pic_censor_words);
$pic['modpickey'] = modauthkey($pic['picid']);
$pic['postip'] = $pic['postip'] . '-' . convertip($pic['postip']);
$pic['url'] = pic_get($pic['filepath'], 'album', $pic['thumb'], $pic['remote']);
if(count($pic_censor_words)) {
$pic_censor_text = "<span style=\"color: red;\">({$pic['censorwords']})</span>";
} else {
$pic_censor_text = '';
}
showtagheader('tbody', '', true, 'hover');
showtablerow("id=\"mod_{$pic['picid']}_row1\"", array("id=\"mod_{$pic['picid']}_row1_op\" rowspan=\"3\" class=\"rowform threadopt\" style=\"width:80px;\"", '', 'width="120"', 'width="120"', 'width="55"'), array(
"<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$pic['picid']}]\" id=\"mod_{$pic['picid']}_1\" value=\"validate\" onclick=\"mod_setbg({$pic['picid']}, 'validate');\"><label for=\"mod_{$pic['picid']}_1\">{$lang['validate']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$pic['picid']}]\" id=\"mod_{$pic['picid']}_2\" value=\"delete\" onclick=\"mod_setbg({$pic['picid']}, 'delete');\"><label for=\"mod_{$pic['picid']}_2\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$pic['picid']}]\" id=\"mod_{$pic['picid']}_3\" value=\"ignore\" onclick=\"mod_setbg({$pic['picid']}, 'ignore');\"><label for=\"mod_{$pic['picid']}_3\">{$lang['ignore']}</label></li></ul>",
"<h3><a href=\"javascript:;\" onclick=\"display_toggle('{$pic['picid']}');\">{$pic['title']}</a> $pic_censor_text</h3><p>{$pic['postip']}</p>",
"<a target=\"_blank\" href=\"home.php?mod=space&uid={$pic['uid']}&do=album&id={$pic['albumid']}\">{$pic['albumname']}</a>",
"<p><a target=\"_blank\" href=\"".ADMINSCRIPT."?action=members&operation=search&uid={$pic['uid']}&submit=yes\">{$pic['username']}</a></p> <p>{$pic['dateline']}</p>",
"<a target=\"_blank\" href=\"home.php?mod=space&uid={$pic['uid']}&do=album&picid={$pic['picid']}&modpickey={$pic['modpickey']}\">{$lang['view']}</a>",
));
showtablerow("id=\"mod_{$pic['picid']}_row2\"", 'colspan="4" style="padding: 10px; line-height: 180%;"', '<div style="overflow: auto; overflow-x: hidden; max-height:120px; height:auto !important; height:100px; word-break: break-all;"><img src="'.$pic['url'].'" /></div>');
showtablerow("id=\"mod_{$pic['picid']}_row3\"", 'class="threadopt threadtitle" colspan="4"', "<a href=\"?action=moderate&operation=pictures&fast=1&picid={$pic['picid']}&moderate[{$pic['picid']}]=validate&page=$page&frame=no\" target=\"fasthandle\">{$lang['validate']}</a> | <a href=\"?action=moderate&operation=pictures&fast=1&picid={$pic['picid']}&moderate[{$pic['picid']}]=delete&page=$page&frame=no\" target=\"fasthandle\">{$lang['delete']}</a> | <a href=\"?action=moderate&operation=pictures&fast=1&picid={$pic['picid']}&moderate[{$pic['picid']}]=ignore&page=$page&frame=no\" target=\"fasthandle\">{$lang['ignore']}</a>");
showtagfooter('tbody');
}
showsubmit('modsubmit', 'submit', '', '<a href="#all" onclick="mod_setbg_all(\'validate\')">'.cplang('moderate_all_validate').'</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'delete\')">'.cplang('moderate_all_delete').'</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'ignore\')">'.cplang('moderate_all_ignore').'</a> &nbsp;<a href="#all" onclick="mod_cancel_all();">'.cplang('moderate_all_cancel').'</a>', $multipage, false);
showtablefooter();
showformfooter();
} else {
$moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
$validates = $deletes = $ignores = 0;
if(is_array($moderate)) {
foreach($moderate as $picid => $act) {
$moderation[$act][] = $picid;
}
}
if($moderation['validate']) {
$validates = C::t('home_pic')->update($moderation['validate'], array('status' => '0'));
$albumincrease = array();
foreach(C::t('home_pic')->fetch_all($moderation['validate']) as $pics) {
$albumincrease[$pics['albumid']]++;
}
foreach($albumincrease as $albumid=>$albuminc) {
C::t('home_album')->update_num_by_albumid($albumid, $albuminc);
}
updatemoderate('picid', $moderation['validate'], 2);
}
if(!empty($moderation['delete'])) {
require_once libfile('function/delete');
$pics = deletepics($moderation['delete']);
$deletes = count($pics);
updatemoderate('picid', $moderation['delete'], 2);
}
if($moderation['ignore']) {
$ignores = C::t('home_pic')->update($moderation['ignore'], array('status' => '2'));
updatemoderate('picid', $moderation['ignore'], 1);
}
if($_GET['fast']) {
echo callback_js($_GET['picid']);
exit;
} else {
cpmsg('moderate_pictures_succeed', "action=moderate&operation=pictures&page=$page&filter=$filter&dateline={$_GET['dateline']}&username={$_GET['username']}&title={$_GET['title']}&tpp={$_GET['tpp']}&showcensor=$showcensor", 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'recycles' => $recycles, 'deletes' => $deletes));
}
}
?>

View File

@@ -0,0 +1,188 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: moderate_portalcomment.php 25246 2011-11-02 03:34:53Z zhangguosheng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
$idtype = $tablename = $mod = '';
if($operation == 'articlecomments') {
$idtype = 'aid';
$tablename = 'portal_article_title';
$mod = 'view';
} else {
$idtype = 'topicid';
$tablename = 'portal_topic';
$mod = 'topic';
}
if(!submitcheck('modsubmit') && !$_GET['fast']) {
if($operation == 'articlecomments') {
shownav('topic', $lang['moderate_articlecomments']);
showsubmenu('nav_moderate_articlecomments', $submenu);
} else {
shownav('topic', $lang['moderate_topiccomments']);
showsubmenu('nav_moderate_topiccomments', $submenu);
}
$select[$_GET['tpp']] = $_GET['tpp'] ? "selected='selected'" : '';
$tpp_options = "<option value='20' $select[20]>20</option><option value='50' $select[50]>50</option><option value='100' $select[100]>100</option>";
$tpp = !empty($_GET['tpp']) ? $_GET['tpp'] : '20';
$start_limit = ($page - 1) * $ppp;
$dateline = $_GET['dateline'] ? $_GET['dateline'] : '604800';
$dateline_options = '';
foreach(array('all', '604800', '2592000', '7776000') as $v) {
$selected = '';
if($dateline == $v) {
$selected = "selected='selected'";
}
$dateline_options .= "<option value=\"$v\" $selected>".cplang("dateline_$v");
}
$cat_select = '';
if($operation == 'articlecomments') {
$cat_select = '<option value="">'.$lang['all'].'</option>';
loadcache('portalcategory');
foreach($_G['cache']['portalcategory'] as $cat) {
$selected = '';
if($cat['catid'] == $_GET['catid']) {
$selected = 'selected="selected"';
}
$cat_select .= "<option value=\"{$cat['catid']}\" $selected>{$cat['catname']}</option>";
}
$cat_select = "<select name=\"catid\">$cat_select</select>";
}
$articlecomment_status = 1;
if($_GET['filter'] == 'ignore') {
$articlecomment_status = 2;
}
showformheader("moderate&operation=$operation");
showboxheader('search');
showtableheader();
if($operation == 'articlecomments') {
showtablerow('', array('width="100"', 'width="200"', 'width="100"', 'width="200"', 'width="60"'),
array(
cplang('username'), "<input size=\"15\" name=\"username\" type=\"text\" value=\"{$_GET['username']}\" />",
cplang('moderate_article_category'), $cat_select,
cplang('moderate_content_keyword'), "<input size=\"15\" name=\"keyword\" type=\"text\" value=\"{$_GET['keyword']}\" />",
)
);
} else {
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
cplang('username'), "<input size=\"15\" name=\"username\" type=\"text\" value=\"{$_GET['username']}\" />",
cplang('moderate_content_keyword'), "<input size=\"15\" name=\"keyword\" type=\"text\" value=\"{$_GET['keyword']}\" />",
)
);
}
showtablerow('', $operation == 'articlecomments' ?
array('width="100"', 'width="200"', 'width="100"', 'colspan="3"') :
array('width="100"', 'width="200"', 'width="100"'),
array(
"{$lang['perpage']}",
"<select name=\"tpp\">$tpp_options</select><label><input name=\"showcensor\" type=\"checkbox\" class=\"checkbox\" value=\"yes\" ".($showcensor ? ' checked="checked"' : '')."/> {$lang['moderate_showcensor']}</label>",
"{$lang['moderate_bound']}",
"<select name=\"filter\">$filteroptions</select>
<select name=\"dateline\">$dateline_options</select>
<input class=\"btn\" type=\"submit\" value=\"{$lang['search']}\" />"
)
);
showtablefooter();
showboxfooter();
$pagetmp = $page;
$modcount = C::t('common_moderate')->fetch_all_for_portalcomment($idtype, $tablename, $moderatestatus, $_GET['catid'], $_GET['username'], $dateline, 1, $_GET['keyword']);
do {
$start_limit = ($pagetmp - 1) * $tpp;
$query = C::t('common_moderate')->fetch_all_for_portalcomment($idtype, $tablename, $moderatestatus, $_GET['catid'], $_GET['username'], $dateline, 0, $_GET['keyword'], $start_limit, $tpp);
$pagetmp = $pagetmp - 1;
} while($pagetmp > 0 && count($query) == 0);
$page = $pagetmp + 1;
$multipage = multi($modcount, $tpp, $page, ADMINSCRIPT."?action=moderate&operation=$operation&filter=$filter&modfid=$modfid&ppp=$tpp&showcensor=$showcensor");
showtableheader('', 'nobottom');
echo '<tr><td><p class="margintop marginbot"><a href="javascript:;" onclick="expandall();">'.cplang('moderate_all_expand').'</a> &nbsp;<a href="javascript:;" onclick="foldall();">'.cplang('moderate_all_fold').'</a></p></td></tr>';
showtablefooter();
showtableheader();
$censor = & discuz_censor::instance();
$censor->highlight = '#FF0000';
require_once libfile('function/misc');
foreach($query as $articlecomment) {
$articlecomment['dateline'] = dgmdate($articlecomment['dateline']);
if($showcensor) {
$censor->check($articlecomment['title']);
$censor->check($articlecomment['message']);
}
$articlecomment_censor_words = $censor->words_found;
if(count($articlecomment_censor_words) > 3) {
$articlecomment_censor_words = array_slice($articlecomment_censor_words, 0, 3);
}
$articlecomment['censorwords'] = implode(', ', $articlecomment_censor_words);
$articlecomment['modarticlekey'] = modauthkey($articlecomment['aid']);
$articlecomment['modarticlecommentkey'] = modauthkey($articlecomment['cid']);
if(count($articlecomment_censor_words)) {
$articlecomment_censor_text = "<span style=\"color: red;\">({$articlecomment['censorwords']})</span>";
} else {
$articlecomment_censor_text = '';
}
showtagheader('tbody', '', true, 'hover');
showtablerow("id=\"mod_{$articlecomment['cid']}_row1\"", array("id=\"mod_{$articlecomment['cid']}_row1_op\" rowspan=\"3\" class=\"rowform threadopt\" style=\"width:80px;\"", '', 'width="120"', 'width="55"'), array(
"<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$articlecomment['cid']}]\" id=\"mod_{$articlecomment['cid']}_1\" value=\"validate\" onclick=\"mod_setbg({$articlecomment['cid']}, 'validate');\"><label for=\"mod_{$articlecomment['cid']}_1\">{$lang['validate']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$articlecomment['cid']}]\" id=\"mod_{$articlecomment['cid']}_2\" value=\"delete\" onclick=\"mod_setbg({$articlecomment['cid']}, 'delete');\"><label for=\"mod_{$articlecomment['cid']}_2\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$articlecomment['cid']}]\" id=\"mod_{$articlecomment['cid']}_3\" value=\"ignore\" onclick=\"mod_setbg({$articlecomment['cid']}, 'ignore');\"><label for=\"mod_{$articlecomment['cid']}_3\">{$lang['ignore']}</label></li></ul>",
"<h3><a href=\"javascript:;\" onclick=\"display_toggle({$articlecomment['cid']});\">{$articlecomment['title']} $articlecomment_censor_text</a></h3>",
"<p><a target=\"_blank\" href=\"".ADMINSCRIPT."?action=members&operation=search&uid={$articlecomment['uid']}&submit=yes\">{$articlecomment['username']}</a></p> <p>{$articlecomment['dateline']}</p>",
"<a target=\"_blank\" href=\"portal.php?mod=$mod&$idtype={$articlecomment['id']}&modarticlekey={$articlecomment['modarticlekey']}#comment_anchor_{$articlecomment['cid']}\">{$lang['view']}</a>&nbsp;<a href=\"portal.php?mod=portalcp&ac=comment&op=edit&cid={$articlecomment['cid']}&modarticlecommentkey={$articlecomment['modarticlecommentkey']}\" target=\"_blank\">{$lang['edit']}</a>",
));
showtablerow("id=\"mod_{$articlecomment['cid']}_row2\"", 'colspan="4" style="padding: 10px; line-height: 180%;"', '<div style="overflow: auto; overflow-x: hidden; max-height:120px; height:auto !important; height:100px; word-break: break-all;">'.$articlecomment['message'].'</div>');
showtablerow("id=\"mod_{$articlecomment['cid']}_row3\"", 'class="threadopt threadtitle" colspan="4"', "<a href=\"?action=moderate&operation=$operation&fast=1&cid={$articlecomment['cid']}&moderate[{$articlecomment['cid']}]=validate&page=$page&frame=no\" target=\"fasthandle\">{$lang['validate']}</a> | <a href=\"?action=moderate&operation=$operation&fast=1&cid={$articlecomment['cid']}&moderate[{$articlecomment['cid']}]=delete&page=$page&frame=no\" target=\"fasthandle\">{$lang['delete']}</a> | <a href=\"?action=moderate&operation=$operation&fast=1&cid={$articlecomment['cid']}&moderate[{$articlecomment['cid']}]=ignore&page=$page&frame=no\" target=\"fasthandle\">{$lang['ignore']}</a>");
showtagfooter('tbody');
}
showsubmit('modsubmit', 'submit', '', '<a href="#all" onclick="mod_setbg_all(\'validate\')">'.cplang('moderate_all_validate').'</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'delete\')">'.cplang('moderate_all_delete').'</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'ignore\')">'.cplang('moderate_all_ignore').'</a> &nbsp;<a href="#all" onclick="mod_cancel_all();">'.cplang('moderate_all_cancel').'</a>', $multipage, false);
showtablefooter();
showformfooter();
} else {
$moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
$validates = $deletes = $ignores = 0;
if(is_array($moderate)) {
foreach($moderate as $cid => $act) {
$moderation[$act][] = $cid;
}
}
if($moderation['validate']) {
$validates = C::t('portal_comment')->update($moderation['validate'], array('status' => '0'));
updatemoderate($idtype.'_cid', $moderation['validate'], 2);
}
if($moderation['delete']) {
$validates = C::t('portal_comment')->delete($moderation['delete']);
updatemoderate($idtype.'_cid', $moderation['delete'], 2);
}
if($moderation['ignore']) {
$validates = C::t('portal_comment')->update($ignore_cids, array('status' => '2'));
updatemoderate($idtype.'_cid', $moderation['ignore'], 1);
}
if($_GET['fast']) {
echo callback_js($_GET['cid']);
exit;
} else {
cpmsg('moderate_'.$operation.'_succeed', "action=moderate&operation=$operation&page=$page&filter=$filter&dateline={$_GET['dateline']}&username={$_GET['username']}&keyword={$_GET['keyword']}&catid={$_GET['catid']}&tpp={$_GET['tpp']}&showcensor=$showcensor", 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'deletes' => $deletes));
}
}
?>

View File

@@ -0,0 +1,396 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: moderate_reply.php 32501 2013-01-29 09:51:00Z chenmengshu $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
loadcache('posttableids');
$posttable = (is_array($_G['cache']['posttableids']) ? in_array($_GET['posttableid'], $_G['cache']['posttableids']) : 0) ? $_GET['posttableid'] : 0;
if(!submitcheck('modsubmit') && !$_GET['fast']) {
require_once libfile('function/discuzcode');
$select[$_GET['ppp']] = $_GET['ppp'] ? "selected='selected'" : '';
$ppp_options = "<option value='20' $select[20]>20</option><option value='50' $select[50]>50</option><option value='100' $select[100]>100</option>";
$ppp = !empty($_GET['ppp']) ? $_GET['ppp'] : '20';
$start_limit = ($page - 1) * $ppp;
$dateline = $_GET['dateline'] ? $_GET['dateline'] : '604800';
$dateline_options = '';
foreach(array('all', '604800', '2592000', '7776000') as $v) {
$selected = '';
if($dateline == $v) {
$selected = "selected='selected'";
}
$dateline_options .= "<option value=\"$v\" $selected>".cplang("dateline_$v");
}
$posttableselect = getposttableselect_admin();
shownav('topic', $lang['moderate_replies']);
showsubmenu('nav_moderate_posts', $submenu);
showformheader("moderate&operation=replies");
showboxheader('search');
showtableheader();
showtablerow('', array('width="100"', 'width="200"', 'width="100"', $posttableselect ? 'width="160"' : '', $posttableselect ? 'width="60"' : ''),
array(
cplang('username'), "<input size=\"15\" name=\"username\" type=\"text\" value=\"{$_GET['username']}\" />",
cplang('moderate_content_keyword'), "<input size=\"15\" name=\"title\" type=\"text\" value=\"{$_GET['title']}\" />",
$posttableselect ? cplang('postsplit_select') : '',
$posttableselect
)
);
showtablerow('', array('width="100"', 'width="200"', 'width="100"', 'colspan="3"'),
array(
"{$lang['perpage']}",
"<select name=\"ppp\">$ppp_options</select><label><input name=\"showcensor\" type=\"checkbox\" class=\"checkbox\" value=\"yes\" ".($showcensor ? ' checked="checked"' : '')."/> {$lang['moderate_showcensor']}</label>",
"{$lang['moderate_bound']}",
"<select name=\"filter\">$filteroptions</select>
<select name=\"modfid\">$forumoptions</select>
<select name=\"dateline\">$dateline_options</select>
<input class=\"btn\" type=\"submit\" value=\"{$lang['search']}\" />"
)
);
showtablefooter();
showboxfooter();
$fidadd = array();
$sqlwhere = '';
if(!empty($_GET['username'])) {
$sqlwhere .= " AND p.author='{$_GET['username']}'";
}
if(!empty($dateline) && $dateline != 'all') {
$sqlwhere .= " AND p.dateline>'".(TIMESTAMP - $dateline)."'";
}
if(!empty($_GET['title'])) {
$sqlwhere .= " AND t.subject LIKE '%{$_GET['title']}%'";
}
if($modfid > 0) {
$fidadd['fids'] = $modfid;
}
$modcount = C::t('common_moderate')->count_by_search_for_post(getposttable($posttable), $moderatestatus, 0, ($modfid > 0 ? $modfid : 0), $_GET['username'], (($dateline && $dateline != 'all') ? (TIMESTAMP - $dateline) : null), $_GET['title']);
$start_limit = ($page - 1) * $ppp;
$postarr = C::t('common_moderate')->fetch_all_by_search_for_post(getposttable($posttable), $moderatestatus, 0, ($modfid > 0 ? $modfid : 0), $_GET['username'], (($dateline && $dateline != 'all') ? (TIMESTAMP - $dateline) : null), $_GET['title'], $start_limit, $ppp);
if($postarr) {
$_tids = $_fids = array();
foreach($postarr as $_post) {
$_fids[$_post['fid']] = $_post['fid'];
$_tids[$_post['tid']] = $_post['tid'];
}
$_forums = C::t('forum_forum')->fetch_all($_fids);
$_threads = C::t('forum_thread')->fetch_all($_tids);
}
$checklength = C::t('common_moderate')->fetch_all_by_idtype('pid', $moderatestatus, null);
if($modcount != $checklength && !$srcdate && !$modfid && !$_GET['username'] && !$_GET['title'] && !$posttable) {
moderateswipe('pid', array_keys($checklength));
}
$multipage = multi($modcount, $ppp, $page, ADMINSCRIPT."?action=moderate&operation=replies&filter=$filter&modfid=$modfid&dateline={$_GET['dateline']}&username={$_GET['username']}&title={$_GET['title']}&ppp=$ppp&showcensor=$showcensor&posttableid=$posttable");
showtableheader('', 'nobottom');
echo '<tr><td><p class="margintop marginbot"><a href="javascript:;" onclick="expandall();">'.cplang('moderate_all_expand').'</a> &nbsp;<a href="javascript:;" onclick="foldall();">'.cplang('moderate_all_fold').'</a></p></td></tr>';
showtablefooter();
showtableheader();
$censor = & discuz_censor::instance();
$censor->highlight = '#FF0000';
require_once libfile('function/misc');
foreach($postarr as &$post) {
$_forum = $_forums[$post['fid']];
$_arr = array(
'forumname' => $_forum['name'],
'allowsmilies' => $_forum['allowsmilies'],
'allowhtml' => $_forum['allowhtml'],
'allowbbcode' => $_forum['allowbbcode'],
'allowimgcode' => $_forum['allowimgcode'],
);
$post = array_merge($post, $_arr);
if(getstatus($post['status'], 5)) {
$post['authorid'] = 0;
$post['author'] = cplang('moderate_t_comment');
}
$post['dateline'] = dgmdate($post['dateline']);
$post['tsubject'] = $_threads[$post['tid']]['subject'];
$post['subject'] = $post['subject'] ? '<b>'.$post['subject'].'</b>' : '';
$post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], sprintf('%00b', $post['htmlon']), $post['allowsmilies'], $post['allowbbcode'], $post['allowimgcode'], $post['allowhtml']);
if($showcensor) {
$censor->check($post['subject']);
$censor->check($post['message']);
}
$post_censor_words = $censor->words_found;
if(count($post_censor_words) > 3) {
$post_censor_words = array_slice($post_censor_words, 0, 3);
}
$post['censorwords'] = implode(', ', $post_censor_words);
$post['modthreadkey'] = modauthkey($post['tid']);
$post['useip'] = $post['useip'] . '-' . convertip($post['useip']);
if($post['attachment']) {
require_once libfile('function/attachment');
foreach(C::t('forum_attachment_n')->fetch_all_by_id('tid:'.$post['tid'], 'pid', $post['pid']) as $attach) {
$_G['setting']['attachurl'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl'];
$attach['url'] = $attach['isimage']
? " {$attach['filename']} (".sizecount($attach['filesize']).")<br /><br /><img src=\"".$_G['setting']['attachurl']."forum/{$attach['attachment']}\" onload=\"if(this.width > 400) {this.resized=true; this.width=400;}\">"
: "<a href=\"".$_G['setting']['attachurl']."forum/{$attach['attachment']}\" target=\"_blank\">{$attach['filename']}</a> (".sizecount($attach['filesize']).")";
$post['message'] .= "<br /><br />{$lang['attachment']}: ".attachtype(fileext($attach['filename'])."\t").$attach['url'];
}
}
if(count($post_censor_words)) {
$post_censor_text = "<span style=\"color: red;\">({$post['censorwords']})</span>";
} else {
$post_censor_text = '';
}
showtagheader('tbody', '', true, 'hover');
showtablerow("id=\"mod_{$post['pid']}_row1\"", array("id=\"mod_{$post['pid']}_row1_op\" rowspan=\"3\" class=\"rowform threadopt\" style=\"width:80px;\"", '', 'width="120"', 'width="120"', 'width="55"'), array(
"<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_1\" value=\"validate\" onclick=\"mod_setbg({$post['pid']}, 'validate');document.getElementById('deloptions_{$post['pid']}').style.display='none';\"><label for=\"mod_{$post['pid']}_1\">{$lang['validate']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_2\" value=\"delete\" onclick=\"mod_setbg({$post['pid']}, 'delete');document.getElementById('deloptions_{$post['pid']}').style.display='inline';\"><label for=\"mod_{$post['pid']}_2\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_3\" value=\"ignore\" onclick=\"mod_setbg({$post['pid']}, 'ignore');document.getElementById('deloptions_{$post['pid']}').style.display='none';\"><label for=\"mod_{$post['pid']}_3\">{$lang['ignore']}</label></li></ul>",
$post['subject'] ? "<h3>{$post['tsubject']} &rsaquo; <a href=\"javascript:;\" onclick=\"display_toggle('{$post['pid']}');\">{$post['subject']}</a> $post_censor_text</h3><p>{$post['useip']}</p>" : "<h3> <a href=\"javascript:;\" onclick=\"display_toggle('{$post['pid']}');\">{$post['tsubject']} &rsaquo;</a> $post_censor_text</h3><p>{$post['useip']}</p>",
"<a href=\"forum.php?mod=forumdisplay&fid={$post['fid']}\">{$post['forumname']}</a>",
"<p><a target=\"_blank\" href=\"".ADMINSCRIPT."?action=members&operation=search&uid={$post['authorid']}&submit=yes\">{$post['author']}</a></p> <p>{$post['dateline']}</p>",
"<a target=\"_blank\" href=\"forum.php?mod=redirect&goto=findpost&ptid={$post['tid']}&pid={$post['pid']}\">{$lang['view']}</a>&nbsp;<a href=\"forum.php?mod=viewthread&tid={$post['tid']}&modthreadkey={$post['modthreadkey']}\" target=\"_blank\">{$lang['edit']}</a>",
));
showtablerow("id=\"mod_{$post['pid']}_row2\"", 'colspan="4" style="padding: 10px; line-height: 180%;"', '<div style="overflow: auto; overflow-x: hidden; max-height:120px; height:auto !important; height:100px; word-break: break-all;">'.$post['message'].'</div>');
showtablerow("id=\"mod_{$post['pid']}_row3\"", 'class="threadopt threadtitle" colspan="4"', "<a href=\"?action=moderate&operation=replies&fast=1&fid={$post['fid']}&tid={$post['tid']}&pid={$post['pid']}&moderate[{$post['pid']}]=validate&page=$page&posttableid=$posttable&frame=no\" target=\"fasthandle\">{$lang['validate']}</a> | <a href=\"?action=moderate&operation=replies&fast=1&fid={$post['fid']}&tid={$post['tid']}&pid={$post['pid']}&moderate[{$post['pid']}]=delete&page=$page&posttableid=$posttable&frame=no\" target=\"fasthandle\">{$lang['delete']}</a> | <a href=\"?action=moderate&operation=replies&fast=1&fid={$post['fid']}&tid={$post['tid']}&pid={$post['pid']}&moderate[{$post['pid']}]=ignore&page=$page&posttableid=$posttable&frame=no\" target=\"fasthandle\">{$lang['ignore']}</a>&nbsp;&nbsp;|&nbsp;&nbsp; ".$lang['moderate_reasonpm']."&nbsp; <input type=\"text\" class=\"txt\" name=\"pm_{$post['pid']}\" id=\"pm_{$post['pid']}\" style=\"margin: 0px;\"> &nbsp; <select style=\"margin: 0px;\" onchange=\"$('pm_{$post['pid']}').value=this.value\">$modreasonoptions</select>&nbsp;<p id=\"deloptions_{$post['pid']}\" style=\"display: none\"><label for=\"userban_{$post['pid']}\"><input type=\"checkbox\" name=\"banuser_{$post['pid']}\" id=\"userban_{$post['pid']}\" class=\"pc\" />".$lang['banuser']."</label><label for=\"userdelpost_{$post['pid']}\"><input type=\"checkbox\" name=\"userdelpost_{$post['pid']}\" id=\"userdelpost_{$post['pid']}\" class=\"pc\" />".$lang['userdelpost']."</label><label for=\"crimerecord_{$post['pid']}\"><input type=\"checkbox\" name=\"crimerecord_{$post['pid']}\" id=\"crimerecord_{$post['pid']}\" class=\"pc\" />".$lang['crimerecord']."</label></p>");
showtagfooter('tbody');
}
showsubmit('modsubmit', 'submit', '', '<a href="#all" onclick="mod_setbg_all(\'validate\')">'.cplang('moderate_all_validate').'</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'delete\')">'.cplang('moderate_all_delete').'</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'ignore\')">'.cplang('moderate_all_ignore').'</a> &nbsp;<a href="#all" onclick="mod_cancel_all();">'.cplang('moderate_all_cancel').'</a> &nbsp;<label><input class="checkbox" type="checkbox" name="apply_all" id="chk_apply_all" value="1" disabled="disabled" />'.cplang('moderate_apply_all').'</label>', $multipage, false);
showtablefooter();
showformfooter();
} else {
$moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
$pmlist = array();
$validates = $ignores = $deletes = 0;
if(is_array($moderate)) {
foreach($moderate as $pid => $act) {
$moderation[$act][] = intval($pid);
}
}
if($_GET['apply_all']) {
$apply_all_action = $_GET['apply_all'];
$first = '0';
if($filter == 'ignore') {
$invisible = '-3';
} else {
$invisible = '-2';
}
if($modfid > 0) {
$modfid = $modfid;
}
if(!empty($_GET['dateline']) && $_GET['dateline'] != 'all') {
$starttime = $_GET['dateline'];
}
if(!empty($_GET['username'])) {
$author = $_GET['username'];
}
if(!empty($_GET['title'])) {
$title = str_replace(array('_', '%'), array('\_', '\%'), $_GET['title']);
$keywords = $title;
}
foreach(C::t('forum_post')->fetch_all_by_search($posttable, null, $keywords, $invisible, $modfid, null, $author, $starttime, null, null, $first) as $post) {
switch($apply_all_action) {
case 'validate':
$moderation['validate'][] = $post['pid'];
break;
case 'delete':
$moderation['delete'][] = $post['pid'];
break;
case 'ignore':
$moderation['ignore'][] = $post['pid'];
break;
}
}
}
require_once libfile('function/post');
if($ignorepids = dimplode($moderation['ignore'])) {
$ignores = C::t('forum_post')->update_post($posttable, $moderation['ignore'], array('invisible' => -3), false, false, 0, -2, $fidadd['fids']);
updatemoderate('pid', $moderation['ignore'], 1);
}
if($deletepids = dimplode($moderation['delete'])) {
$pids = $recyclebinpids = array();
foreach(C::t('forum_post')->fetch_all_post($posttable, $moderation['delete']) as $post) {
if($post['invisible'] != $displayorder || $post['first'] != 0 || ($fidadd['fids'] && $post['fid'] != $fidadd['fids'])) {
continue;
}
if($recyclebins[$post['fid']]) {
$recyclebinpids[] = $post['pid'];
} else {
$pids[] = $post['pid'];
}
$pm = 'pm_'.$post['pid'];
if($post['authorid'] && $post['authorid'] != $_G['uid']) {
$pmlist[] = array(
'action' => $_GET[''.$pm] ? 'modreplies_delete_reason' : 'modreplies_delete',
'notevar' => array('pid' => $post['pid'], 'post' => dhtmlspecialchars(messagecutstr($post['message'], 30)), 'reason' => dhtmlspecialchars($_GET[''.$pm]), 'modusername' => ($_G['setting']['moduser_public'] ? $_G['username'] : '')),
'authorid' => $post['authorid'],
);
}
if($_GET['crimerecord'.$post['pid']]) {
require_once libfile('function/member');
crime('recordaction', $post['authorid'], 'crime_delpost', lang('forum/misc', 'crime_postreason', array('reason' => dhtmlspecialchars($_GET[$pm]), 'tid' => $post['tid'], 'pid' => $post['pid'])));
}
if($_GET['banuser_'.$post['pid']] || $_GET['userdelpost_'.$post['pid']]) {
$members = C::t('common_member')->fetch_all((array)$post['authorid']);
$banuins = array();
foreach($members as $member) {
if(($_G['cache']['usergroups'][$member['groupid']]['type'] == 'system' &&
in_array($member['groupid'], array(1, 2, 3, 6, 7, 8))) || $_G['cache']['usergroups'][$member['groupid']]['type'] == 'special') {
continue;
}
$banuins[$member['uid']] = $member['uid'];
}
if($banuins) {
if($_GET['banuser_'.$post['pid']]) {
C::t('common_member')->update($banuins, array('groupid' => 4));
}
if($_GET['userdelpost_'.$post['pid']]) {
require_once libfile('function/delete');
deletememberpost($banuins);
}
}
}
}
require_once libfile('function/delete');
if($recyclebinpids) {
deletepost($recyclebinpids, 'pid', false, $posttable, true);
}
if($pids) {
$deletes = deletepost($pids, 'pid', false, $posttable);
}
$deletes += count($recyclebinpids);
updatemodworks('DLP', count($moderation['delete']));
updatemoderate('pid', $moderation['delete'], 2);
}
if($validatepids = dimplode($moderation['validate'])) {
$forums = $threads = $attachments = $pidarray = $authoridarray = array();
$tids = $postlist = array();
foreach(C::t('forum_post')->fetch_all_post($posttable, $moderation['validate']) as $post) {
if($post['first'] != 0) {
continue;
}
$tids[$post['tid']] = $post['tid'];
$postlist[] = $post;
}
$threadlist = C::t('forum_thread')->fetch_all($tids);
$firsttime_validatepost = array();
$uids = array();
foreach($postlist as $post) {
$post['lastpost'] = $threadlist[$post['tid']]['lastpost'];
$pidarray[] = $post['pid'];
if(getstatus($post['status'], 3) == 0) {
$post['subject'] = $threadlist[$post['tid']]['subject'];
$firsttime_validatepost[] = $post;
$uids[] = $post['authorid'];
updatepostcredits('+', $post['authorid'], 'reply', $post['fid']);
$attachcount = C::t('forum_attachment_n')->count_by_id('tid:'.$post['tid'], 'pid', $post['pid']);
updatecreditbyaction('postattach', $post['authorid'], array(), '', $attachcount, 1, $post['fid']);
}
$forums[] = $post['fid'];
$threads[$post['tid']]['replies']++;
if($post['dateline'] > $post['lastpost']) {
$threads[$post['tid']]['lastpost'] = array($post['dateline']);
$threads[$post['tid']]['lastposter'] = array($post['anonymous'] && $post['dateline'] != $post['lastpost'] ? '' : $post['author']);
}
if($threads[$post['tid']]['attachadd'] || $post['attachment']) {
$threads[$post['tid']]['attachment'] = array(1);
}
$pm = 'pm_'.$post['pid'];
if($post['authorid'] && $post['authorid'] != $_G['uid']) {
$pmlist[] = array(
'action' => 'modreplies_validate',
'notevar' => array('pid' => $post['pid'], 'tid' => $post['tid'], 'post' => dhtmlspecialchars(messagecutstr($post['message'], 30)), 'reason' => dhtmlspecialchars($_GET[''.$pm]), 'modusername' => ($_G['setting']['moduser_public'] ? $_G['username'] : ''), 'from_id' => 0, 'from_idtype' => 'modreplies'),
'authorid' => $post['authorid'],
);
}
}
unset($postlist, $tids, $threadlist);
if($firsttime_validatepost) {
require_once libfile('function/post');
require_once libfile('function/feed');
$forumsinfo = C::t('forum_forum')->fetch_all_info_by_fids($forums);
$users = array();
foreach ($uids as $uid) {
$space = array('uid'=>$uid);
space_merge($space, 'field_home');
$users[$uid] = $space;
}
foreach ($firsttime_validatepost as $post) {
if($forumsinfo[$post['fid']] && $forumsinfo[$post['fid']]['allowfeed'] && $users[$post['authorid']]['privacy']['feed']['newreply'] && !$post['anonymous']) {
$feed = array(
'icon' => 'post',
'title_template' => 'feed_reply_title',
'title_data' => array(),
'images' => array()
);
$post_url = "forum.php?mod=redirect&goto=findpost&pid=".$post['pid']."&ptid=".$post['tid'];
$feed['title_data'] = array(
'subject' => "<a href=\"$post_url\">".$post['subject']."</a>",
'author' => "<a href=\"home.php?mod=space&uid=".$post['authorid']."\">".$post['author']."</a>"
);
$feed['title_data']['hash_data'] = 'tid'.$post['tid'];
$feed['id'] = $post['pid'];
$feed['idtype'] = 'pid';
feed_add($feed['icon'], $feed['title_template'], $feed['title_data'], $feed['body_template'], $feed['body_data'], '', $feed['images'], $feed['image_links'], '', '', '', 0, $feed['id'], $feed['idtype'],$post['authorid'], $post['author']);
}
}
}
foreach($threads as $tid => $thread) {
C::t('forum_thread')->increase($tid, $thread);
}
foreach(array_unique($forums) as $fid) {
updateforumcount($fid);
}
if(!empty($pidarray)) {
C::t('forum_post')->update_post($posttable, $pidarray, array('status' => 4), false, false, null, -2, null, 0);
$validates = C::t('forum_post')->update_post($posttable, $pidarray, array('invisible' => 0));
updatemodworks('MOD', $validates);
updatemoderate('pid', $pidarray, 2);
} else {
require_once libfile('function/forum');
updatemodworks('MOD', 1);
}
}
if($pmlist) {
foreach($pmlist as $pm) {
notification_add($pm['authorid'], 'system', $pm['action'], $pm['notevar'], 1);
}
}
if($_GET['fast']) {
echo callback_js($_GET['pid']);
exit;
} else {
cpmsg('moderate_replies_succeed', "action=moderate&operation=replies&page=$page&filter=$filter&modfid=$modfid&posttableid=$posttable&dateline={$_GET['dateline']}&username={$_GET['username']}&title={$_GET['title']}&ppp={$_GET['ppp']}&showcensor=$showcensor", 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'recycles' => $recycles, 'deletes' => $deletes));
}
}
?>

View File

@@ -0,0 +1,240 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: moderate_share.php 27434 2012-01-31 08:57:34Z chenmengshu $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
if(!submitcheck('modsubmit') && !$_GET['fast']) {
shownav('topic', $lang['moderate_shares']);
showsubmenu('nav_moderate_shares', $submenu);
$select[$_GET['tpp']] = $_GET['tpp'] ? "selected='selected'" : '';
$tpp_options = "<option value='20' $select[20]>20</option><option value='50' $select[50]>50</option><option value='100' $select[100]>100</option>";
$tpp = !empty($_GET['tpp']) ? $_GET['tpp'] : '20';
$start_limit = ($page - 1) * $ppp;
$dateline = $_GET['dateline'] ? $_GET['dateline'] : '604800';
$dateline_options = '';
foreach(array('all', '604800', '2592000', '7776000') as $v) {
$selected = '';
if($dateline == $v) {
$selected = "selected='selected'";
}
$dateline_options .= "<option value=\"$v\" $selected>".cplang("dateline_$v");
}
$share_status = 1;
if($_GET['filter'] == 'ignore') {
$share_status = 2;
}
showformheader("moderate&operation=shares");
showboxheader('search');
showtableheader();
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
cplang('username'), "<input size=\"15\" name=\"username\" type=\"text\" value=\"{$_GET['username']}\" />",
cplang('moderate_content_keyword'), "<input size=\"15\" name=\"keyword\" type=\"text\" value=\"{$_GET['keyword']}\" />",
)
);
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
"{$lang['perpage']}",
"<select name=\"tpp\">$tpp_options</select><label><input name=\"showcensor\" type=\"checkbox\" class=\"checkbox\" value=\"yes\" ".($showcensor ? ' checked="checked"' : '')."/> {$lang['moderate_showcensor']}</label>",
"{$lang['moderate_bound']}",
"<select name=\"filter\">$filteroptions</select>
<select name=\"dateline\">$dateline_options</select>
<input class=\"btn\" type=\"submit\" value=\"{$lang['search']}\" />"
)
);
showtablefooter();
showboxfooter();
$pagetmp = $page;
$sqlwhere = '';
if(!empty($_GET['username'])) {
$sqlwhere .= " AND s.username='{$_GET['username']}'";
}
if(!empty($dateline) && $dateline != 'all') {
$sqlwhere .= " AND s.dateline>'".(TIMESTAMP - $dateline)."'";
}
if(!empty($_GET['keyword'])) {
$keyword = str_replace(array('%', '_'), array('\%', '\_'), $_GET['keyword']);
$sqlwhere .= " AND s.body_general LIKE '%$keyword%'";
}
$modcount = C::t('common_moderate')->count_by_search_for_share($moderatestatus, $_GET['username'], (($dateline && $dateline != 'all') ? (TIMESTAMP - $dateline) : null), $_GET['keyword']);
do {
$start_limit = ($pagetmp - 1) * $tpp;
$sharearr = C::t('common_moderate')->fetch_all_by_search_for_share($moderatestatus, $_GET['username'], (($dateline && $dateline != 'all') ? (TIMESTAMP - $dateline) : null), $_GET['keyword'], $start_limit, $tpp);
$pagetmp = $pagetmp - 1;
} while($pagetmp > 0 && empty($sharearr));
$page = $pagetmp + 1;
$multipage = multi($modcount, $tpp, $page, ADMINSCRIPT."?action=moderate&operation=shares&filter=$filter&dateline={$_GET['dateline']}&username={$_GET['username']}&keyword={$_GET['keyword']}&tpp=$tpp&showcensor=$showcensor");
showtableheader('', 'nobottom');
echo '<tr><td><p class="margintop marginbot"><a href="javascript:;" onclick="expandall();">'.cplang('moderate_all_expand').'</a> &nbsp;<a href="javascript:;" onclick="foldall();">'.cplang('moderate_all_fold').'</a></p></td></tr>';
showtablefooter();
showtableheader();
$censor = & discuz_censor::instance();
$censor->highlight = '#FF0000';
require_once libfile('function/misc');
foreach($sharearr as $share) {
$short_desc = cutstr($share['body_general'], 30);
$share['dateline'] = dgmdate($share['dateline']);
if($showcensor) {
$censor->check($short_desc);
$censor->check($share['body_general']);
}
$share_censor_words = $censor->words_found;
if(count($share_censor_words) > 3) {
$share_censor_words = array_slice($share_censor_words, 0, 3);
}
$share['censorwords'] = implode(', ', $share_censor_words);
$share['modkey'] = modauthkey($share['itemid']);
if(count($share_censor_words)) {
$share_censor_text = "<span style=\"color: red;\">({$share['censorwords']})</span>";
} else {
$share_censor_text = '';
}
$shareurl = '';
switch($share['type']) {
case 'thread':
$shareurl = "forum.php?mod=viewthread&tid={$share['itemid']}&modthreadkey={$share['modkey']}";
$sharetitle = lang('admincp', 'share_type_thread');
break;
case 'pic':
$shareurl = "home.php?mod=space&uid={$share['fromuid']}&do=album&picid={$share['itemid']}&modpickey={$share['modkey']}";
$sharetitle = lang('admincp', 'share_type_pic');
break;
case 'space':
$shareurl = "home.php?mod=space&uid={$share['itemid']}";
$sharetitle = lang('admincp', 'share_type_space');
break;
case 'blog':
$shareurl = "home.php?mod=space&uid={$share['fromuid']}&do=blog&id={$share['itemid']}&modblogkey={$share['modkey']}";
$sharetitle = lang('admincp', 'share_type_blog');
break;
case 'album':
$shareurl = "home.php?mod=space&uid={$share['fromuid']}&do=album&id={$share['itemid']}&modalbumkey={$share['modkey']}";
$sharetitle = lang('admincp', 'share_type_album');
break;
case 'article':
$shareurl = "portal.php?mod=view&aid={$share['itemid']}&modarticlekey={$share['modkey']}";
$sharetitle = lang('admincp', 'share_type_article');
break;
}
showtagheader('tbody', '', true, 'hover');
showtablerow("id=\"mod_{$share['sid']}_row1\"", array("id=\"mod_{$share['sid']}_row1_op\" rowspan=\"3\" class=\"rowform threadopt\" style=\"width:80px;\"", '', 'width="120"', 'width="120"', 'width="55"', 'width="55"'), array(
"<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$share['sid']}]\" id=\"mod_{$share['sid']}_1\" value=\"validate\" onclick=\"mod_setbg({$share['sid']}, 'validate');\"><label for=\"mod_{$share['sid']}_1\">{$lang['validate']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$share['sid']}]\" id=\"mod_{$share['sid']}_2\" value=\"delete\" onclick=\"mod_setbg({$share['sid']}, 'delete');\"><label for=\"mod_{$share['sid']}_2\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$share['sid']}]\" id=\"mod_{$doing['doid']}_3\" value=\"ignore\" onclick=\"mod_setbg({$share['sid']}, 'ignore');\"><label for=\"mod_{$share['sid']}_3\">{$lang['ignore']}</label></li></ul>",
"<h3><a href=\"javascript:;\" onclick=\"display_toggle({$share['sid']});\">$short_desc $share_censor_text</a></h3>",
$sharetitle,
"<p><a target=\"_blank\" href=\"".ADMINSCRIPT."?action=members&operation=search&uid={$share['uid']}&submit=yes\">{$share['username']}</a></p> <p>{$share['dateline']}</p>",
"<a target=\"_blank\" href=\"$shareurl\">{$lang['view']}</a>",
));
showtablerow("id=\"mod_{$share['sid']}_row2\"", 'colspan="4" style="padding: 10px; line-height: 180%;"', '<div style="overflow: auto; overflow-x: hidden; max-height:120px; height:auto !important; height:100px; word-break: break-all;">'.$share['body_general'].'</div>');
showtablerow("id=\"mod_{$share['sid']}_row3\"", 'class="threadopt threadtitle" colspan="4"', "<a href=\"?action=moderate&operation=shares&fast=1&sid={$share['sid']}&moderate[{$share['sid']}]=validate&page=$page&frame=no\" target=\"fasthandle\">{$lang['validate']}</a> | <a href=\"?action=moderate&operation=shares&fast=1&sid={$share['sid']}&moderate[{$share['sid']}]=delete&page=$page&frame=no\" target=\"fasthandle\">{$lang['delete']}</a> | <a href=\"?action=moderate&operation=shares&fast=1&sid={$share['sid']}&moderate[{$share['sid']}]=ignore&page=$page&frame=no\" target=\"fasthandle\">{$lang['ignore']}</a>");
showtagfooter('tbody');
}
showsubmit('modsubmit', 'submit', '', '<a href="#all" onclick="mod_setbg_all(\'validate\')">'.cplang('moderate_all_validate').'</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'delete\')">'.cplang('moderate_all_delete').'</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'ignore\')">'.cplang('moderate_all_ignore').'</a> &nbsp;<a href="#all" onclick="mod_cancel_all();">'.cplang('moderate_all_cancel').'</a>', $multipage, false);
showtablefooter();
showformfooter();
} else {
$moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
$validates = $deletes = $ignores = 0;
if(is_array($moderate)) {
foreach($moderate as $sid => $act) {
$moderation[$act][] = $sid;
}
}
if(!empty($moderation['validate'])) {
require_once libfile('function/feed');
$validates = C::t('home_share')->update($moderation['validate'], array('status' => 0));
foreach(C::t('home_share')->fetch_all($moderation['validate']) as $share) {
switch($share['type']) {
case 'thread':
$feed_hash_data = 'tid' . $share['itemid'];
$share['title_template'] = lang('spacecp', 'share_thread');
break;
case 'space':
$feed_hash_data = 'uid' . $share['itemid'];
$share['title_template'] = lang('spacecp', 'share_space');
break;
case 'blog':
$feed_hash_data = 'blogid' . $share['itemid'];
$share['title_template'] = lang('spacecp', 'share_blog');
break;
case 'album':
$feed_hash_data = 'albumid' . $share['itemid'];
$share['title_template'] = lang('spacecp', 'share_album');
break;
case 'pic':
$feed_hash_data = 'picid' . $share['itemid'];
$share['title_template'] = lang('spacecp', 'share_image');
break;
case 'article':
$feed_hash_data = 'articleid' . $share['itemid'];
$share['title_template'] = lang('spacecp', 'share_article');
break;
case 'link':
$feed_hash_data = '';
break;
}
feed_add('share',
'{actor} '.$share['title_template'],
array('hash_data' => $feed_hash_data),
$share['body_template'],
dunserialize($share['body_data']),
$share['body_general'],
array($share['image']),
array($share['image_link']),
'',
'',
'',
0,
0,
'',
$share['uid'],
$share['username']
);
}
updatemoderate('sid', $moderation['validate'], 2);
}
if(!empty($moderation['delete'])) {
require libfile('function/delete');
$shares = deleteshares($moderation['delete']);
$deletes = count($shares);
updatemoderate('sid', $moderation['delete'], 2);
}
if($ignore_sids = dimplode($moderation['ignore'])) {
$ignores = C::t('home_share')->update($moderation['ignore'], array('status' => 2));
updatemoderate('sid', $moderation['ignore'], 1);
}
if($_GET['fast']) {
echo callback_js($_GET['sid']);
exit;
} else {
cpmsg('moderate_shares_succeed', "action=moderate&operation=shares&page=$page&filter=$filter&dateline={$_GET['dateline']}&username={$_GET['username']}&keyword={$_GET['keyword']}&tpp={$_GET['tpp']}&showcensor=$showcensor", 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'deletes' => $deletes));
}
}
?>

View File

@@ -0,0 +1,381 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: moderate_thread.php 32501 2013-01-29 09:51:00Z chenmengshu $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
if(!submitcheck('modsubmit') && !$_GET['fast']) {
require_once libfile('function/discuzcode');
$select[$_GET['tpp']] = $_GET['tpp'] ? "selected='selected'" : '';
$tpp_options = "<option value='20' $select[20]>20</option><option value='50' $select[50]>50</option><option value='100' $select[100]>100</option>";
$tpp = !empty($_GET['tpp']) ? $_GET['tpp'] : '20';
$start_limit = ($page - 1) * $tpp;
$dateline = $_GET['dateline'] ? $_GET['dateline'] : '604800';
$dateline_options = '';
foreach(array('all', '604800', '2592000', '7776000') as $v) {
$selected = '';
if($dateline == $v) {
$selected = "selected='selected'";
}
$dateline_options .= "<option value=\"$v\" $selected>".cplang("dateline_$v");
}
shownav('topic', $lang['moderate_threads']);
showsubmenu('nav_moderate_threads', $submenu);
showformheader("moderate&operation=threads");
showboxheader('search');
showtableheader();
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
cplang('username'), "<input size=\"15\" name=\"username\" type=\"text\" value=\"{$_GET['username']}\" />",
cplang('moderate_title_keyword'), "<input size=\"15\" name=\"title\" type=\"text\" value=\"{$_GET['title']}\" />",
)
);
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
"{$lang['perpage']}",
"<select name=\"tpp\">$tpp_options</select><label><input name=\"showcensor\" type=\"checkbox\" class=\"checkbox\" value=\"yes\" ".($showcensor ? ' checked="checked"' : '')."/> {$lang['moderate_showcensor']}</label>",
"{$lang['moderate_bound']}",
"<select name=\"filter\">$filteroptions</select>
<select name=\"modfid\">$forumoptions</select>
<select name=\"dateline\">$dateline_options</select>
<input class=\"btn\" type=\"submit\" value=\"{$lang['search']}\" />"
)
);
showtablefooter();
showboxfooter();
$title = '';
if(!empty($_GET['title'])) {
$title = str_replace(array('_', '%'), array('\_', '\%'), $_GET['title']);
}
if(!empty($dateline) && $dateline != 'all') {
$srcdate = TIMESTAMP - $dateline;
}
$fids = $modfid && $modfid != -1 ? $modfid : 0;
$isgroup = $modfid == -1 ? 1 : -1;
$modcount = 0;
$moderates = C::t('common_moderate')->fetch_all_by_idtype('tid', $moderatestatus, $srcdate);
if(!empty($moderates)) {
$modcount = C::t('forum_thread')->count_by_tid_fid(array_keys($moderates), $fids, $isgroup, $_GET['username'], $title);
}
if($modcount != count($moderates) && !$srcdate && !$fids && !$_GET['username'] && !$title) {
moderateswipe('tid', array_keys($moderates));
}
$start_limit = ($page - 1) * $tpp;
if($modcount) {
$threadlist = C::t('forum_thread')->fetch_all_by_tid_fid(array_keys($moderates), $fids, $isgroup, $_GET['username'], $title, $start_limit, $tpp);
$tids = C::t('forum_thread')->get_posttableid();
if($tids) {
foreach($tids as $posttableid => $tid) {
foreach(C::t('forum_post')->fetch_all_by_tid($posttableid, $tid, true, '', 0, 0, 1) as $post) {
$threadlist[$post['tid']] = array_merge($threadlist[$post['tid']], $post);
}
}
}
$multipage = multi($modcount, $tpp, $page, ADMINSCRIPT."?action=moderate&operation=threads&filter=$filter&modfid=$modfid&dateline={$_GET['dateline']}&username={$_GET['username']}&title={$_GET['title']}&tpp=$tpp&showcensor=$showcensor");
}
showtableheader('', 'nobottom');
echo '<tr><td><p class="margintop marginbot"><a href="javascript:;" onclick="expandall();">'.cplang('moderate_all_expand').'</a> &nbsp;<a href="javascript:;" onclick="foldall();">'.cplang('moderate_all_fold').'</a></p></td></tr>';
showtablefooter();
showtableheader();
loadcache('forums');
require_once libfile('function/misc');
foreach($threadlist as $thread) {
if($thread['displayorder'] >= 0) {
updatemoderate('tid', $thread['tid'], 2);
continue;
}
$threadsortinfo = '';
$thread['useip'] = $thread['useip'] . '-' . convertip($thread['useip']);
if($thread['authorid'] && $thread['author']) {
$thread['author'] = "<a href=\"?action=members&operation=search&uid={$thread['authorid']}&submit=yes\" target=\"_blank\">{$thread['author']}</a>";
} elseif($thread['authorid'] && !$thread['author']) {
$thread['author'] = "<a href=\"?action=members&operation=search&uid={$thread['authorid']}&submit=yes\" target=\"_blank\">{$lang['anonymous']}</a>";
} else {
$thread['author'] = $lang['guest'];
}
$thread['dateline'] = dgmdate($thread['dateline']);
$thread['message'] = discuzcode($thread['message'], $thread['smileyoff'], $thread['bbcodeoff']);
$censor = & discuz_censor::instance();
$censor->highlight = '#FF0000';
if($showcensor) {
$censor->check($thread['subject']);
$censor->check($thread['message']);
}
$thread['modthreadkey'] = modauthkey($thread['tid']);
$censor_words = $censor->words_found;
if(count($censor_words) > 3) {
$censor_words = array_slice($censor_words, 0, 3);
}
$thread['censorwords'] = implode(', ', $censor_words);
if($thread['attachment']) {
require_once libfile('function/attachment');
foreach(C::t('forum_attachment_n')->fetch_all_by_id('tid:'.$thread['tid'], 'tid', $thread['tid']) as $attach) {
$_G['setting']['attachurl'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl'];
$attach['url'] = $attach['isimage']
? " {$attach['filename']} (".sizecount($attach['filesize']).")<br /><br /><img src=\"".$_G['setting']['attachurl']."forum/{$attach['attachment']}\" onload=\"if(this.width > 400) {this.resized=true; this.width=400;}\">"
: "<a href=\"".$_G['setting']['attachurl']."forum/{$attach['attachment']}\" target=\"_blank\">{$attach['filename']}</a> (".sizecount($attach['filesize']).")";
$thread['message'] .= "<br /><br />{$lang['attachment']}: ".attachtype(fileext($attach['filename'])."\t").$attach['url'];
}
}
if($thread['sortid']) {
require_once libfile('function/threadsort');
$threadsortshow = threadsortshow($thread['sortid'], $thread['tid']);
foreach($threadsortshow['optionlist'] as $option) {
$threadsortinfo .= $option['title'].' '.$option['value']."<br />";
}
}
if(count($censor_words)) {
$thread_censor_text = "<span style=\"color: red;\">({$thread['censorwords']})</span>";
} else {
$thread_censor_text = '';
}
$forumname = $_G['cache']['forums'][$thread['fid']]['name'];
showtagheader('tbody', '', true, 'hover');
showtablerow("id=\"mod_{$thread['tid']}_row1\"", array("id=\"mod_{$thread['tid']}_row1_op\" rowspan=\"3\" class=\"rowform threadopt\" style=\"width:80px;\"", '', 'width="120"', 'width="120"', 'width="70"'), array(
"<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$thread['tid']}]\" id=\"mod_{$thread['tid']}_1\" value=\"validate\" onclick=\"mod_setbg({$thread['tid']}, 'validate');document.getElementById('deloptions_{$thread['tid']}').style.display='none';\"><label for=\"mod_{$thread['tid']}_1\">{$lang['validate']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$thread['tid']}]\" id=\"mod_{$thread['tid']}_2\" value=\"delete\" onclick=\"mod_setbg({$thread['tid']}, 'delete');document.getElementById('deloptions_{$thread['tid']}').style.display='inline';\"><label for=\"mod_{$thread['tid']}_2\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$thread['tid']}]\" id=\"mod_{$thread['tid']}_3\" value=\"ignore\" onclick=\"mod_setbg({$thread['tid']}, 'ignore');document.getElementById('deloptions_{$thread['tid']}').style.display='none';\"><label for=\"mod_{$thread['tid']}_3\">{$lang['ignore']}</label></li></ul>",
"<h3><a href=\"javascript:;\" onclick=\"display_toggle('{$thread['tid']}');\">{$thread['subject']}</a> $thread_censor_text</h3><p>{$thread['useip']}</p>",
"<a target=\"_blank\" href=\"forum.php?mod=forumdisplay&fid={$thread['fid']}\">$forumname</a>",
"<p>{$thread['author']}</p> <p>{$thread['dateline']}</p>",
"<a target=\"_blank\" href=\"forum.php?mod=viewthread&tid={$thread['tid']}&modthreadkey={$thread['modthreadkey']}\">{$lang['view']}</a>&nbsp;<a href=\"forum.php?mod=post&action=edit&fid={$thread['fid']}&tid={$thread['tid']}&pid={$thread['pid']}&modthreadkey={$thread['modthreadkey']}\" target=\"_blank\">{$lang['edit']}</a>",
));
showtablerow("id=\"mod_{$thread['tid']}_row2\"", 'colspan="4" style="padding: 10px; line-height: 180%;"', '<div style="overflow: auto; overflow-x: hidden; max-height:120px; height:auto !important; height:120px; word-break: break-all;">'.$thread['message'].'<br /><br />'.$threadsortinfo.'</div>');
showtablerow("id=\"mod_{$thread['tid']}_row3\"", 'class="threadopt threadtitle" colspan="4"', "<a href=\"?action=moderate&operation=threads&fast=1&fid={$thread['fid']}&tid={$thread['tid']}&moderate[{$thread['tid']}]=validate&page=$page&frame=no\" target=\"fasthandle\">{$lang['validate']}</a> | <a href=\"?action=moderate&operation=threads&fast=1&fid={$thread['fid']}&tid={$thread['tid']}&moderate[{$thread['tid']}]=delete&page=$page&frame=no\" target=\"fasthandle\">{$lang['delete']}</a> | <a href=\"?action=moderate&operation=threads&fast=1&fid={$thread['fid']}&tid={$thread['tid']}&moderate[{$thread['tid']}]=ignore&page=$page&frame=no\" target=\"fasthandle\">{$lang['ignore']}</a> | <a href=\"forum.php?mod=post&action=edit&fid={$thread['fid']}&tid={$thread['tid']}&pid={$thread['pid']}&page=1&modthreadkey={$thread['modthreadkey']}\" target=\"_blank\">".$lang['moderate_edit_thread']."</a> &nbsp;&nbsp;|&nbsp;&nbsp; ".$lang['moderate_reasonpm']."&nbsp; <input type=\"text\" class=\"txt\" name=\"pm_{$thread['tid']}\" id=\"pm_{$thread['tid']}\" style=\"margin: 0px;\"> &nbsp; <select style=\"margin: 0px;\" onchange=\"$('pm_{$thread['tid']}').value=this.value\">$modreasonoptions</select>&nbsp;<p id=\"deloptions_{$thread['tid']}\" style=\"display: none\"><label for=\"userban_{$thread['tid']}\"><input type=\"checkbox\" name=\"banuser_{$thread['tid']}\" id=\"userban_{$thread['tid']}\" class=\"pc\" />".$lang['banuser']."</label><label for=\"userdelpost_{$thread['tid']}\"><input type=\"checkbox\" name=\"userdelpost_{$thread['tid']}\" id=\"userdelpost_{$thread['tid']}\" class=\"pc\" />".$lang['userdelpost']."</label><label for=\"crimerecord_{$thread['tid']}\"><input type=\"checkbox\" name=\"crimerecord_{$thread['tid']}\" id=\"crimerecord_{$thread['tid']}\" class=\"pc\" />".$lang['crimerecord']."</label></p>");
showtagfooter('tbody');
}
showsubmit('modsubmit', 'submit', '', '<a href="#all" onclick="mod_setbg_all(\'validate\')">'.cplang('moderate_all_validate').'</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'delete\')">'.cplang('moderate_all_delete').'</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'ignore\')">'.cplang('moderate_all_ignore').'</a> &nbsp;<a href="#all" onclick="mod_cancel_all();">'.cplang('moderate_all_cancel').'</a> &nbsp;<label><input class="checkbox" type="checkbox" name="apply_all" id="chk_apply_all" value="1" disabled="disabled" />'.cplang('moderate_apply_all').'</label>', $multipage, false);
showtablefooter();
showformfooter();
} else {
$validates = $ignores = $recycles = $deletes = 0;
$validatedthreads = $pmlist = array();
$moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
if(is_array($moderate)) {
foreach($moderate as $tid => $act) {
$moderation[$act][] = intval($tid);
}
}
if($_GET['apply_all']) {
$apply_all_action = $_GET['apply_all'];
$author = $dateline = $isgroup = $displayorder = null;
if($filter == 'ignore') {
$displayorder = -3;
} else {
$displayorder = -2;
}
if($modfid == -1) {
$isgroup = 1;
}
if(!empty($_GET['dateline']) && $_GET['dateline'] != 'all') {
$dateline = $_GET['dateline'];
}
foreach(C::t('forum_thread')->fetch_all_moderate($modfid, $displayorder, $isgroup, $dateline, $_GET['username'], $_GET['title']) as $thread) {
switch($apply_all_action) {
case 'validate':
$moderation['validate'][] = $thread['tid'];
break;
case 'delete':
$moderation['delete'][] = $thread['tid'];
break;
case 'ignore':
$moderation['ignore'][] = $thread['tid'];
break;
}
}
}
if($moderation['ignore']) {
$ignores = C::t('forum_thread')->update_displayorder_by_tid_displayorder($moderation['ignore'], -2, -3);
updatemoderate('tid', $moderation['ignore'], 1);
}
if($moderation['delete']) {
$deletetids = array();
$recyclebintids = array();
$deleteauthorids = array();
foreach(C::t('forum_thread')->fetch_all_by_tid_displayorder($moderation['delete'], $displayorder, '>=', $fidadd['fids']) as $thread) {
if($recyclebins[$thread['fid']]) {
$recyclebintids[] = $thread['tid'];
} else {
$deletetids[] = $thread['tid'];
}
$pm = 'pm_'.$thread['tid'];
if($thread['authorid'] && $thread['authorid'] != $_G['uid']) {
$pmlist[] = array(
'action' => $_GET[$pm] ? 'modthreads_delete_reason' : 'modthreads_delete',
'notevar' => array('threadsubject' => $thread['subject'], 'reason' => $_GET[$pm], 'modusername' => ($_G['setting']['moduser_public'] ? $_G['username'] : '')),
'authorid' => $thread['authorid'],
);
}
if($_GET['crimerecord_'.$thread['tid']]) {
require_once libfile('function/member');
crime('recordaction', $thread['authorid'], 'crime_delpost', lang('forum/misc', 'crime_postreason', array('reason' => dhtmlspecialchars($_GET[$pm]), 'tid' => $thread['tid'], 'pid' => $thread['pid'])));
}
if($_GET['banuser_'.$thread['tid']] || $_GET['userdelpost_'.$thread['tid']]) {
$members = C::t('common_member')->fetch_all((array)$thread['authorid']);
$banuins = array();
foreach($members as $member) {
if(($_G['cache']['usergroups'][$member['groupid']]['type'] == 'system' &&
in_array($member['groupid'], array(1, 2, 3, 6, 7, 8))) || $_G['cache']['usergroups'][$member['groupid']]['type'] == 'special') {
continue;
}
$banuins[$member['uid']] = $member['uid'];
}
if($banuins) {
if($_GET['banuser_'.$thread['tid']]) {
C::t('common_member')->update($banuins, array('groupid' => 4));
}
if($_GET['userdelpost_'.$thread['tid']]) {
require_once libfile('function/delete');
deletememberpost($banuins);
}
}
}
}
require_once libfile('function/delete');
if($recyclebintids) {
$recycles = deletethread($recyclebintids, false, false, true);
updatemodworks('MOD', $recycles);
updatemodlog(implode(',', $recyclebintids), 'DEL');
}
$deletes = deletethread($deletetids);
updatemoderate('tid', $moderation['delete'], 2);
}
if($moderation['validate']) {
require_once libfile('function/forum');
$forums = array();
$tids = $authoridarray = $moderatedthread = array();
$firsttime_validatethread = array();
$uids = array();
foreach(C::t('forum_thread')->fetch_all_by_tid_fid($moderation['validate'], $fidadd['fids']) as $thread) {
if($thread['displayorder'] != -2 && $thread['displayorder']!= -3) {
continue;
}
$poststatus = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid']);
$thread['anonymous'] = $poststatus['anonymous'];
$thread['message'] = $poststatus['message'];
$poststatus = $poststatus['status'];
$tids[] = $thread['tid'];
if(getstatus($poststatus, 3) == 0) {
$firsttime_validatethread[] = $thread;
$uids[] = $thread['authorid'];
updatepostcredits('+', $thread['authorid'], 'post', $thread['fid']);
$attachcount = C::t('forum_attachment_n')->count_by_id('tid:'.$thread['tid'], 'tid', $thread['tid']);
updatecreditbyaction('postattach', $thread['authorid'], array(), '', $attachcount, 1, $thread['fid']);
}
$forums[] = $thread['fid'];
$validatedthreads[] = $thread;
$pm = 'pm_'.$thread['tid'];
if($thread['authorid'] && $thread['authorid'] != $_G['uid']) {
$pmlist[] = array(
'action' => 'modthreads_validate',
'notevar' => array('tid' => $thread['tid'], 'threadsubject' => $thread['subject'], 'reason' => dhtmlspecialchars($_GET[''.$pm]), 'modusername' => ($_G['setting']['moduser_public'] ? $_G['username'] : ''), 'from_id' => 0, 'from_idtype' => 'modthreads'),
'authorid' => $thread['authorid'],
);
}
}
if($firsttime_validatethread) {
require_once libfile('function/post');
require_once libfile('function/feed');
$forumsinfo = C::t('forum_forum')->fetch_all_info_by_fids($forums);
$users = array();
foreach ($uids as $uid) {
$space = array('uid'=>$uid);
space_merge($space, 'field_home');
$users[$uid] = $space;
}
foreach ($firsttime_validatethread as $thread) {
if($forumsinfo[$thread['fid']] && $forumsinfo[$thread['fid']]['allowfeed'] && $users[$thread['authorid']]['privacy']['feed']['newthread'] && !$thread['anonymous']) {
$feed = array(
'icon' => 'thread',
'title_template' => 'feed_thread_title',
'title_data' => array(),
'body_template' => 'feed_thread_message',
'body_data' => array(),
'title_data' => array(),
'images' => array()
);
$message = !$thread['price'] && !$thread['readperm'] ? $thread['message'] : '';
$message = messagesafeclear($message);
$feed['body_data'] = array(
'subject' => "<a href=\"forum.php?mod=viewthread&tid={$thread['tid']}\">{$thread['subject']}</a>",
'message' => messagecutstr($message, 150)
);
$feed['title_data']['hash_data'] = 'tid'.$thread['tid'];
$feed['id'] = $thread['tid'];
$feed['idtype'] = 'tid';
feed_add($feed['icon'], $feed['title_template'], $feed['title_data'], $feed['body_template'], $feed['body_data'], '', $feed['images'], $feed['image_links'], '', '', '', 0, $feed['id'], $feed['idtype'],$thread['authorid'], $thread['author']);
}
}
}
if($tids) {
$tidstr = dimplode($tids);
C::t('forum_post')->update_by_tid(0, $tids, array('status' => 4), false, false, null, -2, 0);
loadcache('posttableids');
$posttableids = $_G['cache']['posttableids'] ? $_G['cache']['posttableids'] : array('0');
foreach($posttableids as $id) {
C::t('forum_post')->update_by_tid($id, $tids, array('invisible' => '0'), false, false, 1);
}
$validates = C::t('forum_thread')->update($tids, array('displayorder' => 0, 'moderated' => 1));
foreach(array_unique($forums) as $fid) {
updateforumcount($fid);
}
updatemodworks('MOD', $validates);
updatemodlog($tidstr, 'MOD');
updatemoderate('tid', $tids, 2);
}
}
if($pmlist) {
foreach($pmlist as $pm) {
notification_add($pm['authorid'], 'system', $pm['action'], $pm['notevar'], 1);
}
}
if($_GET['fast']) {
echo callback_js($_GET['tid']);
exit;
} else {
cpmsg('moderate_threads_succeed', "action=moderate&operation=threads&page=$page&filter=$filter&modfid=$modfid&username={$_GET['username']}&title={$_GET['title']}&tpp={$_GET['tpp']}&showcensor=$showcensor&dateline={$_GET['dateline']}", 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'recycles' => $recycles, 'deletes' => $deletes));
}
}
?>

29
source/admincp/robots.txt Normal file
View File

@@ -0,0 +1,29 @@
#
# robots.txt for Discuz! {ver}
#
User-agent: *
Allow: {path}data/attachment/
Allow: {path}data/avatar/
Allow: {path}data/cache/
Allow: {path}uc_server/data/avatar/
Disallow: {path}api/
Disallow: {path}data/
Disallow: {path}source/
Disallow: {path}install/
Disallow: {path}template/default/
Disallow: {path}config/
Disallow: {path}uc_client/
Disallow: {path}uc_server/
Disallow: {path}admin.php
Disallow: {path}search.php
Disallow: {path}member.php
Disallow: {path}api.php
Disallow: {path}misc.php
Disallow: {path}connect.php
Disallow: {path}forum.php?mod=redirect*
Disallow: {path}forum.php?mod=post*
Disallow: {path}home.php?mod=spacecp*
Disallow: {path}*?mod=misc*
Disallow: {path}*?mod=attachment*
Disallow: {path}*mobile=yes*