'; $blockclass_sel .= ''; foreach($_G['cache']['blockclass'] as $key=>$value) { foreach($value['subs'] as $subkey=>$subvalue) { $blockclass_sel .= ""; } } $blockclass_sel .= ''; $adminscript = ADMINSCRIPT; $lang_blockclasssel = cplang('blockstyle_blockclass_sel'); $lang_submit = cplang('submit'); echo <<
$lang_blockclasssel$blockclass_sel
 
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/cache'); updatecache('blockclass'); 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/cache'); updatecache('blockclass'); 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' => "
\n\n
" ); } $theclass = block_getclass($_GET['blockclass']); if($preview) { echo '

'.lang('preview').'

'.$preview; } showformheader('blockstyle&operation='.$operation.'&blockclass='.$_GET['blockclass'].'&styleid='.$_GET['styleid']); showtableheader(); 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']. ': {'.$key.'}'; } } $template .= '
'; $template .= cplang('blockstyle_add_loop').': [loop]...[/loop]'; $template .= cplang('blockstyle_add_order').': [order=N]...[/order]'; $template .= cplang('blockstyle_add_index').': [index=N]...[/index]'; $template .= cplang('blockstyle_add_urltitle').': {title}")\'><a href=...'; $template .= cplang('blockstyle_add_picthumb').': ")\'><img src=...>'; if(in_array($_GET['blockclass'], array('forum_thread', 'portal_article', 'group_thread'), true)) { $template .= cplang('blockstyle_add_moreurl').': {moreurl}'; } $template .= cplang('blockstyle_add_currentorder').': {currentorder}'; $template .= cplang('blockstyle_add_parity').': {parity}'; $template .= '
'; $template .= ''; $template .= ''; $template .= '


'; echo '
'; echo '
'; echo $template; echo '
'; 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']); updatecache('blockclass'); 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 = ''; showsetting('blockstyle_moveto', '', '', $movetoselect); showsubmit('deletesubmit'); showtablefooter(); showformfooter(); } else { C::t('common_block_style')->delete($_GET['styleid']); updatecache('blockclass'); cpmsg('blockstyle_delete_succeed', 'action=blockstyle', 'succeed'); } } else { $_GET = $_GET + $_POST; $searchctrl = '' .'' .''.cplang('hide_search').'' .''; 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 = ''; $adminscript = ADMINSCRIPT; echo <<
$searchlang[blockstyle_id] $searchlang[blockstyle_name]**$searchlang[likesupport]
$searchlang[blockstyle_blockclass]$blockclass_sel $searchlang[blockstyle_template]**$searchlang[likesupport]
$searchlang[resultsort]
SEARCH; $start = ($page-1)*$perpage; showformheader('blockstyle'); showtableheader('blockstyle_list'); 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'], "".cplang('blockstyle_edit')."  ". "".cplang('blockstyle_delete')."" )); } $multipage = multi($count, $perpage, $page, $mpurl); } showsubmit('', '', '', '', $multipage); showtablefooter(); showformfooter(); } ?>