code
stringlengths
1
2.01M
repo_name
stringlengths
3
62
path
stringlengths
1
267
language
stringclasses
231 values
license
stringclasses
13 values
size
int64
1
2.01M
<?php defined('IN_ADMIN') or exit('No permission resources.'); $show_header = true; $show_scroll = true; include $this->admin_tpl('header'); ?> <body scroll="no"> <div style="padding:6px 3px"> <div class="col-2 col-left mr6" style="width:140px"> <h6><img src="<?php echo IMG_PATH?>icon/sitemap-application-blue.png" width="16" height="16" /> <?php echo L('site_select');?></h6> <ul class="content role-memu" id="site_list"> <?php foreach($sites_list as $n=>$r) {?> <?php $green = $this->op->is_setting($r['siteid'],$roleid) ? '_green' : '';?> <li><a href="?m=admin&c=role&a=role_priv&siteid=<?php echo $r['siteid']?>&roleid=<?php echo $roleid?>" target="role"><span><img src="<?php echo IMG_PATH?>icon/gear_disable<?php echo $green?>.png" width="16" height="16" /><?php echo L('sys_setting');?></span><em><?php echo $r['name']?></em></a></li> <?php } ?> </ul> </div> <div class="col-2 col-auto"> <div class="content" style="padding:1px"> <iframe name="role" id="role" src="?m=admin&c=role&a=role_priv&pc_hash=<?php echo $_SESSION['pc_hash']?>" frameborder="false" scrolling="auto" style="overflow-x:hidden;border:none" width="100%" height="483" allowtransparency="true"></iframe> </div> </div> </div> </body> </html> <script type="text/javascript"> $("#site_list li").click( function(){$(this).addClass("on").siblings().removeClass('on')} ); </script>
108wo
phpcms/modules/admin/templates/role_priv_setting.tpl.php
PHP
asf20
1,491
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header'); ?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}}); $("#word").formValidator({onshow:"<?php echo L('input').L('keylink');?>",onfocus:"<?php echo L('input').L('keylink');?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('keylink');?>"}).regexValidator({regexp:"notempty",datatype:"enum",param:'i',onerror:"<?php echo L('en_tips_type');?>"}).ajaxValidator({type : "get",url : "",data :"m=admin&c=keylink&a=public_name",datatype : "html",async:'false',success : function(data){ if( data == "1" ){return true;}else{return false;}},buttons: $("#dosubmit"),onerror : "<?php echo L('keylink').L('exists');?>",onwait : "<?php echo L('connecting');?>"}); $("#url").formValidator({onshow:"<?php echo L('input_siteurl');?>",onfocus:"<?php echo L('input_siteurl');?>"}).inputValidator({min:1,onerror:"<?php echo L('input_siteurl');?>"}).regexValidator({regexp:"^http:",onerror:"<?php echo L('copyfrom_url_tips');?>"}); }) //--> </script> <div class="pad_10"> <table width="100%" cellpadding="2" cellspacing="1" class="table_form"> <form action="?m=admin&c=keylink&a=add" method="post" name="myform" id="myform"> <tr> <th width="25%"><?php echo L('keylink_name');?> :</th> <td><input type="text" name="info[word]" id="word" size="20"></td> </tr> <tr> <th><?php echo L('keylink_url');?> :</th> <td><input type="text" name="info[url]" value="http://www." size="30" id="url"></td> </tr> <input type="submit" name="dosubmit" id="dosubmit" class="dialog" value=" <?php echo L('submit')?> "> </form> </table> </div> </body> </html>
108wo
phpcms/modules/admin/templates/keylink_add.tpl.php
PHP
asf20
1,905
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header'); ?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}}); $("#name").formValidator({onshow:"<?php echo L("input").L('site_name')?>",onfocus:"<?php echo L("input").L('site_name')?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('site_name')?>"}).ajaxValidator({type : "get",url : "",data :"m=admin&c=site&a=public_name",datatype : "html",async:'false',success : function(data){ if( data == "1" ){return true;}else{return false;}},buttons: $("#dosubmit"),onerror : "<?php echo L('site_name').L('exists')?>",onwait : "<?php echo L('connecting')?>"}); $("#dirname").formValidator({onshow:"<?php echo L("input").L('site_dirname')?>",onfocus:"<?php echo L("input").L('site_dirname')?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('site_dirname')?>"}).regexValidator({regexp:"username",datatype:"enum",param:'i',onerror:"<?php echo L('site_dirname_err_msg')?>"}).ajaxValidator({type : "get",url : "",data :"m=admin&c=site&a=public_dirname",datatype : "html",async:'false',success : function(data){ if( data == "1" ){return true;}else{return false;}},buttons: $("#dosubmit"),onerror : "<?php echo L('site_dirname').L('exists')?>",onwait : "<?php echo L('connecting')?>"}); $("#domain").formValidator({onshow:"<?php echo L('site_domain_ex')?>",onfocus:"<?php echo L('site_domain_ex')?>",tipcss:{width:'300px'},empty:false}).inputValidator({onerror:"<?php echo L('site_domain_ex')?>"}).regexValidator({regexp:"http:\/\/(.+)\/$",onerror:"<?php echo L('site_domain_ex2')?>"}); $("#template").formValidator({onshow:"<?php echo L('style_name_point')?>",onfocus:"<?php echo L('select_at_least_1')?>"}).inputValidator({min:1,onerror:"<?php echo L('select_at_least_1')?>"}); $('#release_point').formValidator({onshow:"<?php echo L('publishing_sites_to_other_servers')?>",onfocus:"<?php echo L('choose_release_point')?>",empty:true}).inputValidator({max:4,onerror:"<?php echo L('most_choose_four')?>"}); $('#default_style_input').formValidator({tipid:"default_style_msg",onshow:"<?php echo L('please_select_a_style_and_select_the_template')?>",onfocus:"<?php echo L('please_select_a_style_and_select_the_template')?>"}).inputValidator({min:1,onerror:"<?php echo L('please_choose_the_default_style')?>"}); }) //--> </script> <style type="text/css"> .radio-label{ border-top:1px solid #e4e2e2; border-left:1px solid #e4e2e2;} .radio-label td{ border-right:1px solid #e4e2e2; border-bottom:1px solid #e4e2e2;} </style> <div class="pad-10"> <form action="?m=admin&c=site&a=add" method="post" id="myform"> <div> <fieldset> <legend><?php echo L('basic_configuration')?></legend> <table width="100%" class="table_form"> <tr> <th width="80"><?php echo L('site_name')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="name" id="name" size="30" /></td> </tr> <tr> <th><?php echo L('site_dirname')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="dirname" id="dirname" size="30" /></td> </tr> <tr> <th><?php echo L('site_domain')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="domain" id="domain" size="30"/></td> </tr> </table> </fieldset> <div class="bk15"></div> <fieldset> <legend><?php echo L('seo_configuration')?></legend> <table width="100%" class="table_form"> <tr> <th width="80"><?php echo L('site_title')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="site_title" id="site_title" size="30" /></td> </tr> <tr> <th><?php echo L('keyword_name')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="keywords" id="keywords" size="30" /></td> </tr> <tr> <th><?php echo L('description')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="description" id="description" size="30" /></td> </tr> </table> </fieldset> <div class="bk15"></div> <fieldset> <legend><?php echo L('release_point_configuration')?></legend> <table width="100%" class="table_form"> <tr> <th width="80" valign="top"><?php echo L('release_point')?>:</th> <td> <select name="release_point[]" size="3" id="release_point" multiple title="<?php echo L('ctrl_more_selected')?>"> <option value='' selected><?php echo L('not_use_the_publishers_some')?></option> <?php if(is_array($release_point_list) && !empty($release_point_list)): foreach($release_point_list as $v):?> <option value="<?php echo $v['id']?>"><?php echo $v['name']?></option> <?php endforeach;endif;?> </select> </td> </tr> </table> </fieldset> <div class="bk15"></div> <fieldset> <legend><?php echo L('template_style_configuration')?></legend> <table width="100%" class="table_form"> <tr> <th width="80" valign="top"><?php echo L('style_name')?>:</th> <td class="y-bg"> <select name="template[]" size="3" id="template" multiple title="<?php echo L('ctrl_more_selected')?>" onchange="default_list()"> <?php if(is_array($template_list)): foreach ($template_list as $key=>$val): ?> <option value="<?php echo $val['dirname']?>"><?php echo $val['name']?></option> <?php endforeach;endif;?> </select></td> </tr> </tr> <tr> <th width="80" valign="top"><?php echo L('default_style')?>:<input type="hidden" name="default_style" id="default_style_input" value="0"></th> <td class="y-bg"><span id="default_style"><input type="radio" name="default_style_radio" disabled></span><span id="default_style_msg"></span></td> </tr> </table> <script type="text/javascript"> function default_list() { var html = ''; var old = $('#default_style_input').val(); var checked = ''; $('#template option:selected').each(function(i,n){ if (old == $(n).val()) { checked = 'checked'; } html += '<label><input type="radio" name="default_style_radio" value="'+$(n).val()+'" onclick="$(\'#default_style_input\').val(this.value);" '+checked+'> '+$(n).text()+'</label>'; }); if(!checked) $('#default_style_input').val('0'); $('#default_style').html(html); } </script> </fieldset> <div class="bk15"></div> <fieldset> <legend><?php echo L('site_att_config')?></legend> <table width="100%" class="table_form"> <tr> <th width="130" valign="top"><?php echo L('site_att_upload_maxsize')?></th> <td class="y-bg"><input type="text" class="input-text" name="setting[upload_maxsize]" id="upload_maxsize" size="10" value="2000"/> KB </td> </tr> <tr> <th width="130" valign="top"><?php echo L('site_att_allow_ext')?></th> <td class="y-bg"><input type="text" class="input-text" name="setting[upload_allowext]" id="upload_allowext" size="50" value="jpg|jpeg|gif|bmp|png|doc|docx|xls|xlsx|ppt|pptx|pdf|txt|rar|zip|swf"/></td> </tr> <tr> <th><?php echo L('site_att_upload_maxsize')?> </th> <td class="y-bg"><?php echo $this->check_gd()?></td> <tr> <th><?php echo L('site_att_watermark_enable')?></th> <td class="y-bg"> <input class="radio_style" name="setting[watermark_enable]" value="1" type="radio"> <?php echo L('site_att_watermark_open')?>&nbsp;&nbsp;&nbsp;&nbsp; <input class="radio_style" name="setting[watermark_enable]" value="0" checked="checked" type="radio"><?php echo L('site_att_watermark_close')?> </td> </tr> <tr> <th><?php echo L('site_att_watermark_condition')?></th> <td class="y-bg"><?php echo L('site_att_watermark_minwidth')?> <input type="text" class="input-text" name="setting[watermark_minwidth]" id="watermark_minwidth" size="10" value="300" /> X <?php echo L('site_att_watermark_minheight')?><input type="text" class="input-text" name="setting[watermark_minheight]" id="watermark_minheight" size="10" value="300" /> PX </td> </tr> <tr> <th width="130" valign="top"><?php echo L('site_att_watermark_img')?></th> <td class="y-bg"><input type="text" class="input-text" name="setting[watermark_img]" id="watermark_img" size="30" value="mark.gif" /> <?php echo L('site_att_watermark_img_desc')?></td> </tr> <tr> <th width="130" valign="top"><?php echo L('site_att_watermark_pct')?></th> <td class="y-bg"><input type="text" class="input-text" name="setting[watermark_pct]" id="watermark_pct" size="10" value="100" /> <?php echo L('site_att_watermark_pct_desc')?></td> </tr> <tr> <th width="130" valign="top"><?php echo L('site_att_watermark_quality')?></th> <td class="y-bg"><input type="text" class="input-text" name="setting[watermark_quality]" id="watermark_quality" size="10" value="80" /> <?php echo L('site_att_watermark_quality_desc')?></td> </tr> <tr> <th width="130" valign="top"><?php echo L('site_att_watermark_pos')?></th> <td class="y-bg"> <table width="100%" class="radio-label"> <tr> <td rowspan="3"><input class="radio_style" name="setting[watermark_pos]" value="10" type="radio" > <?php echo L('site_att_watermark_pos_10')?></td> <td><input class="radio_style" name="setting[watermark_pos]" value="1" type="radio" > <?php echo L('site_att_watermark_pos_1')?></td> <td><input class="radio_style" name="setting[watermark_pos]" value="2" type="radio"> <?php echo L('site_att_watermark_pos_2')?></td> <td><input class="radio_style" name="setting[watermark_pos]" value="3" type="radio"> <?php echo L('site_att_watermark_pos_3')?></td> </tr> <tr> <td><input class="radio_style" name="setting[watermark_pos]" value="4" type="radio"> <?php echo L('site_att_watermark_pos_4')?></td> <td><input class="radio_style" name="setting[watermark_pos]" value="5" type="radio"> <?php echo L('site_att_watermark_pos_5')?></td> <td><input class="radio_style" name="setting[watermark_pos]" value="6" type="radio" > <?php echo L('site_att_watermark_pos_6')?></td> </tr> <tr> <td><input class="radio_style" name="setting[watermark_pos]" value="7" type="radio"> <?php echo L('site_att_watermark_pos_7')?></td> <td><input class="radio_style" name="setting[watermark_pos]" value="8" type="radio"> <?php echo L('site_att_watermark_pos_8')?></td> <td><input class="radio_style" name="setting[watermark_pos]" value="9" type="radio" checked> <?php echo L('site_att_watermark_pos_9')?></td> </tr> </table> </td></tr> </table> </fieldset> </div> <div class="bk15"></div> <input type="submit" class="dialog" id="dosubmit" name="dosubmit" value="<?php echo L('submit')?>" /> </div> </div> </form> </body> </html>
108wo
phpcms/modules/admin/templates/site_add.tpl.php
PHP
asf20
10,817
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header');?> <script type="text/javascript"> $(function(){ $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}}); $("#badword").formValidator({onshow:"<?php echo L("input").L('badword_name')?>",onfocus:"<?php echo L("input").L('badword_name')?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('badword_name')?>"}).regexValidator({regexp:"notempty",datatype:"enum",param:'i',onerror:"<?php echo L('input_not_space')?>"}).ajaxValidator({type : "get",url : "",data :"m=admin&c=badword&a=public_name&badid=<?php echo $badid;?>",datatype : "html",async:'false',success : function(data){ if( data == "1" ){return true;}else{return false;}},buttons: $("#dosubmit"),onerror : "<?php echo L('badword_name').L('exists')?>",onwait : "<?php echo L('connecting')?>"}).defaultPassed(); $("#replaceword").formValidator({empty:true,onshow:"<?php echo L('badword_noreplace')?>",onfocus:"<?php echo L("input").L('badword_replacename')?>",oncorrect:"<?php echo L('format_right')?>",onempty:"<?php echo L('badword_notreplace')?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('badword_replacename')?>"}); }) </script> <div class="pad_10"> <table cellpadding="2" cellspacing="1" class="table_form" width="100%"> <form action="?m=admin&c=badword&a=edit&badid=<?php echo $badid?>" method="post" name="myform" id="myform"> <tr> <th width="20%"><?php echo L('badword_name')?></th> <td><input type="text" name="badword" id="badword" value="<?php echo $badword?>"></td> </tr> <tr> <th width="20%"><?php echo L('badword_replacename')?></th> <td><input type="text" name="replaceword" id="replaceword" value="<?php echo $replaceword ?>" ></td> </tr> <tr> <th width="20%"><?php echo L('badword_level')?></th> <td> <select size="1" id="info[level]" name="info[level]"> <?php if($level=='1'){ $level1 = "selected"; }else{ $level2 = "selected"; } ?> <option <?php echo $level1;?> value="1"><?php echo L('badword_common')?></option> <option <?php echo $level2;?> value="2"><?php echo L('badword_dangerous')?></option> </select> <?php echo L('badword_level_info')?> </td> </tr> <input type="submit" name="dosubmit" id="dosubmit" value=" <?php echo L('submit')?> " class="dialog"> </form> </table> </div> </body> </html>
108wo
phpcms/modules/admin/templates/badword_edit.tpl.php
PHP
asf20
2,581
<?php defined('IN_ADMIN') or exit('No permission resources.'); ?> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>jquery.min.js"></script> <div id="leftMain"> <h3 class="f14">phpsso<?php echo L('manage')?></h3> <ul> <li class="sub_menu"> <a style="outline: medium none;" hidefocus="true" href="<?php echo $setting['phpsso_api_url']?>/index.php?m=admin&c=member&a=manage&forward=<?php echo urlencode($setting['phpsso_api_url'].'/index.php?m=admin&c=member&a=manage')?>" target="right"><?php echo L('member_manage')?></a> </li> <li class="sub_menu"> <a style="outline: medium none;" hidefocus="true" href="<?php echo $setting['phpsso_api_url']?>/index.php?m=admin&c=applications&a=init&forward=<?php echo urlencode($setting['phpsso_api_url'].'/index.php?m=admin&c=applications&a=init')?>" target="right"><?php echo L('application')?></a> </li> <li class="sub_menu"> <a style="outline: medium none;" hidefocus="true" href="<?php echo $setting['phpsso_api_url']?>/index.php?m=admin&c=messagequeue&a=manage&forward=<?php echo urlencode($setting['phpsso_api_url'].'/index.php?m=admin&c=messagequeue&a=manage')?>" target="right"><?php echo L('communication')?></a> </li> <li class="sub_menu"> <a style="outline: medium none;" hidefocus="true" href="<?php echo $setting['phpsso_api_url']?>/index.php?m=admin&c=credit&a=manage&forward=<?php echo urlencode($setting['phpsso_api_url'].'/index.php?m=admin&c=credit&a=manage')?>" target="right"><?php echo L('redeem')?></a> </li> <li class="sub_menu"> <a style="outline: medium none;" hidefocus="true" href="<?php echo $setting['phpsso_api_url']?>/index.php?m=admin&c=administrator&a=init&forward=<?php echo urlencode($setting['phpsso_api_url'].'/index.php?m=admin&c=administrator&a=init')?>" target="right"><?php echo L('administrator')?></a> </li> <li class="sub_menu"> <a style="outline: medium none;" hidefocus="true" href="<?php echo $setting['phpsso_api_url']?>/index.php?m=admin&c=system&a=init&forward=<?php echo urlencode($setting['phpsso_api_url'].'/index.php?m=admin&c=system&a=init')?>" target="right"><?php echo L('system_setting')?></a> </li> <li class="sub_menu"> <a style="outline: medium none;" hidefocus="true" href="<?php echo $setting['phpsso_api_url']?>/index.php?m=admin&c=cache&a=init&forward=<?php echo urlencode($setting['phpsso_api_url'].'/index.php?m=admin&c=cache&a=init')?>" target="right"><?php echo L('update_phpsso_cache')?></a> </li> <li class="sub_menu"> <a style="outline: medium none;" hidefocus="true" href="<?php echo $setting['phpsso_api_url']?>/index.php?m=admin&c=password&a=init&forward=<?php echo urlencode($setting['phpsso_api_url'].'/index.php?m=admin&c=password&a=init')?>" target="right"><?php echo L('change_password')?></a> </li> <li class="sub_menu"> <a style="outline: medium none;" hidefocus="true" href="<?php echo $setting['phpsso_api_url']?>/index.php?m=admin&c=login&a=logout&forward=<?php echo urlencode($setting['phpsso_api_url'].'/index.php?m=admin&c=member&a=manage')?>" target="right"><?php echo L('exit')?>phpsso</a> </li> </ul> </div> <script type="text/javascript"> $("#leftMain li").click(function() { var i =$(this).index() + 1; $("#leftMain li").removeClass(); $("#leftMain li:nth-child("+i+")").addClass("on fb blue"); }); </script>
108wo
phpcms/modules/admin/templates/phpsso.tpl.php
PHP
asf20
3,394
<?php defined('IN_ADMIN') or exit('No permission resources.'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET?>" /> <meta http-equiv="X-UA-Compatible" content="IE=7" /> <title><?php echo L('message_tips');?></title> <style type="text/css"> <!-- *{ padding:0; margin:0; font-size:12px} a:link,a:visited{text-decoration:none;color:#0068a6} a:hover,a:active{color:#ff6600;text-decoration: underline} .showMsg{border: 1px solid #1e64c8; zoom:1; width:450px; height:172px;position:absolute;top:44%;left:50%;margin:-87px 0 0 -225px} .showMsg h5{background-image: url(<?php echo IMG_PATH?>msg_img/msg.png);background-repeat: no-repeat; color:#fff; padding-left:35px; height:25px; line-height:26px;*line-height:28px; overflow:hidden; font-size:14px; text-align:left} .showMsg .content{ padding:46px 12px 10px 45px; font-size:14px; height:64px; text-align:left} .showMsg .bottom{ background:#e4ecf7; margin: 0 1px 1px 1px;line-height:26px; *line-height:30px; height:26px; text-align:center} .showMsg .ok,.showMsg .guery{background: url(<?php echo IMG_PATH?>msg_img/msg_bg.png) no-repeat 0px -560px;} .showMsg .guery{background-position: left -460px;} --> </style> <script type="text/javaScript" src="<?php echo JS_PATH?>jquery.min.js"></script> <script language="JavaScript" src="<?php echo JS_PATH?>admin_common.js"></script> </head> <body> <div class="showMsg" style="text-align:center"> <h5><?php echo L('message_tips');?></h5> <div class="content guery" style="display:inline-block;display:-moz-inline-stack;zoom:1;*display:inline;max-width:330px"><?php echo $msg?></div> <div class="bottom"> <?php if($url_forward=='goback' || $url_forward=='') {?> <a href="javascript:history.back();" >[<?php echo L('return_previous');?>]</a> <?php } elseif($url_forward=="close") {?> <input type="button" name="close" value="<?php echo L('close');?> " onClick="window.close();"> <?php } elseif($url_forward=="blank") {?> <?php } elseif($url_forward) { if(strpos($url_forward,'&pc_hash')===false) $url_forward .= '&pc_hash='.$_SESSION['pc_hash']; ?> <a href="<?php echo $url_forward?>"><?php echo L('click_here');?></a> <script language="javascript">setTimeout("redirect('<?php echo $url_forward?>');",<?php echo $ms?>);</script> <?php }?> <?php if($returnjs) { ?> <script style="text/javascript"><?php echo $returnjs;?></script><?php } ?> <?php if ($dialog):?><script style="text/javascript">window.top.right.location.reload();window.top.art.dialog({id:"<?php echo $dialog?>"}).close();</script><?php endif;?> </div> </div> <script style="text/javascript"> function close_dialog() { window.top.right.location.reload();window.top.art.dialog({id:"<?php echo $dialog?>"}).close(); } </script> </body> </html>
108wo
phpcms/modules/admin/templates/showmessage.tpl.php
PHP
asf20
2,989
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header');?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}}); $("#modelid").formValidator({onshow:"<?php echo L('select_model');?>",onfocus:"<?php echo L('select_model');?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L('select_model');?>"}).defaultPassed(); $("#catname").formValidator({onshow:"<?php echo L('input_catname');?>",onfocus:"<?php echo L('input_catname');?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L('input_catname');?>"}).defaultPassed(); $("#catdir").formValidator({onshow:"<?php echo L('input_dirname');?>",onfocus:"<?php echo L('input_dirname');?>"}).regexValidator({regexp:"^([a-zA-Z0-9、-]|[_]){0,30}$",onerror:"<?php echo L('enter_the_correct_catname');?>"}).inputValidator({min:1,onerror:"<?php echo L('input_dirname');?>"}).ajaxValidator({type : "get",url : "",data :"m=admin&c=category&a=public_check_catdir&old_dir=<?php echo $catdir;?>",datatype : "html",cached:false,getdata:{parentid:'parentid'},async:'false',success : function(data){ if( data == "1" ){return true;}else{return false;}},buttons: $("#dosubmit"),onerror : "<?php echo L('catname_have_exists');?>",onwait : "<?php echo L('connecting');?>"}).defaultPassed(); $("#url").formValidator({onshow:" ",onfocus:"<?php echo L('domain_name_format');?>",tipcss:{width:'300px'},empty:true}).inputValidator({onerror:"<?php echo L('domain_name_format');?>"}).regexValidator({regexp:"http:\/\/(.+)\/$",onerror:"<?php echo L('domain_end_string');?>"}); $("#template_list").formValidator({onshow:"<?php echo L('template_setting');?>",onfocus:"<?php echo L('template_setting');?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L('template_setting');?>"}).defaultPassed(); }) //--> </script> <form name="myform" id="myform" action="?m=admin&c=category&a=edit" method="post"> <div class="pad-10"> <div class="col-tab"> <ul class="tabBut cu-li"> <li id="tab_setting_1" class="on" onclick="SwapTab('setting','on','',6,1);"><?php echo L('catgory_basic');?></li> <li id="tab_setting_2" onclick="SwapTab('setting','on','',6,2);"><?php echo L('catgory_createhtml');?></li> <li id="tab_setting_3" onclick="SwapTab('setting','on','',6,3);"><?php echo L('catgory_template');?></li> <li id="tab_setting_4" onclick="SwapTab('setting','on','',6,4);"><?php echo L('catgory_seo');?></li> <li id="tab_setting_5" onclick="SwapTab('setting','on','',6,5);"><?php echo L('catgory_private');?></li> <li id="tab_setting_6" onclick="SwapTab('setting','on','',6,6);"><?php echo L('catgory_readpoint');?></li> </ul> <div id="div_setting_1" class="contentList pad-10"> <table width="100%" class="table_form "> <tr> <th width="200"><?php echo L('select_model')?>:</th> <td> <?php $category_items = getcache('category_items_'.$modelid,'commons'); $disabled = $category_items[$catid] ? 'disabled' : ''; $models = getcache('model','commons'); $model_datas = array(); foreach($models as $_k=>$_v) { if($_v['siteid']!=$this->siteid) continue; $model_datas[$_v['modelid']] = $_v['name']; } echo form::select($model_datas,$modelid,'name="info[modelid]" id="modelid" '.$disabled,L('select_model')); echo L('modelid_edit_tips'); ?> </td> </tr> <tr> <th width="200"><?php echo L('parent_category')?>:</th> <td> <?php echo form::select_category('category_content_'.$this->siteid,$parentid,'name="info[parentid]" id="parentid"',L('please_select_parent_category'),0,-1);?> </td> </tr> <tr> <th><?php echo L('catname')?>:</th> <td><input type="text" name="info[catname]" id="catname" class="input-text" value="<?php echo $catname;?>"></td> </tr> <tr> <th><?php echo L('catdir')?>:</th> <td><input type="text" name="info[catdir]" id="catdir" class="input-text" value="<?php echo $catdir;?>"></td> </tr> <tr> <th><?php echo L('catgory_img')?>:</th> <td><?php echo form::images('info[image]', 'image', $image, 'content');?></td> </tr> <tr> <th><?php echo L('description')?>:</th> <td> <textarea name="info[description]" maxlength="255" style="width:300px;height:60px;"><?php echo $description;?></textarea> </td> </tr> <tr> <th><?php echo L('workflow');?>:</th> <td> <?php $workflows = getcache('workflow_'.$this->siteid,'commons'); if($workflows) { $workflows_datas = array(); foreach($workflows as $_k=>$_v) { $workflows_datas[$_v['workflowid']] = $_v['workname']; } echo form::select($workflows_datas,$setting['workflowid'],'name="setting[workflowid]"',L('catgory_not_need_check')); } else { echo '<input type="hidden" name="setting[workflowid]" value="">'; echo L('add_workflow_tips'); } ?> </td> </tr> <tr> <th><?php echo L('ismenu');?>:</th> <td> <input type='radio' name='info[ismenu]' value='1' <?php if($ismenu) echo 'checked';?>> <?php echo L('yes');?>&nbsp;&nbsp;&nbsp;&nbsp; <input type='radio' name='info[ismenu]' value='0' <?php if(!$ismenu) echo 'checked';?>> <?php echo L('no');?></td> </tr> </table> </div> <div id="div_setting_2" class="contentList pad-10 hidden"> <table width="100%" class="table_form"> <tr> <th width="200"><?php echo L('html_category');?>:</th> <td> <input type='radio' name='setting[ishtml]' value='1' <?php if($setting['ishtml']) echo 'checked';?> onClick="$('#category_php_ruleid').css('display','none');$('#category_html_ruleid').css('display','');$('#tr_domain').css('display','');"> <?php echo L('yes');?>&nbsp;&nbsp;&nbsp;&nbsp; <input type='radio' name='setting[ishtml]' value='0' <?php if(!$setting['ishtml']) echo 'checked';?> onClick="$('#category_php_ruleid').css('display','');$('#category_html_ruleid').css('display','none');$('#tr_domain').css('display','none');"> <?php echo L('no');?> </td> </tr> <tr> <th><?php echo L('html_show');?>:</th> <td> <input type='radio' name='setting[content_ishtml]' value='1' <?php if($setting['content_ishtml']) echo 'checked';?> onClick="$('#show_php_ruleid').css('display','none');$('#show_html_ruleid').css('display','')"> <?php echo L('yes');?>&nbsp;&nbsp;&nbsp;&nbsp; <input type='radio' name='setting[content_ishtml]' value='0' <?php if(!$setting['content_ishtml']) echo 'checked';?> onClick="$('#show_php_ruleid').css('display','');$('#show_html_ruleid').css('display','none')"> <?php echo L('no');?> </td> </tr> <tr> <th><?php echo L('category_urlrules');?>:</th> <td><div id="category_php_ruleid" style="display:<?php if($setting['ishtml']) echo 'none';?>"> <?php echo form::urlrule('content','category',0,$setting['category_ruleid'],'name="category_php_ruleid"'); ?> </div> <div id="category_html_ruleid" style="display:<?php if(!$setting['ishtml']) echo 'none';?>"> <?php echo form::urlrule('content','category',1,$setting['category_ruleid'],'name="category_html_ruleid"'); ?> </div> </td> </tr> <tr> <th><?php echo L('show_urlrules');?>:</th> <td><div id="show_php_ruleid" style="display:<?php if($setting['content_ishtml']) echo 'none';?>"> <?php echo form::urlrule('content','show',0,$setting['show_ruleid'],'name="show_php_ruleid"'); ?> </div> <div id="show_html_ruleid" style="display:<?php if(!$setting['content_ishtml']) echo 'none';?>"> <?php echo form::urlrule('content','show',1,$setting['show_ruleid'],'name="show_html_ruleid"'); ?> </div> </td> </tr> <tr> <th><?php echo L('create_to_rootdir');?>:</th> <td> <input type='radio' name='setting[create_to_html_root]' value='1' <?php if($setting['create_to_html_root']) echo 'checked';?> > <?php echo L('yes');?>&nbsp;&nbsp;&nbsp;&nbsp; <input type='radio' name='setting[create_to_html_root]' value='0' <?php if(!$setting['create_to_html_root']) echo 'checked';?> > <?php echo L('no');?> (<?php echo L('create_to_rootdir_tips');?>)</td> </tr> <tr id="tr_domain" style="display:<?php if(!$setting['ishtml']) echo 'none';?>"> <th><?php echo L('domain')?>:</th> <td><input type="text" name="info[url]" id="url" class="input-text" size="50" value="<?php if(preg_match('/^http:\/\/([a-z0-9\-\.]+)\/$/i',$url)) echo $url;?>"></td> </tr> </table> </div> <div id="div_setting_3" class="contentList pad-10 hidden"> <table width="100%" class="table_form "> <tr> <th width="200"><?php echo L('available_styles');?>:</th> <td> <?php echo form::select($template_list, $setting['template_list'], 'name="setting[template_list]" id="template_list" onchange="load_file_list(this.value)"', L('please_select'))?> </td> </tr> <tr> <th width="200"><?php echo L('category_index_tpl')?>:</th> <td id="category_template"> </td> </tr> <tr> <th width="200"><?php echo L('category_list_tpl')?>:</th> <td id="list_template"> </td> </tr> <tr> <th width="200"><?php echo L('content_tpl')?>:</th> <td id="show_template"> </td> </tr> </table> </div> <div id="div_setting_4" class="contentList pad-10 hidden"> <table width="100%" class="table_form "> <tr> <th width="200"><?php echo L('meta_title');?></th> <td><input name='setting[meta_title]' type='text' id='meta_title' value='<?php echo $setting['meta_title'];?>' size='60' maxlength='60'></td> </tr> <tr> <th ><?php echo L('meta_keywords');?></th> <td><textarea name='setting[meta_keywords]' id='meta_keywords' style="width:90%;height:40px"><?php echo $setting['meta_keywords'];?></textarea></td> </tr> <tr> <th ><strong><?php echo L('meta_description');?></th> <td><textarea name='setting[meta_description]' id='meta_description' style="width:90%;height:50px"><?php echo $setting['meta_description'];?></textarea></td> </tr> </table> </div> <div id="div_setting_5" class="contentList pad-10 hidden"> <table width="100%" > <tr> <th width="200"><?php echo L('role_private')?>:</th> <td> <table width="100%" class="table-list"> <thead> <tr> <th align="left"><?php echo L('role_name');?></th><th><?php echo L('view');?></th><th><?php echo L('add');?></th><th><?php echo L('edit');?></th><th><?php echo L('delete');?></th><th><?php echo L('listorder');?></th><th><?php echo L('push');?></th><th><?php echo L('move');?></th> </tr> </thead> <tbody> <?php $roles = getcache('role','commons'); foreach($roles as $roleid=> $rolrname) { $disabled = $roleid==1 ? 'disabled' : ''; ?> <tr> <td><?php echo $rolrname?></td> <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled;?> <?php echo $this->check_category_priv('init',$roleid);?> value="init,<?php echo $roleid;?>" ></td> <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled;?> <?php echo $this->check_category_priv('add',$roleid);?> value="add,<?php echo $roleid;?>" ></td> <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled;?> <?php echo $this->check_category_priv('edit',$roleid);?> value="edit,<?php echo $roleid;?>" ></td> <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled;?> <?php echo $this->check_category_priv('delete',$roleid);?> value="delete,<?php echo $roleid;?>" ></td> <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled;?> <?php echo $this->check_category_priv('listorder',$roleid);?> value="listorder,<?php echo $roleid;?>" ></td> <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled;?> <?php echo $this->check_category_priv('push',$roleid);?> value="push,<?php echo $roleid;?>" ></td> <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled;?> <?php echo $this->check_category_priv('move',$roleid);?> value="move,<?php echo $roleid;?>" ></td> </tr> <?php }?> </tbody> </table> </td> </tr> <tr><td colspan=2><hr style="border:1px dotted #F2F2F2;"></td> </tr> <tr> <th width="200"><?php echo L('group_private')?>:</th> <td> <table width="100%" class="table-list"> <thead> <tr> <th align="left"><?php echo L('group_name');?></th><th><?php echo L('allow_vistor');?></th><th><?php echo L('allow_contribute');?></th> </tr> </thead> <tbody> <?php $group_cache = getcache('grouplist','member'); foreach($group_cache as $_key=>$_value) { if($_value['groupid']==1) continue; ?> <tr> <td><?php echo $_value['name'];?></td> <td align="center"><input type="checkbox" name="priv_groupid[]" <?php echo $this->check_category_priv('visit',$_value['groupid'],0);?> value="visit,<?php echo $_value['groupid'];?>" ></td> <td align="center"><input type="checkbox" name="priv_groupid[]" <?php echo $this->check_category_priv('add',$_value['groupid'],0);?> value="add,<?php echo $_value['groupid'];?>" ></td> </tr> <?php }?> </tbody> </table> </td> </tr> <tr> <th width="200"><?php echo L('apply_to_child');?></th> <td><input type='radio' name='priv_child' value='1'> <?php echo L('yes');?>&nbsp;&nbsp;&nbsp;&nbsp; <input type='radio' name='priv_child' value='0' checked> <?php echo L('no');?></td></td> </tr> </table> </div> <div id="div_setting_6" class="contentList pad-10 hidden"> <table width="100%" class="table_form"> <tr> <th width="200"><?php echo L('contribute_add_point');?></th> <td><input name='setting[presentpoint]' type='text' value='<?php echo $setting['presentpoint'];?>' size='5' maxlength='5' style='text-align:center'> <?php echo L('contribute_add_point_tips');?></td> </tr> <tr> <th ><?php echo L('default_readpoint');?></th> <td><input name='setting[defaultchargepoint]' type='text' value='<?php echo $setting['defaultchargepoint'];?>' size='4' maxlength='4' style='text-align:center'> <select name="setting[paytype]"><option value="0" <?php if(!$setting['paytype']) echo 'selected';?>><?php echo L('readpoint');?></option><option value="1" <?php if($setting['paytype']) echo 'selected';?>><?php echo L('money');?></option></select> <?php echo L('readpoint_tips');?></td> </tr> <tr> <th><?php echo L('repeatchargedays');?></th> <td> <input name='setting[repeatchargedays]' type='text' value='1' size='4' maxlength='4' style='text-align:center'> <?php echo L('repeat_tips');?>&nbsp;&nbsp; <font color="red"><?php echo L('repeat_tips2');?></font></td> </tr> </table> </div> <div class="bk15"></div> <input name="catid" type="hidden" value="<?php echo $catid;?>"> <input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="button"> </form> </div> </div> <!--table_form_off--> </div> <script language="JavaScript"> <!-- window.top.$('#display_center_id').css('display','none'); $(function(){ var url = $('#url').val(); if(!url.match(/^http:\/\//)) $('#url').val(''); }) function SwapTab(name,cls_show,cls_hide,cnt,cur){ for(i=1;i<=cnt;i++){ if(i==cur){ $('#div_'+name+'_'+i).show(); $('#tab_'+name+'_'+i).attr('class',cls_show); }else{ $('#div_'+name+'_'+i).hide(); $('#tab_'+name+'_'+i).attr('class',cls_hide); } } } function load_file_list(id) { if(id=='') return false; $.getJSON('?m=admin&c=category&a=public_tpl_file_list&style='+id+'&catid=<?php echo $catid?>', function(data){$('#category_template').html(data.category_template);$('#list_template').html(data.list_template);$('#show_template').html(data.show_template);}); } <?php if(isset($setting['template_list']) && !empty($setting['template_list'])) echo "load_file_list('".$setting['template_list']."')"?> //--> </script>
108wo
phpcms/modules/admin/templates/category_edit.tpl.php
PHP
asf20
16,510
<?php defined('IN_ADMIN') or exit('No permission resources.'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" class="off"> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET?>" /> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <title><?php echo L('admin_site_title')?></title> <link href="<?php echo CSS_PATH?>reset.css" rel="stylesheet" type="text/css" /> <link href="<?php echo CSS_PATH.SYS_STYLE;?>-system.css" rel="stylesheet" type="text/css" /> <link href="<?php echo CSS_PATH?>dialog.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" type="text/css" href="<?php echo CSS_PATH?>style/<?php echo SYS_STYLE;?>-styles1.css" title="styles1" media="screen" /> <link rel="alternate stylesheet" type="text/css" href="<?php echo CSS_PATH?>style/<?php echo SYS_STYLE;?>-styles2.css" title="styles2" media="screen" /> <link rel="alternate stylesheet" type="text/css" href="<?php echo CSS_PATH?>style/<?php echo SYS_STYLE;?>-styles3.css" title="styles3" media="screen" /> <link rel="alternate stylesheet" type="text/css" href="<?php echo CSS_PATH?>style/<?php echo SYS_STYLE;?>-styles4.css" title="styles4" media="screen" /> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>jquery.min.js"></script> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>styleswitch.js"></script> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>dialog.js"></script> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>hotkeys.js"></script> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>jquery.sgallery.js"></script> <script type="text/javascript"> var pc_hash = '<?php echo $_SESSION['pc_hash']?>' </script> <style type="text/css"> .objbody{overflow:hidden} </style> </head> <body scroll="no" class="objbody"> <div id="dvLockScreen" class="ScreenLock" style="display:<?php if(isset($_SESSION['lock_screen']) && $_SESSION['lock_screen']==0) echo 'none';?>"> <div id="dvLockScreenWin" class="inputpwd"> <h5><b class="ico ico-info"></b><span id="lock_tips"><?php echo L('lockscreen_status');?></span></h5> <div class="input"> <label class="lb"><?php echo L('password')?>:</label><input type="password" id="lock_password" class="input-text" size="24"> <input type="submit" class="submit" value="&nbsp;" name="dosubmit" onclick="check_screenlock();return false;"> </div></div> </div> <div class="header"> <div class="logo lf"><a href="<?php echo $currentsite['domain']?>" target="_blank"><span class="invisible"><?php echo L('phpcms_title')?></span></a></div> <div class="rt-col"> <div class="tab_style white cut_line text-r"><a href="javascript:;" onclick="lock_screen()"><img src="<?php echo IMG_PATH.'icon/lockscreen.png'?>"> <?php echo L('lockscreen')?></a><span>|</span><a href="http://www.phpcms.cn" target="_blank"><?php echo L('official_site')?></a><span>|</span><a href="http://www.phpcms.cn/license/license.php" target="_blank"><?php echo L('authorization')?></a><span>|</span><a href="http://bbs.phpcms.cn" target="_blank"><?php echo L('igenus_for_postfix')?></a><span>|</span><a href="http://v9.help.phpcms.cn" target="_blank"><?php echo L('help')?></a> <ul id="Skin"> <li class="s1 styleswitch" rel="styles1"></li> <li class="s2 styleswitch" rel="styles2"></li> <li class="s3 styleswitch" rel="styles3"></li> <li class="s4 styleswitch" rel="styles4"></li> </ul> </div> </div> <div class="col-auto"> <div class="log white cut_line"><?php echo L('hello'),$admin_username?> [<?php echo $rolename?>]<span>|</span><a href="?m=admin&c=index&a=public_logout">[<?php echo L('exit')?>]</a><span>|</span> <a href="<?php echo $currentsite['domain']?>" target="_blank" id="site_homepage"><?php echo L('site_homepage')?></a><span>|</span> <a href="?m=member" target="_blank"><?php echo L('member_center')?></a><span>|</span> <a href="?m=search" target="_blank" id="site_search"><?php echo L('search')?></a> </div> <ul class="nav white" id="top_menu"> <?php $array = admin::admin_menu(0); foreach($array as $_value) { if($_value['id']==10) { echo '<li id="_M'.$_value['id'].'" class="on top_menu"><a href="javascript:_M('.$_value['id'].',\'?m='.$_value['m'].'&c='.$_value['c'].'&a='.$_value['a'].'\')" hidefocus="true" style="outline:none;">'.L($_value['name']).'</a></li>'; } else { echo '<li id="_M'.$_value['id'].'" class="top_menu"><a href="javascript:_M('.$_value['id'].',\'?m='.$_value['m'].'&c='.$_value['c'].'&a='.$_value['a'].'\')" hidefocus="true" style="outline:none;">'.L($_value['name']).'</a></li>'; } } ?> <li class="tab_web"><a href="javascript:;"><span><?php echo $currentsite['name']?></span></a></li> </ul> </div> </div> <div id="content"> <div class="col-left left_menu"> <div id="Scroll"><div id="leftMain"></div></div> <a href="javascript:;" id="openClose" style="outline-style: none; outline-color: invert; outline-width: medium;" hideFocus="hidefocus" class="open" title="<?php echo L('spread_or_closed')?>"><span class="hidden"><?php echo L('expand')?></span></a> </div> <div class="col-1 lf cat-menu" id="display_center_id" style="display:none" height="100%"> <div class="content"> <iframe name="center_frame" id="center_frame" src="" frameborder="false" scrolling="auto" style="border:none" width="100%" height="auto" allowtransparency="true"></iframe> </div> </div> <div class="col-auto mr8"> <div class="crumbs"> <div class="shortcut cu-span"><a href="?m=content&c=create_html&a=public_index&pc_hash=<?php echo $_SESSION['pc_hash'];?>" target="right"><span><?php echo L('create_index')?></span></a><a href="?m=admin&c=cache_all&a=init&pc_hash=<?php echo $_SESSION['pc_hash'];?>" target="right"><span><?php echo L('update_backup')?></span></a><a href="javascript:art.dialog({id:'map',iframe:'?m=admin&c=index&a=public_map', title:'<?php echo L('background_map')?>', width:'700', height:'500', lock:true});void(0);"><span><?php echo L('background_map')?></span></a><?php echo runhook('admin_top_left_menu')?></div> <?php echo L('current_position')?><span id="current_pos"></span></div> <div class="col-1"> <div class="content" style="position:relative; overflow:hidden"> <iframe name="right" id="rightMain" src="?m=admin&c=index&a=public_main" frameborder="false" scrolling="auto" style="border:none; margin-bottom:30px" width="100%" height="auto" allowtransparency="true"></iframe> <div class="fav-nav"> <div id="panellist"> <?php foreach($adminpanel as $v) {?> <span> <a onclick="paneladdclass(this);" target="right" href="<?php echo $v['url'].'menuid='.$v['menuid'].'&pc_hash='.$_SESSION['pc_hash'];?>"><?php echo L($v['name'])?></a> <a class="panel-delete" href="javascript:delete_panel(<?php echo $v['menuid']?>, this);"></a></span> <?php }?> </div> <div id="paneladd"></div> <input type="hidden" id="menuid" value=""> <input type="hidden" id="bigid" value="" /> <div id="help" class="fav-help"></div> </div> </div> </div> </div> </div> <ul class="tab-web-panel hidden" style="position:absolute; z-index:999; background:#fff"> <?php foreach ($sitelist as $key=>$v):?> <li style="margin:0"><a href="javascript:site_select(<?php echo $v['siteid']?>, '<?php echo new_addslashes($v['name'])?>', '<?php echo $v['domain']?>', '<?php echo $v['siteid']?>')"><?php echo $v['name']?></a></li> <?php endforeach;?> </ul> <div class="scroll"><a href="javascript:;" class="per" title="使用鼠标滚轴滚动侧栏" onclick="menuScroll(1);"></a><a href="javascript:;" class="next" title="使用鼠标滚轴滚动侧栏" onclick="menuScroll(2);"></a></div> <script type="text/javascript"> if(!Array.prototype.map) Array.prototype.map = function(fn,scope) { var result = [],ri = 0; for (var i = 0,n = this.length; i < n; i++){ if(i in this){ result[ri++] = fn.call(scope ,this[i],i,this); } } return result; }; var getWindowSize = function(){ return ["Height","Width"].map(function(name){ return window["inner"+name] || document.compatMode === "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] }); } window.onload = function (){ if(!+"\v1" && !document.querySelector) { // for IE6 IE7 document.body.onresize = resize; } else { window.onresize = resize; } function resize() { wSize(); return false; } } function wSize(){ //这是一字符串 var str=getWindowSize(); var strs= new Array(); //定义一数组 strs=str.toString().split(","); //字符分割 var heights = strs[0]-150,Body = $('body');$('#rightMain').height(heights); //iframe.height = strs[0]-46; if(strs[1]<980){ $('.header').css('width',980+'px'); $('#content').css('width',980+'px'); Body.attr('scroll',''); Body.removeClass('objbody'); }else{ $('.header').css('width','auto'); $('#content').css('width','auto'); Body.attr('scroll','no'); Body.addClass('objbody'); } var openClose = $("#rightMain").height()+39; $('#center_frame').height(openClose+9); $("#openClose").height(openClose+30); $("#Scroll").height(openClose-20); windowW(); } wSize(); function windowW(){ if($('#Scroll').height()<$("#leftMain").height()){ $(".scroll").show(); }else{ $(".scroll").hide(); } } windowW(); //站点下拉菜单 $(function(){ var offset = $(".tab_web").offset(); $(".tab_web").mouseover(function(){ $(".tab-web-panel").css({ "left": +offset.left+4, "top": +offset.top+$('.tab_web').height()+2}); $(".tab-web-panel").show(); }); $(".tab_web span").mouseout(function(){hidden_site_list_1()}); $(".tab-web-panel").mouseover(function(){clearh();$('.tab_web a').addClass('on')}).mouseout(function(){hidden_site_list_1();$('.tab_web a').removeClass('on')}); //默认载入左侧菜单 $("#leftMain").load("?m=admin&c=index&a=public_menu_left&menuid=10"); }) //站点选择 function site_select(id,name, domain, siteid) { $(".tab_web span").html(name); $.get("?m=admin&c=index&a=public_set_siteid&siteid="+id,function(data){ if (data==1){ window.top.right.location.reload(); window.top.center_frame.location.reload(); $.get("?m=admin&c=index&a=public_menu_left&menuid=0&parentid="+$("#bigid").val(), function(data){$('.top_menu').remove();$('#top_menu').prepend(data)}); } }); $('#site_homepage').attr('href', domain); $('#site_search').attr('href', 'index.php?m=search&siteid='+siteid); } //隐藏站点下拉。 var s = 0; var h; function hidden_site_list() { s++; if(s>=3) { $('.tab-web-panel').hide(); clearInterval(h); s = 0; } } function clearh(){ if(h)clearInterval(h); } function hidden_site_list_1() { h = setInterval("hidden_site_list()", 1); } //左侧开关 $("#openClose").click(function(){ if($(this).data('clicknum')==1) { $("html").removeClass("on"); $(".left_menu").removeClass("left_menu_on"); $(this).removeClass("close"); $(this).data('clicknum', 0); $(".scroll").show(); } else { $(".left_menu").addClass("left_menu_on"); $(this).addClass("close"); $("html").addClass("on"); $(this).data('clicknum', 1); $(".scroll").hide(); } return false; }); function _M(menuid,targetUrl) { $("#menuid").val(menuid); $("#bigid").val(menuid); $("#paneladd").html('<a class="panel-add" href="javascript:add_panel();"><em><?php echo L('add')?></em></a>'); if(menuid!=8) { $("#leftMain").load("?m=admin&c=index&a=public_menu_left&menuid="+menuid, {limit: 25}, function(){ windowW(); }); } else { $("#leftMain").load("?m=admin&c=phpsso&a=public_menu_left&menuid="+menuid, {limit: 25}, function(){ windowW(); }); } //$("#rightMain").attr('src', targetUrl); $('.top_menu').removeClass("on"); $('#_M'+menuid).addClass("on"); $.get("?m=admin&c=index&a=public_current_pos&menuid="+menuid, function(data){ $("#current_pos").html(data); }); //当点击顶部菜单后,隐藏中间的框架 $('#display_center_id').css('display','none'); //显示左侧菜单,当点击顶部时,展开左侧 $(".left_menu").removeClass("left_menu_on"); $("#openClose").removeClass("close"); $("html").removeClass("on"); $("#openClose").data('clicknum', 0); $("#current_pos").data('clicknum', 1); } function _MP(menuid,targetUrl) { $("#menuid").val(menuid); $("#paneladd").html('<a class="panel-add" href="javascript:add_panel();"><em><?php echo L('add')?></em></a>'); $("#rightMain").attr('src', targetUrl+'&menuid='+menuid+'&pc_hash='+pc_hash); $('.sub_menu').removeClass("on fb blue"); $('#_MP'+menuid).addClass("on fb blue"); $.get("?m=admin&c=index&a=public_current_pos&menuid="+menuid, function(data){ $("#current_pos").html(data+'<span id="current_pos_attr"></span>'); }); $("#current_pos").data('clicknum', 1); show_help(targetUrl); } function show_help(targetUrl) { $("#help").slideUp("slow"); var str = ''; $.getJSON("http://v9.help.phpcms.cn/api.php?jsoncallback=?",{op:'help',targetUrl: targetUrl}, function(data){ if(data!=null) { $("#help").slideDown("slow"); $.each(data, function(i,item){ str += '<a href="'+item.url+'" target="_blank">'+item.title+'</a>'; }); str += '<a class="panel-delete" href="javascript:;" onclick="$(\'#help\').slideUp(\'slow\')"></a>'; $('#help').html(str); } }); $("#help").data('time', 1); } setInterval("hidden_help()", 10000); function hidden_help() { var htime = $("#help").data('time')+1; $("#help").data('time', htime); if(htime>2) $("#help").slideUp("slow"); } function add_panel() { var menuid = $("#menuid").val(); $.ajax({ type: "POST", url: "?m=admin&c=index&a=public_ajax_add_panel", data: "menuid=" + menuid, success: function(data){ if(data) { $("#panellist").html(data); } } }); } function delete_panel(menuid, id) { $.ajax({ type: "POST", url: "?m=admin&c=index&a=public_ajax_delete_panel", data: "menuid=" + menuid, success: function(data){ $("#panellist").html(data); } }); } function paneladdclass(id) { $("#panellist span a[class='on']").removeClass(); $(id).addClass('on') } setInterval("session_life()", 160000); function session_life() { $.get("?m=admin&c=index&a=public_session_life"); } function lock_screen() { $.get("?m=admin&c=index&a=public_lock_screen"); $('#dvLockScreen').css('display',''); } function check_screenlock() { var lock_password = $('#lock_password').val(); if(lock_password=='') { $('#lock_tips').html('<font color="red"><?php echo L('password_can_not_be_empty');?></font>'); return false; } $.get("?m=admin&c=index&a=public_login_screenlock", { lock_password: lock_password},function(data){ if(data==1) { $('#dvLockScreen').css('display','none'); $('#lock_password').val(''); $('#lock_tips').html('<?php echo L('lockscreen_status');?>'); } else if(data==3) { $('#lock_tips').html('<font color="red"><?php echo L('wait_1_hour_lock');?></font>'); } else { strings = data.split('|'); $('#lock_tips').html('<font color="red"><?php echo L('password_error_lock');?>'+strings[1]+'<?php echo L('password_error_lock2');?></font>'); } }); } $(document).bind('keydown', 'return', function(evt){check_screenlock();return false;}); (function(){ var addEvent = (function(){ if (window.addEventListener) { return function(el, sType, fn, capture) { el.addEventListener(sType, fn, (capture)); }; } else if (window.attachEvent) { return function(el, sType, fn, capture) { el.attachEvent("on" + sType, fn); }; } else { return function(){}; } })(), Scroll = document.getElementById('Scroll'); // IE6/IE7/IE8/Opera 10+/Safari5+ addEvent(Scroll, 'mousewheel', function(event){ event = window.event || event ; if(event.wheelDelta <= 0 || event.detail > 0) { Scroll.scrollTop = Scroll.scrollTop + 29; } else { Scroll.scrollTop = Scroll.scrollTop - 29; } }, false); // Firefox 3.5+ addEvent(Scroll, 'DOMMouseScroll', function(event){ event = window.event || event ; if(event.wheelDelta <= 0 || event.detail > 0) { Scroll.scrollTop = Scroll.scrollTop + 29; } else { Scroll.scrollTop = Scroll.scrollTop - 29; } }, false); })(); function menuScroll(num){ var Scroll = document.getElementById('Scroll'); if(num==1){ Scroll.scrollTop = Scroll.scrollTop - 60; }else{ Scroll.scrollTop = Scroll.scrollTop + 60; } } </script> </body> </html>
108wo
phpcms/modules/admin/templates/index.tpl.php
PHP
asf20
17,337
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header'); ?> <div class="pad_10"> <div class="table-list"> <form method="post" name="myform" id="myform" action="?m=admin&c=googlesitemap&a=set"> <input type="hidden" name="tabletype" value="phpcmstables" id="phpcmstables"> <table width="100%" cellspacing="0"> <thead> <tr> <th class="tablerowhighlight" colspan=2><?php echo L('google_info')?></th> </tr> </thead> <tr> <td align="right" width="100"><?php echo L('explain')?>: </td> <td> <?php echo L('google_infos')?> </td> </tr> </table> <table width="100%" cellspacing="0"> <thead> <tr> <th class="tablerowhighlight" colspan=2><?php echo L('google_sitemaps')?></th> </tr> </thead> <tr> <td align="right" width="100"> <?php echo L('google_rate')?> : </td> <td colspan=1> <select name="content_priority"> <option value="1">1</option><option value="0.9">0.9</option> <option value="0.8">0.8</option><option selected="" value="0.7">0.7</option> <option value="0.6">0.6</option><option value="0.5">0.5</option> <option value="0.4">0.4</option><option value="0.3">0.3</option> <option value="0.2">0.2</option><option value="0.1">0.1</option> </select> <select name="content_changefreq"> <option value="always"><?php echo L('google_update')?></option><option value="hourly"><?php echo L('google_hour')?></option> <option value="daily"><?php echo L('google_day')?></option><option selected="" value="weekly"><?php echo L('google_week')?></option> <option value="monthly"><?php echo L('google_month')?></option><option value="yearly"><?php echo L('google_year')?></option> <option value="never"><?php echo L('google_noupdate')?></option> </select> </td> </tr> <tr> <td align="right"><?php echo L('google_nums')?> : </td> <td colspan=3> <input type=text name="num" value="20" size=5> </td> </tr> </table> <table width="100%" cellspacing="0"> <thead> <tr> <th class="tablerowhighlight" colspan=2><?php echo L('google_baidunews')?></th> </tr> </thead> <tr> <td align="right"><?php echo L('google_ismake')?> : </td> <td colspan=1><input type="radio" name="mark" value="1" checked> <?php echo L('setting_yes')?> &nbsp; <input type="radio" name="mark" value="0"> <?php echo L('setting_no')?> &nbsp;</td> </tr> <tr> <td align="right" width="100"> <?php echo L('google_select_db')?> : </td> <td colspan=1> <select name='catids[]' id='catids' multiple="multiple" style="height:200px;" title="<?php echo L('push_ctrl_to_select','','content');?>"> <?php echo $string;?> </select> </td> </tr> <tr> <td align="right" width="100"> <?php echo L('google_period')?> : </td> <td colspan=1><input type=text name="time" value="40" size=20> </td> </tr> <tr> <td align="right" width="100"> Email : </td> <td colspan=3><input type=text name="email" value="phpcms@phpcms.cn" size=20></td> </tr> <tr> <td align="right" width="100"> <?php echo L('google_nums')?> : </td> <td colspan=3><input type=text name="baidunum" value="20" size=5> </td> </tr> <tr> <th class="tablerowhighlight" colspan=2> <br> <input type="submit" name="dosubmit" value=" <?php echo L('google_startmake')?> " class="button"> <br> </th> </tr> </table> </form> </div> </div> </body> </html>
108wo
phpcms/modules/admin/templates/googlesitemap.tpl.php
PHP
asf20
3,595
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header');?> <div class="pad_10"> <div class="explain-col"> <?php echo L('linkage_tips');?> </div> <div class="bk10"></div> <form name="myform" action="?m=admin&c=role&a=listorder" method="post"> <div class="table-list"> <table width="100%" cellspacing="0"> <thead> <tr> <th width="10%">ID</th> <th width="20%" align="left" ><?php echo L('linkage_name')?></th> <th width="30%" align="left" ><?php echo L('linkage_desc')?></th> <th width="20%" ><?php echo L('linkage_calling_code')?></th> <th width="20%" ><?php echo L('operations_manage')?></th> </tr> </thead> <tbody> <?php if(is_array($infos)){ foreach($infos as $info){ ?> <tr> <td width="10%" align="center"><?php echo $info['linkageid']?></td> <td width="20%" ><?php echo $info['name']?></td> <td width="30%" ><?php echo $info['description']?></td> <td width="20%" class="text-c"><input type="text" value="{menu_linkage(<?php echo $info['linkageid']?>,'L_<?php echo $info['linkageid']?>')}" style="width:200px;"></td> <td width="20%" class="text-c"><a href="?m=admin&c=linkage&a=public_manage_submenu&keyid=<?php echo $info['linkageid']?>"><?php echo L('linkage_manage_submenu')?></a> | <a href="javascript:void(0);" onclick="edit('<?php echo $info['linkageid']?>','<?php echo new_addslashes($info['name'])?>')"><?php echo L('edit')?></a> | <a href="javascript:confirmurl('?m=admin&c=linkage&a=delete&linkageid=<?php echo $info['linkageid']?>', '<?php echo L('linkage_is_del')?>')"><?php echo L('delete')?></a> | <a href="?m=admin&c=linkage&a=public_cache&linkageid=<?php echo $info['linkageid']?>"><?php echo L('update_backup')?></a></td> </tr> <?php } } ?> </tbody> </table> </div> </div> </form> <script type="text/javascript"> <!-- function edit(id, name) { window.top.art.dialog({id:'edit'}).close(); window.top.art.dialog({title:name,id:'edit',iframe:'?m=admin&c=linkage&a=edit&linkageid='+id,width:'500',height:'200'}, function(){var d = window.top.art.dialog({id:'edit'}).data.iframe;d.document.getElementById('dosubmit').click();return false;}, function(){window.top.art.dialog({id:'edit'}).close()}); } //--> </script> </body> </html>
108wo
phpcms/modules/admin/templates/linkage_list.tpl.php
PHP
asf20
2,316
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin'); ?> <link href="<?php echo CSS_PATH?>open_admin.css" rel="stylesheet" type="text/css" /> <div class="pad_10"> <div class="table-list"> <?php if($license && $_GET['license']) {?> <div class="nr"><p><?php echo $plugin_data['license']?></p></div> <div class="btn ibtn txtc"> <input type="button" onclick="location.href='<?php echo $submit_url?>'" value="<?php echo L('plugin_agree','','plugin')?>" class="button" name="install"> <input type="button" onclick="history.go(-1);" value="<?php echo L('plugin_disagree','','plugin')?>" class="button" name="cancel"> </div> <?php } else { ?> <div class="fs14"><?php echo L('install_plugin','','plugin')?></div> <div class="btn ibtn ibtns"> <div class="fs14 txtc"><?php echo L('install_plugin','','plugin')?></div> <input type="button" onclick="location.href='<?php echo $submit_url?>'" value="<?php echo L('plugin_install_app','','plugin')?>" class="button" name="install"> <input type="button" onclick="history.go(-1);" value="<?php echo L('plugin_uninstall_cancel','','plugin')?>" class="button" name="cancel"> </div> <?php } ?> </div> </div> </div> </body> <a href="javascript:edit(<?php echo $v['siteid']?>, '<?php echo $v['name']?>')"> </html>
108wo
phpcms/modules/admin/templates/plugin_import_confirm.tpl.php
PHP
asf20
1,357
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin');?> <div class="pad-10"> <div class="bk10"></div> <div class="table-list"> <table width="100%" cellspacing="0"> <form action="?m=admin&c=category&a=batch_edit" method="post" name="myform"> <tbody height="200" class="nHover td-line"> <tr> <td align="left" rowspan="6"> <?php echo L('category_batch_edit');?> <font color="red"><?php echo L('category_manage');?></font> <input type="radio" name="type" value="0" <?php if($type==0) echo 'checked';?>><BR><BR> <?php echo L('category_batch_edit');?> <?php echo L('category_type_page');?><input type="radio" name="type" value="1" <?php if($type==1) echo 'checked';?>> </td> </tr> <tr> <td align="center" rowspan="6"> <select name='catids[]' id='catids' multiple="multiple" style="height:300px;width:400px" title="<?php echo L('push_ctrl_to_select','','content');?>"> <?php echo $string;?> </select></td> <td> <input type="hidden" value="<?php echo $type;?>"> <input type="submit" value="<?php echo L('submit');?>"> </td> </tr> </tbody> </form> </table> </div> </div> <script language="JavaScript"> <!-- window.top.$('#display_center_id').css('display','none'); //--> </script>
108wo
phpcms/modules/admin/templates/category_batch_select.tpl.php
PHP
asf20
1,317
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header');?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}}); $("#catname").formValidator({onshow:"<?php echo L('input_catname');?>",onfocus:"<?php echo L('input_catname');?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L('input_catname');?>"})<?php if(ROUTE_A=='edit') echo '.defaultPassed()';?>; $("#url").formValidator({onshow:"<?php echo L('input_linkurl');?>",onfocus:"<?php echo L('input_linkurl');?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L('input_linkurl');?>"})<?php if(ROUTE_A=='edit') echo '.defaultPassed()';?>; }) //--> </script> <form name="myform" id="myform" action="?m=admin&c=category&a=<?php echo ROUTE_A;?>" method="post"> <div class="pad-10"> <div class="col-tab"> <ul class="tabBut cu-li"> <li id="tab_setting_1" class="on" onclick="SwapTab('setting','on','',1,1);"><?php echo L('catgory_basic');?></li> </ul> <div id="div_setting_1" class="contentList pad-10"> <table width="100%" class="table_form "> <tr> <th width="200"><?php echo L('parent_category')?>:</th> <td> <?php echo form::select_category('category_content_'.$this->siteid,$parentid,'name="info[parentid]"',L('please_select_parent_category'),0,-1);?> </td> </tr> <tr> <th><?php echo L('catname')?>:</th> <td><input type="text" name="info[catname]" id="catname" class="input-text" value="<?php echo $catname;?>"></td> </tr> <tr> <th><?php echo L('catgory_img')?>:</th> <td><?php echo form::images('info[image]', 'image', $image, 'content');?></td> </tr> <tr> <th><?php echo L('link_url')?>:</th> <td><input type="text" name="info[url]" id="url" size="50" class="input-text" value="<?php echo $url;?>"></td> </tr> </table> </div> <div class="bk15"></div> <input name="catid" type="hidden" value="<?php echo $catid;?>"> <input name="type" type="hidden" value="<?php echo $type;?>"> <input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="button"> </form> </div> </div> <!--table_form_off--> </div> <script language="JavaScript"> <!-- window.top.$('#display_center_id').css('display','none'); function SwapTab(name,cls_show,cls_hide,cnt,cur){ for(i=1;i<=cnt;i++){ if(i==cur){ $('#div_'+name+'_'+i).show(); $('#tab_'+name+'_'+i).attr('class',cls_show); }else{ $('#div_'+name+'_'+i).hide(); $('#tab_'+name+'_'+i).attr('class',cls_hide); } } } //--> </script>
108wo
phpcms/modules/admin/templates/category_link.tpl.php
PHP
asf20
2,896
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header'); ?> <div class="pad_10"> <div class="table-list"> <table width="100%" cellspacing="0"> <thead> <tr> <th width="80">Siteid</th> <th><?php echo L('site_name')?></th> <th><?php echo L('site_dirname')?></th> <th><?php echo L('site_domain')?></th> <th align="center"><?php echo L('godaddy')?></th> <th width="150"><?php echo L('operations_manage')?></th> </tr> </thead> <tbody> <?php if(is_array($list)): foreach($list as $v): ?> <tr> <td width="80" align="center"><?php echo $v['siteid']?></td> <td align="center"><?php echo $v['name']?></td> <td align="center"><?php echo $v['dirname']?></td> <td align="center"><?php echo $v['domain']?></td> <td align="center"><?php if ($v['siteid']!=1){?><?php echo pc_base::load_config('system', 'html_root')?>/<?php echo $v['dirname'];} else{echo '/';}?></td> <td align="center"><a href="javascript:edit(<?php echo $v['siteid']?>, '<?php echo new_addslashes(htmlspecialchars($v['name']))?>')"><?php echo L('edit')?></a> | <?php if($v['siteid']!=1) { ?><a href="?m=admin&c=site&a=del&siteid=<?php echo $v['siteid']?>" onclick="return confirm('<?php echo new_addslashes(htmlspecialchars(L('confirm', array('message'=>$v['name']))))?>')"><?php echo L('delete')?></a><?php } else { ?><font color="#cccccc"><?php echo L('delete')?></font><?php } ?></td> </tr> <?php endforeach; endif; ?> </tbody> </table> </div> </div> <div id="pages"><?php echo $pages?></div> <script type="text/javascript"> <!-- function edit(id, name) { window.top.art.dialog({id:'edit'}).close(); window.top.art.dialog({title:'<?php echo L('edit_site')?>《'+name+'》',id:'edit',iframe:'?m=admin&c=site&a=edit&siteid='+id,width:'700',height:'500'}, function(){var d = window.top.art.dialog({id:'edit'}).data.iframe;d.document.getElementById('dosubmit').click();return false;}, function(){window.top.art.dialog({id:'edit'}).close()}); } //--> </script> </body> </html>
108wo
phpcms/modules/admin/templates/site_list.tpl.php
PHP
asf20
2,065
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header'); ?> <link href="<?php echo CSS_PATH?>jquery.treeTable.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="<?php echo JS_PATH?>jquery.treetable.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#dnd-example").treeTable({ indent: 20 }); }); function checknode(obj) { var chk = $("input[type='checkbox']"); var count = chk.length; var num = chk.index(obj); var level_top = level_bottom = chk.eq(num).attr('level') for (var i=num; i>=0; i--) { var le = chk.eq(i).attr('level'); if(eval(le) < eval(level_top)) { chk.eq(i).attr("checked",true); var level_top = level_top-1; } } for (var j=num+1; j<count; j++) { var le = chk.eq(j).attr('level'); if(chk.eq(num).attr("checked")==true) { if(eval(le) > eval(level_bottom)) chk.eq(j).attr("checked",true); else if(eval(le) == eval(level_bottom)) break; } else { if(eval(le) > eval(level_bottom)) chk.eq(j).attr("checked",false); else if(eval(le) == eval(level_bottom)) break; } } } </script> <?php if($siteid) {?> <div class="table-list" id="load_priv"> <table width="100%" cellspacing="0"> <thead> <tr> <th class="text-l cu-span" style='padding-left:30px;'><span onClick="javascript:$('input[name=menuid[]]').attr('checked', true)"><?php echo L('selected_all');?></span>/<span onClick="javascript:$('input[name=menuid[]]').attr('checked', false)"><?php echo L('cancel');?></span></th> </tr> </thead> </table> <form name="myform" action="?m=admin&c=role&a=role_priv" method="post"> <input type="hidden" name="roleid" value="<?php echo $roleid?>"></input> <input type="hidden" name="siteid" value="<?php echo $siteid?>"></input> <table width="100%" cellspacing="0" id="dnd-example"> <tbody> <?php echo $categorys;?> </tbody> </table> <div class="btn"><input type="submit" class="button" name="dosubmit" id="dosubmit" value="<?php echo L('submit');?>" /></div> </form> </div> <?php } else {?> <style type="text/css"> .guery{background: url(<?php echo IMG_PATH?>msg_img/msg_bg.png) no-repeat 0px -560px;padding:10px 12px 10px 45px; font-size:14px; height:100px; line-height:96px} .guery{background-position: left -460px;} </style> <center> <div class="guery" style="display:inline-block;display:-moz-inline-stack;zoom:1;*display:inline;"> <?php echo L('select_site');?> </div> </center> <?php }?> </body> </html>
108wo
phpcms/modules/admin/templates/role_priv.tpl.php
PHP
asf20
2,812
<?php defined('IN_ADMIN') or exit('No permission resources.'); $show_header = 1; include $this->admin_tpl('header'); ?> <div class="pad-10"> <form action="?m=admin&c=module&a=install" method="post" id="myform"> <div> <table width="100%" class="table_form"> <tr> <th width="80"><?php echo L('modulename')?>:</th> <td class="y-bg"><?php echo $modulename?></td> </tr> <tr> <th width="80"><?php echo L('introduce')?>:</th> <td class="y-bg"><?php echo $introduce?></td> </tr> <tr> <th width="80"><?php echo L('moduleauthor')?>:</th> <td class="y-bg"><?php echo $author?></td> </tr> <tr> <th width="80">E-mail:</th> <td class="y-bg"><?php echo $authoremail?></td> </tr> <tr> <th width="80"><?php echo L('homepage')?>:</th> <td class="y-bg"><?php echo $authorsite?></td> </tr> </table> </div> <div class="bk15"></div><input type="hidden" name="module" value="<?php echo $_GET['module']?>"> <input type="submit" class="dialog" id="dosubmit" name="dosubmit" value="<?php echo L('submit')?>" /> </div> </div> </form> </body> </html>
108wo
phpcms/modules/admin/templates/module_config.tpl.php
PHP
asf20
1,132
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header');?> <?php if(ROUTE_A=='init') {?> <form name="myform" action="?m=admin&c=menu&a=listorder" method="post"> <div class="pad-lr-10"> <div class="table-list"> <table width="100%" cellspacing="0"> <thead> <tr> <th width="80"><?php echo L('listorder');?></th> <th width="100">id</th> <th><?php echo L('menu_name');?></th> <th><?php echo L('operations_manage');?></th> </tr> </thead> <tbody> <?php echo $categorys;?> </tbody> </table> <div class="btn"><input type="submit" class="button" name="dosubmit" value="<?php echo L('listorder')?>" /></div> </div> </div> </div> </form> </body> </html> <?php } elseif(ROUTE_A=='add') {?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}}); $("#language").formValidator({onshow:"<?php echo L("input").L('chinese_name')?>",onfocus:"<?php echo L("input").L('chinese_name')?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('chinese_name')?>"}); $("#name").formValidator({onshow:"<?php echo L("input").L('menu_name')?>",onfocus:"<?php echo L("input").L('menu_name')?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('menu_name')?>"}); $("#m").formValidator({onshow:"<?php echo L("input").L('module_name')?>",onfocus:"<?php echo L("input").L('module_name')?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('module_name')?>"}); $("#c").formValidator({onshow:"<?php echo L("input").L('file_name')?>",onfocus:"<?php echo L("input").L('file_name')?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('file_name')?>"}); $("#a").formValidator({tipid:'a_tip',onshow:"<?php echo L("input").L('action_name')?>",onfocus:"<?php echo L("input").L('action_name')?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('action_name')?>"}); }) //--> </script> <div class="common-form"> <form name="myform" id="myform" action="?m=admin&c=menu&a=add" method="post"> <table width="100%" class="table_form contentWrap"> <tr> <th width="200"><?php echo L('menu_parentid')?>:</th> <td><select name="info[parentid]" > <option value="0"><?php echo L('no_parent_menu')?></option> <?php echo $select_categorys;?> </select></td> </tr> <tr> <th > <?php echo L('chinese_name')?>:</th> <td><input type="text" name="language" id="language" class="input-text" ></td> </tr> <tr> <th><?php echo L('menu_name')?>:</th> <td><input type="text" name="info[name]" id="name" class="input-text" ></td> </tr> <tr> <th><?php echo L('module_name')?>:</th> <td><input type="text" name="info[m]" id="m" class="input-text" ></td> </tr> <tr> <th><?php echo L('file_name')?>:</th> <td><input type="text" name="info[c]" id="c" class="input-text" ></td> </tr> <tr> <th><?php echo L('action_name')?>:</th> <td><input type="text" name="info[a]" id="a" class="input-text" > <span id="a_tip"></span><?php echo L('ajax_tip')?></td> </tr> <tr> <th><?php echo L('att_data')?>:</th> <td><input type="text" name="info[data]" class="input-text" ></td> </tr> <tr> <th><?php echo L('menu_display')?>:</th> <td><input type="radio" name="info[display]" value="1" checked> <?php echo L('yes')?><input type="radio" name="info[display]" value="0"> <?php echo L('no')?></td> </tr> </table> <!--table_form_off--> </div> <div class="bk15"></div> <div class="btn"><input type="submit" id="dosubmit" class="button" name="dosubmit" value="<?php echo L('submit')?>"/></div> </div> </form> <?php } elseif(ROUTE_A=='edit') {?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}}); $("#language").formValidator({onshow:"<?php echo L("input").L('chinese_name')?>",onfocus:"<?php echo L("input").L('chinese_name')?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('chinese_name')?>"}); $("#name").formValidator({onshow:"<?php echo L("input").L('menu_name')?>",onfocus:"<?php echo L("input").L('menu_name')?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('menu_name')?>"}); $("#m").formValidator({onshow:"<?php echo L("input").L('module_name')?>",onfocus:"<?php echo L("input").L('module_name')?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('module_name')?>"}); $("#c").formValidator({onshow:"<?php echo L("input").L('file_name')?>",onfocus:"<?php echo L("input").L('file_name')?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('file_name')?>"}); $("#a").formValidator({tipid:'a_tip',onshow:"<?php echo L("input").L('action_name')?>",onfocus:"<?php echo L("input").L('action_name')?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('action_name')?>"}); }) //--> </script> <div class="common-form"> <form name="myform" id="myform" action="?m=admin&c=menu&a=edit" method="post"> <table width="100%" class="table_form contentWrap"> <tr> <th width="200"><?php echo L('menu_parentid')?>:</th> <td><select name="info[parentid]" style="width:200px;"> <option value="0"><?php echo L('no_parent_menu')?></option> <?php echo $select_categorys;?> </select></td> </tr> <tr> <th> <?php echo L('for_chinese_lan')?>:</th> <td><input type="text" name="language" id="language" class="input-text" value="<?php echo L($name,'','',1)?>"></td> </tr> <tr> <th><?php echo L('menu_name')?>:</th> <td><input type="text" name="info[name]" id="name" class="input-text" value="<?php echo $name?>"></td> </tr> <tr> <th><?php echo L('module_name')?>:</th> <td><input type="text" name="info[m]" id="m" class="input-text" value="<?php echo $m?>"></td> </tr> <tr> <th><?php echo L('file_name')?>:</th> <td><input type="text" name="info[c]" id="c" class="input-text" value="<?php echo $c?>"></td> </tr> <tr> <th><?php echo L('action_name')?>:</th> <td><input type="text" name="info[a]" id="a" class="input-text" value="<?php echo $a?>"> <span id="a_tip"></span><?php echo L('ajax_tip')?></td> </tr> <tr> <th><?php echo L('att_data')?>:</th> <td><input type="text" name="info[data]" class="input-text" value="<?php echo $data?>"></td> </tr> <tr> <th><?php echo L('menu_display')?>:</th> <td><input type="radio" name="info[display]" value="1" <?php if($display) echo 'checked';?>> <?php echo L('yes')?><input type="radio" name="info[display]" value="0" <?php if(!$display) echo 'checked';?>> <?php echo L('no')?></td> </tr> </table> <!--table_form_off--> </div> <div class="bk15"></div> <input name="id" type="hidden" value="<?php echo $id?>"> <div class="btn"><input type="submit" id="dosubmit" class="button" name="dosubmit" value="<?php echo L('submit')?>"/></div> </div> </form> <?php }?> </body> </html>
108wo
phpcms/modules/admin/templates/menu.tpl.php
PHP
asf20
7,986
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header');?> <style type="text/css"> .table-list td b{color:#666} .tpl_style{background-color:#FBFAE3} </style> <form name="myform" action="?m=admin&c=category&a=batch_edit" method="post"> <div class="pad_10"> <div class="explain-col"> <?php echo L('category_batch_tips');?></a> </div> <div class="bk10"></div> <div id="table-lists" class="table-list" > <table height="auto" cellspacing="0" > <thead > <?php foreach($batch_array as $catid=>$cat) { $batch_array[$catid]['setting'] = string2array($cat['setting']); echo "<th width='260' align='left' ><strong>{$cat[catname]} (catid: <font color='red'>{$catid}</font>)</strong></th>"; } ?> </thead> <tbody> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('catname')?>:</b><br><input type='text' name='info[<?php echo $catid;?>][catname]' id='catname' class='input-text' value='<?php echo $cat['catname']?>' style='width:250px'></td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('catdir')?>:</b><br><input type='text' name='info[<?php echo $catid;?>][catdir]' id='catname' class='input-text' value='<?php echo $cat['catdir']?>' style='width:250px'></td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('catgory_img')?>:</b><br><?php echo form::images('info['.$catid.'][image]', 'image'.$catid, $cat['image'], 'content','',23);?></td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('description')?>:</b><br><textarea name="info[<?php echo $catid;?>][description]" maxlength="255" style="width:240px;height:40px;"><?php echo $cat['description'];?></textarea></td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td class="tpl_style"><b><?php echo L('available_styles')?>:</b><br> <?php echo form::select($template_list, $cat['setting']['template_list'], 'name="setting['.$catid.'][template_list]" id="template_list" onchange="load_file_list(this.value,'.$catid.')"', L('please_select'))?> </td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td class="tpl_style"><b><?php echo L('category_index_tpl')?>:</b><br> <div id="category_template<?php echo $catid;?>"> <?php echo form::select_template($cat['setting']['template_list'], 'content',$cat['setting']['category_template'],'name="setting['.$catid.'][category_template]" style="width:250px"','category');?> </div> </td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td class="tpl_style"><b><?php echo L('category_list_tpl')?>:</b><br> <div id="list_template<?php echo $catid;?>"> <?php echo form::select_template($cat['setting']['template_list'], 'content',$cat['setting']['list_template'],'name="setting['.$catid.'][list_template]" style="width:250px"','list');?> </div> </td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td class="tpl_style"><b><?php echo L('content_tpl')?>:</b><br> <div id="show_template<?php echo $catid;?>"> <?php echo form::select_template($cat['setting']['template_list'], 'content',$cat['setting']['show_template'],'name="setting['.$catid.'][show_template]" style="width:250px"','show');?> </div> </td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('workflow')?>:</b><br><?php echo form::select($workflows_datas,$cat['setting']['workflowid'],'name="setting['.$catid.'][workflowid]"',L('catgory_not_need_check'));?></td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('ismenu')?>:</b><br> <input boxid="ismenu" type='radio' name='info[<?php echo $catid;?>][ismenu]' value='1' <?php if($cat['ismenu']) echo 'checked';?> onclick="change_radio(event,'ismenu',1)"> <?php echo L('yes');?>&nbsp;&nbsp;&nbsp;&nbsp; <input boxid="ismenu" type='radio' name='info[<?php echo $catid;?>][ismenu]' value='0' <?php if(!$cat['ismenu']) echo 'checked';?> onclick="change_radio(event,'ismenu',0)"> <?php echo L('no');?> </td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('html_category')?>:</b><br> <input boxid="ishtml" catid="<?php echo $catid;?>" type='radio' name='setting[<?php echo $catid;?>][ishtml]' value='1' <?php if($cat['setting']['ishtml']) echo 'checked';?> onClick="change_radio(event,'ishtml',1,'category');urlrule('category',1,<?php echo $catid;?>)"> <?php echo L('yes');?>&nbsp;&nbsp;&nbsp;&nbsp; <input boxid="ishtml" catid="<?php echo $catid;?>" type='radio' name='setting[<?php echo $catid;?>][ishtml]' value='0' <?php if(!$cat['setting']['ishtml']) echo 'checked';?> onClick="change_radio(event,'ishtml',0,'category');urlrule('category',0,<?php echo $catid;?>)"> <?php echo L('no');?> </td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('html_show')?>:</b><br> <input boxid="content_ishtml" catid="<?php echo $catid;?>" type='radio' name='setting[<?php echo $catid;?>][content_ishtml]' value='1' <?php if($cat['setting']['content_ishtml']) echo 'checked';?> onClick="change_radio(event,'content_ishtml',1,'show');urlrule('show',1,<?php echo $catid;?>)"> <?php echo L('yes');?>&nbsp;&nbsp;&nbsp;&nbsp; <input boxid="content_ishtml" catid="<?php echo $catid;?>" type='radio' name='setting[<?php echo $catid;?>][content_ishtml]' value='0' <?php if(!$cat['setting']['content_ishtml']) echo 'checked';?> onClick="change_radio(event,'content_ishtml',0,'show');urlrule('show',0,<?php echo $catid;?>)"> <?php echo L('no');?> </td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('category_urlrules')?>:</b><br> <div id="category_php_ruleid<?php echo $catid;?>" style="display:<?php if($cat['setting']['ishtml']) echo 'none';?>"> <?php echo form::urlrule('content','category',0,$cat['setting']['category_ruleid'],'name="category_php_ruleid['.$catid.']" style="width:250px;"'); ?> </div> <div id="category_html_ruleid<?php echo $catid;?>" style="display:<?php if(!$cat['setting']['ishtml']) echo 'none';?>"> <?php echo form::urlrule('content','category',1,$cat['setting']['category_ruleid'],'name="category_html_ruleid['.$catid.']" style="width:250px;"'); ?> </div> </td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('show_urlrules')?>:</b><br> <div id="show_php_ruleid<?php echo $catid;?>" style="display:<?php if($cat['setting']['content_ishtml']) echo 'none';?>"> <?php echo form::urlrule('content','show',0,$cat['setting']['show_ruleid'],'name="show_php_ruleid['.$catid.']" style="width:250px;"'); ?> </div> <div id="show_html_ruleid<?php echo $catid;?>" style="display:<?php if(!$cat['setting']['content_ishtml']) echo 'none';?>"> <?php echo form::urlrule('content','show',1,$cat['setting']['show_ruleid'],'name="show_html_ruleid['.$catid.']" style="width:250px;"'); ?> </div> </td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('create_to_rootdir')?>:</b><br> <input boxid="create_to_html_root" onclick="change_radio(event,'create_to_html_root',1)" type='radio' name='setting[<?php echo $catid;?>][create_to_html_root]' value='1' <?php if($cat['setting']['create_to_html_root']) echo 'checked';?> > <?php echo L('yes');?>&nbsp;&nbsp;&nbsp;&nbsp; <input boxid="create_to_html_root" onclick="change_radio(event,'create_to_html_root',0)" type='radio' name='setting[<?php echo $catid;?>][create_to_html_root]' value='0' <?php if(!$cat['setting']['create_to_html_root']) echo 'checked';?> > <?php echo L('no');?> </td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('meta_title')?>:</b><br> <input name='setting[<?php echo $catid;?>][meta_title]' type='text' value='<?php echo $cat['setting']['meta_title'];?>' style='width:250px'> </td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('meta_keywords')?>:</b><br> <input name='setting[<?php echo $catid;?>][meta_keywords]' type='text' value='<?php echo $cat['setting']['meta_keywords'];?>' style='width:250px'> </td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('meta_description')?>:</b><br> <input name='setting[<?php echo $catid;?>][meta_description]' type='text' value='<?php echo $cat['setting']['meta_description'];?>' style='width:250px'> </td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('contribute_add_point')?>:</b><br> <input name='setting[<?php echo $catid;?>][presentpoint]' type='text' value='<?php echo $cat['setting']['presentpoint'];?>' style='width:100px' maxlength='60'> <?php echo L('point');?> </td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('default_readpoint')?>:</b><br> <input name='setting[<?php echo $catid;?>][defaultchargepoint]' type='text' value='<?php echo $cat['setting']['defaultchargepoint'];?>' style='width:100px' maxlength='60'> <select name="setting[<?php echo $catid;?>][paytype]"><option value="0" <?php if(!$cat['setting']['paytype']) echo 'selected';?>><?php echo L('readpoint');?></option><option value="1" <?php if($cat['setting']['paytype']) echo 'selected';?>><?php echo L('money');?></option></select> </td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('repeatchargedays')?>:</b><br> <input name='setting[<?php echo $catid;?>][repeatchargedays]' type='text' value='<?php echo $cat['setting']['repeatchargedays'];?>' style='width:100px' maxlength='60'><?php echo L('repeat_tips');?> </td> <?php } ?> </tr> </tbody> </table> <div class="btn"> <input type="hidden" name="pc_hash" value="<?php echo $_SESSION['pc_hash'];?>" /> <input type="hidden" name="type" value="<?php echo $type;?>" /> <input type="submit" class="button" name="dosubmit" value="<?php echo L('submit')?>" /></div> <BR><BR> </div> </div> </div> </form> <script language="JavaScript"> <!-- $(document).keydown(function(event) { if(event.keyCode==37) { window.scrollBy(-100,0); } else if(event.keyCode==39) { window.scrollBy(100,0); } }); function change_radio(oEvent,boxid,value,type) { altKey = oEvent.altKey; if(altKey) { var obj = $("input[boxid="+boxid+"][value="+value+"]"); obj.attr('checked',true); if(type){ obj.each(function(){ urlrule(type,value,$(this).attr('catid')); }) } } } window.top.$('#display_center_id').css('display','none'); function urlrule(type,html,catid) { if(type=='category') { if(html) { $('#category_php_ruleid'+catid).css('display','none');$('#category_html_ruleid'+catid).css('display',''); } else { $('#category_php_ruleid'+catid).css('display','');$('#category_html_ruleid'+catid).css('display','none');; } } else { if(html) { $('#show_php_ruleid'+catid).css('display','none');$('#show_html_ruleid'+catid).css('display',''); } else { $('#show_php_ruleid'+catid).css('display','');$('#show_html_ruleid'+catid).css('display','none');; } } } function load_file_list(id,catid) { if(id=='') return false; $.getJSON('?m=admin&c=category&a=public_tpl_file_list&batch_str=1&style='+id+'&catid='+catid, function(data){ if(data==null) return false; $('#category_template'+catid).html(data.category_template);$('#list_template'+catid).html(data.list_template);$('#show_template'+catid).html(data.show_template);}); } //--> </script> </body> </html>
108wo
phpcms/modules/admin/templates/category_batch_edit.tpl.php
PHP
asf20
12,365
<?php defined('IN_ADMIN') or exit('No permission resources.'); $show_dialog = 1; include $this->admin_tpl('header','admin'); ?> <div class="pad-lr-10"> <form name="searchform" action="?m=admin&c=ipbanned&a=search_ip&menuid=<?php echo $_GET['menuid'];?>" method="get" > <input type="hidden" value="admin" name="m"> <input type="hidden" value="ipbanned" name="c"> <input type="hidden" value="search_ip" name="a"> <table width="100%" cellspacing="0" class="search-form"> <tbody> <tr> <td><div class="explain-col">IP: <input type="text" value="" class="input-text" name="search[ip]"> <input type="submit" value="<?php echo L('search')?>" class="button" name="dosubmit"> </div> </td> </tr> </tbody> </table> </form> <form name="myform" id="myform" action="?m=admin&c=ipbanned&a=delete" method="post" onsubmit="checkuid();return false;"> <div class="table-list"> <table width="100%" cellspacing="0"> <thead> <tr> <th width="35" align="center"><input type="checkbox" value="" id="check_box" onclick="selectall('ipbannedid[]');"></th> <th width="30%">IP</th> <th ><?php echo L('deblocking_time')?></th> <th width="120"><?php echo L('operations_manage')?></th> </tr> </thead> <tbody> <?php if(is_array($infos)){ foreach($infos as $info){ ?> <tr> <td align="center"> <input type="checkbox" name="ipbannedid[]" value="<?php echo $info['ipbannedid']?>"> </td> <td width="30%" align="left"><span class="<?php echo $info['style']?>"><?php echo $info['ip']?></span> </td> <td align="center"><?php echo date('Y-m-d H:i', $info['expires']);?></td> <td align="center"><a href="javascript:confirmurl('?m=admin&c=ipbanned&a=delete&ipbannedid=<?php echo $info['ipbannedid']?>', "<?php echo L('confirm_del_ip')?>")"><?php echo L('delete')?></a> </td> </tr> <?php } } ?></tbody> </table> <div class="btn"> <a href="#" onClick="javascript:$('input[type=checkbox]').attr('checked', true)"><?php echo L('selected_all')?></a>/<a href="#" onClick="javascript:$('input[type=checkbox]').attr('checked', false)"><?php echo L('cancel')?></a> <input type="submit" name="submit" class="button" value="<?php echo L('remove_all_selected')?>" onClick="return confirm('<?php echo L('confirm', array('message' => L('selected')))?>')" /> </div> <div id="pages"><?php echo $pages?></div> </div> </form></div> </body> </html> <script type="text/javascript"> function checkuid() { var ids=''; $("input[name='ipbannedid[]']:checked").each(function(i, n){ ids += $(n).val() + ','; }); if(ids=='') { window.top.art.dialog({content:"<?php echo L('before_select_operation')?>",lock:true,width:'200',height:'50',time:1.5},function(){}); return false; } else { myform.submit(); } } </script>
108wo
phpcms/modules/admin/templates/ip_search_list.tpl.php
PHP
asf20
2,905
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header'); ?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}}); $("#ip").formValidator({onshow:"<?php echo L('input').L('ipbanned')?>",onfocus:"<?php echo L('input').L('ipbanned')?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('ipbanned')?>"}).regexValidator({regexp:"notempty",datatype:"enum",param:'i',onerror:"<?php echo L('three_types')?>"}).ajaxValidator({type : "get",url : "",data :"m=admin&c=ipbanned&a=public_name",datatype : "html",async:'false',success : function(data){ if( data == "1" ){return true;}else{return false;}},buttons: $("#dosubmit"),onerror : "<?php echo L('ip_exit')?>",onwait : "<?php echo L('connecting')?>"}); $("#expires").formValidator({onshow:"<?php echo L('input').L('deblocking_time')?>",onfocus:"<?php echo L('input').L('deblocking_time')?>",oncorrect:"<?php echo L('time_isok')?>"}).inputValidator({min:1,onerror:"<?php echo L('time_ismust')?>"}); }) //--> </script> <div class="pad_10"> <form action="?m=admin&c=ipbanned&a=add" method="post" name="myform" id="myform" > <table width="100%" cellpadding="2" cellspacing="1" class="table_form"> <tr> <th width="60">IP :</th> <td><input type="text" name="info[ip]" id="ip" size="25"></td> </tr> <tr> <th><?php echo L('deblocking_time')?> :</th> <td><?php echo form::date('info[expires]', '', '')?></td> </tr> <input type="submit" name="dosubmit" id="dosubmit" class="dialog" value=" <?php echo L('submit')?> "> </table> </form> </div> </body> </html>
108wo
phpcms/modules/admin/templates/ipbanned_add.tpl.php
PHP
asf20
1,828
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header'); ?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}}); $("#name").formValidator({onshow:"<?php echo L('input').L('release_point_name')?>",onfocus:"<?php echo L('input').L('release_point_name')?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('release_point_name')?>"}).ajaxValidator({type : "get",url : "",data :"m=admin&c=release_point&a=public_name",datatype : "html",async:'false',success : function(data){ if( data == "1" ){return true;}else{return false;}},buttons: $("#dosubmit"),onerror : "<?php echo L('release_point_name').L('exists')?>",onwait : "<?php echo L('connecting')?>"}); $("#host").formValidator({onshow:"<?php echo L('input').L('server_address')?>",onfocus:"<?php echo L('input').L('server_address')?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('server_address')?>"}); $("#port").formValidator({onshow:"<?php echo L('input').L('server_port')?>",onfocus:"<?php echo L('input').L('server_port')?>",defaultvalue:'21'}).inputValidator({min:1,onerror:"<?php echo L('input').L('server_port')?>"}).regexValidator({datatype:'enum',regexp:'intege1',onerror:'<?php echo L('server_ports_must_be_integers')?>'}).defaultPassed(); $("#username").formValidator({onshow:"<?php echo L('input').L('username')?>",onfocus:"<?php echo L('input').L('username')?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('username')?>"}); $("#password").formValidator({onshow:"<?php echo L('input').L('password')?>",onfocus:"<?php echo L('input').L('password')?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('password')?>"}); }) //--> </script> <div class="pad-10"> <form action="?m=admin&c=release_point&a=add" method="post" id="myform"> <fieldset> <legend><?php echo L('basic_configuration')?></legend> <table width="100%" class="table_form"> <tr> <th width="80"><?php echo L('release_point_name')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="name" id="name" size="30" /></td> </tr> </table> </fieldset> <div class="bk15"></div> <fieldset> <legend><?php echo L('ftp_server')?></legend> <table width="100%" class="table_form"> <tr> <th width="80"><?php echo L('server_address')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="host" id="host" size="30" /></td> </tr> <tr> <th width="80"><?php echo L("server_port")?>:</th> <td class="y-bg"><input type="text" class="input-text" name="port" id="port" size="30" /></td> </tr> <tr> <th><?php echo L('username')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="username" id="username" size="30" /></td> </tr> <tr> <th><?php echo L('password')?>:</th> <td class="y-bg"><input type="password" class="input-text" name="password" id="password" size="30" /></td> </tr> <tr> <th><?php echo L('path')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="path" id="path" size="30" value="/" /></td> </tr> <tr> <th><?php echo L('passive_mode')?>:</th> <td class="y-bg"><label><input type="checkbox" class="inputcheckbox" name="pasv" value="1" id="pasv" size="30" /><?php echo L('yes')?></label></td> </tr> <tr> <th><?php echo L('ssl_connection')?>:</th> <td class="y-bg"><label><input type="checkbox" class="inputcheckbox" name="ssl" value="1" id="ssl" size="30" <?php if(!$this->ssl){ echo 'disabled';}?> /><?php echo L('yes')?></label> <?php if(!$this->ssl){ echo '<span style="color:red">'.L('your_server_will_not_support_the_ssl_connection').'</a>';}?></td> </tr> </tr> <tr> <th><?php echo L('test_connections')?>:</th> <td class="y-bg"><input type="button" class="button" onclick="ftp_test()" value="<?php echo L('test_connections')?>" /></td> </tr> </table> </fieldset> <div class="bk15"></div> <input type="submit" class="dialog" id="dosubmit" name="dosubmit" value="<?php echo L('submit')?>" /> </div> </div> <script type="text/javascript"> <!-- function ftp_test() { if(!$.formValidator.isOneValid('host')) { $('#host').focus(); return false; } if(!$.formValidator.isOneValid('port')) { $('#port').focus(); return false; } if(!$.formValidator.isOneValid('username')) { $('#username').focus();return false; } if(!$.formValidator.isOneValid('password')) { $('#password').focus();return false; } var host = $('#host').val(); var port = $('#port').val(); var username = $('#username').val(); var password = $('#password').val(); var pasv = $("input[type='checkbox'][name='pasv']:checked").val(); var ssl = $("input[type='checkbox'][name='ssl']:checked").val(); $.get("?",{m:'admin',c:'release_point',a:'public_test_ftp', host:host,port:port,username:username,password:password,pasv:pasv,ssl:ssl}, function(data){ if (data==1){ alert('<?php echo L('ftp_server_connections_success')?>'); } else { alert(data); } }) } //--> </script> </form> </body> </html>
108wo
phpcms/modules/admin/templates/release_point_add.tpl.php
PHP
asf20
5,319
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin'); ?> <link href="<?php echo CSS_PATH?>appcenter.css" rel="stylesheet" type="text/css" /> <div class="pad_10"> <table width="90%" cellspacing="0" cellpadding="0" border="0" class="tb4col"> <thead> <tr> <td colspan="4" align="left" bgcolor="#F2F9FF" class="thd"><?php if($recommed) {?><div class="r"><img src="<?php echo IMG_PATH?>zt.jpg" width="50" height="40"/> </div><?php }?> <img src="<?php echo $thumb ? $thumb : IMG_PATH.'zz_bg.jpg'?>" width="40" height="40" class="imgbh"/> <h5><?php echo $appname?></h5> <p><?php echo $description?></p></td> </tr> </thead> <tbody> <tr> <td align="left" width="50%" class="clj"><h6><?php echo L('plugin_pub','','plugin')?></h6> <?php if(empty($iframe)) {?> <a href="<?php echo $downurl?>" title="<?php echo $appname?>"><?php echo L('plugin_click_download','','plugin')?></a> <?php }?> <a href="index.php?m=admin&c=plugin&a=install_online&id=<?php echo $id?>"><?php echo L('install_online','','plugin')?></a></td> <td align="left" width="50%"><strong><?php echo L('plugin_reg_time','','plugin')?></strong><?php echo date('Y-m-d H:i:s',$inputtime)?><br /> <strong><?php echo L('plugin_copyright','','plugin')?></strong><?php echo $username?> </td> </tr> <tr> <td colspan="2" align="left"><?php echo L('plugin_copyright_info','','plugin')?></td> </tr> </tbody> </table> </body> <a href="javascript:edit(<?php echo $v['siteid']?>, '<?php echo $v['name']?>')"> </html> <script type="text/javascript"> <!-- function add(id, name) { window.top.art.dialog({title:'<?php echo L('edit')?>--'+name, id:'add', iframe:'?m=pay&c=payment&a=add&code='+id ,width:'700',height:'500'}, function(){var d = window.top.art.dialog({id:'add'}).data.iframe; var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'add'}).close()}); } function edit(id, name) { window.top.art.dialog({title:'<?php echo L('edit')?>--'+name, id:'edit', iframe:'?m=pay&c=payment&a=edit&id='+id ,width:'700',height:'500'}, function(){var d = window.top.art.dialog({id:'edit'}).data.iframe; var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'edit'}).close()}); } //--> </script>
108wo
phpcms/modules/admin/templates/plugin_appcenter_detail.tpl.php
PHP
asf20
2,465
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin'); ?> <link href="<?php echo CSS_PATH?>open_admin.css" rel="stylesheet" type="text/css" /> <div class="pad_10"> <div class="table-list"> <div class="fs14"><?php echo L('uninstall_plugin','','plugin')?> - <?php echo $plugin_data['name']?></div> <div class="btn ibtn ibtns"> <div class="fs14 txtc"><?php echo L('uninstall_plugin','','plugin')?></div> <form name="myform" action="?m=admin&c=plugin&a=delete" method="post"> <input type="submit" class="button" name="dosubmit" value="<?php echo L('plugin_uninstall_confirm','','plugin')?>"> <input type="hidden" value="<?php echo $pluginid?>" name="pluginid"> <input type="hidden" value="<?php echo $_SESSION['pc_hash']?>" name="pc_hash"> </form> <input type="button" onclick="history.go(-1);" value="<?php echo L('plugin_uninstall_cancel','','plugin')?>" class="button" name="cancel"> </div> </div> </div> </div> </body> <a href="javascript:edit(<?php echo $v['siteid']?>, '<?php echo $v['name']?>')"> </html>
108wo
phpcms/modules/admin/templates/plugin_delete_confirm.tpl.php
PHP
asf20
1,128
<?php defined('IN_ADMIN') or exit('No permission resources.'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET?>" /> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <title><?php echo L('phpcms_logon')?></title> <style type="text/css"> div{overflow:hidden; *display:inline-block;}div{*display:block;} .login_box{background:url(<?php echo IMG_PATH?>admin_img/login_bg.jpg) no-repeat; width:602px; height:416px; overflow:hidden; position:absolute; left:50%; top:50%; margin-left:-301px; margin-top:-208px;} .login_iptbox{bottom:90px;_bottom:72px;color:#FFFFFF;font-size:12px;height:30px;left:50%;margin-left:-150px;position:absolute;width:300px; overflow:visible;} .login_iptbox .ipt{height:24px; width:110px; margin-right:22px; color:#fff; background:url(<?php echo IMG_PATH?>admin_img/ipt_bg.jpg) repeat-x; *line-height:24px; border:none; color:#000; overflow:hidden;} .login_iptbox label{ *position:relative; *top:-6px;} .login_iptbox .ipt_reg{margin-left:12px;width:46px; margin-right:16px; background:url(<?php echo IMG_PATH?>admin_img/ipt_bg.jpg) repeat-x; *overflow:hidden;text-align:center;} .login_tj_btn{ background:url(<?php echo IMG_PATH?>admin_img/login_dl_btn.jpg) no-repeat 0px 0px; width:52px; height:24px; margin-left:16px; border:none; cursor:pointer; padding:0px; float:right;} .yzm{position:absolute; background:url(<?php echo IMG_PATH?>admin_img/login_ts140x89.gif) no-repeat; width:140px; height:89px;right:56px;top:-96px; text-align:center; font-size:12px; display:none;color:red; padding-top:8px; line-height:24px; left:0px;} .yzm a:link,.yzm a:visited{color:#036;text-decoration:none;} .yzm a:hover{color:#C30;} .yzm img{cursor:pointer; margin:4px auto 7px; width:130px; height:50px; border:1px solid #fff;} .cr{font-size:12px;font-style:inherit;text-align:center;color:#ccc;width:100%; position:absolute; bottom:58px;} .cr a{color:#ccc;text-decoration:none;} .img_boxs{position:absolute;} </style> <script language="JavaScript"> <!-- if(top!=self) if(self!=top) top.location=self.location; //--> </script> </head> <body onload="javascript:document.myform.code.focus();"> <div id="login_bg" class="login_box"> <div class="login_iptbox"> <form action="index.php?m=admin&c=index&a=public_card&card=1&dosubmit=1" method="post" name="myform"><input name="dosubmit" value="" type="submit" class="login_tj_btn" /> <input type="hidden" name="rand" value="<?php echo $rand['rand']?>" /> <input type="text" name="code" id="code" class="ipt" /> <img src="<?php echo $rand['url']?>" height="24" class="img_boxs" /> <div id="yzm" class="yzm" style="display:block"><?php echo L('please_input_your_password_the_picture_corresponding_location_6_digits')?></div> </form> </div> <div class="cr"><?php echo L("copyright")?></div> </div> </body> </html>
108wo
phpcms/modules/admin/templates/login_card.tpl.php
PHP
asf20
3,073
<?php defined('IN_ADMIN') or exit('No permission resources.'); $show_validator = true; include $this->admin_tpl('header'); ?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}}); $("#rolename").formValidator({onshow:"<?php echo L('input').L('role_name')?>",onfocus:"<?php echo L('role_name').L('not_empty')?>"}).inputValidator({min:1,max:999,onerror:"<?php echo L('role_name').L('not_empty')?>"}); }) //--> </script> <div class="pad_10"> <div class="common-form"> <form name="myform" action="?m=admin&c=role&a=add" method="post" id="myform"> <table width="100%" class="table_form contentWrap"> <tr> <td><?php echo L('role_name')?></td> <td><input type="text" name="info[rolename]" value="" class="input-text" id="rolename"></input></td> </tr> <tr> <td><?php echo L('role_description')?></td> <td><textarea name="info[description]" rows="2" cols="20" id="description" class="inputtext" style="height:100px;width:500px;"></textarea></td> </tr> <tr> <td><?php echo L('enabled')?></td> <td><input type="radio" name="info[disabled]" value="0" checked> <?php echo L('enable')?> <label><input type="radio" name="info[disabled]" value="1"><?php echo L('ban')?></td> </tr> <tr> <td><?php echo L('listorder')?></td> <td><input type="text" name="info[listorder]" size="3" class="input-text"></td> </tr> </table> <div class="bk15"></div> <input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="button"> </form> </div> </div> </body> </html>
108wo
phpcms/modules/admin/templates/role_add.tpl.php
PHP
asf20
1,593
<?php defined('IN_ADMIN') or exit('No permission resources.'); $show_validator = true;include $this->admin_tpl('header');?> <script type="text/javascript"> $(document).ready(function() { $.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}}); $("#old_password").formValidator({empty:true,onshow:"<?php echo L('not_change_the_password_please_leave_a_blank')?>",onfocus:"<?php echo L('password').L('between_6_to_20')?>",oncorrect:"<?php echo L('old_password_right')?>"}).inputValidator({min:6,max:20,onerror:"<?php echo L('password').L('between_6_to_20')?>"}).ajaxValidator({ type : "get", url : "", data :"m=admin&c=admin_manage&a=public_password_ajx", datatype : "html", async:'false', success : function(data){ if( data == "1" ) { return true; } else { return false; } }, buttons: $("#dosubmit"), onerror : "<?php echo L('old_password_wrong')?>", onwait : "<?php echo L('connecting_please_wait')?>" }); $("#new_password").formValidator({empty:true,onshow:"<?php echo L('not_change_the_password_please_leave_a_blank')?>",onfocus:"<?php echo L('password').L('between_6_to_20')?>"}).inputValidator({min:6,max:20,onerror:"<?php echo L('password').L('between_6_to_20')?>"}); $("#new_pwdconfirm").formValidator({empty:true,onshow:"<?php echo L('not_change_the_password_please_leave_a_blank')?>",onfocus:"<?php echo L('input').L('passwords_not_match')?>",oncorrect:"<?php echo L('passwords_match')?>"}).compareValidator({desid:"new_password",operateor:"=",onerror:"<?php echo L('input').L('passwords_not_match')?>"}); }) </script> <div class="pad_10"> <div class="common-form"> <form name="myform" action="?m=admin&c=admin_manage&a=public_edit_pwd" method="post" id="myform"> <input type="hidden" name="info[userid]" value="<?php echo $userid?>"></input> <input type="hidden" name="info[username]" value="<?php echo $username?>"></input> <table width="100%" class="table_form contentWrap"> <tr> <td width="80"><?php echo L('username')?></td> <td><?php echo $username?> (<?php echo L('realname')?> <?php echo $realname?>)</td> </tr> <tr> <td><?php echo L('email')?></td> <td> <?php echo $email?> </td> </tr> <tr> <td><?php echo L('old_password')?></td> <td><input type="password" name="old_password" id="old_password" class="input-text"></input></td> </tr> <tr> <td><?php echo L('new_password')?></td> <td><input type="password" name="new_password" id="new_password" class="input-text"></input></td> </tr> <tr> <td><?php echo L('new_pwdconfirm')?></td> <td><input type="password" name="new_pwdconfirm" id="new_pwdconfirm" class="input-text"></input></td> </tr> </table> <div class="bk15"></div> <input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="button" id="dosubmit"> </form> </div> </div> </body> </html>
108wo
phpcms/modules/admin/templates/admin_edit_pwd.tpl.php
PHP
asf20
2,945
<?php defined('IN_ADMIN') or exit('No permission resources.'); $show_dialog = 1; include $this->admin_tpl('header','admin'); ?> <div class="pad-lr-10"> <form name="searchform" action="?m=admin&c=log&a=search_log&menuid=<?php echo $_GET['menuid'];?>" method="get" > <input type="hidden" value="admin" name="m"> <input type="hidden" value="log" name="c"> <input type="hidden" value="search_log" name="a"> <table width="100%" cellspacing="0" class="search-form"> <tbody> <tr> <td><div class="explain-col"><?php echo L('module')?>: <?php echo form::select($module_arr,'','name="search[module]"',$default)?> <?php echo L('username')?> <input type="text" value="phpcms" class="input-text" name="search[username]" size='10'> <?php echo L('times')?> <?php echo form::date('search[start_time]','','1')?> <?php echo L('to')?> <?php echo form::date('search[end_time]','','1')?> <input type="submit" value="<?php echo L('determine_search')?>" class="button" name="dosubmit"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" class="button" name="del_log_4" value="<?php echo L('removed_data')?>" onclick="location='?m=admin&c=log&a=delete&week=4&menuid=<?php echo $_GET['menuid'];?>&pc_hash=<?php echo $_SESSION['pc_hash'];?>'" /> </div> </td> </tr> </tbody> </table> </form> <form name="myform" id="myform" action="?m=admin&c=log&a=delete" method="post" onsubmit="checkuid();return false;"> <div class="table-list"> <table width="100%" cellspacing="0"> <thead> <tr> <th width="80"><?php echo L('username')?></th> <th ><?php echo L('module')?></th> <th ><?php echo L('file')?></th> <th width="120"><?php echo L('time')?></th> <th width="120">IP</th> </tr> </thead> <tbody> <?php if(is_array($infos)){ foreach($infos as $info){ ?> <tr> <td align="center"><?php echo $info['username']?></td> <td align="center"><?php echo $info['module']?></td> <td align="left" title="<?php echo $info['querystring']?>"><?php echo str_cut($info['querystring'], 40);?></td> <td align="center"><?php echo $info['time'];//echo $info['lastusetime'] ? date('Y-m-d H:i', $info['lastusetime']):''?></td> <td align="center"><?php echo $info['ip']?> </td> </tr> <?php } } ?></tbody> </table> <div class="btn"> </div> <div id="pages"><?php echo $pages?></div> </div> </form> </div> </body> </html> <script type="text/javascript"> function checkuid() { var ids=''; $("input[name='logid[]']:checked").each(function(i, n){ ids += $(n).val() + ','; }); if(ids=='') { window.top.art.dialog({content:'<?php echo L('select_operations')?>',lock:true,width:'200',height:'50',time:1.5},function(){}); return false; } else { myform.submit(); } } </script>
108wo
phpcms/modules/admin/templates/log_list.tpl.php
PHP
asf20
2,910
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header'); ?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}}); $("#sitename").formValidator({onshow:"<?php echo L('input').L('copyfrom_name');?>",onfocus:"<?php echo L('input').L('copyfrom_name');?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('copyfrom_name');?>"}).defaultPassed(); $("#siteurl").formValidator({onshow:"<?php echo L('input').L('copyfrom_url');?>",onfocus:"<?php echo L('input').L('copyfrom_url');?>",empty:false}).inputValidator({onerror:"<?php echo L('input').L('copyfrom_url');?>"}).regexValidator({regexp:"^http://",onerror:"<?php echo L('copyfrom_url_tips');?>"}).defaultPassed(); }) //--> </script> <div class="pad_10"> <form action="?m=admin&c=copyfrom&a=edit" method="post" name="myform" id="myform" > <table width="100%" cellpadding="2" cellspacing="1" class="table_form"> <tr> <th width="60"><?php echo L('copyfrom_name');?> :</th> <td><input type="text" name="info[sitename]" id="sitename" size="25" value="<?php echo $sitename;?>"></td> </tr> <tr> <th><?php echo L('copyfrom_url')?> :</th> <td><input type="text" name="info[siteurl]" id="siteurl" size="25" value="<?php echo $siteurl;?>"></td> </tr> <tr> <th><?php echo L('copyfrom_logo')?> :</th> <td><?php echo form::images('info[thumb]', 'thumb', $thumb, 'admin')?></td> </tr> <input type="hidden" name="id" value="<?php echo $id?>"> <input type="submit" name="dosubmit" id="dosubmit" class="dialog" value=" <?php echo L('submit')?> "> </table> </form> </div> </body> </html>
108wo
phpcms/modules/admin/templates/copyfrom_edit.tpl.php
PHP
asf20
1,869
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header');?> <script type="text/javascript"> $(document).ready(function() { $.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}}); $("#name").formValidator({onshow:"<?php echo L('input').L('linkage_name').L('linkage_name_desc')?>",onfocus:"<?php echo L('linkage_name').L('not_empty')?>"}).inputValidator({min:1,max:999,onerror:"<?php echo L('linkage_name').L('not_empty')?>"}); }) </script> <div class="pad_10"> <div class="common-form"> <form name="myform" action="?m=admin&c=linkage&a=public_sub_add" method="post" id="myform"> <table width="100%" class="table_form contentWrap"> <tr> <td><?php echo L('level_menu')?></td> <td> <?php echo $list?> </td> </tr> <tr> <td><?php echo L('linkage_name')?></td> <td> <textarea name="info[name]" rows="2" cols="20" id="name" class="inputtext" style="height:90px;width:150px;"><?php echo $name?></textarea> </td> </tr> <tr> <td><?php echo L('menu_description')?></td> <td> <textarea name="info[description]" rows="2" cols="20" id="description" class="inputtext" style="height:45px;width:300px;"><?php echo $description?></textarea> </td> </tr> </table> <div class="bk15"></div> <input type="hidden" name="keyid" value="<?php echo $keyid?>"> <input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="dialog" id="dosubmit"> </form> </div> </div> </body> </html>
108wo
phpcms/modules/admin/templates/linkage_sub_add.tpl.php
PHP
asf20
1,502
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header'); ?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}}); $("#name").formValidator({onshow:"<?php echo L('input').L('release_point_name')?>",onfocus:"<?php echo L('input').L('release_point_name')?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('release_point_name')?>"}).ajaxValidator({type : "get",url : "",data :"m=admin&c=release_point&a=public_name&id=<?php echo $id?>",datatype : "html",async:'false',success : function(data){ if( data == "1" ){return true;}else{return false;}},buttons: $("#dosubmit"),onerror : "<?php echo L('release_point_name').L('exists')?>",onwait : "<?php echo L('connecting')?>"}).defaultPassed(); $("#host").formValidator({onshow:"<?php echo L('input').L('server_address')?>",onfocus:"<?php echo L('input').L('server_address')?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('server_address')?>"}); $("#port").formValidator({onshow:"<?php echo L('input').L('server_port')?>",onfocus:"<?php echo L('input').L('server_port')?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('server_port')?>"}).regexValidator({datatype:'enum',regexp:'intege1',onerror:'<?php echo L('server_ports_must_be_integers')?>'}); $("#username").formValidator({onshow:"<?php echo L('input').L('username')?>",onfocus:"<?php echo L('input').L('username')?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('username')?>"}); $("#password").formValidator({onshow:"<?php echo L('input').L('password')?>",onfocus:"<?php echo L('input').L('password')?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('password')?>"}); }) //--> </script> <div class="pad-10"> <form action="?m=admin&c=release_point&a=edit&id=<?php echo $id?>" method="post" id="myform"> <fieldset> <legend><?php echo L('basic_configuration')?></legend> <table width="100%" class="table_form"> <tr> <th width="80"><?php echo L('release_point_name')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="name" id="name" size="30" value="<?php echo $data['name']?>" /></td> </tr> </table> </fieldset> <div class="bk15"></div> <fieldset> <legend><?php echo L('ftp_server')?></legend> <table width="100%" class="table_form"> <tr> <th width="80"><?php echo L('server_address')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="host" id="host" size="30" value="<?php echo $data['host']?>" /></td> </tr> <tr> <th width="80"><?php echo L("server_port")?>:</th> <td class="y-bg"><input type="text" class="input-text" name="port" id="port" size="30" value="<?php echo $data['port']?>" /></td> </tr> <tr> <th><?php echo L('username')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="username" id="username" size="30" value="<?php echo $data['username']?>" /></td> </tr> <tr> <th><?php echo L('password')?>:</th> <td class="y-bg"><input type="password" class="input-text" name="password" id="password" size="30" value="<?php echo $data['password']?> "/></td> </tr> <tr> <th><?php echo L('path')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="path" id="path" size="30" value="<?php echo $data['path']?>" /></td> </tr> <tr> <th><?php echo L('passive_mode')?>:</th> <td class="y-bg"><label><input type="checkbox" class="inputcheckbox" name="pasv" id="pasv" value="1" size="30"<?php if ($data['pasv']){echo ' checked';}?> /><?php echo L('yes')?></label></td> </tr> <tr> <th><?php echo L('ssl_connection')?>:</th> <td class="y-bg"><label><input type="checkbox" class="inputcheckbox" name="ssl" id="ssl" value="1" size="30"<?php if ($data['ssl']){echo ' checked';}?> <?php if(!$this->ssl){ echo 'disabled';}?> /><?php echo L('yes')?></label> <?php if(!$this->ssl){ echo '<span style="color:red">'.L('your_server_will_not_support_the_ssl_connection').'</a>';}?></td> </tr> </tr> <tr> <th><?php echo L('test_connections')?>:</th> <td class="y-bg"><input type="button" class="button" onclick="ftp_test()" value="<?php echo L('test_connections')?>" /></td> </tr> </table> </fieldset> <div class="bk15"></div> <input type="submit" class="dialog" id="dosubmit" name="dosubmit" value="<?php echo L('submit')?>" /> </div> </div> <script type="text/javascript"> <!-- function ftp_test() { if(!$.formValidator.isOneValid('host')) { $('#host').focus(); return false; } if(!$.formValidator.isOneValid('port')) { $('#port').focus(); return false; } if(!$.formValidator.isOneValid('username')) { $('#username').focus();return false; } if(!$.formValidator.isOneValid('password')) { $('#password').focus();return false; } var host = $('#host').val(); var port = $('#port').val(); var username = $('#username').val(); var password = $('#password').val(); var pasv = $("input[type='checkbox'][name='pasv']:checked").val(); var ssl = $("input[type='checkbox'][name='ssl']:checked").val(); $.get("?",{m:'admin',c:'release_point',a:'public_test_ftp', host:host,port:port,username:username,password:password,pasv:pasv,ssl:ssl}, function(data){ if (data==1){ alert('<?php echo L('ftp_server_connections_success')?>'); } else { alert(data); } }) } //--> </script> </form> </body> </html>
108wo
phpcms/modules/admin/templates/release_point_edit.tpl.php
PHP
asf20
5,639
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header'); ?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}}); $("#file").formValidator({onshow:"<?php echo L('input').L('urlrule_file')?>",onfocus:"<?php echo L('input').L('urlrule_file')?>"}).regexValidator({regexp:"^([a-zA-Z0-9]|[_]){0,20}$",onerror:"<?php echo L('enter_the_correct_catname');?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('urlrule_file')?>"}); $("#example").formValidator({onshow:"<?php echo L('input').L('urlrule_example')?>",onfocus:"<?php echo L('input').L('urlrule_example')?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('urlrule_example')?>"}); $("#urlrule").formValidator({onshow:"<?php echo L('input').L('urlrule_url')?>",onfocus:"<?php echo L('input').L('urlrule_url')?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('urlrule_url')?>"}); }) //--> </script> <style type="text/css"> .input-botton { border:none; border-bottom:1px dotted #E1A035; background:none; } </style> <div class="pad_10"> <table width="100%" cellpadding="2" cellspacing="1" class="table_form"> <form action="?m=admin&c=urlrule&a=add" method="post" name="myform" id="myform"> <tr> <th width="20%"><?php echo L('urlrule_file')?> :</th> <td><input type="text" name="info[file]" id="file" size="20"></td> </tr> <tr> <th width="20%"><?php echo L('urlrule_module')?> :</th> <td><?php echo form::select($modules,'content',"name='info[module]' id='module'");?></td> </tr> <tr> <th width="20%"><?php echo L('urlrule_ishtml')?> :</th> <td> <input type="radio" value="1" name="info[ishtml]" /><?php echo L('yes');?> <input type="radio" value="0" name="info[ishtml]" checked="checked" /><?php echo L('no');?> </td> </tr> <tr> <th width="20%"><?php echo L('urlrule_example')?> :</th> <td><input type="text" name="info[example]" id="example" size="70"></td> </tr> <tr> <th width="20%"><?php echo L('urlrule_url')?> :</th> <td><input type="text" name="info[urlrule]" id="urlrule" size="70"> </td> </tr> <tr> <th width="20%"><?php echo L('urlrule_func')?> :</th> <td><?php echo L('complete_part_path');?>: <input type="text" name="f1" value="{$categorydir}" size="15" class="input-botton">,<?php echo L('category_path');?>:<input type="text" name="f1" value="{$catdir}" size="10" class="input-botton"> <div class="bk6"></div> <?php echo L('year');?>:<input type="text" name="f1" value="{$year}" size="7" class="input-botton"> <?php echo L('month');?>:<input type="text" name="f1" value="{$month}" size="9" class="input-botton">,<?php echo L('day');?>:<input type="text" name="f1" value="{$day}" size="7" class="input-botton"> ID:<input type="text" name="f1" value="{$id}" size="4" class="input-botton">, <?php echo L('paging');?>:<input type="text" name="f1" value="{$page}" size="7" class="input-botton"> </td> </tr> <input type="submit" name="dosubmit" id="dosubmit" class="dialog" value=" <?php echo L('submit')?> "> </form> </table> </div> </body> </html>
108wo
phpcms/modules/admin/templates/urlrule_add.tpl.php
PHP
asf20
3,406
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header'); ?> <form action="?m=admin&c=role&a=setting_cat_priv&roleid=<?php echo $roleid?>&siteid=<?php echo $siteid?>&op=2" method="post"> <div class="table-list" id="load_priv"> <table width="100%" class="table-list"> <thead> <tr> <th width="25"><?php echo L('select_all')?></th><th align="left"><?php echo L('title_varchar')?></th><th width="25"><?php echo L('view')?></th><th width="25"><?php echo L('add')?></th><th width="25"><?php echo L('edit')?></th><th width="25"><?php echo L('delete')?></th><th width="25"><?php echo L('sort')?></th><th width="25"><?php echo L('push')?></th><th width="25"><?php echo L('move')?></th> </tr> </thead> <tbody> <?php echo $categorys?> </tbody> </table> <div class="btn"> <input type="submit" value="<?php echo L('submit')?>" class="button"> </div> </div> </form> <script type="text/javascript"> <!-- function select_all(name, obj) { if (obj.checked) { $("input[type='checkbox'][name='priv["+name+"][]']").attr('checked', 'checked'); } else { $("input[type='checkbox'][name='priv["+name+"][]']").attr('checked', ''); } } //--> </script> </body> </html>
108wo
phpcms/modules/admin/templates/role_cat_priv_list.tpl.php
PHP
asf20
1,264
<?php defined('IN_ADMIN') or exit('No permission resources.'); include PC_PATH.'modules'.DIRECTORY_SEPARATOR.'admin'.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR.'header.tpl.php'; ?> <div id="main_frameid" class="pad-10 display" style="_margin-right:-12px;_width:98.9%;"> <script type="text/javascript"> $(function(){if ($.browser.msie && parseInt($.browser.version) < 7) $('#browserVersionAlert').show();}); </script> <div class="explain-col mb10" style="display:none" id="browserVersionAlert"> <?php echo L('ie8_tip')?></div> <div class="col-2 lf mr10" style="width:48%"> <h6><?php echo L('personal_information')?></h6> <div class="content"> <?php echo L('main_hello')?><?php echo $admin_username?><br /> <?php echo L('main_role')?><?php echo $rolename?> <br /> <div class="bk20 hr"><hr /></div> <?php echo L('main_last_logintime')?><?php echo date('Y-m-d H:i:s',$logintime)?><br /> <?php echo L('main_last_loginip')?><?php echo $loginip?> <br /> </div> </div> <div class="col-2 col-auto"> <h6><?php echo L('main_safety_tips')?></h6> <div class="content" style="color:#ff0000;"> <?php if($pc_writeable) {?> <?php echo L('main_safety_permissions')?><br /> <?php } ?> <?php if(pc_base::load_config('system','debug')) {?> <?php echo L('main_safety_debug')?><br /> <?php } ?> <?php if(!pc_base::load_config('system','errorlog')) {?> <?php echo L('main_safety_errlog')?><br /> <?php } ?> <div class="bk20 hr"><hr /></div> <?php if(pc_base::load_config('system','execution_sql')) {?> <?php echo L('main_safety_sql')?> <br /> <?php } ?> <?php if($logsize_warning) {?> <?php echo L('main_safety_log',array('size'=>$common_cache['errorlog_size'].'MB'))?> <br /> <?php } ?> </div> </div> <div class="bk10"></div> <div class="col-2 lf mr10" style="width:48%"> <?php $ccache = getcache('category_content_1','commons'); if(module_exists('member') && is_array($ccache)) { ?> <h6><?php echo L('main_shortcut')?></h6> <div class="content" id="admin_panel"> <?php foreach($adminpanel as $v) {?> <span> [<a target="right" href="<?php echo $v['url'].'&menuid='.$v['menuid'];?>&pc_hash=<?php echo $_SESSION['pc_hash'];?>"><?php echo L($v['name'])?></a>] </span> <?php }?> </div> <?php } else { ?> <h6>Update Caches</h6> <div class="content" id="update_tips" style="height:90px; overflow:auto;"><ul id="file" class="sbul"> <div class="pad-10"> <form action="?m=admin&c=cache_all&a=init&pc_hash=<?php echo $_SESSION['pc_hash'];?>" target="cache_if" method="post" id="myform" name="myform"> <input type="hidden" name="dosubmit" value="1"> </form> <iframe id="cache_if" name="cache_if" class="ifm" width="0" height="0"></iframe> </div> <script type="text/javascript"> document.myform.submit(); function addtext(data) { $('#file').append(data); document.getElementById('update_tips').scrollTop = document.getElementById('update_tips').scrollHeight; } </script> </div> <?php }?> </div> <div class="col-2 col-auto"> <h6><?php echo L('main_sysinfo')?></h6> <div class="content"> <?php echo L('main_version')?>Phpcms <?php echo PC_VERSION?> Release <?php echo PC_RELEASE?> [<a href="http://download.phpcms.cn" target="_blank"><?php echo L('main_latest_version')?></a>]<br /> <?php echo L('main_os')?><?php echo $sysinfo['os']?> <br /> <?php echo L('main_web_server')?><?php echo $sysinfo['web_server']?> <br /> <?php echo L('main_sql_version')?><?php echo $sysinfo['mysqlv']?><br /> <?php echo L('main_upload_limit')?><?php echo $sysinfo['fileupload']?><br /> </div> </div> <div class="bk10"></div> <div class="col-2 lf mr10" style="width:48%"> <h6><?php echo L('main_product_team')?></h6> <div class="content"> <?php echo L('main_copyright')?><?php echo $product_copyright?><br /> <?php echo L('main_product_planning')?><?php echo $architecture?><br /> <?php echo L('main_product_dev')?><?php echo $programmer;?><br /> <?php echo L('main_product_ui')?><?php echo $designer;?><br /> <?php echo L('main_product_site')?><a href="http://www.phpcms.cn/" target="_blank">http://www.phpcms.cn/</a> <br /> <?php echo L('main_product_bbs')?><a href="http://bbs.phpcms.cn/" target="_blank">http://bbs.phpcms.cn/</a> </div> </div> <div class="col-2 col-auto"> <h6><?php echo L('main_license')?></h6> <div class="content"> <?php echo L('main_version')?>Phpcms <?php echo PC_VERSION?> Release <?php echo PC_RELEASE?> [<a href="http://buy.phpcms.cn" target="_blank"><?php echo L('main_support')?></a>]<br /> <?php echo L('main_license_type')?><span id="phpcms_license"></span> <br /> <?php echo L('main_serial_number')?><span id="phpcms_sn"></span> <br /> </div> </div> <div class="bk10"></div> </div> </body></html>
108wo
phpcms/modules/admin/templates/main.tpl.php
PHP
asf20
4,764
<?php defined('IN_ADMIN') or exit('No permission resources.'); $show_dialog = 1; include $this->admin_tpl('header','admin'); ?> <div class="pad-lr-10"> <form name="searchform" action="?m=admin&c=log&a=search_log&menuid=<?php echo $_GET['menuid'];?>" method="get" > <input type="hidden" value="admin" name="m"> <input type="hidden" value="log" name="c"> <input type="hidden" value="search_log" name="a"> <table width="100%" cellspacing="0" class="search-form"> <tbody> <tr> <td><div class="explain-col"><?php echo L('module')?>: <?php echo form::select($module_arr,'','name="search[module]"',$default)?> 用户名: <input type="text" value=<?php echo $_GET['search']['username'];?> class="input-text" name="search[username]" size='10'> 时 间: <?php echo form::date('search[start_time]',$_GET['search']['start_time'],'1')?> 至 <?php echo form::date('search[end_time]',$_GET['search']['end_time'],'1')?> <input type="submit" value="确定搜索" class="button" name="dosubmit"> </div> </td> </tr> </tbody> </table> </form> <form name="myform" id="myform" action="?m=admin&c=log&a=delete" method="post" onsubmit="checkuid();return false;"> <div class="table-list"> <table width="100%" cellspacing="0"> <thead> <tr> <th width="35" align="center"><input type="checkbox" value="" id="check_box" onclick="selectall('logid[]');"></th> <th width="80"><?php echo L('username')?></th> <th ><?php echo L('module')?></th> <th ><?php echo L('file')?></th> <th width="120"><?php echo L('time')?></th> <th width="120">IP</th> </tr> </thead> <tbody> <?php if(is_array($infos)){ foreach($infos as $info){ ?> <tr> <td align="center"> <input type="checkbox" name="logid[]" value="<?php echo $info['logid']?>"> </td> <td align="center"><?php echo $info['username']?></td> <td align="center"><?php echo $info['module']?></td> <td align="left" title="<?php echo $info['querystring']?>"><?php echo str_cut($info['querystring'], 40);?></td> <td align="center"><?php echo $info['time'];//echo $info['lastusetime'] ? date('Y-m-d H:i', $info['lastusetime']):''?></td> <td align="center"><?php echo $info['ip']?> </td> </tr> <?php } } ?></tbody> </table> <div class="btn"> </div> <div id="pages"><?php echo $pages?></div> </div> </form></div> </body> </html> <script type="text/javascript"> function checkuid() { var ids=''; $("input[name='logid[]']:checked").each(function(i, n){ ids += $(n).val() + ','; }); if(ids=='') { window.top.art.dialog({content:'<?php echo L('select_operations')?>',lock:true,width:'200',height:'50',time:1.5},function(){}); return false; } else { myform.submit(); } } </script>
108wo
phpcms/modules/admin/templates/log_search_list.tpl.php
PHP
asf20
2,884
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header');?> <div class="table-list pad-lr-10"> <form name="myform" action="?m=admin&c=role&a=listorder" method="post"> <table width="100%" cellspacing="0"> <thead> <tr> <th width="10%"><?php echo L('listorder');?></th> <th width="10%">ID</th> <th width="15%" align="left" ><?php echo L('role_name');?></th> <th width="265" align="left" ><?php echo L('role_desc');?></th> <th width="5%" align="left" ><?php echo L('role_status');?></th> <th class="text-c"><?php echo L('role_operation');?></th> </tr> </thead> <tbody> <?php if(is_array($infos)){ foreach($infos as $info){ ?> <tr> <td width="10%" align="center"><input name='listorders[<?php echo $info['roleid']?>]' type='text' size='3' value='<?php echo $info['listorder']?>' class="input-text-c"></td> <td width="10%" align="center"><?php echo $info['roleid']?></td> <td width="15%" ><?php echo $info['rolename']?></td> <td width="265" ><?php echo $info['description']?></td> <td width="5%"><a href="?m=admin&c=role&a=change_status&roleid=<?php echo $info['roleid']?>&disabled=<?php echo ($info['disabled']==1 ? 0 : 1)?>"><?php echo $info['disabled']? L('icon_locked'):L('icon_unlock')?></a></td> <td class="text-c"> <?php if($info['roleid'] > 1) {?> <a href="javascript:setting_role(<?php echo $info['roleid']?>, '<?php echo new_addslashes($info['rolename'])?>')"><?php echo L('role_setting');?></a> | <a href="javascript:void(0)" onclick="setting_cat_priv(<?php echo $info['roleid']?>, '<?php echo new_addslashes($info['rolename'])?>')"><?php echo L('usersandmenus')?></a> | <?php } else {?> <font color="#cccccc"><?php echo L('role_setting');?></font> | <font color="#cccccc"><?php echo L('usersandmenus')?></font> | <?php }?> <a href="?m=admin&c=role&a=member_manage&roleid=<?php echo $info['roleid']?>&menuid=<?php echo $_GET['menuid']?>"><?php echo L('role_member_manage');?></a> | <?php if($info['roleid'] > 1) {?><a href="?m=admin&c=role&a=edit&roleid=<?php echo $info['roleid']?>&menuid=<?php echo $_GET['menuid']?>"><?php echo L('edit')?></a> | <a href="javascript:confirmurl('?m=admin&c=role&a=delete&roleid=<?php echo $info['roleid']?>', '<?php echo L('posid_del_cofirm')?>')"><?php echo L('delete')?></a> <?php } else {?> <font color="#cccccc"><?php echo L('edit')?></font> | <font color="#cccccc"><?php echo L('delete')?></font> <?php }?> </td> </tr> <?php } } ?> </tbody> </table> <div class="btn"><input type="submit" class="button" name="dosubmit" value="<?php echo L('listorder')?>" /></div> </form> </div> </body> <script type="text/javascript"> <!-- function setting_role(id, name) { window.top.art.dialog({title:'<?php echo L('sys_setting')?>《'+name+'》',id:'edit',iframe:'?m=admin&c=role&a=priv_setting&roleid='+id,width:'700',height:'500'}); } function setting_cat_priv(id, name) { window.top.art.dialog({title:'<?php echo L('usersandmenus')?>《'+name+'》',id:'edit',iframe:'?m=admin&c=role&a=setting_cat_priv&roleid='+id,width:'700',height:'500'}); } //--> </script> </html>
108wo
phpcms/modules/admin/templates/role_list.tpl.php
PHP
asf20
3,161
<?php defined('IN_ADMIN') or exit('No permission resources.'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"<?php if(isset($addbg)) { ?> class="addbg"<?php } ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET?>" /> <meta http-equiv="X-UA-Compatible" content="IE=7" /> <title><?php echo L('website_manage');?></title> <link href="<?php echo CSS_PATH?>reset.css" rel="stylesheet" type="text/css" /> <link href="<?php echo CSS_PATH.SYS_STYLE;?>-system.css" rel="stylesheet" type="text/css" /> <link href="<?php echo CSS_PATH?>table_form.css" rel="stylesheet" type="text/css" /> <?php if(isset($show_dialog)) { ?> <link href="<?php echo CSS_PATH?>dialog.css" rel="stylesheet" type="text/css" /> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>dialog.js"></script> <?php } ?> <link rel="stylesheet" type="text/css" href="<?php echo CSS_PATH?>style/<?php echo SYS_STYLE;?>-styles1.css" title="styles1" media="screen" /> <link rel="alternate stylesheet" type="text/css" href="<?php echo CSS_PATH?>style/<?php echo SYS_STYLE;?>-styles2.css" title="styles2" media="screen" /> <link rel="alternate stylesheet" type="text/css" href="<?php echo CSS_PATH?>style/<?php echo SYS_STYLE;?>-styles3.css" title="styles3" media="screen" /> <link rel="alternate stylesheet" type="text/css" href="<?php echo CSS_PATH?>style/<?php echo SYS_STYLE;?>-styles4.css" title="styles4" media="screen" /> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>jquery.min.js"></script> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>admin_common.js"></script> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>styleswitch.js"></script> <?php if(isset($show_validator)) { ?> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>formvalidator.js" charset="UTF-8"></script> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>formvalidatorregex.js" charset="UTF-8"></script> <?php } ?> <script type="text/javascript"> window.focus(); var pc_hash = '<?php echo $_SESSION['pc_hash'];?>'; <?php if(!isset($show_pc_hash)) { ?> window.onload = function(){ var html_a = document.getElementsByTagName('a'); var num = html_a.length; for(var i=0;i<num;i++) { var href = html_a[i].href; if(href && href.indexOf('javascript:') == -1) { if(href.indexOf('?') != -1) { html_a[i].href = href+'&pc_hash='+pc_hash; } else { html_a[i].href = href+'?pc_hash='+pc_hash; } } } var html_form = document.forms; var num = html_form.length; for(var i=0;i<num;i++) { var newNode = document.createElement("input"); newNode.name = 'pc_hash'; newNode.type = 'hidden'; newNode.value = pc_hash; html_form[i].appendChild(newNode); } } <?php } ?> </script> </head> <body> <?php if(!isset($show_header)) { ?> <div class="subnav"> <div class="content-menu ib-a blue line-x"> <?php if(isset($big_menu)) { echo '<a class="add fb" href="'.$big_menu[0].'"><em>'.$big_menu[1].'</em></a> ';} else {$big_menu = '';} ?> <?php echo admin::submenu($_GET['menuid'],$big_menu); ?> </div> </div> <?php } ?> <style type="text/css"> html{_overflow-y:scroll} </style>
108wo
phpcms/modules/admin/templates/header.tpl.php
PHP
asf20
3,468
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header'); ?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}}); $("#name").formValidator({onshow:"<?php echo L('input').L('posid_name')?>",onfocus:"<?php echo L('posid_name').L('not_empty')?>"}).inputValidator({min:1,max:999,onerror:"<?php echo L('posid_name').L('not_empty')?>"}); $("#maxnum").formValidator({onshow:"<?php echo L('input').L('maxnum')?>",onfocus:"<?php echo L('maxnum').L('not_empty')?>"}).inputValidator({min:1,onerror:"<?php echo L('maxnum').L('not_empty')?>"}).regexValidator({datatype:'enum',regexp:'intege1',onerror:'<?php echo L('maxnum').L('not_empty')?>'}).defaultPassed();; }) //--> </script> <div class="pad_10"> <div class="common-form"> <form name="myform" action="?m=admin&c=position&a=add" method="post" id="myform"> <table width="100%" class="table_form contentWrap"> <tr> <td width="80"><?php echo L('posid_name')?></td> <td><input type="text" name="info[name]" value="<?php echo $info[name]?>" class="input-text" id="name"></input></td> </tr> <tr> <td><?php echo L('posid_modelid')?></td> <td><?php echo form::select($modelinfo,'','name="info[modelid]" onchange="category_load(this);"',L('posid_select_model'));?> </tr> <tr> <td><?php echo L('posid_catid')?></td> <td id="load_catid"></td> </tr> <tr> <td><?php echo L('listorder')?></td> <td><input type="text" name="info[listorder]" id="listorder" class="input-text" size="5" value=""></input></td> </tr> <tr> <td><?php echo L('maxnum')?></td> <td><input type="text" name="info[maxnum]" id="maxnum" class="input-text" size="5" value="20"></input><?php echo L('posid_num')?></td> </tr> <tr> <td><?php echo L('extention_name')?></td> <td><input type="text" name="info[extention]" id="extention" class="input-text" size="20" value=""></input></td> </tr> </table> <div class="bk15"></div> <input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="dialog" id="dosubmit"> </form> <div class="explain-col"> <?php echo L('position_tips')?><br/> <?php echo L('extention_name_tips')?> </div> </div></div> </body> </html> <script type="text/javascript"> function category_load(obj) { var modelid = $(obj).attr('value'); $.get('?m=admin&c=position&a=public_category_load&modelid='+modelid,function(data){ $('#load_catid').html(data); }); } </script>
108wo
phpcms/modules/admin/templates/position_add.tpl.php
PHP
asf20
2,522
<?php defined('IN_ADMIN') or exit('No permission resources.'); $show_validator = true;include $this->admin_tpl('header');?> <script type="text/javascript"> $(document).ready(function() { $.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}}); $("#realname").formValidator({onshow:"<?php echo L('input').L('realname')?>",onfocus:"<?php echo L('realname').L('between_2_to_20')?>"}).inputValidator({min:2,max:20,onerror:"<?php echo L('realname').L('between_2_to_20')?>"}) $("#email").formValidator({onshow:"<?php echo L('input').L('email')?>",onfocus:"<?php echo L('input').L('email')?>",oncorrect:"<?php echo L('email').L('format_right')?>"}).regexValidator({regexp:"email",datatype:"enum",onerror:"<?php echo L('email').L('format_incorrect')?>"}).ajaxValidator({ type : "get", url : "", data :"m=admin&c=admin_manage&a=public_email_ajx", datatype : "html", async:'false', success : function(data){ if( data == "1" ) { return true; } else { return false; } }, buttons: $("#dosubmit"), onerror : "<?php echo L('email_already_exists')?>", onwait : "<?php echo L('connecting_please_wait')?>" }).defaultPassed(); }) </script> <div class="pad_10"> <div class="common-form"> <form name="myform" action="?m=admin&c=admin_manage&a=public_edit_info" method="post" id="myform"> <input type="hidden" name="info[userid]" value="<?php echo $userid?>"></input> <input type="hidden" name="info[username]" value="<?php echo $username?>"></input> <table width="100%" class="table_form contentWrap"> <tr> <td width="80"><?php echo L('username')?></td> <td><?php echo $username?></td> </tr> <tr> <td width="80"><?php echo L('lastlogintime')?></td> <td><?php echo $lastlogintime ? date('Y-m-d H:i:s',$lastlogintime) : ''?></td> </tr> <tr> <td width="80"><?php echo L('lastloginip')?></td> <td><?php echo $lastloginip?></td> </tr> <tr> <td><?php echo L('realname')?></td> <td> <input type="text" name="info[realname]" id="realname" class="input-text" size="30" value="<?php echo $realname?>"></input> </td> </tr> <tr> <td><?php echo L('email')?></td> <td> <input type="text" name="info[email]" id="email" class="input-text" size="40" value="<?php echo $email?>"></input> </td> </tr> <tr> <td>Language</td> <td> <select name="info[lang]" > <?php if(in_array('af',$dir_array)) { ?><option value="af" <?php if($lang=='af') echo 'selected="selected"';?>>Afrikaans</option><?php }?> <?php if(in_array('sq',$dir_array)) { ?><option value="sq" <?php if($lang=='sq') echo 'selected="selected"';?>>Shqip - Albanian</option><?php }?> <?php if(in_array('ar',$dir_array)) { ?><option value="ar" <?php if($lang=='ar') echo 'selected="selected"';?>>&#1575;&#1604;&#1593;&#1585;&#1576;&#1610;&#1577; - Arabic</option><?php }?> <?php if(in_array('az',$dir_array)) { ?><option value="az" <?php if($lang=='az') echo 'selected="selected"';?>>Az&#601;rbaycanca - Azerbaijani</option><?php }?> <?php if(in_array('bn',$dir_array)) { ?><option value="bn" <?php if($lang=='bn') echo 'selected="selected"';?>>Bangla</option><?php }?> <?php if(in_array('eu',$dir_array)) { ?><option value="eu" <?php if($lang=='eu') echo 'selected="selected"';?>>Euskara - Basque</option><?php }?> <?php if(in_array('becyr',$dir_array)) { ?><option value="becyr" <?php if($lang=='becyr') echo 'selected="selected"';?>>&#1041;&#1077;&#1083;&#1072;&#1088;&#1091;&#1089;&#1082;&#1072;&#1103; - Belarusian</option><?php }?> <?php if(in_array('belat',$dir_array)) { ?><option value="belat" <?php if($lang=='belat') echo 'selected="selected"';?>>Bie&#0322;aruskaja - Belarusian latin</option><?php }?> <?php if(in_array('bs',$dir_array)) { ?><option value="bs" <?php if($lang=='bs') echo 'selected="selected"';?>>Bosanski - Bosnian</option><?php }?> <?php if(in_array('ptbr',$dir_array)) { ?><option value="ptbr" <?php if($lang=='ptbr') echo 'selected="selected"';?>>Portugu&ecirc;s - Brazilian portuguese</option><?php }?> <?php if(in_array('bg',$dir_array)) { ?><option value="bg" <?php if($lang=='bg') echo 'selected="selected"';?>>&#1041;&#1098;&#1083;&#1075;&#1072;&#1088;&#1089;&#1082;&#1080; - Bulgarian</option><?php }?> <?php if(in_array('ca',$dir_array)) { ?><option value="ca" <?php if($lang=='ca') echo 'selected="selected"';?>>Catal&agrave; - Catalan</option><?php }?> <?php if(in_array('zh-cn',$dir_array)) { ?><option value="zh-cn" <?php if($lang=='zh-cn') echo 'selected="selected"';?>>&#20013;&#25991; - Chinese simplified</option><?php }?> <?php if(in_array('zhtw',$dir_array)) { ?><option value="zhtw" <?php if($lang=='zhtw') echo 'selected="selected"';?>>&#20013;&#25991; - Chinese traditional</option><?php }?> <?php if(in_array('hr',$dir_array)) { ?><option value="hr" <?php if($lang=='hr') echo 'selected="selected"';?>>Hrvatski - Croatian</option><?php }?> <?php if(in_array('cs',$dir_array)) { ?><option value="cs" <?php if($lang=='cs') echo 'selected="selected"';?>>&#268;esky - Czech</option><?php }?> <?php if(in_array('da',$dir_array)) { ?><option value="da" <?php if($lang=='da') echo 'selected="selected"';?>>Dansk - Danish</option><?php }?> <?php if(in_array('nl',$dir_array)) { ?><option value="nl" <?php if($lang=='nl') echo 'selected="selected"';?>>Nederlands - Dutch</option><?php }?> <?php if(in_array('en',$dir_array)) { ?><option value="en" <?php if($lang=='en') echo 'selected="selected"';?>>English</option><?php }?> <?php if(in_array('et',$dir_array)) { ?><option value="et" <?php if($lang=='et') echo 'selected="selected"';?>>Eesti - Estonian</option><?php }?> <?php if(in_array('fi',$dir_array)) { ?><option value="fi" <?php if($lang=='fi') echo 'selected="selected"';?>>Suomi - Finnish</option><?php }?> <?php if(in_array('fr',$dir_array)) { ?><option value="fr" <?php if($lang=='fr') echo 'selected="selected"';?>>Fran&ccedil;ais - French</option><?php }?> <?php if(in_array('gl',$dir_array)) { ?><option value="gl" <?php if($lang=='gl') echo 'selected="selected"';?>>Galego - Galician</option><?php }?> <?php if(in_array('ka',$dir_array)) { ?><option value="ka" <?php if($lang=='ka') echo 'selected="selected"';?>>&#4325;&#4304;&#4320;&#4311;&#4323;&#4314;&#4312; - Georgian</option><?php }?> <?php if(in_array('de',$dir_array)) { ?><option value="de" <?php if($lang=='de') echo 'selected="selected"';?>>Deutsch - German</option><?php }?> <?php if(in_array('el',$dir_array)) { ?><option value="el" <?php if($lang=='el') echo 'selected="selected"';?>>&Epsilon;&lambda;&lambda;&eta;&nu;&iota;&kappa;&#940; - Greek</option><?php }?> <?php if(in_array('he',$dir_array)) { ?><option value="he" <?php if($lang=='he') echo 'selected="selected"';?>>&#1506;&#1489;&#1512;&#1497;&#1514; - Hebrew</option><?php }?> <?php if(in_array('hi',$dir_array)) { ?><option value="hi" <?php if($lang=='hi') echo 'selected="selected"';?>>&#2361;&#2367;&#2344;&#2381;&#2342;&#2368; - Hindi</option><?php }?> <?php if(in_array('hu',$dir_array)) { ?><option value="hu" <?php if($lang=='hu') echo 'selected="selected"';?>>Magyar - Hungarian</option><?php }?> <?php if(in_array('id',$dir_array)) { ?><option value="id" <?php if($lang=='id') echo 'selected="selected"';?>>Bahasa Indonesia - Indonesian</option><?php }?> <?php if(in_array('it',$dir_array)) { ?><option value="it" <?php if($lang=='it') echo 'selected="selected"';?>>Italiano - Italian</option><?php }?> <?php if(in_array('ja',$dir_array)) { ?><option value="ja" <?php if($lang=='ja') echo 'selected="selected"';?>>&#26085;&#26412;&#35486; - Japanese</option><?php }?> <?php if(in_array('ko',$dir_array)) { ?><option value="ko" <?php if($lang=='ko') echo 'selected="selected"';?>>&#54620;&#44397;&#50612; - Korean</option><?php }?> <?php if(in_array('lv',$dir_array)) { ?><option value="lv" <?php if($lang=='lv') echo 'selected="selected"';?>>Latvie&scaron;u - Latvian</option><?php }?> <?php if(in_array('lt',$dir_array)) { ?><option value="lt" <?php if($lang=='lt') echo 'selected="selected"';?>>Lietuvi&#371; - Lithuanian</option><?php }?> <?php if(in_array('mkcyr',$dir_array)) { ?><option value="mkcyr" <?php if($lang=='mkcyr') echo 'selected="selected"';?>>Macedonian - Macedonian</option><?php }?> <?php if(in_array('ms',$dir_array)) { ?><option value="ms" <?php if($lang=='ms') echo 'selected="selected"';?>>Bahasa Melayu - Malay</option><?php }?> <?php if(in_array('mn',$dir_array)) { ?><option value="mn" <?php if($lang=='mn') echo 'selected="selected"';?>>&#1052;&#1086;&#1085;&#1075;&#1086;&#1083; - Mongolian</option><?php }?> <?php if(in_array('no',$dir_array)) { ?><option value="no" <?php if($lang=='no') echo 'selected="selected"';?>>Norsk - Norwegian</option><?php }?> <?php if(in_array('fa',$dir_array)) { ?><option value="fa" <?php if($lang=='fa') echo 'selected="selected"';?>>&#1601;&#1575;&#1585;&#1587;&#1740; - Persian</option><?php }?> <?php if(in_array('pl',$dir_array)) { ?><option value="pl" <?php if($lang=='pl') echo 'selected="selected"';?>>Polski - Polish</option><?php }?> <?php if(in_array('pt',$dir_array)) { ?><option value="pt" <?php if($lang=='pt') echo 'selected="selected"';?>>Portugu&ecirc;s - Portuguese</option><?php }?> <?php if(in_array('ro',$dir_array)) { ?><option value="ro" <?php if($lang=='ro') echo 'selected="selected"';?>>Rom&acirc;n&#259; - Romanian</option><?php }?> <?php if(in_array('ru',$dir_array)) { ?><option value="ru" <?php if($lang=='ru') echo 'selected="selected"';?>>&#1056;&#1091;&#1089;&#1089;&#1082;&#1080;&#1081; - Russian</option><?php }?> <?php if(in_array('srcyr',$dir_array)) { ?><option value="srcyr" <?php if($lang=='srcyr') echo 'selected="selected"';?>>&#1057;&#1088;&#1087;&#1089;&#1082;&#1080; - Serbian</option><?php }?> <?php if(in_array('srlat',$dir_array)) { ?><option value="srlat" <?php if($lang=='srlat') echo 'selected="selected"';?>>Srpski - Serbian latin</option><?php }?> <?php if(in_array('si',$dir_array)) { ?><option value="si" <?php if($lang=='si') echo 'selected="selected"';?>>&#3523;&#3538;&#3458;&#3524;&#3517; - Sinhala</option><?php }?> <?php if(in_array('af',$dir_array)) { ?><option value="sk" <?php if($lang=='sk') echo 'selected="selected"';?>>Sloven&#269;ina - Slovak</option><?php }?> <?php if(in_array('sl',$dir_array)) { ?><option value="sl" <?php if($lang=='sl') echo 'selected="selected"';?>>Sloven&scaron;&#269;ina - Slovenian</option><?php }?> <?php if(in_array('es',$dir_array)) { ?><option value="es" <?php if($lang=='es') echo 'selected="selected"';?>>Espa&ntilde;ol - Spanish</option><?php }?> <?php if(in_array('sv',$dir_array)) { ?><option value="sv" <?php if($lang=='sv') echo 'selected="selected"';?>>Svenska - Swedish</option><?php }?> <?php if(in_array('tt',$dir_array)) { ?><option value="tt" <?php if($lang=='tt') echo 'selected="selected"';?>>Tatar&ccedil;a - Tatarish</option><?php }?> <?php if(in_array('th',$dir_array)) { ?><option value="th" <?php if($lang=='th') echo 'selected="selected"';?>>&#3616;&#3634;&#3625;&#3634;&#3652;&#3607;&#3618; - Thai</option><?php }?> <?php if(in_array('tr',$dir_array)) { ?><option value="tr" <?php if($lang=='tr') echo 'selected="selected"';?>>T&uuml;rk&ccedil;e - Turkish</option><?php }?> <?php if(in_array('uk',$dir_array)) { ?><option value="uk" <?php if($lang=='uk') echo 'selected="selected"';?>>&#1059;&#1082;&#1088;&#1072;&#1111;&#1085;&#1089;&#1100;&#1082;&#1072; - Ukrainian</option><?php }?> <?php if(in_array('uzcyr',$dir_array)) { ?><option value="uzcyr" <?php if($lang=='uzcyr') echo 'selected="selected"';?>>&#1038;&#1079;&#1073;&#1077;&#1082;&#1095;&#1072; - Uzbek-cyrillic</option><?php }?> <?php if(in_array('uzlat',$dir_array)) { ?><option value="uzlat" <?php if($lang=='uzlat') echo 'selected="selected"';?>>O&lsquo;zbekcha - Uzbek-latin</option><?php }?> </select> </td> </tr> </table> <div class="bk15"></div> <input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="button" id="dosubmit"> </form> </div> </div> </body> </html>
108wo
phpcms/modules/admin/templates/admin_edit_info.tpl.php
PHP
asf20
12,489
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header');?> <form name="myform" action="?m=admin&c=category&a=listorder" method="post"> <div class="pad_10"> <div class="explain-col"> <?php echo L('category_cache_tips');?>,<a href="?m=admin&c=category&a=public_cache&menuid=43&module=admin"><?php echo L('update_cache');?></a> </div> <div class="bk10"></div> <div class="table-list"> <table width="100%" cellspacing="0" > <thead> <tr> <th width="38"><?php echo L('listorder');?></th> <th width="30">catid</th> <th ><?php echo L('catname');?></th> <th align='left' width='50'><?php echo L('category_type');?></th> <th align='left' width="50"><?php echo L('modelname');?></th> <th align='center' width="40"><?php echo L('items');?></th> <th align='center' width="30"><?php echo L('vistor');?></th> <th align='center' width="80"><?php echo L('domain_help');?></th> <th ><?php echo L('operations_manage');?></th> </tr> </thead> <tbody> <?php echo $categorys;?> </tbody> </table> <div class="btn"> <input type="hidden" name="pc_hash" value="<?php echo $_SESSION['pc_hash'];?>" /> <input type="submit" class="button" name="dosubmit" value="<?php echo L('listorder')?>" /></div> </div> </div> </div> </form> <script language="JavaScript"> <!-- window.top.$('#display_center_id').css('display','none'); //--> </script> </body> </html>
108wo
phpcms/modules/admin/templates/category_manage.tpl.php
PHP
asf20
1,579
<?php defined('IN_ADMIN') or exit('No permission resources.'); $show_dialog = 1; include $this->admin_tpl('header','admin'); ?> <div class="pad-lr-10"> <form name="searchform" id="searchform" action="?m=admin&c=ipbanned&a=search_ip&menuid=<?php echo $_GET['menuid'];?>" method="get" > <input type="hidden" value="admin" name="m"> <input type="hidden" value="ipbanned" name="c"> <input type="hidden" value="search_ip" name="a"> <table width="100%" cellspacing="0" class="search-form"> <tbody> <tr> <td><div class="explain-col">IP: <input type="text" value="" class="input-text" id="ip" name="search[ip]"> <input type="submit" value="<?php echo L('search')?>" class="button" name="dosubmit"> </div> </td> </tr> </tbody> </table> </form> <form name="myform" id="myform" action="?m=admin&c=ipbanned&a=delete" method="post" onsubmit="checkuid();return false;"> <div class="table-list"> <table width="100%" cellspacing="0"> <thead> <tr> <th width="35" align="center"><input type="checkbox" value="" id="check_box" onclick="selectall('ipbannedid[]');"></th> <th width="30%">IP</th> <th ><?php echo L('deblocking_time')?></th> <th width="120"><?php echo L('operations_manage')?></th> </tr> </thead> <tbody> <?php if(is_array($infos)){ foreach($infos as $info){ ?> <tr> <td align="center"> <input type="checkbox" name="ipbannedid[]" value="<?php echo $info['ipbannedid']?>"> </td> <td width="30%" align="left"><span class="<?php echo $info['style']?>"><?php echo $info['ip']?></span> </td> <td align="center"><?php echo date('Y-m-d', $info['expires']);?></td> <td align="center"><a href="javascript:confirmurl('?m=admin&c=ipbanned&a=delete&ipbannedid=<?php echo $info['ipbannedid']?>', '<?php echo L('confirm', array('message' => L('selected')))?>')"><?php echo L('delete')?></a> </td> </tr> <?php } } ?></tbody> </table> <div class="btn"> <a href="#" onClick="javascript:$('input[type=checkbox]').attr('checked', true)"><?php echo L('selected_all')?></a>/<a href="#" onClick="javascript:$('input[type=checkbox]').attr('checked', false)"><?php echo L('cancel')?></a> <input type="submit" name="submit" class="button" value="<?php echo L('remove_all_selected')?>" onClick="return confirm('<?php echo L('confirm', array('message' => L('selected')))?>')" /> </div> <div id="pages"><?php echo $pages?></div> </div> </form></div> </body> </html> <script type="text/javascript"> function checkuid() { var ids=''; $("input[name='ipbannedid[]']:checked").each(function(i, n){ ids += $(n).val() + ','; }); if(ids=='') { window.top.art.dialog({content:"<?php echo L('before_select_operation')?>",lock:true,width:'200',height:'50',time:1.5},function(){}); return false; } else { myform.submit(); } } function checkSubmit() { if (searchform.ip.value=="") { searchform.ip.focus(); alert("<?php echo L('parameters_error')?>"); return false; } else { if(searchform.ip.value.split(".").length!=4) { searchform.ip.focus(); alert("<?php echo L('ip_type_error')?>"); return false; } else { for(i=0;i<searchform.ip.value.split(".").length;i++) { var ipPart; ipPart=searchform.ip.value.split(".")[i]; if(isNaN(ipPart) || ipPart=="" || ipPart==null) { searchform.ip.focus(); alert("<?php echo L('ip_type_error')?>"); return false; } else { if(ipPart/1>255 || ipPart/1<0) { searchform.ip.focus(); alert("<?php echo L('ip_type_error')?>"); return false; } } } } } } </script>
108wo
phpcms/modules/admin/templates/ipbanned_list.tpl.php
PHP
asf20
3,793
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header');?> <div class="pad_10"> <table width="100%" cellspacing="0" class="search-form"> <tbody> <tr> <td> <div class="explain-col"> <?php echo L('select_pdo_op')?> <?php echo form::select($pdos,$pdoname,'name="pdo_select" onchange="show_tbl(this)"',L('select_pdo'))?> <input type="submit" value="<?php echo L('pdo_look')?>" class="button" name="dosubmit"> </div> </td> </tr> </tbody> </table> <div class="table-list"> <form method="post" id="myform" name="myform" > <table width="100%" cellspacing="0"> <thead> <tr> <th width="10%" align="left"><input type="checkbox" value="" id="check_box" onclick="selectall('filenames[]');"></th> <th width="15%"><?php echo L('backup_file_name')?></th> <th width="15%"><?php echo L('backup_file_size')?></th> <th width="15%"><?php echo L('backup_file_time')?></th> <th width="15%"><?php echo L('backup_file_number')?></th> <th width="15%"><?php echo L('database_op')?></th> </tr> </thead> <tbody> <?php if(is_array($infos)){ foreach($infos as $info){ ?> <tr> <td width="10%"> <input type="checkbox" name="filenames[]" value="<?php echo $info['filename']?>" id="sql_phpcms" boxid="sql_phpcms"> </td> <td width="15%" align="center"><?php echo $info['filename']?></td> <td width="15%" align="center"><?php echo $info['filesize']?> M</td> <td width="15%" align="center"><?php echo $info['maketime']?></td> <td width="15%" align="center"><?php echo $info['number']?></td> <td width="15%" align="center"> <a href="javascript:confirmurl('?m=admin&c=database&pdoname=<?php echo $pdoname?>&a=import&pre=<?php echo $info['pre']?>&dosubmit=1', '<?php echo L('confirm_recovery')?>')"><?php echo L('backup_import')?></a> </td> </tr> <?php } } ?> </tbody> </table> <div class="btn"> <label for="check_box"><?php echo L('select_all')?>/<?php echo L('cancel')?></label> <input type="submit" class="button" name="dosubmit" value="<?php echo L('backup_del')?>" onclick="document.myform.action='?m=admin&c=database&a=delete&pdoname=<?php echo $pdoname?>';return confirm('<?php echo L('bakup_del_confirm')?>')"/> </div> </form> </div> </div> </body> </html> <script type="text/javascript"> <!-- function show_tbl(obj) { var pdoname = $(obj).val(); location.href='?m=admin&c=database&a=import&pdoname='+pdoname+'&menuid='+<?php echo $_GET['menuid']?>+'&pc_hash=<?php echo $_SESSION['pc_hash']?>'; } //--> </script>
108wo
phpcms/modules/admin/templates/database_import.tpl.php
PHP
asf20
2,667
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header');?> <style type="text/css"> .table-list td b{color:#666} .tpl_style{background-color:#FBFAE3} </style> <form name="myform" action="?m=admin&c=category&a=batch_edit" method="post"> <div class="pad_10"> <div class="explain-col"> <?php echo L('category_batch_tips');?></a> </div> <div class="bk10"></div> <div id="table-lists" class="table-list" > <table height="auto" cellspacing="0" > <thead > <?php foreach($batch_array as $catid=>$cat) { $batch_array[$catid]['setting'] = string2array($cat['setting']); echo "<th width='260' align='left' ><strong>{$cat[catname]} (catid: <font color='red'>{$catid}</font>)</strong></th>"; } ?> </thead> <tbody> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('catname')?>:</b><br><input type='text' name='info[<?php echo $catid;?>][catname]' id='catname' class='input-text' value='<?php echo $cat['catname']?>' style='width:250px'></td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('catdir')?>:</b><br><input type='text' name='info[<?php echo $catid;?>][catdir]' id='catname' class='input-text' value='<?php echo $cat['catdir']?>' style='width:250px'></td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('catgory_img')?>:</b><br><?php echo form::images('info['.$catid.'][image]', 'image'.$catid, $cat['image'], 'content','',23);?></td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('description')?>:</b><br><textarea name="info[<?php echo $catid;?>][description]" maxlength="255" style="width:240px;height:40px;"><?php echo $cat['description'];?></textarea></td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td class="tpl_style"><b><?php echo L('available_styles')?>:</b><br> <?php echo form::select($template_list, $cat['setting']['template_list'], 'name="setting['.$catid.'][template_list]" id="template_list" onchange="load_file_list(this.value,'.$catid.')"', L('please_select'))?> </td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td class="tpl_style"><b><?php echo L('page_templates')?>:</b><br> <div id="category_template<?php echo $catid;?>"> <?php echo form::select_template($cat['setting']['template_list'], 'content',$cat['setting']['page_template'],'name="setting['.$catid.'][page_template]" style="width:250px"','page');?> </div> </td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('ismenu')?>:</b><br> <input boxid="ismenu" type='radio' name='info[<?php echo $catid;?>][ismenu]' value='1' <?php if($cat['ismenu']) echo 'checked';?> onclick="change_radio(event,'ismenu',1)"> <?php echo L('yes');?>&nbsp;&nbsp;&nbsp;&nbsp; <input boxid="ismenu" type='radio' name='info[<?php echo $catid;?>][ismenu]' value='0' <?php if(!$cat['ismenu']) echo 'checked';?> onclick="change_radio(event,'ismenu',0)"> <?php echo L('no');?> </td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('html_category')?>:</b><br> <input boxid="ishtml" catid="<?php echo $catid;?>" type='radio' name='setting[<?php echo $catid;?>][ishtml]' value='1' <?php if($cat['setting']['ishtml']) echo 'checked';?> onClick="change_radio(event,'ishtml',1,'category');urlrule('category',1,<?php echo $catid;?>)"> <?php echo L('yes');?>&nbsp;&nbsp;&nbsp;&nbsp; <input boxid="ishtml" catid="<?php echo $catid;?>" type='radio' name='setting[<?php echo $catid;?>][ishtml]' value='0' <?php if(!$cat['setting']['ishtml']) echo 'checked';?> onClick="change_radio(event,'ishtml',0,'category');urlrule('category',0,<?php echo $catid;?>)"> <?php echo L('no');?> </td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('category_urlrules')?>:</b><br> <div id="category_php_ruleid<?php echo $catid;?>" style="display:<?php if($cat['setting']['ishtml']) echo 'none';?>"> <?php echo form::urlrule('content','category',0,$cat['setting']['category_ruleid'],'name="category_php_ruleid['.$catid.']" style="width:250px;"'); ?> </div> <div id="category_html_ruleid<?php echo $catid;?>" style="display:<?php if(!$cat['setting']['ishtml']) echo 'none';?>"> <?php echo form::urlrule('content','category',1,$cat['setting']['category_ruleid'],'name="category_html_ruleid['.$catid.']" style="width:250px;"'); ?> </div> </td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('meta_title')?>:</b><br> <input name='setting[<?php echo $catid;?>][meta_title]' type='text' value='<?php echo $cat['setting']['meta_title'];?>' style='width:250px'> </td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('meta_keywords')?>:</b><br> <input name='setting[<?php echo $catid;?>][meta_keywords]' type='text' value='<?php echo $cat['setting']['meta_keywords'];?>' style='width:250px'> </td> <?php } ?> </tr> <tr> <?php foreach($batch_array as $catid=>$cat) { ?> <td><b><?php echo L('meta_description')?>:</b><br> <input name='setting[<?php echo $catid;?>][meta_description]' type='text' value='<?php echo $cat['setting']['meta_description'];?>' style='width:250px'> </td> <?php } ?> </tr> </tbody> </table> <div class="btn"> <input type="hidden" name="pc_hash" value="<?php echo $_SESSION['pc_hash'];?>" /> <input type="hidden" name="type" value="<?php echo $type;?>" /> <input type="submit" class="button" name="dosubmit" value="<?php echo L('submit')?>" /></div> <BR><BR> </div> </div> </div> </form> <script language="JavaScript"> <!-- $(document).keydown(function(event) { if(event.keyCode==37) { window.scrollBy(-100,0); } else if(event.keyCode==39) { window.scrollBy(100,0); } }); function change_radio(oEvent,boxid,value,type) { altKey = oEvent.altKey; if(altKey) { var obj = $("input[boxid="+boxid+"][value="+value+"]"); obj.attr('checked',true); if(type){ obj.each(function(){ urlrule(type,value,$(this).attr('catid')); }) } } } window.top.$('#display_center_id').css('display','none'); function urlrule(type,html,catid) { if(type=='category') { if(html) { $('#category_php_ruleid'+catid).css('display','none');$('#category_html_ruleid'+catid).css('display',''); } else { $('#category_php_ruleid'+catid).css('display','');$('#category_html_ruleid'+catid).css('display','none');; } } else { if(html) { $('#show_php_ruleid'+catid).css('display','none');$('#show_html_ruleid'+catid).css('display',''); } else { $('#show_php_ruleid'+catid).css('display','');$('#show_html_ruleid'+catid).css('display','none');; } } } function load_file_list(id,catid) { if(id=='') return false; $.getJSON('?m=admin&c=category&a=public_tpl_file_list&batch_str=1&type=1&style='+id+'&catid='+catid, function(data){ if(data==null) return false; $('#category_template'+catid).html(data.page_template);}); } //--> </script> </body> </html>
108wo
phpcms/modules/admin/templates/category_batch_edit_page.tpl.php
PHP
asf20
7,567
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header');?> <div class="pad_10"> <div class="table-list"> <form name="myform" action="?m=admin&c=role&a=listorder" method="post"> <table width="100%" cellspacing="0"> <thead> <tr> <th width="10%"><?php echo L('userid')?></th> <th width="10%" align="left" ><?php echo L('username')?></th> <th width="10%" align="left" ><?php echo L('userinrole')?></th> <th width="10%" align="left" ><?php echo L('lastloginip')?></th> <th width="20%" align="left" ><?php echo L('lastlogintime')?></th> <th width="15%" align="left" ><?php echo L('email')?></th> <th width="10%"><?php echo L('realname')?></th> <th width="15%" ><?php echo L('operations_manage')?></th> </tr> </thead> <tbody> <?php $admin_founders = explode(',',pc_base::load_config('system','admin_founders'));?> <?php if(is_array($infos)){ foreach($infos as $info){ ?> <tr> <td width="10%" align="center"><?php echo $info['userid']?></td> <td width="10%" ><?php echo $info['username']?></td> <td width="10%" ><?php echo $roles[$info['roleid']]?></td> <td width="10%" ><?php echo $info['lastloginip']?></td> <td width="20%" ><?php echo $info['lastlogintime'] ? date('Y-m-d H:i:s',$info['lastlogintime']) : ''?></td> <td width="15%"><?php echo $info['email']?></td> <td width="10%" align="center"><?php echo $info['realname']?></td> <td width="15%" align="center"> <a href="javascript:edit(<?php echo $info['userid']?>, '<?php echo new_addslashes($info['username'])?>')"><?php echo L('edit')?></a> | <?php if(!in_array($info['userid'],$admin_founders)) {?> <a href="javascript:confirmurl('?m=admin&c=admin_manage&a=delete&userid=<?php echo $info['userid']?>', '<?php echo L('admin_del_cofirm')?>')"><?php echo L('delete')?></a> <?php } else {?> <font color="#cccccc"><?php echo L('delete')?></font> <?php } ?> | <a href="javascript:void(0)" onclick="card(<?php echo $info['userid']?>)"><?php echo L('ht_card')?></a> </td> </tr> <?php } } ?> </tbody> </table> <div id="pages"> <?php echo $pages?></div> </form> </div> </div> </body> </html> <script type="text/javascript"> <!-- function edit(id, name) { window.top.art.dialog({title:'<?php echo L('edit')?>--'+name, id:'edit', iframe:'?m=admin&c=admin_manage&a=edit&userid='+id ,width:'500px',height:'400px'}, function(){var d = window.top.art.dialog({id:'edit'}).data.iframe; var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'edit'}).close()}); } function card(id) { window.top.art.dialog({title:'<?php echo L('the_password_card')?>', id:'edit', iframe:'?m=admin&c=admin_manage&a=card&userid='+id ,width:'500px',height:'400px'}, '', function(){window.top.art.dialog({id:'edit'}).close()}); } //--> </script>
108wo
phpcms/modules/admin/templates/admin_list.tpl.php
PHP
asf20
2,893
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header'); ?> <div class="pad_10"> <div class="table-list"> <table width="100%" cellspacing="0"> <thead> <tr> <th width="80">ID</th> <th align="left" ><?php echo L('release_point_name')?></th> <th align="left" ><?php echo L('server_address')?></th> <th align="left" ><?php echo L("username")?></th> <th width="150"><?php echo L('operations_manage')?></th> </tr> </thead> <tbody> <?php if(is_array($list)): foreach($list as $v): ?> <tr> <td width="80" align="center"><?php echo $v['id']?></td> <td><?php echo $v['name']?></td> <td><?php echo $v['host']?></td> <td><?php echo $v['username']?></td> <td align="center" ><a href="javascript:edit(<?php echo $v['id']?>, '<?php echo new_addslashes($v['name'])?>')"><?php echo L('edit')?></a> | <a href="?m=admin&c=release_point&a=del&id=<?php echo $v['id']?>" onclick="return confirm('<?php echo new_addslashes(L('confirm', array('message'=>$v['name'])))?>')"><?php echo L('delete')?></a></td> </tr> <?php endforeach; endif; ?> </tbody> </table> </div> </div> <div id="pages"><?php echo $pages?></div> <script type="text/javascript"> <!-- function edit(id, name) { window.top.art.dialog({id:'edit'}).close(); window.top.art.dialog({title:'<?php echo L('release_point_edit')?>《'+name+'》',id:'edit',iframe:'?m=admin&c=release_point&a=edit&id='+id,width:'700',height:'500'}, function(){var d = window.top.art.dialog({id:'edit'}).data.iframe;var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'edit'}).close()}); } //--> </script> </body> </html>
108wo
phpcms/modules/admin/templates/release_point_list.tpl.php
PHP
asf20
1,723
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header');?> <div class="pad_10"> <div class="table-list"> <form method="post" name="myform" id="myform" action="?m=admin&c=database&a=export"> <input type="hidden" name="tabletype" value="phpcmstables" id="phpcmstables"> <table width="100%" cellspacing="0"> <thead> <tr> <th class="tablerowhighlight" colspan=4><?php echo L('backup_setting')?></th> </tr> </thead> <tr> <td class="align_r"><?php echo L('sizelimit')?></td> <td colspan=3><input type=text name="sizelimit" value="2048" size=5> K</td> </tr> <tr> <td class="align_r"><?php echo L('sqlcompat')?></td> <td colspan=3><input type="radio" name="sqlcompat" value="" checked> <?php echo L('default')?> &nbsp; <input type="radio" name="sqlcompat" value="MYSQL40"> MySQL 3.23/4.0.x &nbsp; <input type="radio" name="sqlcompat" value="MYSQL41"> MySQL 4.1.x/5.x &nbsp;</td> </tr> <tr> <td class="align_r"><?php echo L('sqlcharset')?></td> <td colspan=3><input type="radio" name="sqlcharset" value="" checked> <?php echo L('default')?>&nbsp; <input type="radio" name="sqlcharset" value="latin1"> LATIN1 &nbsp; <input type="radio" name="sqlcharset" value='utf8'> UTF-8</option></td> </tr> <tr> <td class="align_r"><?php echo L('select_pdo')?></td> <td colspan=3><?php echo form::select($pdos,$pdo_name,'name="pdo_select" onchange="show_tbl(this)"',L('select_pdo'))?></td> </tr> <tr> <td></td> <td colspan=3><input type="submit" name="dosubmit" value=" <?php echo L('backup_starting')?> " class="button"></td> </tr> </table> <table width="100%" cellspacing="0"> <?php if(is_array($infos)){ ?> <thead><tr><th align="center" colspan="8"><strong><?php echo $pdo_name?> <?php echo L('pdo_name')?></strong></th></tr></thead> <thead> <tr> <th width="10%"><input type="checkbox" value="" id="check_box" onclick="selectall('tables[]');"> <a class="cu" href="javascript:void(0);" onclick="reselect()"><?php echo L('reselect')?></a></th> <th width="10%" ><?php echo L('database_tblname')?></th> <th width="10%"><?php echo L('database_type')?></th> <th width="10%"><?php echo L('database_char')?></th> <th width="15%"><?php echo L('database_records')?></th> <th width="15%"><?php echo L('database_size')?></th> <th width="15%"><?php echo L('database_block')?></th> <th width="15%"><?php echo L('database_op')?></th> </tr> </thead> <tbody> <?php foreach($infos['phpcmstables'] as $v){?> <tr> <td width="5%" align="center"><input type="checkbox" name="tables[]" value="<?php echo $v['name']?>"/></td> <td width="10%" align="center"><?php echo $v['name']?></td> <td width="10%" align="center"><?php echo $v['engine']?></td> <td width="10%" align="center"><?php echo $v['collation']?></td> <td width="15%" align="center"><?php echo $v['rows']?></td> <td width="15%" align="center"><?php echo $v['size']?></td> <td width="15%" align="center"><?php echo $v['data_free']?></td> <td width="15%" align="center"><a href="?m=admin&c=database&a=public_repair&operation=optimize&pdo_name=<?php echo $pdo_name?>&tables=<?php echo $v['name']?>"><?php echo L('database_optimize')?></a> | <a href="?m=admin&c=database&a=public_repair&operation=repair&pdo_name=<?php echo $pdo_name?>&tables=<?php echo $v['name']?>"><?php echo L('database_repair')?></a> | <a href="javascript:void(0);" onclick="showcreat('<?php echo $v['name']?>','<?php echo $pdo_name?>')"><?php echo L('database_showcreat')?></a></td> </tr> <?php } ?> </tbody> <?php } ?> </table> <?php if(is_array($infos)){ ?> <div class="btn"> <label for="check_box"><?php echo L('select_all')?>/<?php echo L('cancel')?></label> <input type="button" class="button" onclick="reselect()" value="<?php echo L('reselect')?>"/> <input type="submit" class="button" name="dosubmit" onclick="document.myform.action='?m=admin&c=database&a=public_repair&operation=optimize&pdo_name=<?php echo $pdo_name?>'" value="<?php echo L('batch_optimize')?>"/> <input type="submit" class="button" name="dosubmit" onclick="document.myform.action='?m=admin&c=database&a=public_repair&operation=repair&pdo_name=<?php echo $pdo_name?>'" value="<?php echo L('batch_repair')?>"/> </div> <?php } ?> </form> </div> </div> </form> </body> <script type="text/javascript"> <!-- function show_tbl(obj) { var pdoname = $(obj).val(); location.href='?m=admin&c=database&a=export&pdoname='+pdoname+'&pc_hash=<?php echo $_SESSION['pc_hash']?>'; } function showcreat(tblname, pdo_name) { window.top.art.dialog({title:tblname, id:'show', iframe:'?m=admin&c=database&a=public_repair&operation=showcreat&pdo_name='+pdo_name+'&tables=' +tblname,width:'500px',height:'350px'}); } function reselect() { var chk = $("input[name=tables[]]"); var length = chk.length; for(i=0;i < length;i++){ if(chk.eq(i).attr("checked")) chk.eq(i).attr("checked",false); else chk.eq(i).attr("checked",true); } } //--> </script> </html>
108wo
phpcms/modules/admin/templates/database_export.tpl.php
PHP
asf20
5,195
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header');?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}}); $("#modelid").formValidator({onshow:"<?php echo L('select_model');?>",onfocus:"<?php echo L('select_model');?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L('select_model');?>"}); $("#catname").formValidator({onshow:"<?php echo L('input_catname');?>",onfocus:"<?php echo L('input_catname');?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L('input_catname');?>"}); $("#catdir").formValidator({onshow:"<?php echo L('input_dirname');?>",onfocus:"<?php echo L('input_dirname');?>"}).regexValidator({regexp:"^([a-zA-Z0-9、-]|[_]){0,30}$",onerror:"<?php echo L('enter_the_correct_catname');?>"}).inputValidator({min:1,onerror:"<?php echo L('input_dirname');?>"}).ajaxValidator({type : "get",url : "",data :"m=admin&c=category&a=public_check_catdir",datatype : "html",cached:false,getdata:{parentid:'parentid'},async:'false',success : function(data){ if( data == "1" ){return true;}else{return false;}},buttons: $("#dosubmit"),onerror : "<?php echo L('catname_have_exists');?>",onwait : "<?php echo L('connecting');?>"}); $("#url").formValidator({onshow:" ",onfocus:"<?php echo L('domain_name_format');?>",tipcss:{width:'300px'},empty:true}).inputValidator({onerror:"<?php echo L('domain_name_format');?>"}).regexValidator({regexp:"http:\/\/(.+)\/$",onerror:"<?php echo L('domain_end_string');?>"}); $("#template_list").formValidator({onshow:"<?php echo L('template_setting');?>",onfocus:"<?php echo L('template_setting');?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L('template_setting');?>"}); }) //--> </script> <form name="myform" id="myform" action="?m=admin&c=category&a=add" method="post"> <div class="pad-10"> <div class="col-tab"> <ul class="tabBut cu-li"> <li id="tab_setting_1" class="on" onclick="SwapTab('setting','on','',6,1);"><?php echo L('catgory_basic');?></li> <li id="tab_setting_2" onclick="SwapTab('setting','on','',6,2);"><?php echo L('catgory_createhtml');?></li> <li id="tab_setting_3" onclick="SwapTab('setting','on','',6,3);"><?php echo L('catgory_template');?></li> <li id="tab_setting_4" onclick="SwapTab('setting','on','',6,4);"><?php echo L('catgory_seo');?></li> <li id="tab_setting_5" onclick="SwapTab('setting','on','',6,5);"><?php echo L('catgory_private');?></li> <li id="tab_setting_6" onclick="SwapTab('setting','on','',6,6);"><?php echo L('catgory_readpoint');?></li> </ul> <div id="div_setting_1" class="contentList pad-10"> <table width="100%" class="table_form "> <tr> <th><?php echo L('add_category_types');?>:</th> <td> <input type='radio' name='addtype' value='0' checked id="normal_addid"> <?php echo L('normal_add');?>&nbsp;&nbsp;&nbsp;&nbsp; <input type='radio' name='addtype' value='1' onclick="$('#catdir_tr').html(' ');$('#normal_add').html(' ');$('#normal_add').css('display','none');$('#batch_add').css('display','');$('#normal_addid').attr('disabled','true');this.disabled='true'"> <?php echo L('batch_add');?></td> </tr> <tr> <th width="200"><?php echo L('select_model')?>:</th> <td> <?php $model_datas = array(); foreach($models as $_k=>$_v) { if($_v['siteid']!=$this->siteid) continue; $model_datas[$_v['modelid']] = $_v['name']; } echo form::select($model_datas,$modelid,'name="info[modelid]" id="modelid" onchange="change_tpl(this.value)"',L('select_model')); ?> </td> </tr> <tr> <th width="200"><?php echo L('parent_category')?>:</th> <td> <?php echo form::select_category('category_content_'.$this->siteid,$parentid,'name="info[parentid]" id="parentid"',L('please_select_parent_category'),0,-1);?> </td> </tr> <tr> <th><?php echo L('catname')?>:</th> <td> <span id="normal_add"><input type="text" name="info[catname]" id="catname" class="input-text" value=""></span> <span id="batch_add" style="display:none"> <table width="100%" class="sss"><tr><td width="310"><textarea name="batch_add" maxlength="255" style="width:300px;height:60px;"></textarea></td> <td align="left"> <?php echo L('batch_add_tips');?> </td></tr></table> </span> </td> </tr> <tr id="catdir_tr"> <th><?php echo L('catdir')?>:</th> <td><input type="text" name="info[catdir]" id="catdir" class="input-text" value=""></td> </tr> <tr> <th><?php echo L('catgory_img')?>:</th> <td><?php echo form::images('info[image]', 'image', $image, 'content');?></td> </tr> <tr> <th><?php echo L('description')?>:</th> <td> <textarea name="info[description]" maxlength="255" style="width:300px;height:60px;"><?php echo $description;?></textarea> </td> </tr> <tr> <th><?php echo L('workflow');?>:</th> <td> <?php $workflows = getcache('workflow_'.$this->siteid,'commons'); if($workflows) { $workflows_datas = array(); foreach($workflows as $_k=>$_v) { $workflows_datas[$_v['workflowid']] = $_v['workname']; } echo form::select($workflows_datas,'','name="setting[workflowid]"',L('catgory_not_need_check')); } else { echo '<input type="hidden" name="setting[workflowid]" value="">'; echo L('add_workflow_tips'); } ?> </td> </tr> <tr> <th><?php echo L('ismenu');?>:</th> <td> <input type='radio' name='info[ismenu]' value='1' checked> <?php echo L('yes');?>&nbsp;&nbsp;&nbsp;&nbsp; <input type='radio' name='info[ismenu]' value='0' > <?php echo L('no');?></td> </tr> </table> </div> <div id="div_setting_2" class="contentList pad-10 hidden"> <table width="100%" class="table_form "> <tr> <th width="200"><?php echo L('html_category');?>:</th> <td> <input type='radio' name='setting[ishtml]' value='1' <?php if($setting['ishtml']) echo 'checked';?> onClick="$('#category_php_ruleid').css('display','none');$('#category_html_ruleid').css('display','');$('#tr_domain').css('display','');"> <?php echo L('yes');?>&nbsp;&nbsp;&nbsp;&nbsp; <input type='radio' name='setting[ishtml]' value='0' <?php if(!$setting['ishtml']) echo 'checked';?> onClick="$('#category_php_ruleid').css('display','');$('#category_html_ruleid').css('display','none');$('#tr_domain').css('display','none');"> <?php echo L('no');?> </td> </tr> <tr> <th><?php echo L('html_show');?>:</th> <td> <input type='radio' name='setting[content_ishtml]' value='1' <?php if($setting['content_ishtml']) echo 'checked';?> onClick="$('#show_php_ruleid').css('display','none');$('#show_html_ruleid').css('display','')"> <?php echo L('yes');?>&nbsp;&nbsp;&nbsp;&nbsp; <input type='radio' name='setting[content_ishtml]' value='0' <?php if(!$setting['content_ishtml']) echo 'checked';?> onClick="$('#show_php_ruleid').css('display','');$('#show_html_ruleid').css('display','none')"> <?php echo L('no');?> </td> </tr> <tr> <th><?php echo L('category_urlrules');?>:</th> <td><div id="category_php_ruleid" style="display:<?php if($setting['ishtml']) echo 'none';?>"> <?php echo form::urlrule('content','category',0,$setting['category_ruleid'],'name="category_php_ruleid"'); ?> </div> <div id="category_html_ruleid" style="display:<?php if(!$setting['ishtml']) echo 'none';?>"> <?php echo form::urlrule('content','category',1,$setting['category_ruleid'],'name="category_html_ruleid"'); ?> </div> </td> </tr> <tr> <th><?php echo L('show_urlrules');?>:</th> <td><div id="show_php_ruleid" style="display:<?php if($setting['content_ishtml']) echo 'none';?>"> <?php echo form::urlrule('content','show',0,$setting['category_ruleid'],'name="show_php_ruleid"'); ?> </div> <div id="show_html_ruleid" style="display:<?php if(!$setting['content_ishtml']) echo 'none';?>"> <?php echo form::urlrule('content','show',1,$setting['category_ruleid'],'name="show_html_ruleid"'); ?> </div> </td> </tr> <tr> <th><?php echo L('create_to_rootdir');?>:</th> <td> <input type='radio' name='setting[create_to_html_root]' value='1' <?php if($setting['create_to_html_root']) echo 'checked';?> > <?php echo L('yes');?>&nbsp;&nbsp;&nbsp;&nbsp; <input type='radio' name='setting[create_to_html_root]' value='0' <?php if(!$setting['create_to_html_root']) echo 'checked';?> > <?php echo L('no');?> (<?php echo L('create_to_rootdir_tips');?>)</td> </tr> <tr id="tr_domain" style="display:<?php if(!$setting['ishtml']) echo 'none';?>"> <th><?php echo L('domain')?>:</th> <td><input type="text" name="info[url]" id="url" class="input-text" size="50" value=""></td> </tr> </table> </div> <div id="div_setting_3" class="contentList pad-10 hidden"> <table width="100%" class="table_form "> <tr> <th width="200"><?php echo L('available_styles');?>:</th> <td> <?php echo form::select($template_list, $setting['template_list'], 'name="setting[template_list]" id="template_list" onchange="load_file_list(this.value)"', L('please_select'))?> </td> </tr> <tr> <th width="200"><?php echo L('category_index_tpl')?>:</th> <td id="category_template"> </td> </tr> <tr> <th width="200"><?php echo L('category_list_tpl')?>:</th> <td id="list_template"> </td> </tr> <tr> <th width="200"><?php echo L('content_tpl')?>:</th> <td id="show_template"> </td> </tr> </table> </div> <div id="div_setting_4" class="contentList pad-10 hidden"> <table width="100%" class="table_form "> <tr> <th width="200"><?php echo L('meta_title');?></th> <td><input name='setting[meta_title]' type='text' id='meta_title' value='<?php echo $setting['meta_title'];?>' size='60' maxlength='60'></td> </tr> <tr> <th ><?php echo L('meta_keywords');?></th> <td><textarea name='setting[meta_keywords]' id='meta_keywords' style="width:90%;height:40px"><?php echo $setting['meta_keywords'];?></textarea></td> </tr> <tr> <th ><strong><?php echo L('meta_description');?></th> <td><textarea name='setting[meta_description]' id='meta_description' style="width:90%;height:50px"><?php echo $setting['meta_description'];?></textarea></td> </tr> </table> </div> <div id="div_setting_5" class="contentList pad-10 hidden"> <table width="100%" > <tr> <th width="200"><?php echo L('role_private')?>:</th> <td> <table width="100%" class="table-list"> <thead> <tr> <th align="left"><?php echo L('role_name');?></th><th><?php echo L('view');?></th><th><?php echo L('add');?></th><th><?php echo L('edit');?></th><th><?php echo L('delete');?></th><th><?php echo L('listorder');?></th><th><?php echo L('push');?></th><th><?php echo L('move');?></th> </tr> </thead> <tbody> <?php $roles = getcache('role','commons'); foreach($roles as $roleid=> $rolrname) { $disabled = $roleid==1 ? 'disabled' : ''; ?> <tr> <td><?php echo $rolrname?></td> <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled;?> value="init,<?php echo $roleid;?>" ></td> <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled;?> value="add,<?php echo $roleid;?>" ></td> <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled;?> value="edit,<?php echo $roleid;?>" ></td> <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled;?> value="delete,<?php echo $roleid;?>" ></td> <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled;?> value="listorder,<?php echo $roleid;?>" ></td> <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled;?> value="push,<?php echo $roleid;?>" ></td> <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled;?> value="move,<?php echo $roleid;?>" ></td> </tr> <?php }?> </tbody> </table> </td> </tr> <tr><td colspan=2><hr style="border:1px dotted #F2F2F2;"></td> </tr> <tr> <th width="200"><?php echo L('group_private')?>:</th> <td> <table width="100%" class="table-list"> <thead> <tr> <th align="left"><?php echo L('group_name');?></th><th><?php echo L('allow_vistor');?></th><th><?php echo L('allow_contribute');?></th> </tr> </thead> <tbody> <?php $group_cache = getcache('grouplist','member'); foreach($group_cache as $_key=>$_value) { if($_value['groupid']==1) continue; ?> <tr> <td><?php echo $_value['name'];?></td> <td align="center"><input type="checkbox" name="priv_groupid[]" value="visit,<?php echo $_value['groupid'];?>" ></td> <td align="center"><input type="checkbox" name="priv_groupid[]" value="add,<?php echo $_value['groupid'];?>" ></td> </tr> <?php }?> </tbody> </table> </td> </tr> </table> </div> <div id="div_setting_6" class="contentList pad-10 hidden"> <table width="100%" class="table_form"> <tr> <th width="200"><?php echo L('contribute_add_point');?></th> <td><input name='setting[presentpoint]' type='text' value='1' size='5' maxlength='5' style='text-align:center'> <?php echo L('contribute_add_point_tips');?></td> </tr> <tr> <th ><?php echo L('default_readpoint');?></th> <td><input name='setting[defaultchargepoint]' type='text' value='0' size='4' maxlength='4' style='text-align:center'> <select name="setting[paytype]"><option value="0"><?php echo L('readpoint');?></option><option value="1"><?php echo L('money');?></option></select> <?php echo L('readpoint_tips');?></td> </tr> <tr> <th><?php echo L('repeatchargedays');?></th> <td> <input name='setting[repeatchargedays]' type='text' value='1' size='4' maxlength='4' style='text-align:center'> <?php echo L('repeat_tips');?>&nbsp;&nbsp; <font color="red"><?php echo L('repeat_tips2');?></font></td> </tr> </table> </div> <div class="bk15"></div> <input name="catid" type="hidden" value="<?php echo $catid;?>"> <input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="button"> </form> </div> </div> <!--table_form_off--> </div> <script language="JavaScript"> <!-- window.top.$('#display_center_id').css('display','none'); function SwapTab(name,cls_show,cls_hide,cnt,cur){ for(i=1;i<=cnt;i++){ if(i==cur){ $('#div_'+name+'_'+i).show(); $('#tab_'+name+'_'+i).attr('class',cls_show); }else{ $('#div_'+name+'_'+i).hide(); $('#tab_'+name+'_'+i).attr('class',cls_hide); } } } function change_tpl(modelid) { if(modelid) { $.getJSON('?m=admin&c=category&a=public_change_tpl&modelid='+modelid, function(data){$('#template_list').val(data.template_list);$('#category_template').html(data.category_template);$('#list_template').html(data.list_template);$('#show_template').html(data.show_template);}); } } function load_file_list(id) { if(id=='') return false; $.getJSON('?m=admin&c=category&a=public_tpl_file_list&style='+id+'&catid=<?php echo $parentid?>', function(data){$('#category_template').html(data.category_template);$('#list_template').html(data.list_template);$('#show_template').html(data.show_template);}); } <?php if($modelid) echo "change_tpl($modelid)";?> //--> </script>
108wo
phpcms/modules/admin/templates/category_add.tpl.php
PHP
asf20
16,070
<?php defined('IN_ADMIN') or exit('No permission resources.'); $show_validator = true; include $this->admin_tpl('header');?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}}); $("#username").formValidator({onshow:"<?php echo L('input').L('username')?>",onfocus:"<?php echo L('username').L('between_2_to_20')?>"}).inputValidator({min:2,max:20,onerror:"<?php echo L('username').L('between_2_to_20')?>"}).ajaxValidator({ type : "get", url : "", data :"m=admin&c=admin_manage&a=public_checkname_ajx", datatype : "html", async:'false', success : function(data){ if( data == "1" ) { return true; } else { return false; } }, buttons: $("#dosubmit"), onerror : "<?php echo L('user_already_exist')?>", onwait : "<?php echo L('connecting_please_wait')?>" }); $("#password").formValidator({onshow:"<?php echo L('input').L('password')?>",onfocus:"<?php echo L('password').L('between_6_to_20')?>"}).inputValidator({min:6,max:20,onerror:"<?php echo L('password').L('between_6_to_20')?>"}); $("#pwdconfirm").formValidator({onshow:"<?php echo L('input').L('cofirmpwd')?>",onfocus:"<?php echo L('input').L('passwords_not_match')?>",oncorrect:"<?php echo L('passwords_match')?>"}).compareValidator({desid:"password",operateor:"=",onerror:"<?php echo L('input').L('passwords_not_match')?>"}); $("#email").formValidator({onshow:"<?php echo L('input').L('email')?>",onfocus:"<?php echo L('email').L('format_incorrect')?>",oncorrect:"<?php echo L('email').L('format_right')?>"}).regexValidator({regexp:"email",datatype:"enum",onerror:"<?php echo L('email').L('format_incorrect')?>"}); }) //--> </script> <div class="pad_10"> <div class="common-form"> <form name="myform" action="?m=admin&c=admin_manage&a=add" method="post" id="myform"> <table width="100%" class="table_form contentWrap"> <tr> <td width="80"><?php echo L('username')?></td> <td><input type="test" name="info[username]" class="input-text" id="username"></input></td> </tr> <tr> <td><?php echo L('password')?></td> <td><input type="password" name="info[password]" class="input-text" id="password" value=""></input></td> </tr> <tr> <td><?php echo L('cofirmpwd')?></td> <td><input type="password" name="info[pwdconfirm]" class="input-text" id="pwdconfirm" value=""></input></td> </tr> <tr> <td><?php echo L('email')?></td> <td> <input type="text" name="info[email]" value="" class="input-text" id="email" size="30"></input> </td> </tr> <tr> <td><?php echo L('realname')?></td> <td> <input type="text" name="info[realname]" value="" class="input-text" id="realname"></input> </td> </tr> <tr> <td><?php echo L('userinrole')?></td> <td> <select name="info[roleid]"> <?php foreach($roles as $role) { ?> <option value="<?php echo $role['roleid']?>" <?php echo (($role['roleid']==$roleid) ? 'selected' : '')?>><?php echo $role['rolename']?></option> <?php } ?> </select> </td> </tr> </table> <div class="bk15"></div> <input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="button"> </form> </div> </div> </body> </html>
108wo
phpcms/modules/admin/templates/admin_add.tpl.php
PHP
asf20
3,260
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header');?> <script type="text/javascript"> <!-- $(function(){ SwapTab('setting','on','',5,<?php echo $_GET['tab'] ? $_GET['tab'] : '1'?>); $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}}); $("#js_path").formValidator({onshow:"<?php echo L('setting_input').L('setting_js_path')?>",onfocus:"<?php echo L('setting_js_path').L('setting_end_with_x')?>"}).inputValidator({onerror:"<?php echo L('setting_js_path').L('setting_input_error')?>"}).regexValidator({regexp:"(.+)\/$",onerror:"<?php echo L('setting_js_path').L('setting_end_with_x')?>"}); $("#css_path").formValidator({onshow:"<?php echo L('setting_input').L('setting_css_path')?>",onfocus:"<?php echo L('setting_css_path').L('setting_end_with_x')?>"}).inputValidator({onerror:"<?php echo L('setting_css_path').L('setting_input_error')?>"}).regexValidator({regexp:"(.+)\/$",onerror:"<?php echo L('setting_css_path').L('setting_end_with_x')?>"}); $("#img_path").formValidator({onshow:"<?php echo L('setting_input').L('setting_img_path')?>",onfocus:"<?php echo L('setting_img_path').L('setting_end_with_x')?>"}).inputValidator({onerror:"<?php echo L('setting_img_path').L('setting_input_error')?>"}).regexValidator({regexp:"(.+)\/$",onerror:"<?php echo L('setting_img_path').L('setting_end_with_x')?>"}); $("#upload_url").formValidator({onshow:"<?php echo L('setting_input').L('setting_upload_url')?>",onfocus:"<?php echo L('setting_upload_url').L('setting_end_with_x')?>"}).inputValidator({onerror:"<?php echo L('setting_upload_url').L('setting_input_error')?>"}).regexValidator({regexp:"(.+)\/$",onerror:"<?php echo L('setting_upload_url').L('setting_end_with_x')?>"}); $("#errorlog_size").formValidator({onshow:"<?php echo L('setting_errorlog_hint')?>",onfocus:"<?php echo L('setting_input').L('setting_error_log_size')?>"}).inputValidator({onerror:"<?php echo L('setting_error_log_size').L('setting_input_error')?>"}).regexValidator({regexp:"num",datatype:"enum",onerror:"<?php echo L('setting_errorlog_type')?>"}); $("#phpsso_api_url").formValidator({onshow:"<?php echo L('setting_phpsso_type')?>",onfocus:"<?php echo L('setting_phpsso_type')?>",tipcss:{width:'300px'},empty:false}).inputValidator({onerror:"<?php echo L('setting_phpsso_type')?>"}).regexValidator({regexp:"http:\/\/(.+)[^/]$",onerror:"<?php echo L('setting_phpsso_type')?>"}); $("#phpsso_appid").formValidator({onshow:"<?php echo L('input').L('setting_phpsso_appid')?>",onfocus:"<?php echo L('input').L('setting_phpsso_appid')?>"}).regexValidator({regexp:"^\\d{1,8}$",onerror:"<?php echo L('setting_phpsso_appid').L('must_be_number')?>"}); $("#phpsso_version").formValidator({onshow:"<?php echo L('input').L('setting_phpsso_version')?>",onfocus:"<?php echo L('input').L('setting_phpsso_version')?>"}).regexValidator({regexp:"^\\d{1,8}$",onerror:"<?php echo L('setting_phpsso_version').L('must_be_number')?>"}); $("#phpsso_auth_key").formValidator({onshow:"<?php echo L('input').L('setting_phpsso_auth_key')?>",onfocus:"<?php echo L('input').L('setting_phpsso_auth_key')?>"}).regexValidator({regexp:"^\\w{32}$",onerror:"<?php echo L('setting_phpsso_auth_key').L('must_be_32_w')?>"}); }) //--> </script> <form action="?m=admin&c=setting&a=save" method="post" id="myform"> <div class="pad-10"> <div class="col-tab"> <ul class="tabBut cu-li"> <li id="tab_setting_1" class="on" onclick="SwapTab('setting','on','',5,1);"><?php echo L('setting_basic_cfg')?></li> <li id="tab_setting_2" onclick="SwapTab('setting','on','',5,2);"><?php echo L('setting_safe_cfg')?></li> <li id="tab_setting_3" onclick="SwapTab('setting','on','',5,3);"><?php echo L('setting_sso_cfg')?></li> <li id="tab_setting_4" onclick="SwapTab('setting','on','',5,4);"><?php echo L('setting_mail_cfg')?></li> <li id="tab_setting_5" onclick="SwapTab('setting','on','',5,5);"><?php echo L('setting_connect')?></li> </ul> <div id="div_setting_1" class="contentList pad-10"> <table width="100%" class="table_form"> <tr> <th width="120"><?php echo L('setting_admin_email')?></th> <td class="y-bg"><input type="text" class="input-text" name="setting[admin_email]" id="admin_email" size="30" value="<?php echo $admin_email?>"/></td> </tr> </table> <table width="100%" class="table_form"> <tr> <th width="120"><?php echo L('setting_gzip')?></th> <td class="y-bg"> <input name="setconfig[gzip]" value="1" type="radio" <?php echo ($gzip=='1') ? ' checked' : ''?>> <?php echo L('setting_yes')?>&nbsp;&nbsp;&nbsp;&nbsp; <input name="setconfig[gzip]" value="0" type="radio" <?php echo ($gzip=='0') ? ' checked' : ''?>> <?php echo L('setting_no')?></td> </tr> <tr> <th width="120"><?php echo L('setting_attachment_stat')?></th> <td class="y-bg"> <input name="setconfig[attachment_stat]" value="1" type="radio" <?php echo ($attachment_stat=='1') ? ' checked' : ''?>> <?php echo L('setting_yes')?>&nbsp;&nbsp;&nbsp;&nbsp; <input name="setconfig[attachment_stat]" value="0" type="radio" <?php echo ($attachment_stat=='0') ? ' checked' : ''?>> <?php echo L('setting_no')?>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo L('setting_attachment_stat_desc')?></td> </tr> <tr> <th width="120"><?php echo L('setting_js_path')?></th> <td class="y-bg"><input type="text" class="input-text" name="setconfig[js_path]" id="js_path" size="50" value="<?php echo JS_PATH?>" /></td> </tr> <tr> <th width="120"><?php echo L('setting_css_path')?></th> <td class="y-bg"><input type="text" class="input-text" name="setconfig[css_path]" id="css_path" size="50" value="<?php echo CSS_PATH?>"/></td> </tr> <tr> <th width="120"><?php echo L('setting_img_path')?></th> <td class="y-bg"><input type="text" class="input-text" name="setconfig[img_path]" id="img_path" size="50" value="<?php echo IMG_PATH?>" /></td> </tr> <tr> <th width="120"><?php echo L('setting_upload_url')?></th> <td class="y-bg"><input type="text" class="input-text" name="setconfig[upload_url]" id="upload_url" size="50" value="<?php echo $upload_url?>" /></td> </tr> </table> </div> <div id="div_setting_2" class="contentList pad-10 hidden"> <table width="100%" class="table_form"> <tr> <th width="120"><?php echo L('setting_admin_log')?></th> <td class="y-bg"> <input name="setconfig[admin_log]" value="1" type="radio" <?php echo ($admin_log=='1') ? ' checked' : ''?>> <?php echo L('setting_yes')?>&nbsp;&nbsp;&nbsp;&nbsp; <input name="setconfig[admin_log]" value="0" type="radio" <?php echo ($admin_log=='0') ? ' checked' : ''?>> <?php echo L('setting_no')?> </td> </tr> <tr> <th width="120"><?php echo L('setting_error_log')?></th> <td class="y-bg"> <input name="setconfig[errorlog]" value="1" type="radio" <?php echo ($errorlog=='1') ? ' checked' : ''?>> <?php echo L('setting_yes')?>&nbsp;&nbsp;&nbsp;&nbsp; <input name="setconfig[errorlog]" value="0" type="radio" <?php echo ($errorlog=='0') ? ' checked' : ''?>> <?php echo L('setting_no')?> </td> </tr> <tr> <th><?php echo L('setting_error_log_size')?></th> <td class="y-bg"><input type="text" class="input-text" name="setting[errorlog_size]" id="errorlog_size" size="5" value="<?php echo $errorlog_size?>"/> MB</td> </tr> <tr> <th><?php echo L('setting_maxloginfailedtimes')?></th> <td class="y-bg"><input type="text" class="input-text" name="setting[maxloginfailedtimes]" id="maxloginfailedtimes" size="10" value="<?php echo $maxloginfailedtimes?>"/></td> </tr> <tr> <th><?php echo L('setting_minrefreshtime')?></th> <td class="y-bg"><input type="text" class="input-text" name="setting[minrefreshtime]" id="minrefreshtime" size="10" value="<?php echo $minrefreshtime?>"/> <?php echo L('miao')?></td> </tr> </table> </div> <div id="div_setting_3" class="contentList pad-10 hidden"> <table width="100%" class="table_form"> <tr> <th width="120"><?php echo L('setting_phpsso')?></th> <td class="y-bg"> <input name="setconfig[phpsso]" value="1" type="radio" <?php echo ($phpsso=='1') ? ' checked' : ''?>> <?php echo L('setting_yes')?>&nbsp;&nbsp;&nbsp;&nbsp; <input name="setconfig[phpsso]" value="0" type="radio" <?php echo ($phpsso=='0') ? ' checked' : ''?>> <?php echo L('setting_no')?></td> </tr> <tr> <th><?php echo L('setting_phpsso_appid')?></th> <td class="y-bg"><input type="text" class="input-text" name="setconfig[phpsso_appid]" id="phpsso_appid" size="30" value="<?php echo $phpsso_appid ?>"/></td> </tr> <tr> <th><?php echo L('setting_phpsso_phpsso_api_url')?></th> <td class="y-bg"><input type="text" class="input-text" name="setconfig[phpsso_api_url]" id="phpsso_api_url" size="50" value="<?php echo $phpsso_api_url ?>"/></td> </tr> <tr> <th><?php echo L('setting_phpsso_auth_key')?></th> <td class="y-bg"><input type="text" class="input-text" name="setconfig[phpsso_auth_key]" id="phpsso_auth_key" size="50" value="<?php echo $phpsso_auth_key ?>"/></td> </tr> <tr> <th><?php echo L('setting_phpsso_version')?></th> <td class="y-bg"><input type="text" class="input-text" name="setconfig[phpsso_version]" id="phpsso_version" size="2" value="<?php echo $phpsso_version ?>"/></td> </tr> </table> </div> <div id="div_setting_4" class="contentList pad-10 hidden"> <table width="100%" class="table_form"> <tr> <th width="120"><?php echo L('mail_type')?></th> <td class="y-bg"> <input name="setting[mail_type]" checkbox="mail_type" value="1" onclick="showsmtp(this)" type="radio" <?php echo $mail_type==1 ? ' checked' : ''?>> <?php echo L('mail_type_smtp')?> <input name="setting[mail_type]" checkbox="mail_type" value="0" onclick="showsmtp(this)" type="radio" <?php echo $mail_type==0 ? ' checked' : ''?> <?php if(substr(strtolower(PHP_OS), 0, 3) == 'win') echo 'disabled'; ?>/> <?php echo L('mail_type_mail')?> </td> </tr> <tbody id="smtpcfg" style="<?php if($mail_type == 0) echo 'display:none'?>"> <tr> <th><?php echo L('mail_server')?></th> <td class="y-bg"><input type="text" class="input-text" name="setting[mail_server]" id="mail_server" size="30" value="<?php echo $mail_server?>"/></td> </tr> <tr> <th><?php echo L('mail_port')?></th> <td class="y-bg"><input type="text" class="input-text" name="setting[mail_port]" id="mail_port" size="30" value="<?php echo $mail_port?>"/></td> </tr> <tr> <th><?php echo L('mail_from')?></th> <td class="y-bg"><input type="text" class="input-text" name="setting[mail_from]" id="mail_from" size="30" value="<?php echo $mail_from?>"/></td> </tr> <tr> <th><?php echo L('mail_auth')?></th> <td class="y-bg"> <input name="setting[mail_auth]" id="mail_auth" value="1" type="radio" <?php echo $mail_auth==1 ? ' checked' : ''?>> <?php echo L('mail_auth_open')?> <input name="setting[mail_auth]" id="mail_auth" value="0" type="radio" <?php echo $mail_auth==0 ? ' checked' : ''?>> <?php echo L('mail_auth_close')?></td> </tr> <tr> <th><?php echo L('mail_user')?></th> <td class="y-bg"><input type="text" class="input-text" name="setting[mail_user]" id="mail_user" size="30" value="<?php echo $mail_user?>"/></td> </tr> <tr> <th><?php echo L('mail_password')?></th> <td class="y-bg"><input type="password" class="input-text" name="setting[mail_password]" id="mail_password" size="30" value="<?php echo $mail_password?>"/></td> </tr> </tbody> <tr> <th><?php echo L('mail_test')?></th> <td class="y-bg"><input type="text" class="input-text" name="mail_to" id="mail_to" size="30" value=""/> <input type="button" class="button" onClick="javascript:test_mail();" value="<?php echo L('mail_test_send')?>"></td> </tr> </table> </div> <div id="div_setting_5" class="contentList pad-10 hidden"> <table width="100%" class="table_form"> <tr> <th width="120"><?php echo L('setting_snda_enable')?></th> <td class="y-bg"> APP key <input type="text" class="input-text" name="setconfig[snda_akey]" id="snda_akey" size="20" value="<?php echo $snda_akey ?>"/> APP secret key <input type="text" class="input-text" name="setconfig[snda_skey]" id="snda_skey" size="40" value="<?php echo $snda_skey ?>"/> <a href="http://code.snda.com/index/oauth" target="_blank"><?php echo L('click_register')?></a> </td> </tr> <tr> <th><?php echo L('setting_connect_sina')?></th> <td class="y-bg"> App key <input type="text" class="input-text" name="setconfig[sina_akey]" id="sina_akey" size="20" value="<?php echo $sina_akey ?>"/> App secret key <input type="text" class="input-text" name="setconfig[sina_skey]" id="sina_skey" size="40" value="<?php echo $sina_skey ?>"/> <a href="http://open.t.sina.com.cn/wiki/index.php/<?php echo L('connect_micro')?>" target="_blank"><?php echo L('click_register')?></a> </td> </tr> <tr> <th><?php echo L('setting_connect_qq')?></th> <td class="y-bg"> App key <input type="text" class="input-text" name="setconfig[qq_akey]" id="qq_akey" size="20" value="<?php echo $qq_akey ?>"/> App secret key <input type="text" class="input-text" name="setconfig[qq_skey]" id="qq_skey" size="40" value="<?php echo $qq_skey ?>"/> <a href="http://open.t.qq.com/" target="_blank"><?php echo L('click_register')?></a> </td> </tr> </table> </div> <div class="bk15"></div> <input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="button"> </div> </div> </form> </body> <script type="text/javascript"> function SwapTab(name,cls_show,cls_hide,cnt,cur){ for(i=1;i<=cnt;i++){ if(i==cur){ $('#div_'+name+'_'+i).show(); $('#tab_'+name+'_'+i).attr('class',cls_show); }else{ $('#div_'+name+'_'+i).hide(); $('#tab_'+name+'_'+i).attr('class',cls_hide); } } } function showsmtp(obj,hiddenid){ hiddenid = hiddenid ? hiddenid : 'smtpcfg'; var status = $(obj).val(); if(status == 1) $("#"+hiddenid).show(); else $("#"+hiddenid).hide(); } function test_mail() { var mail_type = $('input[checkbox=mail_type][checked]').val(); $.post('?m=admin&c=setting&a=public_test_mail&mail_to='+$('#mail_to').val(),{mail_type:mail_type,mail_server:$('#mail_server').val(),mail_port:$('#mail_port').val(),mail_user:$('#mail_user').val(),mail_password:$('#mail_password').val(),mail_auth:$('#mail_auth').val(),mail_auth:$('#mail_auth').val(),mail_from:$('#mail_from').val()}, function(data){ alert(data); }); } </script> </html>
108wo
phpcms/modules/admin/templates/setting.tpl.php
PHP
asf20
14,912
<?php defined('IN_ADMIN') or exit('No permission resources.'); $show_dialog = 1; include $this->admin_tpl('header','admin'); ?> <div class="pad-lr-10"> <form name="myform" id="myform" action="?m=admin&c=copyfrom&a=listorder" method="post"> <div class="table-list"> <table width="100%" cellspacing="0"> <thead> <tr> <th width="55" align="center"><?php echo L('listorder');?></th> <th><?php echo L('copyfrom_name');?></th> <th ><?php echo L('copyfrom_url')?></th> <th ><?php echo L('copyfrom_logo')?></th> <th width="120"><?php echo L('operations_manage')?></th> </tr> </thead> <tbody> <?php foreach($datas as $r) { ?> <tr> <td align="center"><input type="text" name="listorders[<?php echo $r['id']?>]" value="<?php echo $r['listorder']?>" size="3" class='input-text-c'></td> <td align="center"><?php echo $r['sitename']?></td> <td align="center"><?php echo $r['siteurl']?></td> <td align="center"><?php if($r['thumb']) {?><img src="<?php echo $r['thumb']?>"><?php }?></td> <td align="center"><a href="javascript:edit('<?php echo $r['id']?>','<?php echo new_addslashes($r['sitename'])?>')"><?php echo L('edit');?></a> | <a href="javascript:;" onclick="data_delete(this,'<?php echo $r['id']?>','<?php echo L('confirm',array('message'=>new_addslashes($r['sitename'])));?>')"><?php echo L('delete')?></a> </td> </tr> <?php } ?> </tbody> </table> <div class="btn"><input type="submit" class="button" name="dosubmit" value="<?php echo L('listorder')?>" /></div> </div> <div id="pages"><?php echo $pages?></div> </div> </form></div> </body> </html> <script type="text/javascript"> <!-- function edit(id, name) { window.top.art.dialog({id:'edit'}).close(); window.top.art.dialog({title:'<?php echo L('edit');?>《'+name+'》',id:'edit',iframe:'?m=admin&c=copyfrom&a=edit&id='+id,width:'580',height:'240'}, function(){var d = window.top.art.dialog({id:'edit'}).data.iframe;d.document.getElementById('dosubmit').click();return false;}, function(){window.top.art.dialog({id:'edit'}).close()}); } function data_delete(obj,id,name){ window.top.art.dialog({content:name, fixed:true, style:'confirm', id:'data_delete'}, function(){ $.get('?m=admin&c=copyfrom&a=delete&id='+id+'&pc_hash='+pc_hash,function(data){ if(data) { $(obj).parent().parent().fadeOut("slow"); } }) }, function(){}); }; //--> </script>
108wo
phpcms/modules/admin/templates/copyfrom_list.tpl.php
PHP
asf20
2,491
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header'); ?> <form name="myform" action="?m=admin&c=position&a=public_item" method="post"> <input type="hidden" value="<?php echo $posid?>" name="posid"> <div class="pad_10"> <div class="table-list"> <table width="100%" cellspacing="0"> <thead> <tr> <th width="10%" align="left"><input type="checkbox" value="" id="check_box" onclick="selectall('items[]');"></th> <th width="10%" align="left"><?php echo L('listorder');?></th> <th width="10%" align="left">ID</th> <th width="" align="left"><?php echo L('title');?></th> <th width="15%"><?php echo L('catname');?></th> <th width="15%"><?php echo L('inputtime')?></th> <th width="15%"><?php echo L('posid_operation');?></th> </tr> </thead> <tbody> <?php if(is_array($infos)){ foreach($infos as $info){ ?> <tr> <td width="10%"> <input type="checkbox" name="items[]" value="<?php echo $info['id'],'-',$info['modelid']?>" id="items" boxid="items"> </td> <td width="10%"> <input name='listorders[<?php echo $info['catid'],'-',$info['id']?>]' type='text' size='3' value='<?php echo $info['listorder']?>' class="input-text-c"> </td> <td width="10%" align="left"><?php echo $info['id']?></td> <td width="" align="left"><?php echo $info['title']?> <?php if($info['thumb']!='') {echo '<img src="'.IMG_PATH.'icon/small_img.gif">'; }?></td> <td width="15%" align="center"><?php echo $info['catname']?></td> <td width="15%" align="center"><?php echo date('Y-m-d H:i:s',$info['inputtime'])?></td> <td width="15%" align="center"><a href="<?php echo $info['url']?>" target="_blank"><?php echo L('posid_item_view')?></a> | <a onclick="javascript:openwinx('?m=content&c=content&a=edit&catid=<?php echo $info['catid']?>&id=<?php echo $info['id']?>','')" href="javascript:;"><?php echo L('posid_item_edit');?></a> | <a href="javascript:item_manage(<?php echo $info['id']?>,<?php echo $info['posid']?>, <?php echo $info['modelid']?>,'<?php echo $info['title']?>')"><?php echo L('posid_item_manage')?></a> </td> </tr> <?php } } ?> </tbody> </table> <div class="btn"><label for="check_box"><?php echo L('select_all')?>/<?php echo L('cancel')?></label> <input type="button" class="button" value="<?php echo L('listorder')?>" onclick="myform.action='?m=admin&c=position&a=public_item_listorder';myform.submit();"/> <input type="submit" class="button" name="dosubmit" value="<?php echo L('posid_item_remove')?>" /> </div></div> <div id="pages"> <?php echo $pages?></div> </div> </div> </form> </body> </html> <script type="text/javascript"> function item_manage(id,posid, modelid, name) { window.top.art.dialog({title:'<?php echo L('edit')?>--'+name, id:'edit', iframe:'?m=admin&c=position&a=public_item_manage&id='+id+'&posid='+posid+'&modelid='+modelid ,width:'550px',height:'430px'}, function(){var d = window.top.art.dialog({id:'edit'}).data.iframe; var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'edit'}).close()}); } </script>
108wo
phpcms/modules/admin/templates/position_items.tpl.php
PHP
asf20
3,255
<?php defined('IN_ADMIN') or exit('No permission resources.'); $show_header = true; $show_scroll = true; include $this->admin_tpl('header'); ?> <body scroll="no"> <div style="padding:6px 3px"> <div class="col-2 col-left mr6" style="width:140px"> <h6><img src="<?php echo IMG_PATH?>icon/sitemap-application-blue.png" width="16" height="16" /> <?php echo L('site_select');?></h6> <ul class="content role-memu" id="site_list"> <?php foreach($sites_list as $n=>$r) {?> <li><a href="?m=admin&c=role&a=setting_cat_priv&siteid=<?php echo $r['siteid']?>&roleid=<?php echo $roleid?>&op=1" target="role"><span><img src="<?php echo IMG_PATH?>icon/gear_disable.png" width="16" height="16" /><?php echo L('sys_setting');?></span><em><?php echo $r['name']?></em></a></li> <?php } ?> </ul> </div> <div class="col-2 col-auto"> <div class="content" style="padding:1px"> <iframe name="role" id="role" src="?m=admin&c=role&a=role_priv&pc_hash=<?php echo $_SESSION['pc_hash']?>" frameborder="false" scrolling="auto" style="overflow-x:hidden;border:none" width="100%" height="483" allowtransparency="true"></iframe> </div> </div> </div> </body> </html> <script type="text/javascript"> $("#site_list li").click( function(){$(this).addClass("on").siblings().removeClass('on')} ); </script>
108wo
phpcms/modules/admin/templates/role_cat_priv.tpl.php
PHP
asf20
1,394
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header');?> <div class="pad_10"> <div class="table-list"> <xmp><?php echo $structure?></xmp> </div> </div> </body> </html>
108wo
phpcms/modules/admin/templates/database_structure.tpl.php
PHP
asf20
220
<?php defined('IN_ADMIN') or exit('No permission resources.'); $show_dialog = 1; include $this->admin_tpl('header','admin'); ?> <div class="pad-lr-10"> <form name="myform" id="myform" action="?m=admin&c=badword&a=delete" method="post" onsubmit="checkuid();return false;"> <div class="table-list"> <table width="100%" cellspacing="0"> <thead> <tr> <th width="35" align="center"><input type="checkbox" value="" id="check_box" onclick="selectall('badid[]');"></th> <th ><?php echo L('badword_name')?></th> <th ><?php echo L('badword_replacename')?></th> <th width="80"><?php echo L('badword_level')?></th> <th width="120"><?php echo L('inputtime')?></th> <th width="120"><?php echo L('operations_manage')?></th> </tr> </thead> <tbody> <?php if(is_array($infos)){ foreach($infos as $info){ ?> <tr> <td align="center"> <input type="checkbox" name="badid[]" value="<?php echo $info['badid']?>"> </td> <td align="center"><span class="<?php echo $info['style']?>"><?php echo $info['badword']?></span> </td> <td align="center"><?php echo $info['replaceword']?></td> <td align="center"><?php echo $level[$info['level']]?></td> <td align="center"><?php echo $info['lastusetime'] ? date('Y-m-d H:i', $info['lastusetime']):''?></td> <td align="center"><a href="javascript:edit(<?php echo $info['badid']?>, '<?php echo new_addslashes($info['badword'])?>')"><?php echo L('edit')?></a> | <a href="javascript:confirmurl('?m=admin&c=badword&a=delete&badid=<?php echo $info['badid']?>', '<?php echo L('badword_confirm_del')?>')"><?php echo L('delete')?></a> </td> </tr> <?php } } ?> </tbody> </table> <div class="btn"> <a href="#" onClick="javascript:$('input[type=checkbox]').attr('checked', true)"><?php echo L('selected_all')?></a>/<a href="#" onClick="javascript:$('input[type=checkbox]').attr('checked', false)"><?php echo L('cancel')?></a> <input type="submit" name="submit" class="button" value="<?php echo L('remove_all_selected')?>" onClick="return confirm('<?php echo L('badword_confom_del')?>')" /> </div> <div id="pages"><?php echo $pages?></div> </div> </form> </div> </body> </html> <script type="text/javascript"> function edit(id, name) { window.top.art.dialog({id:'edit'}).close(); window.top.art.dialog({title:'<?php echo L('badword_edit')?> '+name+' ',id:'edit',iframe:'?m=admin&c=badword&a=edit&badid='+id,width:'450',height:'180'}, function(){var d = window.top.art.dialog({id:'edit'}).data.iframe;var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'edit'}).close()}); } function checkuid() { var ids=''; $("input[name='badid[]']:checked").each(function(i, n){ ids += $(n).val() + ','; }); if(ids=='') { window.top.art.dialog({content:'<?php echo L('badword_pleasechose')?>',lock:true,width:'200',height:'50',time:1.5},function(){}); return false; } else { myform.submit(); } } </script>
108wo
phpcms/modules/admin/templates/badword_list.tpl.php
PHP
asf20
3,126
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header');?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}}); $("#sitename").formValidator({onshow:"<?php echo L('input').L('mirrors_name')?>",onfocus:"<?php echo L('mirrors_name').L('downserver_not_empty')?>"}).inputValidator({min:1,max:999,onerror:"<?php echo L('downserver_name').L('downserver_not_empty')?>"}); $("#siteurl").formValidator({onshow:"<?php echo L('mirror_address')?>",onfocus:"<?php echo L('mirror_address')?>"}).inputValidator({onerror:"<?php echo L('downserver_error')?>"}).regexValidator({regexp:"([a-zA-Z]+):\/\/(.+)[^\/]$",onerror:"<?php echo L('downserver_error')?>"}); }) //--> </script> <div class="pad_10"> <div class="common-form"> <form name="myform" action="?m=admin&c=downservers&a=edit" method="post" id="myform"> <input type="hidden" name="id" value="<?php echo $id?>"></input> <table width="100%" class="table_form"> <tr> <td width="80"><?php echo L('mirrors_name')?></td> <td><input type="text" name="info[sitename]" class="input-text" value="<?php echo $sitename?>" id="sitename"></input></td> </tr> <tr> <td width="80"><?php echo L('mirror_address')?></td> <td><input type="text" name="info[siteurl]" class="input-text" value="<?php echo $siteurl?>" id="siteurl" size="40"></input></td> </tr> <tr> <td><?php echo L('site_select')?></td> <td><?php echo form::select($sitelist,$siteid,'name="info[siteid]"',$default)?></td> </tr> </table> <input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="dialog" id="dosubmit"> </form> </div> </div> </body> </html>
108wo
phpcms/modules/admin/templates/downservers_edit.tpl.php
PHP
asf20
1,744
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header');?> <form name="myform" action="?m=admin&c=position&a=listorder" method="post"> <div class="pad_10"> <div class="table-list"> <table width="100%" cellspacing="0"> <thead> <tr> <th width="10%" align="left"><?php echo L('listorder');?></th> <th width="5%" align="left">ID</th> <th width="15%"><?php echo L('posid_name');?></th> <th width="15%"><?php echo L('posid_catid');?></th> <th width="15%"><?php echo L('posid_modelid');?></th> <th width="20%"><?php echo L('posid_operation');?></th> </tr> </thead> <tbody> <?php if(is_array($infos)){ foreach($infos as $info){ ?> <tr> <td width="10%"> <input name='listorders[<?php echo $info['posid']?>]' type='text' size='2' value='<?php echo $info['listorder']?>' class="input-text-c"> </td> <td width="5%" align="left"><?php echo $info['posid']?></td> <td width="15%" align="center"><?php echo $info['name']?></td> <td width="15%" align="center"><?php echo $info['catid'] ? $category[$info['catid']]['catname'] : L('posid_all')?></td> <td width="15%" align="center"><?php echo $info['modelid'] ? $model[$info['modelid']]['name'] : L('posid_all')?></td> <td width="20%" align="center"> <a href="?m=admin&c=position&a=public_item&posid=<?php echo $info['posid']?>&menuid=<?php echo $_GET['menuid']?>"><?php echo L('posid_item_manage')?></a> | <a href="javascript:edit(<?php echo $info['posid']?>, '<?php echo new_addslashes($info['name'])?>')"><?php echo L('edit')?></a> | <?php if($info['siteid']=='0' && $_SESSION['roleid'] != 1) {?> <font color="#ccc"><?php echo L('delete')?></font> <?php } else {?> <a href="javascript:confirmurl('?m=admin&c=position&a=delete&posid=<?php echo $info['posid']?>', '<?php echo L('posid_del_cofirm')?>')"><?php echo L('delete')?></a> <?php } ?> </td> </tr> <?php } } ?> </tbody> </table> <div class="btn"><input type="submit" class="button" name="dosubmit" value="<?php echo L('listorder')?>" /></div> </div> <div id="pages"> <?php echo $pages?></div> </div> </div> </form> </body> <a href="javascript:edit(<?php echo $v['siteid']?>, '<?php echo $v['name']?>')"> </html> <script type="text/javascript"> <!-- window.top.$('#display_center_id').css('display','none'); function edit(id, name) { window.top.art.dialog({title:'<?php echo L('edit')?>--'+name, id:'edit', iframe:'?m=admin&c=position&a=edit&posid='+id ,width:'500px',height:'360px'}, function(){var d = window.top.art.dialog({id:'edit'}).data.iframe; var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'edit'}).close()}); } //--> </script>
108wo
phpcms/modules/admin/templates/position_list.tpl.php
PHP
asf20
2,874
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); class copyfrom extends admin { private $db; public $siteid; function __construct() { $this->db = pc_base::load_model('copyfrom_model'); pc_base::load_sys_class('form', '', 0); parent::__construct(); $this->siteid = $this->get_siteid(); } /** * 来源管理列表 */ public function init () { $datas = array(); $datas = $this->db->listinfo(array('siteid'=>$this->siteid),'listorder ASC',$_GET['page']); $pages = $this->db->pages; $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=admin&c=copyfrom&a=add\', title:\''.L('add_copyfrom').'\', width:\'580\', height:\'240\', lock:true}, function(){var d = window.top.art.dialog({id:\'add\'}).data.iframe;var form = d.document.getElementById(\'dosubmit\');form.click();return false;}, function(){window.top.art.dialog({id:\'add\'}).close()});void(0);', L('add_copyfrom')); $this->public_cache(); include $this->admin_tpl('copyfrom_list'); } /** * 添加来源 */ public function add() { if(isset($_POST['dosubmit'])) { $_POST['info'] = $this->check($_POST['info']); $this->db->insert($_POST['info']); showmessage(L('add_success'), '', '', 'add'); } else { $show_header = $show_validator = ''; include $this->admin_tpl('copyfrom_add'); } } /** * 管理来源 */ public function edit() { if(isset($_POST['dosubmit'])) { $id = intval($_POST['id']); $_POST['info'] = $this->check($_POST['info']); $this->db->update($_POST['info'],array('id'=>$id)); showmessage(L('update_success'), '', '', 'edit'); } else { $show_header = $show_validator = ''; $id = intval($_GET['id']); if (!$id) showmessage(L('illegal_action')); $r = $this->db->get_one(array('id'=>$id, 'siteid'=>$this->siteid)); if (empty($r)) showmessage(L('illegal_action')); extract($r); include $this->admin_tpl('copyfrom_edit'); } } /** * 删除来源 */ public function delete() { $_GET['id'] = intval($_GET['id']); if (!$_GET['id']) showmessage(L('illegal_action')); $this->db->delete(array('id'=>$_GET['id'], 'siteid'=>$this->siteid)); exit('1'); } /** * 检查POST数据 * @param array $data 前台POST数据 * @return array $data */ private function check($data = array()) { if (!is_array($data) || empty($data)) return array(); if (!preg_match('/^((http|https):\/\/)?([^\/]+)/i', $data['siteurl'])) showmessage(L('input').L('copyfrom_url')); if (empty($data['sitename'])) showmessage(L('input').L('copyfrom_name')); if ($data['thumb'] && !preg_match('/^((http|https):\/\/)?([^\/]+)/i', $data['thumb'])) showmessage(L('copyfrom_logo').L('format_incorrect')); $data['siteid'] = $this->siteid; return $data; } /** * 排序 */ public function listorder() { if(isset($_POST['dosubmit'])) { foreach($_POST['listorders'] as $id => $listorder) { $this->db->update(array('listorder'=>$listorder),array('id'=>$id)); } showmessage(L('operation_success'),HTTP_REFERER); } else { showmessage(L('operation_failure')); } } /** * 生成缓存 */ public function public_cache() { $infos = $this->db->select('','*','','listorder DESC','','id'); setcache('copyfrom', $infos, 'admin'); return true; } } ?>
108wo
phpcms/modules/admin/copyfrom.php
PHP
asf20
3,436
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); class release_point extends admin { private $db; public $ssl = 0; public function __construct() { parent::__construct(); $this->db = pc_base::load_model('release_point_model'); if (function_exists('ftp_ssl_connect')) { $this->ssl = 1; } } public function init() { $list = $this->db->select(); $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=admin&c=release_point&a=add\', title:\''.L('release_point_add').'\', width:\'700\', height:\'500\', lock:true}, function(){var d = window.top.art.dialog({id:\'add\'}).data.iframe;var form = d.document.getElementById(\'dosubmit\');form.click();return false;}, function(){window.top.art.dialog({id:\'add\'}).close()});void(0);', L('release_point_add')); include $this->admin_tpl('release_point_list'); } public function add() { if (isset($_POST['dosubmit'])) { $name = isset($_POST['name']) && trim($_POST['name']) ? trim($_POST['name']) : showmessage(L('release_point_name').L('empty')); $host = isset($_POST['host']) && trim($_POST['host']) ? trim($_POST['host']) : showmessage(L('server_address').L('empty')); $port = isset($_POST['port']) && intval($_POST['port']) ? intval($_POST['port']) : showmessage(L('server_port').L('empty')); $username = isset($_POST['username']) && trim($_POST['username']) ? trim($_POST['username']) : showmessage(L('username').L('empty')); $password = isset($_POST['password']) && trim($_POST['password']) ? trim($_POST['password']) : showmessage(L('password').L('empty')); $path = isset($_POST['path']) && trim($_POST['path']) ? trim($_POST['path']) : showmessage(L('path').L('empty')); $pasv = isset($_POST['pasv']) && trim($_POST['pasv']) ? trim($_POST['pasv']) : 0; $ssl = isset($_POST['ssl']) && trim($_POST['ssl']) ? trim($_POST['ssl']) : 0; if ($this->db->get_one(array("name"=>$name))) { showmessage(L('release_point_name').L('exists')); } if ($this->db->insert(array('name'=>$name,'host'=>$host,'port'=>$port,'username'=>$username, 'password'=>$password, 'path'=>$path, 'pasv'=>$pasv, 'ssl'=>$ssl))) { showmessage(L('operation_success'), '', '', 'add'); } else { showmessage(L('operation_failure')); } } $show_header = $show_validator = true; include $this->admin_tpl('release_point_add'); } public function edit() { $id = isset($_GET['id']) && intval($_GET['id']) ? intval($_GET['id']) : showmessage(L('illegal_parameters'), HTTP_REFERER); if ($data = $this->db->get_one(array('id'=>$id))) { if (isset($_POST['dosubmit'])) { $name = isset($_POST['name']) && trim($_POST['name']) ? trim($_POST['name']) : showmessage(L('release_point_name').L('empty')); $host = isset($_POST['host']) && trim($_POST['host']) ? trim($_POST['host']) : showmessage(L('server_address').L('empty')); $port = isset($_POST['port']) && intval($_POST['port']) ? intval($_POST['port']) : showmessage(L('server_port').L('empty')); $username = isset($_POST['username']) && trim($_POST['username']) ? trim($_POST['username']) : showmessage(L('username').L('empty')); $password = isset($_POST['password']) && trim($_POST['password']) ? trim($_POST['password']) : showmessage(L('password').L('empty')); $path = isset($_POST['path']) && trim($_POST['path']) ? trim($_POST['path']) : showmessage(L('path').L('empty')); $pasv = isset($_POST['pasv']) && trim($_POST['pasv']) ? trim($_POST['pasv']) : 0; $ssl = isset($_POST['ssl']) && trim($_POST['ssl']) ? trim($_POST['ssl']) : 0; if ($data['name'] != $name && $this->db->get_one(array("name"=>$name))) { showmessage(L('release_point_name').L('exists')); } if ($this->db->update(array('name'=>$name,'host'=>$host,'port'=>$port,'username'=>$username, 'password'=>$password, 'path'=>$path, 'pasv'=>$pasv, 'ssl'=>$ssl), array('id'=>$id))) { showmessage(L('operation_success'), '', '', 'edit'); } else { showmessage(L('operation_failure')); } } $show_header = $show_validator = true; include $this->admin_tpl('release_point_edit'); } else { showmessage(L('notfound'), HTTP_REFERER); } } public function public_name() { $name = isset($_GET['name']) && trim($_GET['name']) ? (pc_base::load_config('system', 'charset') == 'gbk' ? iconv('utf-8', 'gbk', trim($_GET['name'])) : trim($_GET['name'])) : exit('0'); $id = isset($_GET['id']) && intval($_GET['id']) ? intval($_GET['id']) : ''; $data = array(); if ($id) { $data = $this->db->get_one(array('id'=>$id), 'name'); if (!empty($data) && $data['name'] == $name) { exit('1'); } } if ($this->db->get_one(array('name'=>$name), 'id')) { exit('0'); } else { exit('1'); } } public function del() { $id = isset($_GET['id']) && intval($_GET['id']) ? intval($_GET['id']) : showmessage(L('illegal_parameters'), HTTP_REFERER); if ($this->db->get_one(array('id'=>$id))) { if ($this->db->delete(array('id'=>$id))) { showmessage(L('operation_success'), HTTP_REFERER); } else { showmessage(L('operation_failure'), HTTP_REFERER); } } else { showmessage(L('notfound'), HTTP_REFERER); } } public function public_test_ftp() { $host = isset($_GET['host']) && trim($_GET['host']) ? trim($_GET['host']) : exit('0'); $port = isset($_GET['port']) && intval($_GET['port']) ? intval($_GET['port']) : exit('0'); $username = isset($_GET['username']) && trim($_GET['username']) ? trim($_GET['username']) : exit('0'); $password = isset($_GET['password']) && trim($_GET['password']) ? trim($_GET['password']) : exit('0'); $pasv = isset($_GET['pasv']) && trim($_GET['pasv']) ? trim($_GET['pasv']) : 0; $ssl = isset($_GET['ssl']) && trim($_GET['ssl']) ? trim($_GET['ssl']) : 0; $ftp = pc_base::load_sys_class('ftps'); if ($ftp->connect($host, $username, $password, $port, $pasv, $ssl, 25)) { if ($ftp->link_time > 15) { exit(L('ftp_connection_a_long_time')); } exit('1'); } else { exit(L('can_ftp_server_connections')); } } }
108wo
phpcms/modules/admin/release_point.php
PHP
asf20
6,178
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); class menu extends admin { function __construct() { parent::__construct(); $this->db = pc_base::load_model('menu_model'); } function init () { $tree = pc_base::load_sys_class('tree'); $tree->icon = array('&nbsp;&nbsp;&nbsp;│ ','&nbsp;&nbsp;&nbsp;├─ ','&nbsp;&nbsp;&nbsp;└─ '); $tree->nbsp = '&nbsp;&nbsp;&nbsp;'; $userid = $_SESSION['userid']; $admin_username = param::get_cookie('admin_username'); $table_name = $this->db->table_name; $result = $this->db->select('','*','','listorder ASC,id DESC'); $array = array(); foreach($result as $r) { $r['cname'] = L($r['name']); $r['str_manage'] = '<a href="?m=admin&c=menu&a=add&parentid='.$r['id'].'&menuid='.$_GET['menuid'].'">'.L('add_submenu').'</a> | <a href="?m=admin&c=menu&a=edit&id='.$r['id'].'&menuid='.$_GET['menuid'].'">'.L('modify').'</a> | <a href="javascript:confirmurl(\'?m=admin&c=menu&a=delete&id='.$r['id'].'&menuid='.$_GET['menuid'].'\',\''.L('confirm',array('message'=>$r['cname'])).'\')">'.L('delete').'</a> '; $array[] = $r; } $str = "<tr> <td align='center'><input name='listorders[\$id]' type='text' size='3' value='\$listorder' class='input-text-c'></td> <td align='center'>\$id</td> <td >\$spacer\$cname</td> <td align='center'>\$str_manage</td> </tr>"; $tree->init($array); $categorys = $tree->get_tree(0, $str); include $this->admin_tpl('menu'); } function add() { if(isset($_POST['dosubmit'])) { $this->db->insert($_POST['info']); //开发过程中用于自动创建语言包 $file = PC_PATH.'languages'.DIRECTORY_SEPARATOR.'zh-cn'.DIRECTORY_SEPARATOR.'system_menu.lang.php'; if(file_exists($file)) { $content = file_get_contents($file); $content = substr($content,0,-2); $key = $_POST['info']['name']; $data = $content."\$LANG['$key'] = '$_POST[language]';\r\n?>"; file_put_contents($file,$data); } else { $key = $_POST['info']['name']; $data = "<?php\r\n\$LANG['$key'] = '$_POST[language]';\r\n?>"; file_put_contents($file,$data); } //结束 showmessage(L('add_success')); } else { $show_validator = ''; $tree = pc_base::load_sys_class('tree'); $result = $this->db->select(); $array = array(); foreach($result as $r) { $r['cname'] = L($r['name']); $r['selected'] = $r['id'] == $_GET['parentid'] ? 'selected' : ''; $array[] = $r; } $str = "<option value='\$id' \$selected>\$spacer \$cname</option>"; $tree->init($array); $select_categorys = $tree->get_tree(0, $str); include $this->admin_tpl('menu'); } } function delete() { $_GET['id'] = intval($_GET['id']); $this->db->delete(array('id'=>$_GET['id'])); showmessage(L('operation_success')); } function edit() { if(isset($_POST['dosubmit'])) { $id = intval($_POST['id']); //print_r($_POST['info']);exit; $this->db->update($_POST['info'],array('id'=>$id)); //修改语言文件 $file = PC_PATH.'languages'.DIRECTORY_SEPARATOR.'zh-cn'.DIRECTORY_SEPARATOR.'system_menu.lang.php'; require $file; $key = $_POST['info']['name']; if(!isset($LANG[$key])) { $content = file_get_contents($file); $content = substr($content,0,-2); $data = $content."\$LANG['$key'] = '$_POST[language]';\r\n?>"; file_put_contents($file,$data); } elseif(isset($LANG[$key]) && $LANG[$key]!=$_POST['language']) { $content = file_get_contents($file); $content = str_replace($LANG[$key],$_POST['language'],$content); file_put_contents($file,$content); } //结束语言文件修改 showmessage(L('operation_success')); } else { $show_validator = $array = $r = ''; $tree = pc_base::load_sys_class('tree'); $id = intval($_GET['id']); $r = $this->db->get_one(array('id'=>$id)); if($r) extract($r); $result = $this->db->select(); foreach($result as $r) { $r['cname'] = L($r['name']); $r['selected'] = $r['id'] == $parentid ? 'selected' : ''; $array[] = $r; } $str = "<option value='\$id' \$selected>\$spacer \$cname</option>"; $tree->init($array); $select_categorys = $tree->get_tree(0, $str); include $this->admin_tpl('menu'); } } /** * 排序 */ function listorder() { if(isset($_POST['dosubmit'])) { foreach($_POST['listorders'] as $id => $listorder) { $this->db->update(array('listorder'=>$listorder),array('id'=>$id)); } showmessage(L('operation_success')); } else { showmessage(L('operation_failure')); } } } ?>
108wo
phpcms/modules/admin/menu.php
PHP
asf20
4,716
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin', 'admin', 0); class site extends admin { private $db; public function __construct() { $this->db = pc_base::load_model('site_model'); parent::__construct(); } public function init() { $total = $this->db->count(); $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1; $pagesize = 20; $offset = ($page - 1) * $pagesize; $list = $this->db->select('', '*', $offset.','.$pagesize); $pages = pages($total, $page, $pagesize); $show_dialog = true; $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=admin&c=site&a=add\', title:\''.L('add_site').'\', width:\'700\', height:\'500\', lock:true}, function(){var d = window.top.art.dialog({id:\'add\'}).data.iframe;var form = d.document.getElementById(\'dosubmit\');form.click();return false;}, function(){window.top.art.dialog({id:\'add\'}).close()});void(0);', L('add_site')); include $this->admin_tpl('site_list'); } public function add() { header("Cache-control: private"); if (isset($_GET['show_header'])) $show_header = 1; if (isset($_POST['dosubmit'])) { $name = isset($_POST['name']) && trim($_POST['name']) ? trim($_POST['name']) : showmessage(L('site_name').L('empty')); $dirname = isset($_POST['dirname']) && trim($_POST['dirname']) ? strtolower(trim($_POST['dirname'])) : showmessage(L('site_dirname').L('empty')); $domain = isset($_POST['domain']) && trim($_POST['domain']) ? trim($_POST['domain']) : ''; $site_title = isset($_POST['site_title']) && trim($_POST['site_title']) ? trim($_POST['site_title']) : ''; $keywords = isset($_POST['keywords']) && trim($_POST['keywords']) ? trim($_POST['keywords']) : ''; $description = isset($_POST['description']) && trim($_POST['description']) ? trim($_POST['description']) : ''; $release_point = isset($_POST['release_point']) ? $_POST['release_point'] : ''; $template = isset($_POST['template']) && !empty($_POST['template']) ? $_POST['template'] : showmessage(L('please_select_a_style')); $default_style = isset($_POST['default_style']) && !empty($_POST['default_style']) ? $_POST['default_style'] : showmessage(L('please_choose_the_default_style')); if ($this->db->get_one(array('name'=>$name), 'siteid')) { showmessage(L('site_name').L('exists')); } if (!preg_match('/^\\w+$/i', $dirname)) { showmessage(L('site_dirname').L('site_dirname_err_msg')); } if ($this->db->get_one(array('dirname'=>$dirname), 'siteid')) { showmessage(L('site_dirname').L('exists')); } if (!empty($domain) && !preg_match('/http:\/\/(.+)\/$/i', $domain)) { showmessage(L('site_domain').L('site_domain_ex2')); } if (!empty($domain) && $this->db->get_one(array('domain'=>$domain), 'siteid')) { showmessage(L('site_domain').L('exists')); } if (!empty($release_point) && is_array($release_point)) { if (count($release_point) > 4) { showmessage(L('release_point_configuration').L('most_choose_four')); } $s = ''; foreach ($release_point as $key=>$val) { if($val) $s.= $s ? ",$val" : $val; } $release_point = $s; unset($s); } else { $release_point = ''; } if (!empty($template) && is_array($template)) { $template = implode(',', $template); } else { $template = ''; } $_POST['setting']['watermark_img'] = IMG_PATH.'water/'.$_POST['setting']['watermark_img']; $setting = trim(array2string($_POST['setting'])); if ($this->db->insert(array('name'=>$name,'dirname'=>$dirname, 'domain'=>$domain, 'site_title'=>$site_title, 'keywords'=>$keywords, 'description'=>$description, 'release_point'=>$release_point, 'template'=>$template,'setting'=>$setting, 'default_style'=>$default_style))) { $class_site = pc_base::load_app_class('sites'); $class_site->set_cache(); showmessage(L('operation_success'), '?m=admin&c=site&a=init', '', 'add'); } else { showmessage(L('operation_failure')); } } else { $release_point_db = pc_base::load_model('release_point_model'); $release_point_list = $release_point_db->select('', 'id, name'); $show_validator = $show_scroll = $show_header = true; $template_list = template_list(); include $this->admin_tpl('site_add'); } } public function del() { $siteid = isset($_GET['siteid']) && intval($_GET['siteid']) ? intval($_GET['siteid']) : showmessage(L('illegal_parameters'), HTTP_REFERER); if($siteid==1) showmessage(L('operation_failure'), HTTP_REFERER); if ($this->db->get_one(array('siteid'=>$siteid))) { if ($this->db->delete(array('siteid'=>$siteid))) { $class_site = pc_base::load_app_class('sites'); $class_site->set_cache(); showmessage(L('operation_success'), HTTP_REFERER); } else { showmessage(L('operation_failure'), HTTP_REFERER); } } else { showmessage(L('notfound'), HTTP_REFERER); } } public function edit() { $siteid = isset($_GET['siteid']) && intval($_GET['siteid']) ? intval($_GET['siteid']) : showmessage(L('illegal_parameters'), HTTP_REFERER); if ($data = $this->db->get_one(array('siteid'=>$siteid))) { if (isset($_POST['dosubmit'])) { $name = isset($_POST['name']) && trim($_POST['name']) ? trim($_POST['name']) : showmessage(L('site_name').L('empty')); $dirname = isset($_POST['dirname']) && trim($_POST['dirname']) ? strtolower(trim($_POST['dirname'])) : ($siteid == 1 ? '' :showmessage(L('site_dirname').L('empty'))); $domain = isset($_POST['domain']) && trim($_POST['domain']) ? trim($_POST['domain']) : ''; $site_title = isset($_POST['site_title']) && trim($_POST['site_title']) ? trim($_POST['site_title']) : ''; $keywords = isset($_POST['keywords']) && trim($_POST['keywords']) ? trim($_POST['keywords']) : ''; $description = isset($_POST['description']) && trim($_POST['description']) ? trim($_POST['description']) : ''; $release_point = isset($_POST['release_point']) ? $_POST['release_point'] : ''; $template = isset($_POST['template']) && !empty($_POST['template']) ? $_POST['template'] : showmessage(L('please_select_a_style')); $default_style = isset($_POST['default_style']) && !empty($_POST['default_style']) ? $_POST['default_style'] : showmessage(L('please_choose_the_default_style')); if ($data['name'] != $name && $this->db->get_one(array('name'=>$name), 'siteid')) { showmessage(L('site_name').L('exists')); } if ($siteid != 1) { if (!preg_match('/^\\w+$/i', $dirname)) { showmessage(L('site_dirname').L('site_dirname_err_msg')); } if ($data['dirname'] != $dirname && $this->db->get_one(array('dirname'=>$dirname), 'siteid')) { showmessage(L('site_dirname').L('exists')); } } if (!empty($domain) && !preg_match('/http:\/\/(.+)\/$/i', $domain)) { showmessage(L('site_domain').L('site_domain_ex2')); } if (!empty($domain) && $data['domain'] != $domain && $this->db->get_one(array('domain'=>$domain), 'siteid')) { showmessage(L('site_domain').L('exists')); } if (!empty($release_point) && is_array($release_point)) { if (count($release_point) > 4) { showmessage(L('release_point_configuration').L('most_choose_four')); } $s = ''; foreach ($release_point as $key=>$val) { if($val) $s.= $s ? ",$val" : $val; } $release_point = $s; unset($s); } else { $release_point = ''; } if (!empty($template) && is_array($template)) { $template = implode(',', $template); } else { $template = ''; } $_POST['setting']['watermark_img'] = 'statics/images/water/'.$_POST['setting']['watermark_img']; $setting = trim(array2string($_POST['setting'])); $sql = array('name'=>$name,'dirname'=>$dirname, 'domain'=>$domain, 'site_title'=>$site_title, 'keywords'=>$keywords, 'description'=>$description, 'release_point'=>$release_point, 'template'=>$template, 'setting'=>$setting, 'default_style'=>$default_style); if ($siteid == 1) unset($sql['dirname']); if ($this->db->update($sql, array('siteid'=>$siteid))) { $class_site = pc_base::load_app_class('sites'); $class_site->set_cache(); showmessage(L('operation_success'), '', '', 'edit'); } else { showmessage(L('operation_failure')); } } else { $show_validator = true; $show_header = true; $show_scroll = true; $template_list = template_list(); $setting = string2array($data['setting']); $setting['watermark_img'] = str_replace('statics/images/water/','',$setting['watermark_img']); $release_point_db = pc_base::load_model('release_point_model'); $release_point_list = $release_point_db->select('', 'id, name'); include $this->admin_tpl('site_edit'); } } else { showmessage(L('notfound'), HTTP_REFERER); } } public function public_name() { $name = isset($_GET['name']) && trim($_GET['name']) ? (pc_base::load_config('system', 'charset') == 'gbk' ? iconv('utf-8', 'gbk', trim($_GET['name'])) : trim($_GET['name'])) : exit('0'); $siteid = isset($_GET['siteid']) && intval($_GET['siteid']) ? intval($_GET['siteid']) : ''; $data = array(); if ($siteid) { $data = $this->db->get_one(array('siteid'=>$siteid), 'name'); if (!empty($data) && $data['name'] == $name) { exit('1'); } } if ($this->db->get_one(array('name'=>$name), 'siteid')) { exit('0'); } else { exit('1'); } } public function public_dirname() { $dirname = isset($_GET['dirname']) && trim($_GET['dirname']) ? (pc_base::load_config('system', 'charset') == 'gbk' ? iconv('utf-8', 'gbk', trim($_GET['dirname'])) : trim($_GET['dirname'])) : exit('0'); $siteid = isset($_GET['siteid']) && intval($_GET['siteid']) ? intval($_GET['siteid']) : ''; $data = array(); if ($siteid) { $data = $this->db->get_one(array('siteid'=>$siteid), 'dirname'); if (!empty($data) && $data['dirname'] == $dirname) { exit('1'); } } if ($this->db->get_one(array('dirname'=>$dirname), 'siteid')) { exit('0'); } else { exit('1'); } } private function check_gd() { if(!function_exists('imagepng') && !function_exists('imagejpeg') && !function_exists('imagegif')) { $gd = L('gd_unsupport'); } else { $gd = L('gd_support'); } return $gd; } }
108wo
phpcms/modules/admin/site.php
PHP
asf20
10,489
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); pc_base::load_sys_class('form', '', 0); class downservers extends admin { private $db; function __construct() { parent::__construct(); $this->db = pc_base::load_model('downservers_model'); $this->sites = pc_base::load_app_class('sites'); } public function init() { if(isset($_POST['dosubmit'])) { $info['siteurl'] = trim($_POST['info']['siteurl']); $info['sitename'] = trim($_POST['info']['sitename']); $info['siteid'] = intval($_POST['info']['siteid']); if(empty($info['sitename'])) showmessage(L('downserver_not_empty'), HTTP_REFERER); if(empty($info['siteurl']) || !preg_match('/(\w+):\/\/(.+)[^\/]$/i', $info['siteurl'])) showmessage(L('downserver_error'), HTTP_REFERER); $insert_id = $this->db->insert($info,true); if($insert_id){ $this->_set_cache(); showmessage(L('operation_success'), HTTP_REFERER); } } else { $infos = $sitelist = array(); $current_siteid = get_siteid(); $where = "`siteid`='$current_siteid' or `siteid`=''"; $sitelists = $this->sites->get_list(); if($_SESSION['roleid'] == '1') { foreach($sitelists as $key=>$v) $sitelist[$key] = $v['name']; $default = L('all_site'); } else { $sitelist[$current_siteid] = $sitelists[$current_siteid]['name']; $default = ''; } $page = $_GET['page'] ? $_GET['page'] : '1'; $infos = $this->db->listinfo($where, 'listorder DESC,id DESC', $page, $pagesize = 20); $pages = $this->db->pages; include $this->admin_tpl('downservers_list'); } } public function edit() { if(isset($_POST['dosubmit'])) { $info['siteurl'] = trim($_POST['info']['siteurl']); $info['sitename'] = trim($_POST['info']['sitename']); $info['siteid'] = intval($_POST['info']['siteid']); if(empty($info['sitename'])) showmessage(L('downserver_not_empty'), HTTP_REFERER); if(empty($info['siteurl']) || !preg_match('/(\w+):\/\/(.+)[^\/]$/i', $info['siteurl'])) showmessage(L('downserver_error'), HTTP_REFERER); $id = intval(trim($_POST['id'])); $this->_set_cache(); $this->db->update($info,array('id'=>$id)); showmessage(L('operation_success'), '', '', 'edit'); } else { $info = $sitelist = array(); $default = ''; $sitelists = $this->sites->get_list(); if($_SESSION['roleid'] == '1') { foreach($sitelists as $key=>$v) $sitelist[$key] = $v['name']; $default = L('all_site'); } else { $current_siteid = self::get_siteid(); $sitelist[$current_siteid] = $sitelists[$current_siteid]['name']; $default = ''; } $info = $this->db->get_one(array('id'=>$_GET['id'])); extract($info); $show_validator = true; $show_header = true; include $this->admin_tpl('downservers_edit'); } } public function delete() { $id = intval($_GET['id']); $this->db->delete(array('id'=>$id)); $this->_set_cache(); showmessage(L('downserver_del_success'), HTTP_REFERER); } /** * 排序 */ public function listorder() { if(isset($_POST['dosubmit'])) { foreach($_POST['listorders'] as $id => $listorder) { $this->db->update(array('listorder'=>$listorder),array('id'=>$id)); } showmessage(L('operation_success'), HTTP_REFERER); } else { showmessage(L('operation_failure'), HTTP_REFERER); } } private function _set_cache() { $infos = $this->db->select(); foreach ($infos as $info){ $servers[$info['id']] = $info; } setcache('downservers', $servers,'commons'); return $infos; } } ?>
108wo
phpcms/modules/admin/downservers.php
PHP
asf20
3,648
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); class index extends admin { public function __construct() { parent::__construct(); $this->db = pc_base::load_model('admin_model'); $this->menu_db = pc_base::load_model('menu_model'); $this->panel_db = pc_base::load_model('admin_panel_model'); } public function init () { $userid = $_SESSION['userid']; $admin_username = param::get_cookie('admin_username'); $roles = getcache('role','commons'); $rolename = $roles[$_SESSION['roleid']]; $site = pc_base::load_app_class('sites'); $sitelist = $site->get_list($_SESSION['roleid']); $currentsite = $this->get_siteinfo(param::get_cookie('siteid')); /*管理员收藏栏*/ $adminpanel = $this->panel_db->select(array('userid'=>$userid), "*",20 , 'datetime'); include $this->admin_tpl('index'); } public function login() { if(isset($_GET['dosubmit'])) { //不为口令卡验证 if (!isset($_GET['card'])) { $username = isset($_POST['username']) ? trim($_POST['username']) : showmessage(L('nameerror'),HTTP_REFERER); $code = isset($_POST['code']) && trim($_POST['code']) ? trim($_POST['code']) : showmessage(L('input_code'), HTTP_REFERER); if ($_SESSION['code'] != strtolower($code)) { showmessage(L('code_error'), HTTP_REFERER); } } else { //口令卡验证 if (!isset($_SESSION['card_verif']) || $_SESSION['card_verif'] != 1) { showmessage(L('your_password_card_is_not_validate'), '?m=admin&c=index&a=public_card'); } $username = $_SESSION['card_username'] ? $_SESSION['card_username'] : showmessage(L('nameerror'),HTTP_REFERER); } //密码错误剩余重试次数 $this->times_db = pc_base::load_model('times_model'); $rtime = $this->times_db->get_one(array('username'=>$username,'isadmin'=>1)); $maxloginfailedtimes = getcache('common','commons'); $maxloginfailedtimes = (int)$maxloginfailedtimes['maxloginfailedtimes']; if($rtime['times'] > $maxloginfailedtimes) { $minute = 60-floor((SYS_TIME-$rtime['logintime'])/60); showmessage(L('wait_1_hour',array('minute'=>$minute))); } //查询帐号 $r = $this->db->get_one(array('username'=>$username)); if(!$r) showmessage(L('user_not_exist'),'?m=admin&c=index&a=login'); $password = md5(md5(trim((!isset($_GET['card']) ? $_POST['password'] : $_SESSION['card_password']))).$r['encrypt']); if($r['password'] != $password) { $ip = ip(); if($rtime && $rtime['times'] < $maxloginfailedtimes) { $times = $maxloginfailedtimes-intval($rtime['times']); $this->times_db->update(array('ip'=>$ip,'isadmin'=>1,'times'=>'+=1'),array('username'=>$username)); } else { $this->times_db->delete(array('username'=>$username,'isadmin'=>1)); $this->times_db->insert(array('username'=>$username,'ip'=>$ip,'isadmin'=>1,'logintime'=>SYS_TIME,'times'=>1)); $times = $maxloginfailedtimes; } showmessage(L('password_error',array('times'=>$times)),'?m=admin&c=index&a=login',3000); } $this->times_db->delete(array('username'=>$username)); //查看是否使用口令卡 if (!isset($_GET['card']) && $r['card'] && pc_base::load_config('system', 'safe_card') == 1) { $_SESSION['card_username'] = $username; $_SESSION['card_password'] = $_POST['password']; header("location:?m=admin&c=index&a=public_card"); exit; } elseif (isset($_GET['card']) && pc_base::load_config('system', 'safe_card') == 1 && $r['card']) {//对口令卡进行验证 isset($_SESSION['card_username']) ? $_SESSION['card_username'] = '' : ''; isset($_SESSION['card_password']) ? $_SESSION['card_password'] = '' : ''; isset($_SESSION['card_password']) ? $_SESSION['card_verif'] = '' : ''; } $this->db->update(array('lastloginip'=>ip(),'lastlogintime'=>SYS_TIME),array('userid'=>$r['userid'])); $_SESSION['userid'] = $r['userid']; $_SESSION['roleid'] = $r['roleid']; $_SESSION['pc_hash'] = random(6,'abcdefghigklmnopqrstuvwxwyABCDEFGHIGKLMNOPQRSTUVWXWY0123456789'); $_SESSION['lock_screen'] = 0; $default_siteid = self::return_siteid(); $cookie_time = SYS_TIME+86400*30; if(!$r['lang']) $r['lang'] = 'zh-cn'; param::set_cookie('admin_username',$username,$cookie_time); param::set_cookie('siteid', $default_siteid,$cookie_time); param::set_cookie('userid', $r['userid'],$cookie_time); param::set_cookie('admin_email', $r['email'],$cookie_time); param::set_cookie('sys_lang', $r['lang'],$cookie_time); showmessage(L('login_success'),'?m=admin&c=index'); } else { pc_base::load_sys_class('form', '', 0); include $this->admin_tpl('login'); } } public function public_card() { $username = $_SESSION['card_username'] ? $_SESSION['card_username'] : showmessage(L('nameerror'),HTTP_REFERER); $r = $this->db->get_one(array('username'=>$username)); if(!$r) showmessage(L('user_not_exist'),'?m=admin&c=index&a=login'); if (isset($_GET['dosubmit'])) { pc_base::load_app_class('card', 'admin', 0); $result = card::verification($r['card'], $_POST['code'], $_POST['rand']); $_SESSION['card_verif'] = 1; header("location:?m=admin&c=index&a=login&dosubmit=1&card=1"); exit; } pc_base::load_app_class('card', 'admin', 0); $rand = card::authe_rand($r['card']); include $this->admin_tpl('login_card'); } public function public_logout() { $_SESSION['userid'] = 0; $_SESSION['roleid'] = 0; param::set_cookie('admin_username',''); param::set_cookie('userid',0); //退出phpsso $phpsso_api_url = pc_base::load_config('system', 'phpsso_api_url'); $phpsso_logout = '<script type="text/javascript" src="'.$phpsso_api_url.'/api.php?op=logout" reload="1"></script>'; showmessage(L('logout_success').$phpsso_logout,'?m=admin&c=index&a=login'); } //左侧菜单 public function public_menu_left() { $menuid = intval($_GET['menuid']); $datas = admin::admin_menu($menuid); if (isset($_GET['parentid']) && $parentid = intval($_GET['parentid']) ? intval($_GET['parentid']) : 10) { foreach($datas as $_value) { if($parentid==$_value['id']) { echo '<li id="_M'.$_value['id'].'" class="on top_menu"><a href="javascript:_M('.$_value['id'].',\'?m='.$_value['m'].'&c='.$_value['c'].'&a='.$_value['a'].'\')" hidefocus="true" style="outline:none;">'.L($_value['name']).'</a></li>'; } else { echo '<li id="_M'.$_value['id'].'" class="top_menu"><a href="javascript:_M('.$_value['id'].',\'?m='.$_value['m'].'&c='.$_value['c'].'&a='.$_value['a'].'\')" hidefocus="true" style="outline:none;">'.L($_value['name']).'</a></li>'; } } } else { include $this->admin_tpl('left'); } } //当前位置 public function public_current_pos() { echo admin::current_pos($_GET['menuid']); exit; } /** * 设置站点ID COOKIE */ public function public_set_siteid() { $siteid = isset($_GET['siteid']) && intval($_GET['siteid']) ? intval($_GET['siteid']) : exit('0'); param::set_cookie('siteid', $siteid); exit('1'); } public function public_ajax_add_panel() { $menuid = isset($_POST['menuid']) ? $_POST['menuid'] : exit('0'); $menuarr = $this->menu_db->get_one(array('id'=>$menuid)); $url = '?m='.$menuarr['m'].'&c='.$menuarr['c'].'&a='.$menuarr['a'].'&'.$menuarr['data']; $data = array('menuid'=>$menuid, 'userid'=>$_SESSION['userid'], 'name'=>$menuarr['name'], 'url'=>$url, 'datetime'=>SYS_TIME); $this->panel_db->insert($data, '', 1); $panelarr = $this->panel_db->listinfo(array('userid'=>$_SESSION['userid']), "datetime"); foreach($panelarr as $v) { echo "<span><a onclick='paneladdclass(this);' target='right' href='".$v['url'].'&menuid='.$v['menuid']."&pc_hash=".$_SESSION['pc_hash']."'>".L($v['name'])."</a> <a class='panel-delete' href='javascript:delete_panel(".$v['menuid'].");'></a></span>"; } exit; } public function public_ajax_delete_panel() { $menuid = isset($_POST['menuid']) ? $_POST['menuid'] : exit('0'); $this->panel_db->delete(array('menuid'=>$menuid, 'userid'=>$_SESSION['userid'])); $panelarr = $this->panel_db->listinfo(array('userid'=>$_SESSION['userid']), "datetime"); foreach($panelarr as $v) { echo "<span><a onclick='paneladdclass(this);' target='right' href='".$v['url']."&pc_hash=".$_SESSION['pc_hash']."'>".L($v['name'])."</a> <a class='panel-delete' href='javascript:delete_panel(".$v['menuid'].");'></a></span>"; } exit; } public function public_main() { pc_base::load_app_func('global'); pc_base::load_app_func('admin'); define('PC_VERSION', pc_base::load_config('version','pc_version')); define('PC_RELEASE', pc_base::load_config('version','pc_release')); $admin_username = param::get_cookie('admin_username'); $roles = getcache('role','commons'); $userid = $_SESSION['userid']; $rolename = $roles[$_SESSION['roleid']]; $r = $this->db->get_one(array('userid'=>$userid)); $logintime = $r['lastlogintime']; $loginip = $r['lastloginip']; $sysinfo = get_sysinfo(); $sysinfo['mysqlv'] = mysql_get_server_info(); $show_header = $show_pc_hash = 1; /*检测框架目录可写性*/ $pc_writeable = is_writable(PC_PATH.'base.php'); $common_cache = getcache('common','commons'); $logsize_warning = errorlog_size() > $common_cache['errorlog_size'] ? '1' : '0'; $adminpanel = $this->panel_db->select(array('userid'=>$userid), '*',20 , 'datetime'); $product_copyright = base64_decode('5LiK5rW355ub5aSn572R57uc5Y+R5bGV5pyJ6ZmQ5YWs5Y+4'); $architecture = base64_decode('546L5Y+C5Yqg'); $programmer = base64_decode('546L5Y+C5Yqg44CB546L6ZOB5oiQ44CB6ZmI5a2m5pe644CB6ZmI6bmP44CB546L5a6Y5bqG44CB5byg5bqG44CB54aK55Sf5Y2O44CB5ZCV5a2Y55m9'); $designer = base64_decode('6JGj6aOe6b6Z44CB5byg5LqM5by6'); ob_start(); include $this->admin_tpl('main'); $data = ob_get_contents(); ob_end_clean(); system_information($data); } /** * 维持 session 登陆状态 */ public function public_session_life() { $userid = $_SESSION['userid']; return true; } /** * 锁屏 */ public function public_lock_screen() { $_SESSION['lock_screen'] = 1; } public function public_login_screenlock() { if(empty($_GET['lock_password'])) showmessage(L('password_can_not_be_empty')); //密码错误剩余重试次数 $this->times_db = pc_base::load_model('times_model'); $username = param::get_cookie('admin_username'); $maxloginfailedtimes = getcache('common','commons'); $maxloginfailedtimes = (int)$maxloginfailedtimes['maxloginfailedtimes']; $rtime = $this->times_db->get_one(array('username'=>$username,'isadmin'=>1)); if($rtime['times'] > $maxloginfailedtimes-1) { $minute = 60-floor((SYS_TIME-$rtime['logintime'])/60); exit('3'); } //查询帐号 $r = $this->db->get_one(array('userid'=>$_SESSION['userid'])); $password = md5(md5($_GET['lock_password']).$r['encrypt']); if($r['password'] != $password) { $ip = ip(); if($rtime && $rtime['times']<$maxloginfailedtimes) { $times = $maxloginfailedtimes-intval($rtime['times']); $this->times_db->update(array('ip'=>$ip,'isadmin'=>1,'times'=>'+=1'),array('username'=>$username)); } else { $this->times_db->insert(array('username'=>$username,'ip'=>$ip,'isadmin'=>1,'logintime'=>SYS_TIME,'times'=>1)); $times = $maxloginfailedtimes; } exit('2|'.$times);//密码错误 } $this->times_db->delete(array('username'=>$username)); $_SESSION['lock_screen'] = 0; exit('1'); } //后台站点地图 public function public_map() { $array = admin::admin_menu(0); $menu = array(); foreach ($array as $k=>$v) { $menu[$v['id']] = $v; $menu[$v['id']]['childmenus'] = admin::admin_menu($v['id']); } $show_header = true; include $this->admin_tpl('map'); } /** * * 读取盛大接扣获取appid和secretkey */ public function public_snda_status() { //引入盛大接口 if(!strstr(pc_base::load_config('snda','snda_status'), '|')) { $this->site_db = pc_base::load_model('site_model'); $uuid_arr = $this->site_db->get_one(array('siteid'=>1), 'uuid'); $uuid = $uuid_arr['uuid']; $snda_check_url = "http://open.sdo.com/phpcms?cmsid=".$uuid."&sitedomain=".$_SERVER['SERVER_NAME']; $snda_res_json = @file_get_contents($snda_check_url); $snda_res = json_decode($snda_res_json, 1); if(!isset($snda_res[err]) && !empty($snda_res['appid'])) { $appid = $snda_res['appid']; $secretkey = $snda_res['secretkey']; set_config(array('snda_status'=>$appid.'|'.$secretkey), 'snda'); } } } } ?>
108wo
phpcms/modules/admin/index.php
PHP
asf20
12,837
<?php defined('IN_PHPCMS') or exit('No permission resources.'); //定义在后台 define('IN_ADMIN',true); class plugin_op { private $db,$db_var; public function __construct(){ $this->db_var = pc_base::load_model('plugin_var_model'); $this->db = pc_base::load_model('plugin_var_model'); } /** * 插件后台模板加载 */ public function plugin_tpl($file,$identification) { return PC_PATH.'plugin'.DIRECTORY_SEPARATOR.$identification.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR.'admin'.DIRECTORY_SEPARATOR.$file.'.tpl.php'; } /** * 获取插件自定义变量信息 * @param $pluginid 插件id */ public function getpluginvar($pluginid){ if(empty($pluginid)) return flase; if($info_var = $this->db_var->select(array('pluginid'=>$pluginid))) { foreach ($info_var as $var) { $pluginvar[$var['fieldname']] = $var['value']; } } return $pluginvar; } /** * 获取插件配置 * @param $pluginid 插件id */ function getplugincfg($pluginid) { $info = $this->db->get_one(array('pluginid'=>$pluginid)); return $info; } } ?>
108wo
phpcms/modules/admin/classes/plugin_op.class.php
PHP
asf20
1,130
<?php defined('IN_PHPCMS') or exit('No permission resources.'); //定义在后台 define('IN_ADMIN',true); class admin_op { public function __construct() { $this->db = pc_base::load_model('admin_model'); } /* * 修改密码 */ public function edit_password($userid, $password){ $userid = intval($userid); if($userid < 1) return false; if(!is_password($password)) { showmessage(L('pwd_incorrect')); return false; } $passwordinfo = password($password); return $this->db->update($passwordinfo,array('userid'=>$userid)); } /* * 检查用户名重名 */ public function checkname($username) { $username = trim($username); if ($this->db->get_one(array('username'=>$username),'userid')){ return false; } return true; } } ?>
108wo
phpcms/modules/admin/classes/admin_op.class.php
PHP
asf20
803
<?php /** * 站点对外接口 * @author chenzhouyu * */ class sites { //数据库连接 private $db; public function __construct() { $this->db = pc_base::load_model('site_model'); } /** * 获取站点列表 * @param string $roleid 角色ID 留空为获取所有站点列表 */ public function get_list($roleid='') { $roleid = intval($roleid); if(empty($roleid)) { if ($data = getcache('sitelist', 'commons')) { return $data; } else { $this->set_cache(); return $this->db->select(); } } else { $site_arr = $this->get_role_siteid($roleid); $sql = "`siteid` in($site_arr)"; return $this->db->select($sql); } } /** * 按ID获取站点信息 * @param integer $siteid 站点ID号 */ public function get_by_id($siteid) { return siteinfo($siteid); } /** * 设置站点缓存 */ public function set_cache() { $list = $this->db->select(); $data = array(); foreach ($list as $key=>$val) { $data[$val['siteid']] = $val; $data[$val['siteid']]['url'] = $val['domain'] ? $val['domain'] : pc_base::load_config('system', 'web_path').$val['dirname'].'/'; } setcache('sitelist', $data, 'commons'); } /** * PC标签中调用站点列表 */ public function pc_tag_list() { $list = $this->db->select('', 'siteid,name'); $sitelist = array(''=>L('please_select_a_site', '', 'admin')); foreach ($list as $k=>$v) { $sitelist[$v['siteid']] = $v['name']; } return $sitelist; } /** * 按角色ID获取站点列表 * @param string $roleid 角色ID */ public function get_role_siteid($roleid) { $roleid = intval($roleid); if($roleid == 1) { $sitelists = $this->get_list(); foreach($sitelists as $v) { $sitelist[] = $v['siteid']; } } else { $sitelist = getcache('role_siteid', 'commons'); $sitelist = $sitelist[$roleid]; } if(is_array($sitelist)) { $siteid = implode(',',array_unique($sitelist)); return $siteid; } else { showmessage(L('no_site_permissions'),'?m=admin&c=index&a=login'); } } }
108wo
phpcms/modules/admin/classes/sites.class.php
PHP
asf20
2,138
<?php /** * * 更新缓存类 * */ defined('IN_PHPCMS') or exit('No permission resources.'); class cache_api { private $db; public function __construct() { $this->db = ''; $this->siteid = get_siteid(); } /** * 更新缓存 * @param string $model 方法名 * @param string $param 参数 */ public function cache($model = '', $param = '') { if (file_exists(PC_PATH.'model'.DIRECTORY_SEPARATOR.$model.'_model.class.php')) { $this->db = pc_base::load_model($model.'_model'); if ($param) { $this->$model($param); } else { $this->$model(); } } else { $this->$model(); } } /** * 更新站点缓存方法 */ public function cache_site() { $site = pc_base::load_app_class('sites', 'admin'); $site->set_cache(); } /** * 更新栏目缓存方法 */ public function category() { $categorys = array(); $models = getcache('model','commons'); foreach ($models as $modelid=>$model) { $datas = $this->db->select(array('modelid'=>$modelid),'catid,type,items',10000); $array = array(); foreach ($datas as $r) { if($r['type']==0) $array[$r['catid']] = $r['items']; } setcache('category_items_'.$modelid, $array,'commons'); } $array = array(); $categorys = $this->db->select('`module`=\'content\'','catid,siteid',20000,'listorder ASC'); foreach ($categorys as $r) { $array[$r['catid']] = $r['siteid']; } setcache('category_content',$array,'commons'); $categorys = $this->categorys = array(); $this->categorys = $this->db->select(array('siteid'=>$this->siteid, 'module'=>'content'),'*',10000,'listorder ASC'); foreach($this->categorys as $r) { unset($r['module']); $setting = string2array($r['setting']); $r['create_to_html_root'] = $setting['create_to_html_root']; $r['ishtml'] = $setting['ishtml']; $r['content_ishtml'] = $setting['content_ishtml']; $r['category_ruleid'] = $setting['category_ruleid']; $r['show_ruleid'] = $setting['show_ruleid']; $r['workflowid'] = $setting['workflowid']; $r['isdomain'] = '0'; if(!preg_match('/^(http|https):\/\//', $r['url'])) { $r['url'] = siteurl($r['siteid']).$r['url']; } elseif ($r['ishtml']) { $r['isdomain'] = '1'; } $categorys[$r['catid']] = $r; } setcache('category_content_'.$this->siteid,$categorys,'commons'); return true; } /** * 更新下载服务器缓存方法 */ public function downservers () { $infos = $this->db->select(); foreach ($infos as $info){ $servers[$info['id']] = $info; } setcache('downservers', $servers,'commons'); return $infos; } /** * 更新敏感词缓存方法 */ public function badword() { $infos = $this->db->select('','badid,badword','','badid ASC'); setcache('badword', $infos, 'commons'); return true; } /** * 更新ip禁止缓存方法 */ public function ipbanned() { $infos = $this->db->select('', '`ip`,`expires`', '', 'ipbannedid desc'); setcache('ipbanned', $infos, 'commons'); return true; } /** * 更新关联链接缓存方法 */ public function keylink() { $infos = $this->db->select('','word,url','','keylinkid ASC'); $datas = $rs = array(); foreach($infos as $r) { $rs[0] = $r['word']; $rs[1] = $r['url']; $datas[] = $rs; } setcache('keylink', $datas, 'commons'); return true; } /** * 更新联动菜单缓存方法 */ public function linkage() { $infos = $this->db->select(array('keyid'=>0)); foreach ($infos as $r) { $linkageid = intval($r['linkageid']); $r = $this->db->get_one(array('linkageid'=>$linkageid),'name,siteid,style'); $info['title'] = $r['name']; $info['style'] = $r['style']; $info['siteid'] = $r['siteid']; $info['data'] = $this->submenulist($linkageid); setcache($linkageid, $info,'linkage'); } return true; } /** * 子菜单列表 * @param intval $keyid 菜单id */ public function submenulist($keyid=0) { $keyid = intval($keyid); $datas = array(); $where = ($keyid > 0) ? array('keyid'=>$keyid) : ''; $result = $this->db->select($where,'*','','listorder ,linkageid'); foreach($result as $r) { $datas[$r['linkageid']] = $r; } return $datas; } /** * 更新推荐位缓存方法 */ public function position () { $infos = $this->db->select('','*',1000,'listorder DESC'); foreach ($infos as $info){ $positions[$info['posid']] = $info; } setcache('position', $positions,'commons'); return $infos; } /** * 更新投票配置 */ public function vote_setting() { $m_db = pc_base::load_model('module_model'); $data = $m_db->select(array('module'=>'vote')); $setting = string2array($data[0]['setting']); setcache('vote', $setting, 'commons'); } /** * 更新友情链接配置 */ public function link_setting() { $m_db = pc_base::load_model('module_model'); $data = $m_db->select(array('module'=>'link')); $setting = string2array($data[0]['setting']); setcache('link', $setting, 'commons'); } /** * 更新管理员角色缓存方法 */ public function admin_role() { $infos = $this->db->select(array('disabled'=>'0'), $data = '`roleid`,`rolename`', '', 'roleid ASC'); foreach ($infos as $info){ $role[$info['roleid']] = $info['rolename']; } $this->cache_siteid($role); setcache('role', $role,'commons'); return $infos; } /** * 更新管理员角色缓存方法 */ public function cache_siteid($role) { $priv_db = pc_base::load_model('admin_role_priv_model'); $sitelist = array(); foreach($role as $n=>$r) { $sitelists = $priv_db->select(array('roleid'=>$n),'siteid', '', 'siteid'); foreach($sitelists as $site) { foreach($site as $v){ $sitelist[$n][] = intval($v); } } } $sitelist = @array_map("array_unique", $sitelist); setcache('role_siteid', $sitelist,'commons'); return $sitelist; } /** * 更新url规则缓存方法 */ public function urlrule() { $datas = $this->db->select('','*','','','','urlruleid'); $basic_data = array(); foreach($datas as $roleid=>$r) { $basic_data[$roleid] = $r['urlrule'];; } setcache('urlrules_detail',$datas,'commons'); setcache('urlrules',$basic_data,'commons'); } /** * 更新模块缓存方法 */ public function module() { $modules = array(); $modules = $this->db->select(array('disabled'=>0), '*', '', '', '', 'module'); setcache('modules', $modules, 'commons'); return true; } /** * 更新模型缓存方法 */ public function sitemodel() { define('MODEL_PATH', PC_PATH.'modules'.DIRECTORY_SEPARATOR.'content'.DIRECTORY_SEPARATOR.'fields'.DIRECTORY_SEPARATOR); define('CACHE_MODEL_PATH', PHPCMS_PATH.'caches'.DIRECTORY_SEPARATOR.'caches_model'.DIRECTORY_SEPARATOR.'caches_data'.DIRECTORY_SEPARATOR); require MODEL_PATH.'fields.inc.php'; //更新内容模型类:表单生成、入库、更新、输出 $classtypes = array('form','input','update','output'); foreach($classtypes as $classtype) { $cache_data = file_get_contents(MODEL_PATH.'content_'.$classtype.'.class.php'); $cache_data = str_replace('}?>','',$cache_data); foreach($fields as $field=>$fieldvalue) { if(file_exists(MODEL_PATH.$field.DIRECTORY_SEPARATOR.$classtype.'.inc.php')) { $cache_data .= file_get_contents(MODEL_PATH.$field.DIRECTORY_SEPARATOR.$classtype.'.inc.php'); } } $cache_data .= "\r\n } \r\n?>"; file_put_contents(CACHE_MODEL_PATH.'content_'.$classtype.'.class.php',$cache_data); chmod(CACHE_MODEL_PATH.'content_'.$classtype.'.class.php',0777); } //更新模型数据缓存 $model_array = array(); $datas = $this->db->select(array('type'=>0)); foreach ($datas as $r) { $model_array[$r['modelid']] = $r; $this->sitemodel_field($r['modelid']); } setcache('model', $model_array, 'commons'); return true; } /** * 更新模型字段缓存方法 */ public function sitemodel_field($modelid) { $field_array = array(); $db = pc_base::load_model('sitemodel_field_model'); $fields = $db->select(array('modelid'=>$modelid,'disabled'=>0),'*',100,'listorder ASC'); foreach($fields as $_value) { $setting = string2array($_value['setting']); $_value = array_merge($_value,$setting); $field_array[$_value['field']] = $_value; } setcache('model_field_'.$modelid,$field_array,'model'); return true; } /** * 更新类别缓存方法 */ public function type($param = '') { $datas = array(); $result_datas = $this->db->select(array('siteid'=>get_siteid(),'module'=>$param),'*',1000,'listorder ASC,typeid ASC'); foreach($result_datas as $_key=>$_value) { $datas[$_value['typeid']] = $_value; } if ($param=='search') { $this->search_type(); } else { setcache('type_'.$param, $datas, 'commons'); } return true; } /** * 更新工作流缓存方法 */ public function workflow() { $datas = array(); $workflow_datas = $this->db->select(array('siteid'=>get_siteid()),'*',1000); foreach($workflow_datas as $_k=>$_v) { $datas[$_v['workflowid']] = $_v; } setcache('workflow_'.get_siteid(),$datas,'commons'); return true; } /** * 更新数据源缓存方法 */ public function dbsource() { $db = pc_base::load_model('dbsource_model'); $list = $db->select(); $data = array(); if ($list) { foreach ($list as $val) { $data[$val['name']] = array('hostname'=>$val['host'].':'.$val['port'], 'database' =>$val['dbname'] , 'db_tablepre'=>$val['dbtablepre'], 'username' =>$val['username'],'password' => $val['password'],'charset'=>$val['charset'],'debug'=>0,'pconnect'=>0,'autoconnect'=>0); } } else { return false; } return setcache('dbsource', $data, 'commons'); } /** * 更新会员组缓存方法 */ public function member_group() { $grouplist = $this->db->listinfo('', '', 1, 100, 'groupid'); setcache('grouplist', $grouplist,'member'); return true; } /** * 更新会员配置缓存方法 */ public function member_setting() { $this->db = pc_base::load_model('module_model'); $member_setting = $this->db->get_one(array('module'=>'member'), 'setting'); $member_setting = string2array($member_setting['setting']); setcache('member_setting', $member_setting, 'member'); return true; } /** * 更新会员模型缓存方法 */ public function membermodel() { define('MEMBER_MODEL_PATH',PC_PATH.'modules'.DIRECTORY_SEPARATOR.'member'.DIRECTORY_SEPARATOR.'fields'.DIRECTORY_SEPARATOR); //模型缓存路径 define('MEMBER_CACHE_MODEL_PATH',PHPCMS_PATH.'caches'.DIRECTORY_SEPARATOR.'caches_model'.DIRECTORY_SEPARATOR.'caches_data'.DIRECTORY_SEPARATOR); $sitemodel_db = pc_base::load_model('sitemodel_model'); $data = $sitemodel_db->select(array('type'=>2), "*", 1000, 'sort', '', 'modelid'); setcache('member_model', $data, 'commons'); require MEMBER_MODEL_PATH.'fields.inc.php'; //更新内容模型类:表单生成、入库、更新、输出 $classtypes = array('form','input','update','output'); foreach($classtypes as $classtype) { $cache_data = file_get_contents(MEMBER_MODEL_PATH.'member_'.$classtype.'.class.php'); $cache_data = str_replace('}?>','',$cache_data); foreach($fields as $field=>$fieldvalue) { if(file_exists(MEMBER_MODEL_PATH.$field.DIRECTORY_SEPARATOR.$classtype.'.inc.php')) { $cache_data .= file_get_contents(MEMBER_MODEL_PATH.$field.DIRECTORY_SEPARATOR.$classtype.'.inc.php'); } } $cache_data .= "\r\n } \r\n?>"; file_put_contents(MEMBER_CACHE_MODEL_PATH.'member_'.$classtype.'.class.php',$cache_data); chmod(MEMBER_CACHE_MODEL_PATH.'member_'.$classtype.'.class.php',0777); } return true; } /** * 更新会员模型字段缓存方法 */ public function member_model_field() { $member_model = getcache('member_model', 'commons'); $this->db = pc_base::load_model('sitemodel_field_model'); foreach ($member_model as $modelid => $m) { $field_array = array(); $fields = $this->db->select(array('modelid'=>$modelid,'disabled'=>0),'*',100,'listorder ASC'); foreach($fields as $_value) { $setting = string2array($_value['setting']); $_value = array_merge($_value,$setting); $field_array[$_value['field']] = $_value; } setcache('model_field_'.$modelid,$field_array,'model'); } return true; } /** * 更新搜索配置缓存方法 */ public function search_setting() { $this->db = pc_base::load_model('module_model'); $setting = $this->db->get_one(array('module'=>'search'), 'setting'); $setting = string2array($setting['setting']); setcache('search', $setting, 'search'); return true; } /** * 更新搜索类型缓存方法 */ public function search_type() { $sitelist = getcache('sitelist','commons'); foreach ($sitelist as $siteid=>$_v) { $datas = $search_model = array(); $result_datas = $result_datas2 = $this->db->select(array('siteid'=>$siteid,'module'=>'search'),'*',1000,'listorder ASC'); foreach($result_datas as $_key=>$_value) { if(!$_value['modelid']) continue; $datas[$_value['modelid']] = $_value['typeid']; $search_model[$_value['modelid']]['typeid'] = $_value['typeid']; $search_model[$_value['modelid']]['name'] = $_value['name']; $search_model[$_value['modelid']]['sort'] = $_value['listorder']; } setcache('type_model_'.$siteid,$datas,'search'); $datas = array(); foreach($result_datas2 as $_key=>$_value) { if($_value['modelid']) continue; $datas[$_value['typedir']] = $_value['typeid']; $search_model[$_value['typedir']]['typeid'] = $_value['typeid']; $search_model[$_value['typedir']]['name'] = $_value['name']; } setcache('type_module_'.$siteid,$datas,'search'); //搜索header头中使用类型缓存 setcache('search_model_'.$siteid,$search_model,'search'); } return true; } /** * 更新专题缓存方法 */ public function special() { $specials = array(); $result = $this->db->select(array('disabled'=>0), '`id`, `siteid`, `title`, `url`, `thumb`, `banner`, `ishtml`', '', '`listorder` DESC, `id` DESC'); foreach($result as $r) { $specials[$r['id']] = $r; } setcache('special', $specials, 'commons'); return true; } /** * 更新网站配置方法 */ public function setting() { $this->db = pc_base::load_model('module_model'); $result = $this->db->get_one(array('module'=>'admin')); $setting = string2array($result['setting']); setcache('common', $setting,'commons'); return true; } /** * 更新数据源模型缓存方法 */ public function database() { $module = $M = array(); $M = getcache('modules', 'commons'); if (is_array($M)) { foreach ($M as $key => $m) { if (file_exists(PC_PATH.'modules'.DIRECTORY_SEPARATOR.$key.DIRECTORY_SEPARATOR.'classes'.DIRECTORY_SEPARATOR.$key.'_tag.class.php') && !in_array($key, array('message', 'block'))) { $module[$key] = $m['name']; } } } $filepath = CACHE_PATH.'configs/'; $module = "<?php\nreturn ".var_export($module, true).";\n?>"; return $file_size = pc_base::load_config('system','lock_ex') ? file_put_contents($filepath.'modules.php', $module, LOCK_EX) : file_put_contents($filepath.'modules.php', $module); } /** * 根据数据库记录更新缓存 */ public function cache2database() { $cache = pc_base::load_model('cache_model'); if (!isset($_GET['pages']) && empty($_GET['pages'])) { $r = $cache->get_one(array(), 'COUNT(*) AS num'); if ($r['num']) { $total = $r['num']; $pages = ceil($total/20); } else { $pages = 1; } } else { $pages = intval($_GET['pages']); } $currpage = max(intval($_GET['currpage']), 1); $offset = ($currpage-1)*20; $result = $cache->select(array(), '*', $offset.', 20', 'filename ASC'); if (is_array($result) && !empty($result)) { foreach ($result as $re) { if (!file_exists(CACHE_PATH.$re['path'].$re['filename'])) { $filesize = pc_base::load_config('system','lock_ex') ? file_put_contents(CACHE_PATH.$re['path'].$re['filename'], $re['data'], LOCK_EX) : file_put_contents(CACHE_PATH.$re['path'].$re['filename'], $re['data']); } else { continue; } } } $currpage++; if ($currpage>$pages) { return true; } else { echo '<script type="text/javascript">window.parent.addtext("<li>'.L('part_cache_success').($currpage-1).'/'.$pages.'..........</li>");</script>'; showmessage(L('part_cache_success'), '?m=admin&c=cache_all&a=init&page='.$_GET['page'].'&currpage='.$currpage.'&pages='.$pages.'&dosubmit=1',0); } } /** * 更新删除缓存文件方法 */ public function del_file() { $path = PHPCMS_PATH.'caches'.DIRECTORY_SEPARATOR.'caches_template'.DIRECTORY_SEPARATOR; $files = glob($path.'*'); pc_base::load_sys_func('dir'); if (is_array($files)) { foreach ($files as $f) { $dir = basename($f); if (!in_array($dir, array('block', 'dbsource'))) { dir_delete($path.$dir); } } } $path = PHPCMS_PATH.'caches'.DIRECTORY_SEPARATOR.'caches_tpl_data'.DIRECTORY_SEPARATOR.'caches_data'.DIRECTORY_SEPARATOR; $files = glob($path.'*'); if (is_array($files)) { foreach ($files as $f) { $dir = basename($f); @unlink($path.$dir); } } return true; } /** * 更新来源缓存方法 */ public function copyfrom() { $infos = $this->db->select('','*','','listorder DESC','','id'); setcache('copyfrom', $infos, 'admin'); return true; } }
108wo
phpcms/modules/admin/classes/cache_api.class.php
PHP
asf20
17,882
<?php /** * position_api.class.php 推荐至推荐位接口类 * * @copyright (C) 2005-2010 PHPCMS * @license http://www.phpcms.cn/license/ * @lastmodify 2010-8-3 */ defined('IN_PHPCMS') or exit('No permission resources.'); class push_api { private $db, $pos_data; //数据调用属性 public function __construct() { $this->db = pc_base::load_model('position_model'); //加载数据模型 } /** * 推荐位推送修改接口 * 适合在文章发布、修改时调用 * @param int $id 推荐文章ID * @param int $modelid 模型ID * @param array $posid 推送到的推荐位ID * @param array $data 推送数据 * @param int $expiration 过期时间设置 * @param int $undel 是否判断推荐位去除情况 * @param string $model 调取的数据模型 * 调用方式 * $push = pc_base::load_app_class('push_api','admin'); * $push->position_update(323, 25, 45, array(20,21), array('title'=>'文章标题','thumb'=>'缩略图路径','inputtime'='时间戳')); */ public function position_update($id, $modelid, $catid, $posid, $data, $expiration, $undel = 0, $model = 'content_model') { $arr = $param = array(); $id = intval($id); if($id == '0') return false; $modelid = intval($modelid); $data['inputtime'] = $data['inputtime'] ? $data['inputtime'] : SYS_TIME; //组装属性参数 $arr['modelid'] = $modelid; $arr['catid'] = $catid; $arr['posid'] = $posid; $arr['dosubmit'] = '1'; //组装数据 $param[0] = $data; $param[0]['id'] = $id; if ($undel==0) $pos_info = $this->position_del($catid, $id, $posid); return $this->position_list($param, $arr, $expiration, $model) ? true : false; } /** * 推荐位删除计算 * Enter description here ... * @param int $catid 栏目ID * @param int $id 文章id * @param array $input_posid 传入推荐位数组 */ private function position_del($catid,$id,$input_posid) { $array = array(); $pos_data = pc_base::load_model('position_data_model'); //查找已存在推荐位 $r = $pos_data->select(array('id'=>$id,'catid'=>$catid),'posid'); if(!$r) return false; foreach ($r as $v) $array[] = $v['posid']; //差集计算,需要删除的推荐 $real_posid = implode(',', array_diff($array,$input_posid)); if (!$real_posid) return false; $sql = "`catid`='$catid' AND `id`='$id' AND `posid` IN ($real_posid)"; return $pos_data->delete($sql) ? true : false; } /** * 判断文章是否被推荐 * @param $id * @param $modelid */ private function content_pos($id, $modelid) { $id = intval($id); $modelid = intval($modelid); if ($id && $modelid) { $db_data = pc_base::load_model('position_data_model'); $this->db_content = pc_base::load_model('content_model'); $MODEL = getcache('model','commons'); $this->db_content->table_name = $this->db_content->db_tablepre.$MODEL[$modelid]['tablename']; $posids = $db_data->get_one(array('id'=>$id,'modelid'=>$modelid)) ? 1 : 0; if ($posids==0) $this->db_content->update(array('posids'=>$posids),array('id'=>$id)); } return true; } /** * 接口处理方法 * @param array $param 属性 请求时,为模型、栏目数组。提交添加为二维信息数据 。例:array(1=>array('title'=>'多发发送方法', ....)) * @param array $arr 参数 表单数据,只在请求添加时传递。 例:array('modelid'=>1, 'catid'=>12); * @param int $expiration 过期时间设置 * @param string $model 调取的数据库型名称 */ public function position_list($param = array(), $arr = array(), $expiration = 0, $model = 'content_model') { if ($arr['dosubmit']) { if (!$model) { $model = 'content_model'; } else { $model = $model; } $db = pc_base::load_model($model); $modelid = intval($arr['modelid']); $catid = intval($arr['catid']); $expiration = intval($expiration)>SYS_TIME ? intval($expiration) : 0; $db->set_model($modelid); $info = $r = array(); $pos_data = pc_base::load_model('position_data_model'); $position_info = getcache('position', 'commons'); $fulltext_array = getcache('model_field_'.$modelid,'model'); if (is_array($arr['posid']) && !empty($arr['posid']) && is_array($param) && !empty($param)) { foreach ($arr['posid'] as $pid) { $ext = $func_char = ''; $r = $this->db->get_one(array('posid'=>$pid), 'extention'); //检查推荐位是否启用了扩展字段 $ext = $r['extention'] ? $r['extention'] : ''; if ($ext) { $ext = str_replace(array('\'', '"', ' '), '', $ext); $func_char = strpos($ext, '('); if ($func_char) { $func_name = $param_k = $param_arr = ''; $func_name = substr($ext, 0, $func_char); $param_k = substr($ext, $func_char+1, strrpos($ext, ')')-($func_char+1)); $param_arr = explode(',', $param_k); } } foreach ($param as $d) { $info['id'] = $info['listorder'] = $d['id']; $info['catid'] = $catid; $info['posid'] = $pid; $info['module'] = $model == 'yp_content_model' ? 'yp' : 'content'; $info['modelid'] = $modelid; $fields_arr = $fields_value = ''; foreach($fulltext_array AS $key=>$value){ $fields_arr[] = '{'.$key.'}'; $fields_value[] = $d[$key]; if($value['isposition']) { if ($d[$key]) $info['data'][$key] = $d[$key]; } } if ($ext) { if ($func_name) { foreach ($param_arr as $k => $v) { $c_func_name = $c_param = $c_param_arr = $c_func_char = ''; $c_func_char = strpos($v, '('); if ($c_func_char) { $c_func_name = substr($v, 0, $c_func_char); $c_param = substr($v, $c_func_char+1, strrpos($v, ')')-($c_func_char+1)); $c_param_arr = explode(',', $c_param); $param_arr[$k] = call_user_func_array($c_func_name, $c_param_arr); } else { $param_arr[$k] = str_replace($fields_arr, $fields_value, $v); } } $info['extention'] = call_user_func_array($func_name, $param_arr); } else { $info['extention'] = $d[$ext]; } } //颜色选择为隐藏域 在这里进行取值 $info['data']['style'] = $d['style']; $info['thumb'] = $info['data']['thumb'] ? 1 : 0; $info['siteid'] = get_siteid(); $info['data'] = array2string($info['data']); $info['expiration'] = $expiration; if ($r = $pos_data->get_one(array('id'=>$d['id'], 'posid'=>$pid, 'catid'=>$info['catid']))) { if($r['synedit'] == '0') $pos_data->update($info, array('id'=>$d['id'], 'posid'=>$pid, 'catid'=>$info['catid'])); } else { $pos_data->insert($info); } $db->update(array('posids'=>1), array('id'=>$d['id'])); unset($info); } $maxnum = $position_info[$pid]['maxnum']+4; $r = $pos_data->select(array('catid'=>$catid, 'posid'=>$pid), 'id, listorder', $maxnum.',1', 'listorder DESC, id DESC'); if ($r && $position_info[$pid]['maxnum']) { $listorder = $r[0]['listorder']; $where = '`catid`='.$catid.' AND `posid`='.$pid.' AND `listorder`<'.$listorder; $result = $pos_data->select($where, 'id, modelid'); foreach ($result as $r) { $pos_data->delete(array('id'=>$r['id'], 'posid'=>$pid, 'catid'=>$catid)); $this->content_pos($r['id'], $r['modelid']); } } } } return true; } else { $infos = $info = array(); $where = '1'; $siteid = get_siteid(); $category = getcache('category_content_'.$siteid,'commons'); $positions = getcache('position', 'commons'); if(!empty($positions)) { foreach ($positions as $pid => $p) { if ($p['catid']) $catids = array_keys((array)subcat($p['catid'], 0, 1)); if (($p['siteid']==0 || $p['siteid']==$siteid) && ($p['modelid']==0 || $p['modelid']==$param['modelid']) && ($p['catid']==0 || in_array($param['catid'], $catids))) { $info[$pid] = $p['name']; } } return array( 'posid' => array('name'=>L('position'), 'htmltype'=>'checkbox', 'defaultvalue'=>'', 'data'=>$info, 'validator'=>array('min'=>1)), ); } } } } ?>
108wo
phpcms/modules/admin/classes/push_api.class.php
PHP
asf20
8,310
<?php defined('IN_PHPCMS') or exit('No permission resources.'); //定义在后台 define('IN_ADMIN',true); class role_op { public function __construct() { $this->db = pc_base::load_model('admin_role_model'); $this->priv_db = pc_base::load_model('admin_role_priv_model'); } /** * 获取角色中文名称 * @param int $roleid 角色ID */ public function get_rolename($roleid) { $roleid = intval($roleid); $search_field = '`roleid`,`rolename`'; $info = $this->db->get_one(array('roleid'=>$roleid),$search_field); return $info; } /** * 检查角色名称重复 * @param $name 角色组名称 */ public function checkname($name) { $info = $this->db->get_one(array('rolename'=>$name),'roleid'); if($info[roleid]){ return true; } return false; } /** * 获取菜单表信息 * @param int $menuid 菜单ID * @param int $menu_info 菜单数据 */ public function get_menuinfo($menuid,$menu_info) { $menuid = intval($menuid); unset($menu_info[$menuid][id]); return $menu_info[$menuid]; } /** * 检查指定菜单是否有权限 * @param array $data menu表中数组 * @param int $roleid 需要检查的角色ID */ public function is_checked($data,$roleid,$siteid,$priv_data) { $priv_arr = array('m','c','a','data'); if($data['m'] == '') return false; foreach($data as $key=>$value){ if(!in_array($key,$priv_arr)) unset($data[$key]); } $data['roleid'] = $roleid; $data['siteid'] = $siteid; $info = in_array($data, $priv_data); if($info){ return true; } else { return false; } } /** * 是否为设置状态 */ public function is_setting($siteid,$roleid) { $siteid = intval($siteid); $roleid = intval($roleid); $sqls = "`siteid`='$siteid' AND `roleid` = '$roleid' AND `m` != ''"; $result = $this->priv_db->get_one($sqls); return $result ? true : false; } /** * 获取菜单深度 * @param $id * @param $array * @param $i */ public function get_level($id,$array=array(),$i=0) { foreach($array as $n=>$value){ if($value['id'] == $id) { if($value['parentid']== '0') return $i; $i++; return $this->get_level($value['parentid'],$array,$i); } } } } ?>
108wo
phpcms/modules/admin/classes/role_op.class.php
PHP
asf20
2,292
<?php /** * position_api.class.php 模块安装接口类 * * @copyright (C) 2005-2010 PHPCMS * @license http://www.phpcms.cn/license/ * @lastmodify 2010-8-31 */ defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_sys_func('dir'); class module_api { private $db, $m_db, $installdir, $uninstaldir, $module, $isall; public $error_msg = ''; public function __construct() { $this->db = pc_base::load_model('module_model'); } /** * 模块安装 * @param string $module 模块名 */ public function install($module = '') { define('INSTALL', true); if ($module) $this->module = $module; $this->installdir = PC_PATH.'modules'.DIRECTORY_SEPARATOR.$this->module.DIRECTORY_SEPARATOR.'install'.DIRECTORY_SEPARATOR; $this->check(); $models = @require($this->installdir.'model.php'); if (!is_array($models) || empty($models)) { $models = array('module'); } if (!in_array('module', $models)) { array_unshift($models, 'module'); } if (is_array($models) && !empty($models)) { foreach ($models as $m) { $this->m_db = pc_base::load_model($m.'_model'); $sql = file_get_contents($this->installdir.$m.'.sql'); $this->sql_execute($sql); } } if (file_exists($this->installdir.'extention.inc.php')) { $menu_db = pc_base::load_model('menu_model'); @include ($this->installdir.'extention.inc.php'); if(!defined('INSTALL_MODULE')) { $file = PC_PATH.'languages'.DIRECTORY_SEPARATOR.pc_base::load_config('system', 'lang').DIRECTORY_SEPARATOR.'system_menu.lang.php'; if(file_exists($file)) { $content = file_get_contents($file); $content = substr($content,0,-2); $data = ''; foreach ($language as $key => $l) { if (L($key, '', 'system_menu')==L('no_language').'['.$key.']') { $data .= "\$LANG['".$key."'] = '".$l."';\r\n"; } } $data = $content.$data."?>"; file_put_contents($file,$data); } else { foreach ($language as $key =>$l) { if (L($key, '', 'system_menu')==L('no_language').'['.$key.']') { $data .= "\$LANG['".$key."'] = '".$l."';\r\n"; } } $data = "<?"."php\r\n\$data?>"; file_put_contents($file,$data); } } } if(!defined('INSTALL_MODULE')) { if (file_exists($this->installdir.'languages'.DIRECTORY_SEPARATOR)) { dir_copy($this->installdir.'languages'.DIRECTORY_SEPARATOR, PC_PATH.'languages'.DIRECTORY_SEPARATOR); } if(file_exists($this->installdir.'templates'.DIRECTORY_SEPARATOR)) { dir_copy($this->installdir.'templates'.DIRECTORY_SEPARATOR, PC_PATH.'templates'.DIRECTORY_SEPARATOR.pc_base::load_config('system', 'tpl_name').DIRECTORY_SEPARATOR.$this->module.DIRECTORY_SEPARATOR); if (file_exists($this->installdir.'templates'.DIRECTORY_SEPARATOR.'name.inc.php')) { $keyid = 'templates|'.pc_base::load_config('system', 'tpl_name').'|'.$this->module; $file_explan[$keyid] = include $this->installdir.'templates'.DIRECTORY_SEPARATOR.'name.inc.php'; $templatepath = PC_PATH.'templates'.DIRECTORY_SEPARATOR.pc_base::load_config('system', 'tpl_name').DIRECTORY_SEPARATOR; if (file_exists($templatepath.'config.php')) { $style_info = include $templatepath.'config.php'; $style_info['file_explan'] = array_merge($style_info['file_explan'], $file_explan); @file_put_contents($templatepath.'config.php', '<?php return '.var_export($style_info, true).';?>'); } unlink(PC_PATH.'templates'.DIRECTORY_SEPARATOR.pc_base::load_config('system', 'tpl_name').DIRECTORY_SEPARATOR.$this->module.DIRECTORY_SEPARATOR.'name.inc.php'); } } } return true; } /** * 检查安装目录 * @param string $module 模块名 */ public function check($module = '') { define('INSTALL', true); if ($module) $this->module = $module; if(!$this->module) { $this->error_msg = L('no_module'); return false; } if(!defined('INSTALL_MODULE')) { if (dir_create(PC_PATH.'languages'.DIRECTORY_SEPARATOR.pc_base::load_config('system', 'lang').DIRECTORY_SEPARATOR.'test_create_dir')) { sleep(1); dir_delete(PC_PATH.'languages'.DIRECTORY_SEPARATOR.pc_base::load_config('system', 'lang').DIRECTORY_SEPARATOR.'test_create_dir'); } else { $this->error_msg = L('lang_dir_no_write'); return false; } } $r = $this->db->get_one(array('module'=>$this->module)); if ($r) { $this->error_msg = L('this_module_installed'); return false; } if (!$this->installdir) { $this->installdir = PC_PATH.'modules'.DIRECTORY_SEPARATOR.$this->module.DIRECTORY_SEPARATOR.'install'.DIRECTORY_SEPARATOR; } if (!is_dir($this->installdir)) { $this->error_msg = L('install_dir_no_exist'); return false; } if (!file_exists($this->installdir.'module.sql')) { $this->error_msg = L('module_sql_no_exist'); return false; } $models = @require($this->installdir.'model.php'); if (is_array($models) && !empty($models)) { foreach ($models as $m) { if (!file_exists(PC_PATH.'model'.DIRECTORY_SEPARATOR.$m.'_model.class.php')) { $this->error_msg = $m.L('model_clas_no_exist'); return false; } if (!file_exists($this->installdir.$m.'.sql')) { $this->error_msg = $m.L('sql_no_exist'); return false; } } } return true; } /** * 模块卸载 * @param string $module 模块名 */ public function uninstall($module) { define('UNINSTALL', true); if (!$module) { $this->error_msg = L('illegal_parameters'); return false; } $this->module = $module; $this->uninstalldir = PC_PATH.'modules'.DIRECTORY_SEPARATOR.$this->module.DIRECTORY_SEPARATOR.'uninstall'.DIRECTORY_SEPARATOR; if (!is_dir($this->uninstalldir)) { $this->error_msg = L('uninstall_dir_no_exist'); return false; } if (file_exists($this->uninstalldir.'model.php')) { $models = @require($this->uninstalldir.'model.php'); if (is_array($models) && !empty($models)) { foreach ($models as $m) { if (!file_exists($this->uninstalldir.$m.'.sql')) { $this->error_msg = $this->module.DIRECTORY_SEPARATOR.'uninstall'.DIRECTORY_SEPARATOR.$m.L('sql_no_exist'); return false; } } } } if (file_exists($this->uninstalldir.'extention.inc.php')) { @include ($this->uninstalldir.'extention.inc.php'); } if (is_array($models) && !empty($models)) { foreach ($models as $m) { $this->m_db = pc_base::load_model($m.'_model'); $sql = file_get_contents($this->uninstalldir.$m.'.sql'); $this->sql_execute($sql); } } if (file_exists(PC_PATH.'languages'.DIRECTORY_SEPARATOR.pc_base::load_config('system', 'lang').DIRECTORY_SEPARATOR.$this->module.'.lang.php')) { @unlink(PC_PATH.'languages'.DIRECTORY_SEPARATOR.pc_base::load_config('system', 'lang').DIRECTORY_SEPARATOR.$this->module.'.lang.php'); } if (is_dir(PC_PATH.'templates'.DIRECTORY_SEPARATOR.pc_base::load_config('system', 'tpl_name').DIRECTORY_SEPARATOR.$this->module)) { @dir_delete(PC_PATH.'templates'.DIRECTORY_SEPARATOR.pc_base::load_config('system', 'tpl_name').DIRECTORY_SEPARATOR.$this->module); } $templatepath = PC_PATH.'templates'.DIRECTORY_SEPARATOR.pc_base::load_config('system', 'tpl_name').DIRECTORY_SEPARATOR; if (file_exists($templatepath.'config.php')) { $keyid = 'templates|'.pc_base::load_config('system', 'tpl_name').'|'.$this->module; $style_info = include $templatepath.'config.php'; unset($style_info['file_explan'][$keyid]); @file_put_contents($templatepath.'config.php', '<?php return '.var_export($style_info, true).';?>'); } $menu_db = pc_base::load_model('menu_model'); $menu_db->delete(array('m'=>$this->module)); $this->db->delete(array('module'=>$this->module)); return true; } /** * 执行mysql.sql文件,创建数据表等 * @param string $sql sql语句 */ private function sql_execute($sql) { $sqls = $this->sql_split($sql); if (is_array($sqls)) { foreach ($sqls as $sql) { if (trim($sql) != '') { $this->m_db->query($sql); } } } else { $this->m_db->query($sqls); } return true; } /** * 处理sql语句,执行替换前缀都功能。 * @param string $sql 原始的sql,将一些大众的部分替换成私有的 */ private function sql_split($sql) { $dbcharset = $GLOBALS['dbcharset']; if (!$dbcharset) { $dbcharset = pc_base::load_config('database','default'); $dbcharset = $dbcharset['charset']; } if($this->m_db->version() > '4.1' && $dbcharset) { $sql = preg_replace("/TYPE=(InnoDB|MyISAM|MEMORY)( DEFAULT CHARSET=[^; ]+)?/", "ENGINE=\\1 DEFAULT CHARSET=".$dbcharset, $sql); } if($this->m_db->db_tablepre != "phpcms_") $sql = str_replace("phpcms_", $this->m_db->db_tablepre, $sql); $sql = str_replace(array("\r", '2010-9-05'), array("\n", date('Y-m-d')), $sql); $ret = array(); $num = 0; $queriesarray = explode(";\n", trim($sql)); unset($sql); foreach ($queriesarray as $query) { $ret[$num] = ''; $queries = explode("\n", trim($query)); $queries = array_filter($queries); foreach ($queries as $query) { $str1 = substr($query, 0, 1); if($str1 != '#' && $str1 != '-') $ret[$num] .= $query; } $num++; } return $ret; } } ?>
108wo
phpcms/modules/admin/classes/module_api.class.php
PHP
asf20
9,418
<?php defined('IN_PHPCMS') or exit('No permission resources.'); $session_storage = 'session_'.pc_base::load_config('system','session_storage'); pc_base::load_sys_class($session_storage); if(param::get_cookie('sys_lang')) { define('SYS_STYLE',param::get_cookie('sys_lang')); } else { define('SYS_STYLE','zh-cn'); } //定义在后台 define('IN_ADMIN',true); class admin { public $userid; public $username; public function __construct() { self::check_admin(); self::check_priv(); pc_base::load_app_func('global','admin'); if (!module_exists(ROUTE_M)) showmessage(L('module_not_exists')); self::manage_log(); self::check_ip(); self::lock_screen(); self::check_hash(); } /** * 判断用户是否已经登陆 */ final public function check_admin() { if(ROUTE_M =='admin' && ROUTE_C =='index' && in_array(ROUTE_A, array('login', 'public_card'))) { return true; } else { if(!isset($_SESSION['userid']) || !isset($_SESSION['roleid']) || !$_SESSION['userid'] || !$_SESSION['roleid']) showmessage(L('admin_login'),'?m=admin&c=index&a=login'); } } /** * 加载后台模板 * @param string $file 文件名 * @param string $m 模型名 */ final public static function admin_tpl($file, $m = '') { $m = empty($m) ? ROUTE_M : $m; if(empty($m)) return false; return PC_PATH.'modules'.DIRECTORY_SEPARATOR.$m.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR.$file.'.tpl.php'; } /** * 按父ID查找菜单子项 * @param integer $parentid 父菜单ID * @param integer $with_self 是否包括他自己 */ final public static function admin_menu($parentid, $with_self = 0) { $parentid = intval($parentid); $menudb = pc_base::load_model('menu_model'); $result =$menudb->select(array('parentid'=>$parentid,'display'=>1),'*',1000,'listorder ASC'); if($with_self) { $result2[] = $menudb->get_one(array('id'=>$parentid)); $result = array_merge($result2,$result); } //权限检查 if($_SESSION['roleid'] == 1) return $result; $array = array(); $privdb = pc_base::load_model('admin_role_priv_model'); $siteid = param::get_cookie('siteid'); foreach($result as $v) { $action = $v['a']; if(preg_match('/^public_/',$action)) { $array[] = $v; } else { if(preg_match('/^ajax_([a-z]+)_/',$action,$_match)) $action = $_match[1]; $r = $privdb->get_one(array('m'=>$v['m'],'c'=>$v['c'],'a'=>$action,'roleid'=>$_SESSION['roleid'],'siteid'=>$siteid)); if($r) $array[] = $v; } } return $array; } /** * 获取菜单 头部菜单导航 * * @param $parentid 菜单id */ final public static function submenu($parentid = '', $big_menu = false) { if(empty($parentid)) { $menudb = pc_base::load_model('menu_model'); $r = $menudb->get_one(array('m'=>ROUTE_M,'c'=>ROUTE_C,'a'=>ROUTE_A)); $parentid = $_GET['menuid'] = $r['id']; } $array = self::admin_menu($parentid,1); $numbers = count($array); if($numbers==1 && !$big_menu) return ''; $string = ''; $pc_hash = $_SESSION['pc_hash']; foreach($array as $_value) { if (!isset($_GET['s'])) { $classname = ROUTE_M == $_value['m'] && ROUTE_C == $_value['c'] && ROUTE_A == $_value['a'] ? 'class="on"' : ''; } else { $_s = !empty($_value['data']) ? str_replace('=', '', strstr($_value['data'], '=')) : ''; $classname = ROUTE_M == $_value['m'] && ROUTE_C == $_value['c'] && ROUTE_A == $_value['a'] && $_GET['s'] == $_s ? 'class="on"' : ''; } if($_value['parentid'] == 0 || $_value['m']=='') continue; if($classname) { $string .= "<a href='javascript:;' $classname><em>".L($_value['name'])."</em></a><span>|</span>"; } else { $string .= "<a href='?m=".$_value['m']."&c=".$_value['c']."&a=".$_value['a']."&menuid=$parentid&pc_hash=$pc_hash".'&'.$_value['data']."' $classname><em>".L($_value['name'])."</em></a><span>|</span>"; } } $string = substr($string,0,-14); return $string; } /** * 当前位置 * * @param $id 菜单id */ final public static function current_pos($id) { $menudb = pc_base::load_model('menu_model'); $r =$menudb->get_one(array('id'=>$id),'id,name,parentid'); $str = ''; if($r['parentid']) { $str = self::current_pos($r['parentid']); } return $str.L($r['name']).' > '; } /** * 获取当前的站点ID */ final public static function get_siteid() { return get_siteid(); } /** * 获取当前站点信息 * @param integer $siteid 站点ID号,为空时取当前站点的信息 * @return array */ final public static function get_siteinfo($siteid = '') { if ($siteid == '') $siteid = self::get_siteid(); if (empty($siteid)) return false; $sites = pc_base::load_app_class('sites', 'admin'); return $sites->get_by_id($siteid); } final public static function return_siteid() { $sites = pc_base::load_app_class('sites', 'admin'); $siteid = explode(',',$sites->get_role_siteid($_SESSION['roleid'])); return current($siteid); } /** * 权限判断 */ final public function check_priv() { if(ROUTE_M =='admin' && ROUTE_C =='index' && in_array(ROUTE_A, array('login', 'init', 'public_card'))) return true; if($_SESSION['roleid'] == 1) return true; $siteid = param::get_cookie('siteid'); $action = ROUTE_A; $privdb = pc_base::load_model('admin_role_priv_model'); if(preg_match('/^public_/',ROUTE_A)) return true; if(preg_match('/^ajax_([a-z]+)_/',ROUTE_A,$_match)) { $action = $_match[1]; } $r =$privdb->get_one(array('m'=>ROUTE_M,'c'=>ROUTE_C,'a'=>$action,'roleid'=>$_SESSION['roleid'],'siteid'=>$siteid)); if(!$r) showmessage('您没有权限操作该项','blank'); } /** * * 记录日志 */ final private function manage_log() { //判断是否记录 $setconfig = pc_base::load_config('system'); extract($setconfig); if($admin_log==1){ $action = ROUTE_A; if($action == '' || strchr($action,'public') || $action == 'init' || $action=='public_current_pos') { return false; }else { $ip = ip(); $log = pc_base::load_model('log_model'); $username = param::get_cookie('admin_username'); $userid = isset($_SESSION['userid']) ? $_SESSION['userid'] : ''; $time = date('Y-m-d H-i-s',SYS_TIME); $url = '?m='.ROUTE_M.'&c='.ROUTE_C.'&a='.ROUTE_A; $log->insert(array('module'=>ROUTE_M,'username'=>$username,'userid'=>$userid,'action'=>ROUTE_C, 'querystring'=>$url,'time'=>$time,'ip'=>$ip)); } } } /** * * 后台IP禁止判断 ... */ final private function check_ip(){ $this->ipbanned = pc_base::load_model('ipbanned_model'); $this->ipbanned->check_ip(); } /** * 检查锁屏状态 */ final private function lock_screen() { if(isset($_SESSION['lock_screen']) && $_SESSION['lock_screen']==1) { if(preg_match('/^public_/', ROUTE_A) || (ROUTE_M == 'content' && ROUTE_C == 'create_html') || (ROUTE_M == 'release') || (ROUTE_A == 'login') || (ROUTE_M == 'search' && ROUTE_C == 'search_admin' && ROUTE_A=='createindex')) return true; showmessage(L('admin_login'),'?m=admin&c=index&a=login'); } } /** * 检查hash值,验证用户数据安全性 */ final private function check_hash() { if(preg_match('/^public_/', ROUTE_A) || ROUTE_M =='admin' && ROUTE_C =='index' || in_array(ROUTE_A, array('login'))) { return true; } if(isset($_GET['pc_hash']) && $_SESSION['pc_hash'] != '' && ($_SESSION['pc_hash'] == $_GET['pc_hash'])) { return true; } elseif(isset($_POST['pc_hash']) && $_SESSION['pc_hash'] != '' && ($_SESSION['pc_hash'] == $_POST['pc_hash'])) { return true; } else { showmessage(L('hash_check_false'),HTTP_REFERER); } } }
108wo
phpcms/modules/admin/classes/admin.class.php
PHP
asf20
7,803
<?php class card { static $server_url = 'http://safe.phpcms.cn/index.php'; /** * 到远程服务器上去取KEY */ public static function get_key() { return self::_get_data('?op=key'); } /** * 卡片的显示地址 * @param $sn 口令卡编号 */ public static function get_pic($sn) { $key = self::get_key(); return self::$server_url.'?op=card&key='.urlencode($key).'&code='.urlencode(sys_auth("sn=$sn", 'ENCODE', $key)); } /** * 申请新的卡片 * @return 返回卡片的sn */ public static function creat_card() { $key = self::get_key(); return self::_get_data('?op=creat_card&key='.urlencode($key)); } /** * 解除口令卡绑定 * @param string $sn 口令卡编号 */ public static function remove_card($sn) { $key = self::get_key(); return self::_get_data('?op=remove&key='.urlencode($key).'&code='.urlencode(sys_auth("sn=$sn", 'ENCODE', $key))); } /** * 请求口令验证码 * @param string $sn 口令卡编号 */ public static function authe_rand($sn) { $key = self::get_key(); $data = self::_get_data('?op=authe_request&key='.urlencode($key).'&code='.urlencode(sys_auth("sn=$sn", 'ENCODE', $key))); return array('rand'=>$data,'url'=>self::$server_url.'?op=show_rand&key='.urlencode($key).'&code='.urlencode(sys_auth("rand=$data", 'ENCODE', $key))); } /** * 验证动态口令 * @param string $sn 口令卡编号 * @param string $code 用户输入口令 * @param string $rand 随机码 */ public static function verification($sn, $code, $rand) { $key = self::get_key(); return self::_get_data('?op=verification&key='.urlencode($key).'&code='.urlencode(sys_auth("sn=$sn&code=$code&rand=$rand", 'ENCODE', $key)), 'index.php?m=admin&c=index&a=public_card'); } /** * 请求远程数据 * @param string $url 需要请求的地址。 * @param string $backurl 返回地址 */ private static function _get_data($url, $backurl = '') { if ($data = @file_get_contents(self::$server_url.$url)) { $data = json_decode($data, true); //如果系统是GBK的系统,把UTF8转码为GBK if (pc_base::load_config('system', 'charset') == 'gbk') { $data = array_iconv($data, 'utf-8', 'gbk'); } if ($data['status'] != 1) { showmessage($data['msg'], $backurl); } else { return $data['msg']; } } else { showmessage(L('your_server_it_may_not_have_access_to').self::$server_url.L('_please_check_the_server_configuration')); } } }
108wo
phpcms/modules/admin/classes/card.class.php
PHP
asf20
2,567
<?php defined('IN_PHPCMS') or exit('No permission resources.'); class role_cat { //数据库连接 static $db; private static function _connect() { self::$db = pc_base::load_model('category_priv_model'); } /** * 获取角色配置权限 * @param integer $roleid 角色ID * @param integer $siteid 站点ID */ public static function get_roleid($roleid, $siteid) { if (empty(self::$db)) { self::_connect(); } if ($data = self::$db->select("`roleid` = '$roleid' AND `is_admin` = '1' AND `siteid` IN ('$siteid') ")) { $priv = array(); foreach ($data as $k=>$v) { $priv[$v['catid']][$v['action']] = true; } return $priv; } else { return false; } } /** * 获取站点栏目列表 * @param integer $siteid 站点ID * @return array() 返回为数组 */ public static function get_category($siteid) { $category = getcache('category_content_'.$siteid, 'commons'); foreach ($category as $k=>$v) { if (!in_array($v['type'], array(0,1))) unset($category[$k]); } return $category; } /** * 更新数据库信息 * @param integer $roleid 角色ID * @param integer $siteid 站点ID * @param array $data 需要更新的数据 */ public static function updata_priv($roleid, $siteid, $data) { if (empty(self::$db)) { self::_connect(); } //删除该角色当前的权限 self::$db->delete(array('roleid'=>$roleid, 'siteid'=>$siteid, 'is_admin'=>1)); foreach ($data as $k=>$v) { if (is_array($v) && !empty($v[0])) { foreach ($v as $key=>$val) { self::$db->insert(array('siteid'=>$siteid, 'catid'=>$k, 'is_admin'=>1, 'roleid'=>$roleid, 'action'=>$val)); } } } } }
108wo
phpcms/modules/admin/classes/role_cat.class.php
PHP
asf20
1,753
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); set_time_limit(0); class linkage extends admin { private $db; function __construct() { parent::__construct(); $this->db = pc_base::load_model('linkage_model'); $this->sites = pc_base::load_app_class('sites'); pc_base::load_sys_class('form', '', 0); $this->childnode = array(); } /** * 联动菜单列表 */ public function init() { $where = array('keyid'=>0); $infos = $this->db->select($where); $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=admin&c=linkage&a=add\', title:\''.L('linkage_add').'\', width:\'500\', height:\'220\', lock:true}, function(){var d = window.top.art.dialog({id:\'add\'}).data.iframe;var form = d.document.getElementById(\'dosubmit\');form.click();return false;}, function(){window.top.art.dialog({id:\'add\'}).close()});void(0);', L('linkage_add')); include $this->admin_tpl('linkage_list'); } /** * 添加联动菜单 */ function add() { if(isset($_POST['dosubmit'])) { $info = array(); $info['name'] = isset($_POST['info']['name']) && trim($_POST['info']['name']) ? trim($_POST['info']['name']) : showmessage(L('linkage_not_empty')); $info['description'] = trim($_POST['info']['description']); $info['style'] = trim(intval($_POST['info']['style'])); $info['siteid'] = trim(intval($_POST['info']['siteid'])); $this->db->insert($info); $insert_id = $this->db->insert_id(); if($insert_id){ showmessage(L('operation_success'), '', '', 'add'); } } else { $show_header = true; $show_validator = true; $sitelist = $this->sites->get_list(); foreach($sitelist as $siteid=>$v) { $sitelist[$siteid] = $v['name']; } include $this->admin_tpl('linkage_add'); } } /** * 编辑联动菜单 */ public function edit() { if(isset($_POST['dosubmit'])) { $info = array(); $linkageid = intval($_POST['linkageid']); $info['name'] = isset($_POST['info']['name']) && trim($_POST['info']['name']) ? trim($_POST['info']['name']) : showmessage(L('linkage_not_empty')); $info['description'] = trim($_POST['info']['description']); $info['style'] = trim(intval($_POST['info']['style'])); $info['siteid'] = trim(intval($_POST['info']['siteid'])); if($_POST['info']['keyid']) $info['keyid'] = trim($_POST['info']['keyid']); if($_POST['info']['parentid']) $info['parentid'] = trim($_POST['info']['parentid']); $this->db->update($info,array('linkageid'=>$linkageid)); $id = $info['keyid'] ? $info['keyid'] : $linkageid; showmessage(L('operation_success'), '', '', 'edit'); } else { $linkageid = intval($_GET['linkageid']); $info = $this->db->get_one(array('linkageid'=>$linkageid)); extract($info); $sitelist = $this->sites->get_list(); foreach($sitelist as $id=>$v) { $sitelist[$id] = $v['name']; } $show_header = true; $show_validator = true; include $this->admin_tpl('linkage_edit'); } } /** * 删除菜单 */ public function delete() { $linkageid = intval($_GET['linkageid']); $keyid = intval($_GET['keyid']); $this->_get_childnode($linkageid); if(is_array($this->childnode)){ foreach($this->childnode as $linkageid_tmp) { $this->db->delete(array('linkageid' => $linkageid_tmp)); } } $this->db->delete(array('keyid' => $linkageid)); $id = $keyid ? $keyid : $linkageid; if(!$keyid)$this->_dlecache($linkageid); showmessage(L('operation_success')); } public function public_cache() { $linkageid = intval($_GET['linkageid']); $this->_cache($linkageid); showmessage(L('operation_success')); } /** * 菜单排序 */ public function public_listorder() { if(!is_array($_POST['listorders'])) return FALSE; foreach($_POST['listorders'] as $linkageid=>$value) { $value = intval($value); $this->db->update(array('listorder'=>$value),array('linkageid'=>$linkageid)); } $id = intval($_POST['keyid']); showmessage(L('operation_success'),'?m=admin&c=linkage&a=init'); } /** * 管理联动菜单子菜单 */ public function public_manage_submenu() { $keyid = isset($_GET['keyid']) && trim($_GET['keyid']) ? trim($_GET['keyid']) : showmessage(L('linkage_parameter_error')); $tree = pc_base::load_sys_class('tree'); $tree->icon = array('&nbsp;&nbsp;&nbsp;│ ','&nbsp;&nbsp;&nbsp;├─ ','&nbsp;&nbsp;&nbsp;└─ '); $tree->nbsp = '&nbsp;&nbsp;&nbsp;'; $sum = $this->db->count(array('keyid'=>$keyid)); $sql_parentid = $_GET['parentid'] ? trim($_GET['parentid']) : 0; $where = $sum > 40 ? array('keyid'=>$keyid,'parentid'=>$sql_parentid) : array('keyid'=>$keyid); $result = $this->db->select($where,'*','','listorder ,linkageid'); foreach($result as $areaid => $area){ $areas[$area['linkageid']] = array('id'=>$area['linkageid'],'parentid'=>$area['parentid'],'name'=>$area['name'],'listorder'=>$area['listorder'],'style'=>$area['style'],'mod'=>$mod,'file'=>$file,'keyid'=>$keyid,'description'=>$area['description']); $areas[$area['linkageid']]['str_manage'] = ($sum > 40 && $this->_is_last_node($area['keyid'],$area['linkageid'])) ? '<a href="?m=admin&c=linkage&a=public_manage_submenu&keyid='.$area['keyid'].'&parentid='.$area['linkageid'].'">'.L('linkage_manage_submenu').'</a> | ' : ''; $areas[$area['linkageid']]['str_manage'] .= '<a href="javascript:void(0);" onclick="add(\''.$keyid.'\',\''.new_addslashes($area['name']).'\',\''.$area['linkageid'].'\')">'.L('linkage_add_submenu').'</a> | <a href="javascript:void(0);" onclick="edit(\''.$area['linkageid'].'\',\''.$area['name'].'\',\''.$area['parentid'].'\')">'.L('edit').'</a> | <a href="javascript:confirmurl(\'?m=admin&c=linkage&a=delete&linkageid='.$area['linkageid'].'&keyid='.$area['keyid'].'\', \''.L('linkage_is_del').'\')">'.L('delete').'</a> '; } $str = "<tr> <td align='center' width='80'><input name='listorders[\$id]' type='text' size='3' value='\$listorder' class='input-text-c'></td> <td align='center' width='100'>\$id</td> <td>\$spacer\$name</td> <td >\$description</td> <td align='center'>\$str_manage</td> </tr>"; $tree->init($areas); $submenu = $tree->get_tree($sql_parentid, $str); $big_menu =array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=admin&c=linkage&a=public_sub_add&keyid='.$keyid.'\', title:\''.L('linkage_add').'\', width:\'500\', height:\'430\', lock:true}, function(){var d = window.top.art.dialog({id:\'add\'}).data.iframe;var form = d.document.getElementById(\'dosubmit\');form.click();return false;}, function(){window.top.art.dialog({id:\'add\'}).close()});void(0);', L('linkage_add')); include $this->admin_tpl('linkage_submenu'); } /** * 子菜单添加 */ public function public_sub_add() { if(isset($_POST['dosubmit'])) { $info = array(); $info['keyid'] = isset($_POST['keyid']) && trim($_POST['keyid']) ? trim(intval($_POST['keyid'])) : showmessage(L('linkage_parameter_error')); $name = isset($_POST['info']['name']) && trim($_POST['info']['name']) ? trim($_POST['info']['name']) : showmessage(L('linkage_parameter_error')); $info['description'] = trim($_POST['info']['description']); $info['style'] = trim($_POST['info']['style']); $info['parentid'] = trim($_POST['info']['parentid']); $names = explode("\n", trim($name)); foreach($names as $name) { $name = trim($name); if(!$name) continue; $info['name'] = $name; $this->db->insert($info); } if($this->db->insert_id()){ showmessage(L('operation_success'), '', '', 'add'); } } else { $keyid = $_GET['keyid']; $linkageid = $_GET['linkageid']; $list = form::select_linkage($keyid,'0','info[parentid]', 'parentid', L('cat_empty'), $linkageid); $show_validator = true; include $this->admin_tpl('linkage_sub_add'); } } public function ajax_getlist() { $keyid = intval($_GET['keyid']); $datas = getcache($keyid,'linkage'); $infos = $datas['data']; $where_id = isset($_GET['parentid']) ? $_GET['parentid'] : intval($infos[$_GET['linkageid']]['parentid']); $parent_menu_name = ($where_id==0) ? $datas['title'] :$infos[$where_id]['name']; foreach($infos AS $k=>$v) { if($v['parentid'] == $where_id) { $s[]=iconv('gb2312','utf-8',$v['linkageid'].','.$v['name'].','.$v['parentid'].','.$parent_menu_name); } } if(count($s)>0) { $jsonstr = json_encode($s); echo $_GET['callback'].'(',$jsonstr,')'; exit; } else { echo $_GET['callback'].'()';exit; } } /** * 生成联动菜单缓存 * @param init $linkageid */ private function _cache($linkageid) { $linkageid = intval($linkageid); $info = array(); $r = $this->db->get_one(array('linkageid'=>$linkageid),'name,siteid,style,keyid'); $info['title'] = $r['name']; $info['style'] = $r['style']; $info['siteid'] = $r['siteid']; $info['data'] = $this->submenulist($linkageid); setcache($linkageid, $info,'linkage'); return $info; } /** * 删除联动菜单缓存文件 * @param init $linkageid */ private function _dlecache($linkageid) { return delcache($linkageid,'linkage'); } /** * 子菜单列表 * @param unknown_type $keyid */ private function submenulist($keyid=0) { $keyid = intval($keyid); $datas = array(); $where = ($keyid > 0) ? array('keyid'=>$keyid) : ''; $result = $this->db->select($where,'*','','listorder ,linkageid'); if(is_array($result)) { foreach($result as $r) { $arrchildid = $r['arrchildid'] = $this->get_arrchildid($r['linkageid'],$result); $child = $r['child'] = is_numeric($arrchildid) ? 0 : 1; $this->db->update(array('child'=>$child,'arrchildid'=>$arrchildid),array('linkageid'=>$r['linkageid'])); $datas[$r['linkageid']] = $r; } } return $datas; } /** * 获取所属站点 * @param unknown_type $keyid */ private function _get_belong_siteid($keyid) { $keyid = intval($keyid); $info = $this->db->get_one(array('linkageid'=>$keyid)); return $info ? $info['siteid'] : false; } /** * 获取联动菜单子节点 * @param int $linkageid */ private function _get_childnode($linkageid) { $where = array('parentid'=>$linkageid); $this->childnode[] = intval($linkageid); $result = $this->db->select($where); if($result) { foreach($result as $r) { $this->_get_childnode($r['linkageid']); } } } private function _is_last_node($keyid,$linkageid) { $result = $this->db->count(array('keyid'=>$keyid,'parentid'=>$linkageid)); return $result ? true : false; } /** * 返回菜单ID */ public function public_get_list() { $where = array('keyid'=>0); $infos = $this->db->select($where); include $this->admin_tpl('linkage_get_list'); } /** * 获取子菜单ID列表 * @param $linkageid 联动菜单id * @param $linkageinfo */ private function get_arrchildid($linkageid,$linkageinfo) { $arrchildid = $linkageid; if(is_array($linkageinfo)) { foreach($linkageinfo as $linkage) { if($linkage['parentid'] && $linkage['linkageid'] != $linkageid && $linkage['parentid']== $linkageid) { $arrchildid .= ','.$this->get_arrchildid($linkage['linkageid'],$linkageinfo); } } } return $arrchildid; } } ?>
108wo
phpcms/modules/admin/linkage.php
PHP
asf20
11,503
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); pc_base::load_app_func('admin'); class admin_manage extends admin { private $db,$role_db; function __construct() { parent::__construct(); $this->db = pc_base::load_model('admin_model'); $this->role_db = pc_base::load_model('admin_role_model'); $this->op = pc_base::load_app_class('admin_op'); } /** * 管理员管理列表 */ public function init() { $userid = $_SESSION['userid']; $admin_username = param::get_cookie('admin_username'); $page = $_GET['page'] ? intval($_GET['page']) : '1'; $infos = $this->db->listinfo('', '', $page, 20); $pages = $this->db->pages; $roles = getcache('role','commons'); include $this->admin_tpl('admin_list'); } /** * 添加管理员 */ public function add() { if(isset($_POST['dosubmit'])) { $info = array(); if(!$this->op->checkname($_POST['info']['username'])){ showmessage(L('admin_already_exists')); } $info = checkuserinfo($_POST['info']); if(!checkpasswd($info['password'])){ showmessage(L('pwd_incorrect')); } $passwordinfo = password($info['password']); $info['password'] = $passwordinfo['password']; $info['encrypt'] = $passwordinfo['encrypt']; $admin_fields = array('username', 'email', 'password', 'encrypt','roleid','realname'); foreach ($info as $k=>$value) { if (!in_array($k, $admin_fields)){ unset($info[$k]); } } $this->db->insert($info); if($this->db->insert_id()){ showmessage(L('operation_success'),'?m=admin&c=admin_manage'); } } else { $roles = $this->role_db->select(array('disabled'=>'0')); include $this->admin_tpl('admin_add'); } } /** * 修改管理员 */ public function edit() { if(isset($_POST['dosubmit'])) { $memberinfo = $info = array(); $info = checkuserinfo($_POST['info']); if(isset($info['password']) && !empty($info['password'])) { $this->op->edit_password($info['userid'], $info['password']); } $userid = $info['userid']; $admin_fields = array('username', 'email', 'roleid','realname'); foreach ($info as $k=>$value) { if (!in_array($k, $admin_fields)){ unset($info[$k]); } } $this->db->update($info,array('userid'=>$userid)); showmessage(L('operation_success'),'','','edit'); } else { $info = $this->db->get_one(array('userid'=>$_GET['userid'])); extract($info); $roles = $this->role_db->select(array('disabled'=>'0')); $show_header = true; include $this->admin_tpl('admin_edit'); } } /** * 删除管理员 */ public function delete() { $userid = intval($_GET['userid']); if($userid == '1') showmessage(L('this_object_not_del'), HTTP_REFERER); $this->db->delete(array('userid'=>$userid)); showmessage(L('admin_cancel_succ')); } /** * 更新管理员状态 */ public function lock(){ $userid = intval($_GET['userid']); $disabled = intval($_GET['disabled']); $this->db->update(array('disabled'=>$disabled),array('userid'=>$userid)); showmessage(L('operation_success'),'?m=admin&c=admin_manage'); } /** * 管理员自助修改密码 */ public function public_edit_pwd() { $userid = $_SESSION['userid']; if(isset($_POST['dosubmit'])) { $r = $this->db->get_one(array('userid'=>$userid),'password,encrypt'); if ( password($_POST['old_password'],$r['encrypt']) !== $r['password'] ) showmessage(L('old_password_wrong'),HTTP_REFERER); if(isset($_POST['new_password']) && !empty($_POST['new_password'])) { $this->op->edit_password($userid, $_POST['new_password']); } showmessage(L('password_edit_succ_logout'),'?m=admin&c=index&a=public_logout'); } else { $info = $this->db->get_one(array('userid'=>$userid)); extract($info); include $this->admin_tpl('admin_edit_pwd'); } } /* * 编辑用户信息 */ public function public_edit_info() { $userid = $_SESSION['userid']; if(isset($_POST['dosubmit'])) { $admin_fields = array('email','realname','lang'); $info = array(); $info = $_POST['info']; if(trim($info['lang'])=='') $info['lang'] = 'zh-cn'; foreach ($info as $k=>$value) { if (!in_array($k, $admin_fields)){ unset($info[$k]); } } $this->db->update($info,array('userid'=>$userid)); param::set_cookie('sys_lang', $info['lang'],SYS_TIME+86400*30); showmessage(L('operation_success'),HTTP_REFERER); } else { $info = $this->db->get_one(array('userid'=>$userid)); extract($info); $lang_dirs = glob(PC_PATH.'languages/*'); $dir_array = array(); foreach($lang_dirs as $dirs) { $dir_array[] = str_replace(PC_PATH.'languages/','',$dirs); } include $this->admin_tpl('admin_edit_info'); } } /** * 异步检测用户名 */ function public_checkname_ajx() { $username = isset($_GET['username']) && trim($_GET['username']) ? trim($_GET['username']) : exit(0); if ($this->db->get_one(array('username'=>$username),'userid')){ exit('0'); } exit('1'); } /** * 异步检测密码 */ function public_password_ajx() { $userid = $_SESSION['userid']; $r = array(); $r = $this->db->get_one(array('userid'=>$userid),'password,encrypt'); if ( password($_GET['old_password'],$r['encrypt']) == $r['password'] ) { exit('1'); } exit('0'); } /** * 异步检测emial合法性 */ function public_email_ajx() { $email = $_GET['email']; if ($this->db->get_one(array('email'=>$email),'userid')){ exit('0'); } exit('1'); } //电子口令卡 function card() { if (pc_base::load_config('system', 'safe_card') != 1) { showmessage(L('your_website_opened_the_card_no_password')); } $userid = isset($_GET['userid']) && intval($_GET['userid']) ? intval($_GET['userid']) : showmessage(L('user_id_cannot_be_empty')); $data = array(); if ($data = $this->db->get_one(array('userid'=>$userid), '`card`,`username`')) { $pic_url = ''; if ($data['card']) { pc_base::load_app_class('card', 'admin', 0); $pic_url = card::get_pic($data['card']); } $show_header = true; include $this->admin_tpl('admin_card'); } else { showmessage(L('users_were_not_found')); } } //绑定电子口令卡 function creat_card() { if (pc_base::load_config('system', 'safe_card') != 1) { showmessage(L('your_website_opened_the_card_no_password')); } $userid = isset($_GET['userid']) && intval($_GET['userid']) ? intval($_GET['userid']) : showmessage(L('user_id_cannot_be_empty')); $data = $card = ''; if ($data = $this->db->get_one(array('userid'=>$userid), '`card`,`username`')) { if (empty($data['card'])) { pc_base::load_app_class('card', 'admin', 0); $card = card::creat_card(); if ($this->db->update(array('card'=>$card), array('userid'=>$userid))) { showmessage(L('password_card_application_success'), '?m=admin&c=admin_manage&a=card&userid='.$userid); } else { showmessage(L('a_card_with_a_local_database_please_contact_the_system_administrators')); } } else { showmessage(L('please_lift_the_password_card_binding'),HTTP_REFERER); } } else { showmessage(L('users_were_not_found')); } } //解除口令卡绑定 function remove_card() { if (pc_base::load_config('system', 'safe_card') != 1) { showmessage(L('your_website_opened_the_card_no_password')); } $userid = isset($_GET['userid']) && intval($_GET['userid']) ? intval($_GET['userid']) : showmessage(L('user_id_cannot_be_empty')); $data = $result = ''; if ($data = $this->db->get_one(array('userid'=>$userid), '`card`,`username`,`userid`')) { pc_base::load_app_class('card', 'admin', 0); if ($result = card::remove_card($data['card'])) { $this->db->update(array('card'=>''), array('userid'=>$userid)); showmessage(L('the_binding_success'), '?m=admin&c=admin_manage&a=card&userid='.$userid); } } else { showmessage(L('users_were_not_found')); } } } ?>
108wo
phpcms/modules/admin/admin_manage.php
PHP
asf20
8,185
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); pc_base::load_sys_class('form', '', 0); class googlesitemap extends admin { function __construct() { parent::__construct(); $this->header = "<\x3Fxml version=\"1.0\" encoding=\"UTF-8\"\x3F>\n\t<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">"; $this->charset = "UTF-8"; $this->footer = "\t</urlset>\n"; $this->baidunews_footer = "</document>"; $this->items = array(); $this->baidunew_items = array(); //生成栏目级别选项 $this->siteid = $this->get_siteid(); $this->categorys = getcache('category_content_'.$this->siteid,'commons'); } function add_item2($new_item) { $this->items[] = $new_item; } function build( $file_name = null ) { $map = $this->header . "\n"; foreach ($this->items AS $item){ $map .= "\t\t<url>\n\t\t\t<loc>$item[loc]</loc>\n"; $map .= "\t\t\t<lastmod>$item[lastmod]</lastmod>\n"; $map .= "\t\t\t<changefreq>$item[changefreq]</changefreq>\n"; $map .= "\t\t\t<priority>$item[priority]</priority>\n"; $map .= "\t\t</url>\n\n"; } $map .= $this->footer . "\n"; if (!is_null($file_name)){ return file_put_contents($file_name, $map); } else { return $map; } } function google_sitemap_item($loc, $lastmod = '', $changefreq = '', $priority = '') { $data = array(); $data['loc'] = $loc; $data['lastmod'] = $lastmod; $data['changefreq'] = $changefreq; $data['priority'] = $priority; return $data; } /** * * 百度新闻数组 组成 * @param $title * @param $link * @param $description * @param $text * @param $image * @param $keywords * @param $category * @param $author * @param $source * @param $pubDate */ function baidunews_item($title, $link = '', $description = '',$text = '',$image = '', $keywords = '',$category = '',$author = '',$source='',$pubDate='') { $data = array(); $data['title'] = $title; $data['link'] = $link; $data['description'] = $description; $data['text'] = $text; $data['image'] = $image; $data['keywords'] = $keywords; $data['category'] = $category; $data['author'] = $author; $data['source'] = $source; $data['pubDate'] = $pubDate; return $data; } function add_baidunews_item($new_item){ $this->baidunew_items[] = $new_item; } function baidunews_build( $file_name = null ,$this_domain,$email,$time) { //百度头部 $this->baidunews = ''; $this->baidunews = "<?xml version=\"1.0\" encoding=\"".CHARSET."\" ?>\n"; $this->baidunews .= "<document>\n"; $this->baidunews .= "<webSite>".$this_domain."</webSite>\n"; $this->baidunews .= "<webMaster>".$email."</webMaster>\n"; $this->baidunews .= "<updatePeri>".$time."</updatePeri>\n"; foreach ($this->baidunew_items AS $item){ $this->baidunews .= "<item>\n"; $this->baidunews .= "<title>".$item['title']."</title>\n"; $this->baidunews .= "<link>".$item['link']."</link>\n"; $this->baidunews .= "<description>".$item['description'] ."</description>\n"; $this->baidunews .= "<text>".$item['text']."</text>\n"; $this->baidunews .= "<image>".$item['image']."</image>\n"; $this->baidunews .= "<keywords>".$item['keywords']."</keywords>\n"; $this->baidunews .= "<category>".$item['category']."</category>\n"; $this->baidunews .= "<author>".$item['author']."</author>\n"; $this->baidunews .= "<source>".$item['source']."</source>\n"; $this->baidunews .= "<pubDate>".$item['pubDate']."</pubDate>\n"; $this->baidunews .= "</item>\n"; } $this->baidunews .= $this->baidunews_footer . "\n"; if (!is_null($file_name)){ return file_put_contents($file_name, $this->baidunews); } else { return $this->baidunews; } } /** * * Enter 生成google sitemap, 百度新闻协议 */ function set () { $hits_db = pc_base::load_model('hits_model'); $dosubmit = isset($_POST['dosubmit']) ? $_POST['dosubmit'] : $_GET['dosubmit']; //读站点缓存 $siteid = $this->siteid; $sitecache = getcache('sitelist','commons'); //根据当前站点,取得文件存放路径 $systemconfig = pc_base::load_config('system'); $html_root = substr($systemconfig['html_root'], 1); //判断当前站点目录,是PHPCMS则把文件写到根目录下, 不是则写到分站目录下.(分站目录用由静态文件路经html_root和分站目录dirname组成) if($siteid==1){ $dir = PHPCMS_PATH; }else { $dir = PHPCMS_PATH.$html_root.DIRECTORY_SEPARATOR.$sitecache[$siteid]['dirname'].DIRECTORY_SEPARATOR; } //模型缓存 $modelcache = getcache('model','commons'); //获取当前站点域名,下面生成URL时会用到. $this_domain = substr($sitecache[$siteid]['domain'], 0,strlen($sitecache[$siteid]['domain'])-1); if($dosubmit) { //生成百度新闻 if($_POST['mark']) { $baidunum = $_POST['baidunum'] ? intval($_POST['baidunum']) : 20; if($_POST['catids']=="")showmessage(L('choose_category'), HTTP_REFERER); $catids = $_POST['catids']; $catid_cache = $this->categorys;//栏目缓存 $this->content_db = pc_base::load_model('content_model'); foreach ($catids as $catid) { $modelid = $catid_cache[$catid]['modelid'];//根据栏目ID查出modelid 进而确定表名,并结合栏目ID:catid 检索出对应栏目下的新闻条数 $this->content_db->set_model($modelid); $result = $this->content_db->select(array('catid'=>$catid,'status'=>99), '*', $limit = "0,$baidunum", 'id desc'); //重设表前缀,for循环时用来查,文章正文 $this->content_db->table_name = $this->content_db->table_name.'_data'; foreach ($result as $arr){ //把每一条数据都装入数组中 extract($arr); if(!preg_match('/^(http|https):\/\//', $url)){ $url = $this_domain.$url; } if($thumb != ""){ if(!preg_match('/^(http|https):\/\//', $thumb)){ $thumb = $this_domain.$thumb; } } //取当前新闻模型 附属表 取 新闻正文 $url = htmlspecialchars($url); $description = htmlspecialchars(strip_tags($description)); //根据本条ID,从对应tablename_data取出正文内容 $content_arr = $this->content_db->get_one(array('id'=>$id),'content'); $content = htmlspecialchars(strip_tags($content_arr['content'])); //组合数据 $smi = $this->baidunews_item($title,$url,$description,$content,$thumb, $keywords,$category,$author,$source,date('Y-m-d', $inputtime));//推荐文件 $this->add_baidunews_item($smi); } } $baidunews_file = $dir.'baidunews.xml'; @mkdir($dir,0777,true); $this->baidunews_build($baidunews_file,$this_domain,$_POST['email'],$_POST['time']); } //生成网站地图 $content_priority = $_POST['content_priority']; $content_changefreq = $_POST['content_changefreq']; $num = $_POST['num'] ? intval($_POST['num']) : 100; $today = date('Y-m-d'); $domain = $this_domain; //生成地图头部 -第一条 $smi = $this->google_sitemap_item($domain, $today, 'daily', '1.0'); $this->add_item2($smi); $this->content_db = pc_base::load_model('content_model'); //只提取该站点的模型.再循环取数据,生成站点地图. $modelcache = getcache('model','commons'); $new_model = array(); foreach ($modelcache as $modelid => $mod){ if($mod['siteid']==$siteid){ $new_model[$modelid]['modelid'] = $modelid; $new_model[$modelid]['name'] = $mod['name']; } } foreach($new_model as $modelid=>$m) {//每个模块取出num条数据 $this->content_db->set_model($modelid);// 或者 $this->conetnt_db->set_model($modelid); $result = $this->content_db->select(array('status'=>99), '*', $limit = "0,$num", $order = 'inputtime desc'); foreach ($result as $arr){ if(substr($arr['url'],0,1)=='/'){ $url = htmlspecialchars(strip_tags($domain.$arr['url'])); }else { $url = htmlspecialchars(strip_tags($arr['url'])); } $hit_r = $hits_db->get_one(array('hitsid'=>'c-'.$modelid.'-'.$arr['id'])); if($hit_r['views']>1000) $content_priority = 0.9; $smi = $this->google_sitemap_item($url, $today, $content_changefreq, $content_priority);//推荐文件 $this->add_item2($smi); } } $sm_file = $dir.'sitemaps.xml'; if($this->build($sm_file)){ showmessage(L('create_success'), HTTP_REFERER); } } else { $tree = pc_base::load_sys_class('tree'); $tree->icon = array('&nbsp;&nbsp;&nbsp;│ ','&nbsp;&nbsp;&nbsp;├─ ','&nbsp;&nbsp;&nbsp;└─ '); $tree->nbsp = '&nbsp;&nbsp;&nbsp;'; $categorys = array(); foreach($this->categorys as $catid=>$r) { if($this->siteid != $r['siteid'] || $r['type']) continue; if($modelid && $modelid != $r['modelid']) continue; $r['disabled'] = $r['child'] ? 'disabled' : ''; $categorys[$catid] = $r; } $str = "<option value='\$catid' \$selected \$disabled>\$spacer \$catname</option>"; $tree->init($categorys); $string .= $tree->get_tree(0, $str); include $this->admin_tpl('googlesitemap'); } } } ?>
108wo
phpcms/modules/admin/googlesitemap.php
PHP
asf20
9,835
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); pc_base::load_sys_class('form', '', 0); class position extends admin { private $db, $db_data, $db_content; function __construct() { parent::__construct(); $this->db = pc_base::load_model('position_model'); $this->db_data = pc_base::load_model('position_data_model'); $this->db_content = pc_base::load_model('content_model'); $this->sites = pc_base::load_app_class('sites'); } public function init() { $infos = array(); $where = ''; $current_siteid = self::get_siteid(); $category = getcache('category_content_'.$current_siteid,'commons'); $model = getcache('model','commons'); $where = "`siteid`='$current_siteid' OR `siteid`='0'"; $page = $_GET['page'] ? $_GET['page'] : '1'; $infos = $this->db->listinfo($where, $order = 'listorder DESC,posid DESC', $page, $pagesize = 20); $pages = $this->db->pages; $show_dialog = true; $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=admin&c=position&a=add\', title:\''.L('posid_add').'\', width:\'500\', height:\'360\', lock:true}, function(){var d = window.top.art.dialog({id:\'add\'}).data.iframe;var form = d.document.getElementById(\'dosubmit\');form.click();return false;}, function(){window.top.art.dialog({id:\'add\'}).close()});void(0);', L('posid_add')); include $this->admin_tpl('position_list'); } /** * 推荐位添加 */ public function add() { if(isset($_POST['dosubmit'])) { if(!is_array($_POST['info']) || empty($_POST['info']['name'])){ showmessage(L('operation_failure')); } $_POST['info']['siteid'] = intval($_POST['info']['modelid']) ? get_siteid() : 0; $_POST['info']['listorder'] = intval($_POST['info']['listorder']); $_POST['info']['maxnum'] = intval($_POST['info']['maxnum']); $insert_id = $this->db->insert($_POST['info'],true); $this->_set_cache(); if($insert_id){ showmessage(L('operation_success'), '', '', 'add'); } } else { pc_base::load_sys_class('form'); $this->sitemodel_db = pc_base::load_model('sitemodel_model'); $sitemodel = $sitemodel = array(); $sitemodel = getcache('model','commons'); foreach($sitemodel as $value){ if($value['siteid'] == get_siteid())$modelinfo[$value['modelid']]=$value['name']; } $show_header = $show_validator = true; include $this->admin_tpl('position_add'); } } /** * 推荐位编辑 */ public function edit() { if(isset($_POST['dosubmit'])) { $_POST['posid'] = intval($_POST['posid']); if(!is_array($_POST['info']) || empty($_POST['info']['name'])){ showmessage(L('operation_failure')); } $_POST['info']['siteid'] = intval($_POST['info']['modelid']) ? get_siteid() : 0; $_POST['info']['listorder'] = intval($_POST['info']['listorder']); $_POST['info']['maxnum'] = intval($_POST['info']['maxnum']); $this->db->update($_POST['info'],array('posid'=>$_POST['posid'])); $this->_set_cache(); showmessage(L('operation_success'), '', '', 'edit'); } else { $info = $this->db->get_one(array('posid'=>$_GET['posid'])); extract($info); pc_base::load_sys_class('form'); $this->sitemodel_db = pc_base::load_model('sitemodel_model'); $sitemodel = $sitemodel = array(); $sitemodel = getcache('model','commons'); foreach($sitemodel as $value){ if($value['siteid'] == get_siteid())$modelinfo[$value['modelid']]=$value['name']; } $show_validator = $show_header = $show_scroll = true; include $this->admin_tpl('position_edit'); } } /** * 推荐位删除 */ public function delete() { $posid = intval($_GET['posid']); $this->db->delete(array('posid'=>$posid)); $this->_set_cache(); showmessage(L('posid_del_success'),'?m=admin&c=position'); } /** * 推荐位排序 */ public function listorder() { if(isset($_POST['dosubmit'])) { foreach($_POST['listorders'] as $posid => $listorder) { $this->db->update(array('listorder'=>$listorder),array('posid'=>$posid)); } $this->_set_cache(); showmessage(L('operation_success'),'?m=admin&c=position'); } else { showmessage(L('operation_failure'),'?m=admin&c=position'); } } /** * 推荐位文章统计 * @param $posid 推荐位ID */ public function content_count($posid) { $posid = intval($posid); $where = array('posid'=>$posid); $infos = $this->db_data->get_one($where, $data = 'count(*) as count'); return $infos['count']; } /** * 推荐位文章列表 */ public function public_item() { if(isset($_POST['dosubmit'])) { $items = count($_POST['items']) > 0 ? $_POST['items'] : showmessage(L('posid_select_to_remove'),HTTP_REFERER); if(is_array($items)) { $sql = array(); foreach ($items as $item) { $_v = explode('-', $item); $sql['id'] = $_v[0]; $sql['modelid']= $_v[1]; $sql['posid'] = intval($_POST['posid']); $this->db_data->delete($sql); $this->content_pos($sql['id'],$sql['modelid']); } } showmessage(L('operation_success'),HTTP_REFERER); } else { $posid = intval($_GET['posid']); $MODEL = getcache('model','commons'); $siteid = $this->get_siteid(); $CATEGORY = getcache('category_content_'.$siteid,'commons'); $page = $_GET['page'] ? $_GET['page'] : '1'; $pos_arr = $this->db_data->listinfo(array('posid'=>$posid,'siteid'=>$siteid),'listorder DESC', $page, $pagesize = 20); $pages = $this->db_data->pages; $infos = array(); foreach ($pos_arr as $_k => $_v) { $r = string2array($_v['data']); $r['catname'] = $CATEGORY[$_v['catid']]['catname']; $r['modelid'] = $_v['modelid']; $r['posid'] = $_v['posid']; $r['id'] = $_v['id']; $r['listorder'] = $_v['listorder']; $r['catid'] = $_v['catid']; $r['url'] = go($_v['catid'], $_v['id']); $key = $r['modelid'].'-'.$r['id']; $infos[$key] = $r; } $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=admin&c=position&a=add\', title:\''.L('posid_add').'\', width:\'500\', height:\'300\', lock:true}, function(){var d = window.top.art.dialog({id:\'add\'}).data.iframe;var form = d.document.getElementById(\'dosubmit\');form.click();return false;}, function(){window.top.art.dialog({id:\'add\'}).close()});void(0);', L('posid_add')); include $this->admin_tpl('position_items'); } } /** * 推荐位文章管理 */ public function public_item_manage() { if(isset($_POST['dosubmit'])) { $posid = intval($_POST['posid']); $modelid = intval($_POST['modelid']); $id= intval($_POST['id']); $pos_arr = $this->db_data->get_one(array('id'=>$id,'posid'=>$posid,'modelid'=>$modelid)); $array = string2array($pos_arr['data']); $array['inputtime'] = strtotime($_POST['info']['inputtime']); $array['title'] = trim($_POST['info']['title']); $array['thumb'] = trim($_POST['info']['thumb']); $array['description'] = trim($_POST['info']['description']); $thumb = $_POST['info']['thumb'] ? 1 : 0; $array = array('data'=>array2string($array),'synedit'=>intval($_POST['synedit']),'thumb'=>$thumb); $this->db_data->update($array,array('id'=>$id,'posid'=>$posid,'modelid'=>$modelid)); showmessage(L('operation_success'),'','','edit'); } else { $posid = intval($_GET['posid']); $modelid = intval($_GET['modelid']); $id = intval($_GET['id']); if($posid == 0 || $modelid == 0) showmessage(L('linkage_parameter_error'), HTTP_REFERER); $pos_arr = $this->db_data->get_one(array('id'=>$id,'posid'=>$posid,'modelid'=>$modelid)); extract(string2array($pos_arr['data'])); $synedit = $pos_arr['synedit']; $show_validator = true; $show_header = true; include $this->admin_tpl('position_item_manage'); } } /** * 推荐位文章排序 */ public function public_item_listorder() { if(isset($_POST['posid'])) { foreach($_POST['listorders'] as $_k => $listorder) { $pos = array(); $pos = explode('-', $_k); $this->db_data->update(array('listorder'=>$listorder),array('id'=>$pos[1],'catid'=>$pos[0],'posid'=>$_POST['posid'])); } showmessage(L('operation_success'),HTTP_REFERER); } else { showmessage(L('operation_failure'),HTTP_REFERER); } } /** * 推荐位添加栏目加载 */ public function public_category_load() { $modelid = intval($_GET['modelid']); pc_base::load_sys_class('form'); $category = form::select_category('','','name="info[catid]"',L('please_select_parent_category'),$modelid); echo $category; } private function _set_cache() { $infos = $this->db->select('','*',1000,'listorder DESC'); $positions = array(); foreach ($infos as $info){ $positions[$info['posid']] = $info; } setcache('position', $positions,'commons'); return $infos; } private function content_pos($id,$modelid) { $id = intval($id); $modelid = intval($modelid); $MODEL = getcache('model','commons'); $this->db_content->table_name = $this->db_content->db_tablepre.$MODEL[$modelid]['tablename']; $posids = $this->db_data->get_one(array('id'=>$id,'modelid'=>$modelid)) ? 1 : 0; return $this->db_content->update(array('posids'=>$posids),array('id'=>$id)); } } ?>
108wo
phpcms/modules/admin/position.php
PHP
asf20
9,416
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); pc_base::load_sys_class('form','',0); class urlrule extends admin { function __construct() { parent::__construct(); $this->db = pc_base::load_model('urlrule_model'); $this->module_db = pc_base::load_model('module_model'); } function init () { $page = intval($_GET['page']); $infos = $this->db->listinfo('','',$page); $pages = $this->db->pages; $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=admin&c=urlrule&a=add\', title:\''.L('add_urlrule').'\', width:\'750\', height:\'300\', lock:true}, function(){var d = window.top.art.dialog({id:\'add\'}).data.iframe;var form = d.document.getElementById(\'dosubmit\');form.click();return false;}, function(){window.top.art.dialog({id:\'add\'}).close()});void(0);', L('add_urlrule')); $this->public_cache_urlrule(); include $this->admin_tpl('urlrule_list'); } function add() { if(isset($_POST['dosubmit'])) { $this->db->insert($_POST['info']); $this->public_cache_urlrule(); showmessage(L('add_success'),'','','add'); } else { $show_validator = $show_header = ''; $modules_arr = $this->module_db->select('','module,name'); $modules = array(); foreach ($modules_arr as $r) { $modules[$r['module']] = $r['name']; } include $this->admin_tpl('urlrule_add'); } } function delete() { $_GET['urlruleid'] = intval($_GET['urlruleid']); $this->db->delete(array('urlruleid'=>$_GET['urlruleid'])); $this->public_cache_urlrule(); showmessage(L('operation_success'),HTTP_REFERER); } function edit() { if(isset($_POST['dosubmit'])) { $urlruleid = intval($_POST['urlruleid']); $this->db->update($_POST['info'],array('urlruleid'=>$urlruleid)); $this->public_cache_urlrule(); showmessage(L('update_success'),'','','edit'); } else { $show_validator = $show_header = ''; $urlruleid = $_GET['urlruleid']; $r = $this->db->get_one(array('urlruleid'=>$urlruleid)); extract($r); $modules_arr = $this->module_db->select('','module,name'); $modules = array(); foreach ($modules_arr as $r) { $modules[$r['module']] = $r['name']; } include $this->admin_tpl('urlrule_edit'); } } /** * 更新URL规则 */ public function public_cache_urlrule() { $datas = $this->db->select('','*','','','','urlruleid'); $basic_data = array(); foreach($datas as $roleid=>$r) { $basic_data[$roleid] = $r['urlrule'];; } setcache('urlrules_detail',$datas,'commons'); setcache('urlrules',$basic_data,'commons'); } } ?>
108wo
phpcms/modules/admin/urlrule.php
PHP
asf20
2,679
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); class phpsso extends admin { function __construct() { parent::__construct(); } function menu() { } function public_menu_left() { $setting = pc_base::load_config('system'); include $this->admin_tpl('phpsso'); } } ?>
108wo
phpcms/modules/admin/phpsso.php
PHP
asf20
361
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); pc_base::load_sys_class('form', '', 0); class role extends admin { private $db, $priv_db; function __construct() { parent::__construct(); $this->db = pc_base::load_model('admin_role_model'); $this->priv_db = pc_base::load_model('admin_role_priv_model'); $this->op = pc_base::load_app_class('role_op'); } /** * 角色管理列表 */ public function init() { $infos = $this->db->select($where = '', $data = '*', $limit = '', $order = 'listorder DESC, roleid DESC', $group = ''); include $this->admin_tpl('role_list'); } /** * 添加角色 */ public function add() { if(isset($_POST['dosubmit'])) { if(!is_array($_POST['info']) || empty($_POST['info']['rolename'])){ showmessage(L('operation_failure')); } if($this->op->checkname($_POST['info']['rolename'])){ showmessage(L('role_duplicate')); } $insert_id = $this->db->insert($_POST['info'],true); $this->_cache(); if($insert_id){ showmessage(L('operation_success'),'?m=admin&c=role&a=init'); } } else { include $this->admin_tpl('role_add'); } } /** * 编辑角色 */ public function edit() { if(isset($_POST['dosubmit'])) { $_POST['roleid'] = intval($_POST['roleid']); if(!is_array($_POST['info']) || empty($_POST['info']['rolename'])){ showmessage(L('operation_failure')); } $this->db->update($_POST['info'],array('roleid'=>$_POST['roleid'])); $this->_cache(); showmessage(L('operation_success'),'?m=admin&c=role'); } else { $info = $this->db->get_one(array('roleid'=>$_GET['roleid'])); extract($info); include $this->admin_tpl('role_edit'); } } /** * 删除角色 */ public function delete() { $roleid = intval($_GET['roleid']); if($roleid == '1') showmessage(L('this_object_not_del'), HTTP_REFERER); $this->db->delete(array('roleid'=>$roleid)); $this->priv_db->delete(array('roleid'=>$roleid)); $this->_cache(); showmessage(L('role_del_success')); } /** * 更新角色排序 */ public function listorder() { if(isset($_POST['dosubmit'])) { foreach($_POST['listorders'] as $roleid => $listorder) { $this->db->update(array('listorder'=>$listorder),array('roleid'=>$roleid)); } showmessage(L('operation_success')); } else { showmessage(L('operation_failure')); } } /** * 角色权限设置 */ public function role_priv() { $this->menu_db = pc_base::load_model('menu_model'); $siteid = $siteid ? $siteid : self::get_siteid(); if(isset($_POST['dosubmit'])){ if (is_array($_POST['menuid']) && count($_POST['menuid']) > 0) { $this->priv_db->delete(array('roleid'=>$_POST['roleid'],'siteid'=>$_POST['siteid'])); $menuinfo = $this->menu_db->select('','`id`,`m`,`c`,`a`,`data`'); foreach ($menuinfo as $_v) $menu_info[$_v[id]] = $_v; foreach($_POST['menuid'] as $menuid){ $info = array(); $info = $this->op->get_menuinfo(intval($menuid),$menu_info); $info['roleid'] = $_POST['roleid']; $info['siteid'] = $_POST['siteid']; $this->priv_db->insert($info); } } else { $this->priv_db->delete(array('roleid'=>$_POST['roleid'],'siteid'=>$_POST['siteid'])); } $this->_cache(); showmessage(L('operation_success'), HTTP_REFERER); } else { $siteid = intval($_GET['siteid']); $roleid = intval($_GET['roleid']); if ($siteid) { $menu = pc_base::load_sys_class('tree'); $menu->icon = array('│ ','├─ ','└─ '); $menu->nbsp = '&nbsp;&nbsp;&nbsp;'; $result = $this->menu_db->select(); $priv_data = $this->priv_db->select(); //获取权限表数据 $modules = 'admin,announce,vote,system'; foreach ($result as $n=>$t) { $result[$n]['cname'] = L($t['name'],'',$modules); $result[$n]['checked'] = ($this->op->is_checked($t,$_GET['roleid'],$siteid, $priv_data))? ' checked' : ''; $result[$n]['level'] = $this->op->get_level($t['id'],$result); $result[$n]['parentid_node'] = ($t['parentid'])? ' class="child-of-node-'.$t['parentid'].'"' : ''; } $str = "<tr id='node-\$id' \$parentid_node> <td style='padding-left:30px;'>\$spacer<input type='checkbox' name='menuid[]' value='\$id' level='\$level' \$checked onclick='javascript:checknode(this);'> \$cname</td> </tr>"; $menu->init($result); $categorys = $menu->get_tree(0, $str); } $show_header = true; $show_scroll = true; include $this->admin_tpl('role_priv'); } } public function priv_setting() { $sites = pc_base::load_app_class('sites', 'admin'); $sites_list = $sites->get_list(); $roleid = intval($_GET['roleid']); include $this->admin_tpl('role_priv_setting'); } /** * 更新角色状态 */ public function change_status(){ $roleid = intval($_GET['roleid']); $disabled = intval($_GET['disabled']); $this->db->update(array('disabled'=>$disabled),array('roleid'=>$roleid)); $this->_cache(); showmessage(L('operation_success'),'?m=admin&c=role'); } /** * 成员管理 */ public function member_manage() { $this->admin_db = pc_base::load_model('admin_model'); $roleid = intval($_GET['roleid']); $roles = getcache('role','commons'); $infos = $this->admin_db->select(array('roleid'=>$roleid)); include $this->admin_tpl('admin_list'); } /** * 设置栏目权限 */ public function setting_cat_priv() { $roleid = isset($_GET['roleid']) && intval($_GET['roleid']) ? intval($_GET['roleid']) : showmessage(L('illegal_parameters'), HTTP_REFERER); $op = isset($_GET['op']) && intval($_GET['op']) ? intval($_GET['op']) : ''; switch ($op) { case 1: $siteid = isset($_GET['siteid']) && intval($_GET['siteid']) ? intval($_GET['siteid']) : showmessage(L('illegal_parameters'), HTTP_REFERER); pc_base::load_app_class('role_cat', '', 0); $category = role_cat::get_category($siteid); //获取角色当前权限设置 $priv = role_cat::get_roleid($roleid, $siteid); //加载tree $tree = pc_base::load_sys_class('tree'); $categorys = array(); foreach ($category as $k=>$v) { if ($v['type'] == 1) { $v['disabled'] = 'disabled'; $v['init_check'] = ''; $v['add_check'] = ''; $v['delete_check'] = ''; $v['listorder_check'] = ''; $v['push_check'] = ''; $v['move_check'] = ''; } else { $v['disabled'] = ''; $v['add_check'] = isset($priv[$v['catid']]['add']) ? 'checked' : ''; $v['delete_check'] = isset($priv[$v['catid']]['delete']) ? 'checked' : ''; $v['listorder_check'] = isset($priv[$v['catid']]['listorder']) ? 'checked' : ''; $v['push_check'] = isset($priv[$v['catid']]['push']) ? 'checked' : ''; $v['move_check'] = isset($priv[$v['catid']]['remove']) ? 'checked' : ''; $v['edit_check'] = isset($priv[$v['catid']]['edit']) ? 'checked' : ''; } $v['init_check'] = isset($priv[$v['catid']]['init']) ? 'checked' : ''; $category[$k] = $v; } $show_header = true; $str = "<tr> <td align='center'><input type='checkbox' value='1' onclick='select_all(\$catid, this)' ></td> <td>\$spacer\$catname</td> <td align='center'><input type='checkbox' name='priv[\$catid][]' \$init_check value='init' ></td> <td align='center'><input type='checkbox' name='priv[\$catid][]' \$disabled \$add_check value='add' ></td> <td align='center'><input type='checkbox' name='priv[\$catid][]' \$disabled \$edit_check value='edit' ></td> <td align='center'><input type='checkbox' name='priv[\$catid][]' \$disabled \$delete_check value='delete' ></td> <td align='center'><input type='checkbox' name='priv[\$catid][]' \$disabled \$listorder_check value='listorder' ></td> <td align='center'><input type='checkbox' name='priv[\$catid][]' \$disabled \$push_check value='push' ></td> <td align='center'><input type='checkbox' name='priv[\$catid][]' \$disabled \$move_check value='remove' ></td> </tr>"; $tree->init($category); $categorys = $tree->get_tree(0, $str); include $this->admin_tpl('role_cat_priv_list'); break; case 2: $siteid = isset($_GET['siteid']) && intval($_GET['siteid']) ? intval($_GET['siteid']) : showmessage(L('illegal_parameters'), HTTP_REFERER); pc_base::load_app_class('role_cat', '', 0); role_cat::updata_priv($roleid, $siteid, $_POST['priv']); showmessage(L('operation_success'),'?m=admin&c=role&a=init', '', 'edit'); break; default: $sites = pc_base::load_app_class('sites', 'admin'); $sites_list = $sites->get_list(); include $this->admin_tpl('role_cat_priv'); break; } } /** * 角色缓存 */ private function _cache() { $infos = $this->db->select(array('disabled'=>'0'), $data = '`roleid`,`rolename`', '', 'roleid ASC'); $role = array(); foreach ($infos as $info){ $role[$info['roleid']] = $info['rolename']; } $this->_cache_siteid($role); setcache('role', $role,'commons'); return $infos; } /** * 缓存站点数据 */ private function _cache_siteid($role) { $sitelist = array(); foreach($role as $n=>$r) { $sitelists = $this->priv_db->select(array('roleid'=>$n),'siteid', '', 'siteid'); foreach($sitelists as $site) { foreach($site as $v){ $sitelist[$n][] = intval($v); } } } if(is_array($sitelist)) { $sitelist = @array_map("array_unique", $sitelist); setcache('role_siteid', $sitelist,'commons'); } return $sitelist; } } ?>
108wo
phpcms/modules/admin/role.php
PHP
asf20
9,746
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); class category extends admin { private $db; public $siteid; function __construct() { parent::__construct(); $this->db = pc_base::load_model('category_model'); $this->siteid = $this->get_siteid(); } /** * 管理栏目 */ public function init () { $show_pc_hash = ''; $tree = pc_base::load_sys_class('tree'); $models = getcache('model','commons'); $sitelist = getcache('sitelist','commons'); $category_items = array(); foreach ($models as $modelid=>$model) { $category_items[$modelid] = getcache('category_items_'.$modelid,'commons'); } $tree->icon = array('&nbsp;&nbsp;&nbsp;│ ','&nbsp;&nbsp;&nbsp;├─ ','&nbsp;&nbsp;&nbsp;└─ '); $tree->nbsp = '&nbsp;&nbsp;&nbsp;'; $categorys = array(); //读取缓存 $result = getcache('category_content_'.$this->siteid,'commons'); $show_detail = count($result) < 500 ? 1 : 0; $parentid = $_GET['parentid'] ? $_GET['parentid'] : 0; $html_root = pc_base::load_config('system','html_root'); $types = array(0 => L('category_type_system'),1 => L('category_type_page'),2 => L('category_type_link')); if(!empty($result)) { foreach($result as $r) { $r['modelname'] = $models[$r['modelid']]['name']; $r['str_manage'] = ''; if(!$show_detail) { if($r['parentid']!=$parentid) continue; $r['parentid'] = 0; $r['str_manage'] .= '<a href="?m=admin&c=category&a=init&parentid='.$r['catid'].'&menuid='.$_GET['menuid'].'&s='.$r['type'].'&pc_hash='.$_SESSION['pc_hash'].'">'.L('manage_sub_category').'</a> | '; } $r['str_manage'] .= '<a href="?m=admin&c=category&a=add&parentid='.$r['catid'].'&menuid='.$_GET['menuid'].'&s='.$r['type'].'&pc_hash='.$_SESSION['pc_hash'].'">'.L('add_sub_category').'</a> | '; $r['str_manage'] .= '<a href="?m=admin&c=category&a=edit&catid='.$r['catid'].'&menuid='.$_GET['menuid'].'&type='.$r['type'].'&pc_hash='.$_SESSION['pc_hash'].'">'.L('edit').'</a> | <a href="javascript:confirmurl(\'?m=admin&c=category&a=delete&catid='.$r['catid'].'&menuid='.$_GET['menuid'].'\',\''.L('confirm',array('message'=>addslashes($r['catname']))).'\')">'.L('delete').'</a> '; $r['typename'] = $types[$r['type']]; $r['display_icon'] = $r['ismenu'] ? '' : ' <img src ="'.IMG_PATH.'icon/gear_disable.png" title="'.L('not_display_in_menu').'">'; if($r['type'] || $r['child']) { $r['items'] = ''; } else { $r['items'] = $category_items[$r['modelid']][$r['catid']]; } $r['help'] = ''; $setting = string2array($r['setting']); if($r['url']) { if(preg_match('/^(http|https):\/\//', $r['url'])) { $catdir = $r['catdir']; $prefix = $r['sethtml'] ? '' : $html_root; if($this->siteid==1) { $catdir = $prefix.'/'.$r['parentdir'].$catdir; } else { $catdir = $prefix.'/'.$sitelist[$this->siteid]['dirname'].$html_root.'/'.$catdir; } if($r['type']==0 && $setting['ishtml'] && strpos($r['url'], '?')===false && substr_count($r['url'],'/')<4) $r['help'] = '<img src="'.IMG_PATH.'icon/help.png" title="'.L('tips_domain').$r['url'].'&#10;'.L('directory_binding').'&#10;'.$catdir.'/">'; } else { $r['url'] = substr($sitelist[$this->siteid]['domain'],0,-1).$r['url']; } $r['url'] = "<a href='$r[url]' target='_blank'>".L('vistor')."</a>"; } else { $r['url'] = "<a href='?m=admin&c=category&a=public_cache&menuid=43&module=admin'><font color='red'>".L('update_backup')."</font></a>"; } $categorys[$r['catid']] = $r; } } $str = "<tr> <td align='center'><input name='listorders[\$id]' type='text' size='3' value='\$listorder' class='input-text-c'></td> <td align='center'>\$id</td> <td >\$spacer\$catname\$display_icon</td> <td>\$typename</td> <td>\$modelname</td> <td align='center'>\$items</td> <td align='center'>\$url</td> <td align='center'>\$help</td> <td align='center' >\$str_manage</td> </tr>"; $tree->init($categorys); $categorys = $tree->get_tree(0, $str); include $this->admin_tpl('category_manage'); } /** * 添加栏目 */ public function add() { if(isset($_POST['dosubmit'])) { pc_base::load_sys_func('iconv'); $_POST['info']['type'] = intval($_POST['type']); if(isset($_POST['batch_add']) && empty($_POST['batch_add'])) { if($_POST['info']['catname']=='') showmessage(L('input_catname')); if($_POST['info']['type']!=2) { if($_POST['info']['catdir']=='') showmessage(L('input_dirname')); if(!$this->public_check_catdir(0,$_POST['info']['catdir'])) showmessage(L('catname_have_exists')); } } $_POST['info']['siteid'] = $this->siteid; $_POST['info']['module'] = 'content'; $setting = $_POST['setting']; if($_POST['info']['type']!=2) { //栏目生成静态配置 if($setting['ishtml']) { $setting['category_ruleid'] = $_POST['category_html_ruleid']; } else { $setting['category_ruleid'] = $_POST['category_php_ruleid']; $_POST['info']['url'] = ''; } } //内容生成静态配置 if($setting['content_ishtml']) { $setting['show_ruleid'] = $_POST['show_html_ruleid']; } else { $setting['show_ruleid'] = $_POST['show_php_ruleid']; } if($setting['repeatchargedays']<1) $setting['repeatchargedays'] = 1; $_POST['info']['sethtml'] = $setting['create_to_html_root']; $_POST['info']['setting'] = array2string($setting); $end_str = $old_end = '<script type="text/javascript">window.top.art.dialog({id:"test"}).close();window.top.art.dialog({id:"test",content:\'<h2>'.L("add_success").'</h2><span style="fotn-size:16px;">'.L("following_operation").'</span><br /><ul style="fotn-size:14px;"><li><a href="?m=admin&c=category&a=public_cache&menuid=43&module=admin" target="right" onclick="window.top.art.dialog({id:\\\'test\\\'}).close()">'.L("following_operation_1").'</a></li><li><a href="'.HTTP_REFERER.'" target="right" onclick="window.top.art.dialog({id:\\\'test\\\'}).close()">'.L("following_operation_2").'</a></li></ul>\',width:"400",height:"200"});</script>'; if(!isset($_POST['batch_add']) || empty($_POST['batch_add'])) { $catname = CHARSET == 'gbk' ? $_POST['info']['catname'] : iconv('utf-8','gbk',$_POST['info']['catname']); $letters = gbk_to_pinyin($catname); $_POST['info']['letter'] = strtolower(implode('', $letters)); $catid = $this->db->insert($_POST['info'], true); $this->update_priv($catid, $_POST['priv_roleid']); $this->update_priv($catid, $_POST['priv_groupid'],0); } else { $end_str = ''; $batch_adds = explode("\n", $_POST['batch_add']); foreach ($batch_adds as $_v) { if(trim($_v)=='') continue; $names = explode('|', $_v); $catname = $names[0]; $_POST['info']['catname'] = $names[0]; $letters = gbk_to_pinyin($catname); $_POST['info']['letter'] = strtolower(implode('', $letters)); $_POST['info']['catdir'] = trim($names[1]) ? trim($names[1]) : trim($_POST['info']['letter']); if(!$this->public_check_catdir(0,$_POST['info']['catdir'])) { $end_str .= $end_str ? ','.$_POST['info']['catname'].'('.$_POST['info']['catdir'].')' : $_POST['info']['catname'].'('.$_POST['info']['catdir'].')'; continue; } $catid = $this->db->insert($_POST['info'], true); $this->update_priv($catid, $_POST['priv_roleid']); $this->update_priv($catid, $_POST['priv_groupid'],0); } $end_str = $end_str ? L('follow_catname_have_exists').$end_str : $old_end; } $this->cache(); showmessage(L('add_success').$end_str); } else { //获取站点模板信息 pc_base::load_app_func('global'); $template_list = template_list($this->siteid, 0); foreach ($template_list as $k=>$v) { $template_list[$v['dirname']] = $v['name'] ? $v['name'] : $v['dirname']; unset($template_list[$k]); } $show_validator = ''; if(isset($_GET['parentid'])) { $parentid = $_GET['parentid']; $r = $this->db->get_one(array('catid'=>$parentid)); if($r) extract($r,EXTR_SKIP); $setting = string2array($setting); } pc_base::load_sys_class('form','',0); $type = $_GET['s']; if($type==0) { $exists_model = false; $models = getcache('model','commons'); foreach($models as $_m) { if($this->siteid == $_m['siteid']) { $exists_model = true; break; } } if(!$exists_model) showmessage(L('please_add_model'),'?m=content&c=sitemodel&a=init&menuid=59',5000); include $this->admin_tpl('category_add'); } elseif ($type==1) { include $this->admin_tpl('category_page_add'); } else { include $this->admin_tpl('category_link'); } } } /** * 修改栏目 */ public function edit() { if(isset($_POST['dosubmit'])) { pc_base::load_sys_func('iconv'); $catid = 0; $catid = intval($_POST['catid']); $setting = $_POST['setting']; //栏目生成静态配置 if($_POST['type'] != 2) { if($setting['ishtml']) { $setting['category_ruleid'] = $_POST['category_html_ruleid']; } else { $setting['category_ruleid'] = $_POST['category_php_ruleid']; $_POST['info']['url'] = ''; } } //内容生成静态配置 if($setting['content_ishtml']) { $setting['show_ruleid'] = $_POST['show_html_ruleid']; } else { $setting['show_ruleid'] = $_POST['show_php_ruleid']; } if($setting['repeatchargedays']<1) $setting['repeatchargedays'] = 1; $_POST['info']['sethtml'] = $setting['create_to_html_root']; $_POST['info']['setting'] = array2string($setting); $_POST['info']['module'] = 'content'; $catname = CHARSET == 'gbk' ? $_POST['info']['catname'] : iconv('utf-8','gbk',$_POST['info']['catname']); $letters = gbk_to_pinyin($catname); $_POST['info']['letter'] = strtolower(implode('', $letters)); //应用权限设置到子栏目 if($_POST['priv_child']) { $arrchildid = $this->db->get_one(array('catid'=>$catid), 'arrchildid'); if(!empty($arrchildid['arrchildid'])) { $arrchildid_arr = explode(',', $arrchildid['arrchildid']); if(!empty($arrchildid_arr)) { foreach ($arrchildid_arr as $arr_v) { $this->update_priv($arr_v, $_POST['priv_groupid'], 0); } } } } $this->db->update($_POST['info'],array('catid'=>$catid,'siteid'=>$this->siteid)); $this->update_priv($catid, $_POST['priv_roleid']); $this->update_priv($catid, $_POST['priv_groupid'],0); $this->cache(); //更新附件状态 if($_POST['info']['image'] && pc_base::load_config('system','attachment_stat')) { $this->attachment_db = pc_base::load_model('attachment_model'); $this->attachment_db->api_update($_POST['info']['image'],'catid-'.$catid,1); } showmessage(L('operation_success').'<script type="text/javascript">window.top.art.dialog({id:"test"}).close();window.top.art.dialog({id:"test",content:\'<h2>'.L("operation_success").'</h2><span style="fotn-size:16px;">'.L("edit_following_operation").'</span><br /><ul style="fotn-size:14px;"><li><a href="?m=admin&c=category&a=public_cache&menuid=43&module=admin" target="right" onclick="window.top.art.dialog({id:\\\'test\\\'}).close()">'.L("following_operation_1").'</a></li></ul>\',width:"400",height:"200"});</script>','?m=admin&c=category&a=init&module=admin&menuid=43'); } else { //获取站点模板信息 pc_base::load_app_func('global'); $template_list = template_list($this->siteid, 0); foreach ($template_list as $k=>$v) { $template_list[$v['dirname']] = $v['name'] ? $v['name'] : $v['dirname']; unset($template_list[$k]); } $show_validator = $catid = $r = ''; $catid = intval($_GET['catid']); pc_base::load_sys_class('form','',0); $r = $this->db->get_one(array('catid'=>$catid)); if($r) extract($r); $setting = string2array($setting); $this->priv_db = pc_base::load_model('category_priv_model'); $this->privs = $this->priv_db->select(array('catid'=>$catid)); $type = $_GET['type']; if($type==0) { include $this->admin_tpl('category_edit'); } elseif ($type==1) { include $this->admin_tpl('category_page_edit'); } else { include $this->admin_tpl('category_link'); } } } /** * 排序 */ public function listorder() { if(isset($_POST['dosubmit'])) { foreach($_POST['listorders'] as $id => $listorder) { $this->db->update(array('listorder'=>$listorder),array('catid'=>$id)); } $this->cache(); showmessage(L('operation_success'),HTTP_REFERER); } else { showmessage(L('operation_failure')); } } /** * 删除栏目 */ public function delete() { $catid = intval($_GET['catid']); $categorys = getcache('category_content_'.$this->siteid,'commons'); $modelid = $categorys[$catid]['modelid']; $items = getcache('category_items_'.$modelid,'commons'); if($items[$catid]) showmessage(L('category_does_not_allow_delete')); $this->delete_child($catid); $this->db->delete(array('catid'=>$catid)); $this->cache(); showmessage(L('operation_success'),HTTP_REFERER); } /** * 递归删除栏目 * @param $catid 要删除的栏目id */ private function delete_child($catid) { $catid = intval($catid); if (empty($catid)) return false; $r = $this->db->get_one(array('parentid'=>$catid)); if($r) { $this->delete_child($r['catid']); $this->db->delete(array('catid'=>$r['catid'])); } return true; } /** * 更新缓存 */ public function cache() { $categorys = array(); $models = getcache('model','commons'); foreach ($models as $modelid=>$model) { $datas = $this->db->select(array('modelid'=>$modelid),'catid,type,items',10000); $array = array(); foreach ($datas as $r) { if($r['type']==0) $array[$r['catid']] = $r['items']; } setcache('category_items_'.$modelid, $array,'commons'); } $array = array(); $categorys = $this->db->select('`module`=\'content\'','catid,siteid',20000,'listorder ASC'); foreach ($categorys as $r) { $array[$r['catid']] = $r['siteid']; } setcache('category_content',$array,'commons'); $categorys = $this->categorys = array(); $this->categorys = $this->db->select(array('siteid'=>$this->siteid, 'module'=>'content'),'*',10000,'listorder ASC'); foreach($this->categorys as $r) { unset($r['module']); $setting = string2array($r['setting']); $r['create_to_html_root'] = $setting['create_to_html_root']; $r['ishtml'] = $setting['ishtml']; $r['content_ishtml'] = $setting['content_ishtml']; $r['category_ruleid'] = $setting['category_ruleid']; $r['show_ruleid'] = $setting['show_ruleid']; $r['workflowid'] = $setting['workflowid']; $r['isdomain'] = '0'; if(!preg_match('/^(http|https):\/\//', $r['url'])) { $r['url'] = siteurl($r['siteid']).$r['url']; } elseif ($r['ishtml']) { $r['isdomain'] = '1'; } $categorys[$r['catid']] = $r; } setcache('category_content_'.$this->siteid,$categorys,'commons'); return true; } /** * 更新缓存并修复栏目 */ public function public_cache() { $this->repair(); $this->cache(); showmessage(L('operation_success'),'?m=admin&c=category&a=init&module=admin&menuid=43'); } /** * 修复栏目数据 */ private function repair() { pc_base::load_sys_func('iconv'); @set_time_limit(600); $html_root = pc_base::load_config('system','html_root'); $this->categorys = $categorys = array(); $this->categorys = $categorys = $this->db->select(array('siteid'=>$this->siteid,'module'=>'content'), '*', '', 'listorder ASC, catid ASC', '', 'catid'); $this->get_categorys($categorys); if(is_array($this->categorys)) { foreach($this->categorys as $catid => $cat) { if($cat['type'] == 2) continue; $arrparentid = $this->get_arrparentid($catid); $setting = string2array($cat['setting']); $arrchildid = $this->get_arrchildid($catid); $child = is_numeric($arrchildid) ? 0 : 1; if($categorys[$catid]['arrparentid']!=$arrparentid || $categorys[$catid]['arrchildid']!=$arrchildid || $categorys[$catid]['child']!=$child) $this->db->update(array('arrparentid'=>$arrparentid,'arrchildid'=>$arrchildid,'child'=>$child),array('catid'=>$catid)); $parentdir = $this->get_parentdir($catid); $catname = $cat['catname']; $letters = gbk_to_pinyin($catname); $letter = strtolower(implode('', $letters)); $listorder = $cat['listorder'] ? $cat['listorder'] : $catid; $this->sethtml = $setting['create_to_html_root']; //检查是否生成到根目录 $this->get_sethtml($catid); $sethtml = $this->sethtml ? 1 : 0; if($setting['ishtml']) { //生成静态时 $url = $this->update_url($catid); if(!preg_match('/^(http|https):\/\//i', $url)) { $url = $sethtml ? '/'.$url : $html_root.'/'.$url; } } else { //不生成静态时 $url = $this->update_url($catid); $url = APP_PATH.$url; } if($cat['url']!=$url) $this->db->update(array('url'=>$url), array('catid'=>$catid)); if($categorys[$catid]['parentdir']!=$parentdir || $categorys[$catid]['sethtml']!=$sethtml || $categorys[$catid]['letter']!=$letter || $categorys[$catid]['listorder']!=$listorder) $this->db->update(array('parentdir'=>$parentdir,'sethtml'=>$sethtml,'letter'=>$letter,'listorder'=>$listorder), array('catid'=>$catid)); } } //删除在非正常显示的栏目 foreach($this->categorys as $catid => $cat) { if($cat['parentid'] != 0 && !isset($this->categorys[$cat['parentid']])) { $this->db->delete(array('catid'=>$catid)); } } return true; } /** * 获取父栏目是否生成到根目录 */ private function get_sethtml($catid) { foreach($this->categorys as $id => $cat) { if($catid==$id) { $parentid = $cat['parentid']; if($this->categorys[$parentid]['sethtml']) { $this->sethtml = 1; } if($parentid) { $this->get_sethtml($parentid); } } } } /** * 找出子目录列表 * @param array $categorys */ private function get_categorys($categorys = array()) { if (is_array($categorys) && !empty($categorys)) { foreach ($categorys as $catid => $c) { $this->categorys[$catid] = $c; $result = array(); foreach ($this->categorys as $_k=>$_v) { if($_v['parentid']) $result[] = $_v; } $this->get_categorys($r); } } return true; } /** * 更新栏目链接地址 */ private function update_url($catid) { $catid = intval($catid); if (!$catid) return false; $url = pc_base::load_app_class('url', 'content'); //调用URL实例 return $url->category_url($catid); } /** * * 获取父栏目ID列表 * @param integer $catid 栏目ID * @param array $arrparentid 父目录ID * @param integer $n 查找的层次 */ private function get_arrparentid($catid, $arrparentid = '', $n = 1) { if($n > 5 || !is_array($this->categorys) || !isset($this->categorys[$catid])) return false; $parentid = $this->categorys[$catid]['parentid']; $arrparentid = $arrparentid ? $parentid.','.$arrparentid : $parentid; if($parentid) { $arrparentid = $this->get_arrparentid($parentid, $arrparentid, ++$n); } else { $this->categorys[$catid]['arrparentid'] = $arrparentid; } $parentid = $this->categorys[$catid]['parentid']; return $arrparentid; } /** * * 获取子栏目ID列表 * @param $catid 栏目ID */ private function get_arrchildid($catid) { $arrchildid = $catid; if(is_array($this->categorys)) { foreach($this->categorys as $id => $cat) { if($cat['parentid'] && $id != $catid && $cat['parentid']==$catid) { $arrchildid .= ','.$this->get_arrchildid($id); } } } return $arrchildid; } /** * 获取父栏目路径 * @param $catid */ function get_parentdir($catid) { if($this->categorys[$catid]['parentid']==0) return ''; $r = $this->categorys[$catid]; $setting = string2array($r['setting']); $url = $r['url']; $arrparentid = $r['arrparentid']; unset($r); if (strpos($url, '://')===false) { if ($setting['creat_to_html_root']) { return ''; } else { $arrparentid = explode(',', $arrparentid); $arrcatdir = array(); foreach($arrparentid as $id) { if($id==0) continue; $arrcatdir[] = $this->categorys[$id]['catdir']; } return implode('/', $arrcatdir).'/'; } } else { if ($setting['create_to_html_root']) { if (preg_match('/^((http|https):\/\/)?([^\/]+)/i', $url, $matches)) { $url = $matches[0].'/'; $rs = $this->db->get_one(array('url'=>$url), '`parentdir`,`catid`'); if ($catid == $rs['catid']) return ''; else return $rs['parentdir']; } else { return ''; } } else { $arrparentid = explode(',', $arrparentid); $arrcatdir = array(); krsort($arrparentid); foreach ($arrparentid as $id) { if ($id==0) continue; $arrcatdir[] = $this->categorys[$id]['catdir']; if ($this->categorys[$id]['parentdir'] == '') break; } krsort($arrcatdir); return implode('/', $arrcatdir).'/'; } } } /** * 检查目录是否存在 * @param $return_method 返回方法 * @param $catdir 目录 */ public function public_check_catdir($return_method = 1,$catdir = '') { $old_dir = ''; $catdir = $catdir ? $catdir : $_GET['catdir']; $parentid = intval($_GET['parentid']); $old_dir = $_GET['old_dir']; $r = $this->db->get_one(array('siteid'=>$this->siteid,'module'=>'content','catdir'=>$catdir,'parentid'=>$parentid)); if($r && $old_dir != $r['catdir']) { //目录存在 if($return_method) { exit('0'); } else { return false; } } else { if($return_method) { exit('1'); } else { return true; } } } /** * 更新权限 * @param $catid * @param $priv_datas * @param $is_admin */ private function update_priv($catid,$priv_datas,$is_admin = 1) { $this->priv_db = pc_base::load_model('category_priv_model'); $this->priv_db->delete(array('catid'=>$catid,'is_admin'=>$is_admin)); if(is_array($priv_datas) && !empty($priv_datas)) { foreach ($priv_datas as $r) { $r = explode(',', $r); $action = $r[0]; $roleid = $r[1]; $this->priv_db->insert(array('catid'=>$catid,'roleid'=>$roleid,'is_admin'=>$is_admin,'action'=>$action,'siteid'=>$this->siteid)); } } } /** * 检查栏目权限 * @param $action 动作 * @param $roleid 角色 * @param $is_admin 是否为管理组 */ private function check_category_priv($action,$roleid,$is_admin = 1) { $checked = ''; foreach ($this->privs as $priv) { if($priv['is_admin']==$is_admin && $priv['roleid']==$roleid && $priv['action']==$action) $checked = 'checked'; } return $checked; } /** * 重新统计栏目信息数量 */ public function count_items() { $this->content_db = pc_base::load_model('content_model'); $result = getcache('category_content_'.$this->siteid,'commons'); foreach($result as $r) { if($r['type'] == 0) { $modelid = $r['modelid']; $this->content_db->set_model($modelid); $number = $this->content_db->count(array('catid'=>$r['catid'])); $this->db->update(array('items'=>$number),array('catid'=>$r['catid'])); } } showmessage(L('operation_success'),HTTP_REFERER); } /** * json方式加载模板 */ public function public_tpl_file_list() { $style = isset($_GET['style']) && trim($_GET['style']) ? trim($_GET['style']) : exit(0); $catid = isset($_GET['catid']) && intval($_GET['catid']) ? intval($_GET['catid']) : 0; $batch_str = isset($_GET['batch_str']) ? '['.$catid.']' : ''; if ($catid) { $cat = getcache('category_content_'.$this->siteid,'commons'); $cat = $cat[$catid]; $cat['setting'] = string2array($cat['setting']); } pc_base::load_sys_class('form','',0); if($_GET['type']==1) { $html = array('page_template'=>form::select_template($style, 'content',(isset($cat['setting']['page_template']) && !empty($cat['setting']['page_template']) ? $cat['setting']['page_template'] : 'category'),'name="setting'.$batch_str.'[page_template]"','page')); } else { $html = array('category_template'=> form::select_template($style, 'content',(isset($cat['setting']['category_template']) && !empty($cat['setting']['category_template']) ? $cat['setting']['category_template'] : 'category'),'name="setting'.$batch_str.'[category_template]"','category'), 'list_template'=>form::select_template($style, 'content',(isset($cat['setting']['list_template']) && !empty($cat['setting']['list_template']) ? $cat['setting']['list_template'] : 'list'),'name="setting'.$batch_str.'[list_template]"','list'), 'show_template'=>form::select_template($style, 'content',(isset($cat['setting']['show_template']) && !empty($cat['setting']['show_template']) ? $cat['setting']['show_template'] : 'show'),'name="setting'.$batch_str.'[show_template]"','show') ); } if ($_GET['module']) { unset($html); if ($_GET['templates']) { $templates = explode('|', $_GET['templates']); if ($_GET['id']) $id = explode('|', $_GET['id']); if (is_array($templates)) { foreach ($templates as $k => $tem) { $t = $tem.'_template'; if ($id[$k]=='') $id[$k] = $tem; $html[$t] = form::select_template($style, $_GET['module'], $id[$k], 'name="'.$_GET['name'].'['.$t.']" id="'.$t.'"', $tem); } } } } if (CHARSET == 'gbk') { $html = array_iconv($html, 'gbk', 'utf-8'); } echo json_encode($html); } /** * 快速进入搜索 */ public function public_ajax_search() { if($_GET['catname']) { if(preg_match('/([a-z]+)/i',$_GET['catname'])) { $field = 'letter'; $catname = strtolower(trim($_GET['catname'])); } else { $field = 'catname'; $catname = trim($_GET['catname']); if (CHARSET == 'gbk') $catname = iconv('utf-8','gbk',$catname); } $result = $this->db->select("$field LIKE('$catname%') AND siteid='$this->siteid' AND child=0",'catid,type,catname,letter',10); if (CHARSET == 'gbk') { $result = array_iconv($result, 'gbk', 'utf-8'); } echo json_encode($result); } } /** * json方式读取风格列表,推送部分调用 */ public function public_change_tpl() { pc_base::load_sys_class('form','',0); $models = getcache('model','commons'); $modelid = intval($_GET['modelid']); if($_GET['modelid']) { $style = $models[$modelid]['default_style']; $category_template = $models[$modelid]['category_template']; $list_template = $models[$modelid]['list_template']; $show_template = $models[$modelid]['show_template']; $html = array( 'template_list'=> $style, 'category_template'=> form::select_template($style, 'content',$category_template,'name="setting[category_template]"','category'), 'list_template'=>form::select_template($style, 'content',$list_template,'name="setting[list_template]"','list'), 'show_template'=>form::select_template($style, 'content',$show_template,'name="setting[show_template]"','show') ); if (CHARSET == 'gbk') { $html = array_iconv($html, 'gbk', 'utf-8'); } echo json_encode($html); } } /** * 批量修改 */ public function batch_edit() { $categorys = getcache('category_content_'.$this->siteid,'commons'); if(isset($_POST['dosubmit'])) { pc_base::load_sys_func('iconv'); $catid = intval($_POST['catid']); $post_setting = $_POST['setting']; //栏目生成静态配置 $infos = $info = array(); $infos = $_POST['info']; if(empty($infos)) showmessage(L('operation_success')); $this->attachment_db = pc_base::load_model('attachment_model'); foreach ($infos as $catid=>$info) { $setting = string2array($categorys[$catid]['setting']); if($_POST['type'] != 2) { if($post_setting[$catid]['ishtml']) { $setting['category_ruleid'] = $_POST['category_html_ruleid'][$catid]; } else { $setting['category_ruleid'] = $_POST['category_php_ruleid'][$catid]; $info['url'] = ''; } } foreach($post_setting[$catid] as $_k=>$_setting) { $setting[$_k] = $_setting; } //内容生成静态配置 if($post_setting[$catid]['content_ishtml']) { $setting['show_ruleid'] = $_POST['show_html_ruleid'][$catid]; } else { $setting['show_ruleid'] = $_POST['show_php_ruleid'][$catid]; } if($setting['repeatchargedays']<1) $setting['repeatchargedays'] = 1; $info['sethtml'] = $post_setting[$catid]['create_to_html_root']; $info['setting'] = array2string($setting); $info['module'] = 'content'; $catname = CHARSET == 'gbk' ? $info['catname'] : iconv('utf-8','gbk',$info['catname']); $letters = gbk_to_pinyin($catname); $info['letter'] = strtolower(implode('', $letters)); $this->db->update($info,array('catid'=>$catid,'siteid'=>$this->siteid)); //更新附件状态 if($info['image'] && pc_base::load_config('system','attachment_stat')) { $this->attachment_db->api_update($info['image'],'catid-'.$catid,1); } } $this->public_cache(); showmessage(L('operation_success'),'?m=admin&c=category&a=init&module=admin&menuid=43'); } else { if(isset($_POST['catids'])) { //获取站点模板信息 pc_base::load_app_func('global'); $template_list = template_list($this->siteid, 0); foreach ($template_list as $k=>$v) { $template_list[$v['dirname']] = $v['name'] ? $v['name'] : $v['dirname']; unset($template_list[$k]); } $show_validator = $show_header = ''; $catid = intval($_GET['catid']); $type = $_POST['type'] ? intval($_POST['type']) : 0; pc_base::load_sys_class('form','',0); if(empty($_POST['catids'])) showmessage(L('illegal_parameters')); $batch_array = $workflows = array(); foreach ($categorys as $catid=>$cat) { if($cat['type']==$type && in_array($catid, $_POST['catids'])) { $batch_array[$catid] = $cat; } } if(empty($batch_array)) showmessage(L('please_select_category')); $workflows = getcache('workflow_'.$this->siteid,'commons'); if($workflows) { $workflows_datas = array(); foreach($workflows as $_k=>$_v) { $workflows_datas[$_v['workflowid']] = $_v['workname']; } } if($type==1) { include $this->admin_tpl('category_batch_edit_page'); } else { include $this->admin_tpl('category_batch_edit'); } } else { $type = isset($_GET['select_type']) ? intval($_GET['select_type']) : 0; $tree = pc_base::load_sys_class('tree'); $tree->icon = array('&nbsp;&nbsp;│ ','&nbsp;&nbsp;├─ ','&nbsp;&nbsp;└─ '); $tree->nbsp = '&nbsp;&nbsp;'; $category = array(); foreach($categorys as $catid=>$r) { if($this->siteid != $r['siteid'] || ($r['type']==2 && $r['child']==0)) continue; $category[$catid] = $r; } $str = "<option value='\$catid' \$selected>\$spacer \$catname</option>"; $tree->init($category); $string .= $tree->get_tree(0, $str); include $this->admin_tpl('category_batch_select'); } } } } ?>
108wo
phpcms/modules/admin/category.php
PHP
asf20
31,755
<?php /** * 模板风格列表 * @param integer $siteid 站点ID,获取单个站点可使用的模板风格列表 * @param integer $disable 是否显示停用的{1:是,0:否} */ function template_list($siteid = '', $disable = 0) { $list = glob(PC_PATH.'templates'.DIRECTORY_SEPARATOR.'*', GLOB_ONLYDIR); $arr = $template = array(); if ($siteid) { $site = pc_base::load_app_class('sites','admin'); $info = $site->get_by_id($siteid); if($info['template']) $template = explode(',', $info['template']); } foreach ($list as $key=>$v) { $dirname = basename($v); if ($siteid && !in_array($dirname, $template)) continue; if (file_exists($v.DIRECTORY_SEPARATOR.'config.php')) { $arr[$key] = include $v.DIRECTORY_SEPARATOR.'config.php'; if (!$disable && isset($arr[$key]['disable']) && $arr[$key]['disable'] == 1) { unset($arr[$key]); continue; } } else { $arr[$key]['name'] = $dirname; } $arr[$key]['dirname']=$dirname; } return $arr; } /** * 设置config文件 * @param $config 配属信息 * @param $filename 要配置的文件名称 */ function set_config($config, $filename="system") { $configfile = CACHE_PATH.'configs'.DIRECTORY_SEPARATOR.$filename.'.php'; if(!is_writable($configfile)) showmessage('Please chmod '.$configfile.' to 0777 !'); $pattern = $replacement = array(); foreach($config as $k=>$v) { if(in_array($k,array('js_path','css_path','img_path','attachment_stat','admin_log','gzip','errorlog','phpsso','phpsso_appid','phpsso_api_url','phpsso_auth_key','phpsso_version','connect_enable', 'upload_url','sina_akey', 'sina_skey', 'snda_enable', 'snda_status', 'snda_akey', 'snda_skey', 'qq_akey', 'qq_skey'))) { $v = trim($v); $configs[$k] = $v; $pattern[$k] = "/'".$k."'\s*=>\s*([']?)[^']*([']?)(\s*),/is"; $replacement[$k] = "'".$k."' => \${1}".$v."\${2}\${3},"; } } $str = file_get_contents($configfile); $str = preg_replace($pattern, $replacement, $str); return pc_base::load_config('system','lock_ex') ? file_put_contents($configfile, $str, LOCK_EX) : file_put_contents($configfile, $str); } /** * 获取系统信息 */ function get_sysinfo() { $sys_info['os'] = PHP_OS; $sys_info['zlib'] = function_exists('gzclose');//zlib $sys_info['safe_mode'] = (boolean) ini_get('safe_mode');//safe_mode = Off $sys_info['safe_mode_gid'] = (boolean) ini_get('safe_mode_gid');//safe_mode_gid = Off $sys_info['timezone'] = function_exists("date_default_timezone_get") ? date_default_timezone_get() : L('no_setting'); $sys_info['socket'] = function_exists('fsockopen') ; $sys_info['web_server'] = $_SERVER['SERVER_SOFTWARE']; $sys_info['phpv'] = phpversion(); $sys_info['fileupload'] = @ini_get('file_uploads') ? ini_get('upload_max_filesize') :'unknown'; return $sys_info; } /** * 检查目录可写性 * @param $dir 目录路径 */ function dir_writeable($dir) { $writeable = 0; if(is_dir($dir)) { if($fp = @fopen("$dir/chkdir.test", 'w')) { @fclose($fp); @unlink("$dir/chkdir.test"); $writeable = 1; } else { $writeable = 0; } } return $writeable; } /** * 返回错误日志大小,单位MB */ function errorlog_size() { $logfile = CACHE_PATH.'error_log.php'; if(file_exists($logfile)) { return $logsize = pc_base::load_config('system','errorlog') ? round(filesize($logfile) / 1048576 * 100) / 100 : 0; } return 0; } ?>
108wo
phpcms/modules/admin/functions/global.func.php
PHP
asf20
3,686
<?php /** * 检查管理员名称 * @param array $data 管理员数据 */ function checkuserinfo($data) { if(!is_array($data)){ showmessage(L('parameters_error'));return false; } elseif (!is_username($data['username'])){ showmessage(L('username_illegal'));return false; } elseif (empty($data['email']) || !is_email($data['email'])){ showmessage(L('email_illegal'));return false; } elseif (empty($data['roleid'])){ return false; } return $data; } /** * 检查管理员密码合法性 * @param string $password 密码 */ function checkpasswd($password){ if (!is_password($password)){ return false; } return true; } function system_information($data) { $update = pc_base::load_sys_class('update'); $notice_url = $update->notice(); $string = base64_decode('PHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiPiQoIiNtYWluX2ZyYW1laWQiKS5yZW1vdmVDbGFzcygiZGlzcGxheSIpOzwvc2NyaXB0PjxkaXYgaWQ9InBocGNtc19ub3RpY2UiPjwvZGl2PjxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0IiBzcmM9Ik5PVElDRV9VUkwiPjwvc2NyaXB0Pg=='); echo $data.str_replace('NOTICE_URL',$notice_url,$string); } ?>
108wo
phpcms/modules/admin/functions/admin.func.php
PHP
asf20
1,144
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); class keylink extends admin { function __construct() { $this->db = pc_base::load_model('keylink_model'); parent::__construct(); } function init () { $page = $_GET['page'] ? intval($_GET['page']) : '1'; $infos = $this->db->listinfo('','keylinkid DESC',$page ,'20'); $pages = $this->db->pages; $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=admin&c=keylink&a=add\', title:\''.L('add_keylink').'\', width:\'450\', height:\'130\'}, function(){var d = window.top.art.dialog({id:\'add\'}).data.iframe;var form = d.document.getElementById(\'dosubmit\');form.click();return false;}, function(){window.top.art.dialog({id:\'add\'}).close()});void(0);', L('add_keylink')); include $this->admin_tpl('keylink_list'); } /** * 验证数据有效性 */ public function public_name() { $word = isset($_GET['word']) && trim($_GET['word']) ? (CHARSET == 'gbk' ? iconv('utf-8', 'gbk', trim($_GET['word'])) : trim($_GET['word'])) : exit('0'); //修改检测 $keylinkid = isset($_GET['keylinkid']) && intval($_GET['keylinkid']) ? intval($_GET['keylinkid']) : ''; $data = array(); if ($keylinkid) { $data = $this->db->get_one(array('keylinkid'=>$keylinkid), 'word'); if (!empty($data) && $data['word'] == $word) { exit('1'); } } //添加检测 if ($this->db->get_one(array('word'=>$word), 'keylinkid')) { exit('0'); } else { exit('1'); } } /** * 关联词添加 */ function add() { if(isset($_POST['dosubmit'])){ if(empty($_POST['info']['word']) || empty($_POST['info']['url']))return false; $this->db->insert($_POST['info']); $this->public_cache_file();//更新缓存 showmessage(L('operation_success'),'?m=admin&c=keylink&a=add','', 'add'); }else{ $show_validator = $show_scroll = $show_header = true; include $this->admin_tpl('keylink_add'); } } /** * 关联词修改 */ function edit() { if(isset($_POST['dosubmit'])){ $keylinkid = intval($_GET['keylinkid']); if(empty($_POST['info']['word']) || empty($_POST['info']['url']))return false; $this->db->update($_POST['info'],array('keylinkid'=>$keylinkid)); $this->public_cache_file();//更新缓存 showmessage(L('operation_success'),'?m=admin&c=keylink&a=edit','', 'edit'); }else{ $show_validator = $show_scroll = $show_header = true; $info = $this->db->get_one(array('keylinkid'=>$_GET['keylinkid'])); if(!$info) showmessage(L('specified_word_not_exist')); extract($info); include $this->admin_tpl('keylink_edit'); } } /** * 关联词删除 */ function delete() { if(is_array($_POST['keylinkid'])){ foreach($_POST['keylinkid'] as $keylinkid_arr) { $this->db->delete(array('keylinkid'=>$keylinkid_arr)); } $this->public_cache_file();//更新缓存 showmessage(L('operation_success'),'?m=admin&c=keylink'); } else { $keylinkid = intval($_GET['keylinkid']); if($keylinkid < 1) return false; $result = $this->db->delete(array('keylinkid'=>$keylinkid)); $this->public_cache_file();//更新缓存 if($result){ showmessage(L('operation_success'),'?m=admin&c=keylink'); }else { showmessage(L("operation_failure"),'?m=admin&c=keylink'); } } } /** * 生成缓存 */ public function public_cache_file() { $infos = $this->db->select('','word,url','','keylinkid ASC'); $datas = $rs = array(); foreach($infos as $r) { $rs[0] = $r['word']; $rs[1] = $r['url']; $datas[] = $rs; } setcache('keylink', $datas, 'commons'); return true; } } ?>
108wo
phpcms/modules/admin/keylink.php
PHP
asf20
3,771
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); class log extends admin { function __construct() { parent::__construct(); $this->db = pc_base::load_model('log_model'); pc_base::load_sys_class('form'); $admin_username = param::get_cookie('admin_username');//管理员COOKIE $userid = $_SESSION['userid'];//登陆USERID  } function init () { $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1; $infos = $this->db->listinfo($where = '',$order = 'logid DESC',$page, $pages = '13'); $pages = $this->db->pages; //模块数组 $module_arr = array(); $modules = getcache('modules','commons'); $default = L('open_module'); foreach($modules as $module=>$m) $module_arr[$m['module']] = $m['module']; include $this->admin_tpl('log_list'); } /** * 操作日志删除 包含批量删除 单个删除 */ function delete() { $week = intval($_GET['week']); if($week){ $where = ''; $start = SYS_TIME - $week*7*24*3600; $d = date("Y-m-d",$start); //$end = strtotime($end_time); //$where .= "AND `message_time` >= '$start' AND `message_time` <= '$end' "; $where .= "`time` <= '$d'"; $this->db->delete($where); showmessage(L('operation_success'),'?m=admin&c=log'); } else { return false; } } /** * 日志搜索 */ public function search_log() { $where = ''; extract($_GET['search']); if($username){ $where .= $where ? " AND username='$username'" : " username='$username'"; } if ($module){ $where .= $where ? " AND module='$module'" : " module='$module'"; } if($start_time && $end_time) { $start = $start_time; $end = $end_time; $where .= "AND `time` >= '$start' AND `time` <= '$end' "; } $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1; $infos = $this->db->listinfo($where,$order = 'logid DESC',$page, $pages = '12'); $pages = $this->db->pages; //模块数组 $module_arr = array(); $modules = getcache('modules','commons'); $default = $module ? $module : L('open_module');//未设定则显示 不限模块 ,设定则显示指定的 foreach($modules as $module=>$m) $module_arr[$m['module']] = $m['module']; include $this->admin_tpl('log_search_list'); } } ?>
108wo
phpcms/modules/admin/log.php
PHP
asf20
2,406
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); class module extends admin { private $db; public function __construct() { $this->db = pc_base::load_model('module_model'); parent::__construct(); } public function init() { $dirs = $module = $dirs_arr = $directory = array(); $dirs = glob(PC_PATH.DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR.'*'); foreach ($dirs as $d) { if (is_dir($d)) { $d = basename($d); $dirs_arr[] = $d; } } define('INSTALL', true); $modules = $this->db->select('', '*', '', '', '', 'module'); $total = count($dirs_arr); $dirs_arr = array_chunk($dirs_arr, 20, true); $page = max(intval($_GET['page']), 1); $pages = pages($total, $page, 20); $directory = $dirs_arr[intval($page-1)]; include $this->admin_tpl('module_list'); } /** * 模块安装 */ public function install() { $this->module = $_POST['module'] ? $_POST['module'] : $_GET['module']; $module_api = pc_base::load_app_class('module_api'); if (!$module_api->check($this->module)) showmessage($module_api->error_msg, 'blank'); if ($_POST['dosubmit']) { if ($module_api->install()) showmessage(L('success_module_install').L('update_cache'), '?m=admin&c=module&a=cache&pc_hash='.$_SESSION['pc_hash']); else showmesage($module_api->error_msg, HTTP_REFERER); } else { include PC_PATH.'modules'.DIRECTORY_SEPARATOR.$this->module.DIRECTORY_SEPARATOR.'install'.DIRECTORY_SEPARATOR.'config.inc.php'; include $this->admin_tpl('module_config'); } } /** * 模块卸载 */ public function uninstall() { if(!isset($_GET['module']) || empty($_GET['module'])) showmessage(L('illegal_parameters')); $module_api = pc_base::load_app_class('module_api'); if(!$module_api->uninstall($_GET['module'])) showmessage($module_api->error_msg, 'blank'); else showmessage(L('uninstall_success'), '?m=admin&c=module&a=cache&pc_hash='.$_SESSION['pc_hash']); } /** * 更新模块缓存 */ public function cache() { echo '<script type="text/javascript">parent.right.location.href = \'?m=admin&c=cache_all&a=init&pc_hash='.$_SESSION['pc_hash'].'\';window.top.art.dialog({id:\'install\'}).close();</script>'; //showmessage(L('update_cache').L('success'), '', '', 'install'); } } ?>
108wo
phpcms/modules/admin/module.php
PHP
asf20
2,374
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); pc_base::load_sys_class('form', '', 0); pc_base::load_sys_func('plugin'); class plugin extends admin { private $db,$db_var; function __construct() { parent::__construct(); $this->db = pc_base::load_model('plugin_model'); $this->db_var = pc_base::load_model('plugin_var_model'); pc_base::load_app_func('global'); } /** * 应用配置信息 */ public function init() { $show_validator = true; $show_dialog = true; if($pluginfo = $this->db->select('','*','','disable DESC,listorder DESC')) { foreach ($pluginfo as $_k=>$_r) { if(file_exists(PC_PATH.'plugin'.DIRECTORY_SEPARATOR.$_r['dir'].DIRECTORY_SEPARATOR.$_r['dir'].'.class.php')){ $pluginfo[$_k]['url'] = 'plugin.php?id='.$_r['dir']; } else { $pluginfo[$_k]['url'] = ''; } $pluginfo[$_k]['dir'] = $_r['dir'].'/'; } } include $this->admin_tpl('plugin_list'); } /** * 应用导入\安装 */ public function import() { if(!isset($_GET['dir'])) { $plugnum = 1; $installsdir = array(); if($installs_pluginfo = $this->db->select()) { foreach ($installs_pluginfo as $_r) { $installsdir[] = $_r['dir']; } } $pluginsdir = dir(PC_PATH.'plugin'); while (false !== ($entry = $pluginsdir->read())) { $config_file = ''; $plugin_data = array(); if(!in_array($entry, array('.', '..')) && is_dir(PC_PATH.'plugin'.DIRECTORY_SEPARATOR.$entry) && !in_array($entry, $installsdir) && !$this->db->get_one(array('identification'=>$entry))) { $config_file = PC_PATH.'plugin'.DIRECTORY_SEPARATOR.$entry.DIRECTORY_SEPARATOR.'plugin_'.$entry.'.cfg.php'; if(file_exists($config_file)) { $plugin_data = @require($config_file); $pluginfo[$plugnum]['name'] = $plugin_data['plugin']['name']; $pluginfo[$plugnum]['version'] = $plugin_data['plugin']['version']; $pluginfo[$plugnum]['copyright'] = $plugin_data['plugin']['copyright']; $pluginfo[$plugnum]['dir'] = $entry; $plugnum++; } } } include $this->admin_tpl('plugin_list_import'); } else { $dir = trim($_GET['dir']); $license = 0; $config_file = PC_PATH.'plugin'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.'plugin_'.$dir.'.cfg.php'; if(file_exists($config_file)) { $plugin_data = @require($config_file); $license = ($plugin_data['license'] == '' || !isset($plugin_data['license'])) ? 0 : 1; } if(empty($_GET['license']) && $license) { $submit_url = '?m=admin&c=plugin&a=import&dir='.$dir.'&license=1&pc_hash='. $_SESSION['pc_hash'].'&menuid='.$_GET['menuid']; } else { $submit_url = '?m=admin&c=plugin&a=install&dir='.$dir.'&pc_hash='. $_SESSION['pc_hash'].'&menuid='.$_GET['menuid']; } $show_header = 0; include $this->admin_tpl('plugin_import_confirm'); } } /** * 应用删除程序 */ public function delete() { if(isset($_POST['dosubmit'])) { $pluginid = intval($_POST['pluginid']); $plugin_data = $this->db->get_one(array('pluginid'=>$pluginid)); $op_status = FALSE; $dir = $plugin_data['dir']; $config_file = PC_PATH.'plugin'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.'plugin_'.$dir.'.cfg.php'; if(file_exists($config_file)) { $plugin_data = @require($config_file); } $filename = PC_PATH.'plugin'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.$plugin_data['plugin']['uninstallfile']; if(file_exists($filename)) { @include_once $filename; } else { showmessage(L('plugin_lacks_uninstall_file','','plugin'),HTTP_REFERER); } if($op_status) { $this->db->delete(array('pluginid'=>$pluginid)); $this->db_var->delete(array('pluginid'=>$pluginid)); delcache($dir,'plugins'); delcache($dir.'_var','plugins'); $this->set_hook_cache(); if($plugin_data['plugin']['iframe']) { pc_base::load_sys_func('dir'); if(!dir_delete(PC_PATH.'plugin'.DIRECTORY_SEPARATOR.$dir)) { showmessage(L('plugin_uninstall_success_no_delete','','plugin'),'?m=admin&c=plugin'); } } showmessage(L('plugin_uninstall_success','','plugin'),'?m=admin&c=plugin'); } else { showmessage(L('plugin_uninstall_fail','','plugin'),'?m=admin&c=plugin'); } } else { $show_header = 0; $pluginid = intval($_GET['pluginid']); $plugin_data = $this->db->get_one(array('pluginid'=>$pluginid)); include $this->admin_tpl('plugin_delete_confirm'); } } /** * 应用安装 */ public function install() { $op_status = FALSE; $dir = trim($_GET['dir']); $config_file = PC_PATH.'plugin'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.'plugin_'.$dir.'.cfg.php'; if(file_exists($config_file)) { $plugin_data = @require($config_file); } else { showmessage(L('plugin_config_not_exist','','plugin')); } $app_status = app_validity_check($plugin_data['appid']); if($app_status != 2){ $app_msg = $app_status == '' ? L('plugin_not_exist_or_pending','','plugin') : ($app_status == 0 || $app_status == 1 ? L('plugin_developing','','plugin') : L('plugin_be_locked','','plugin')); showmessage($app_msg); } if($plugin_data['version'] && $plugin_data['version']!=pc_base::load_config('version', 'pc_version')) { showmessage(L('plugin_incompatible','','plugin')); } if($plugin_data['dir'] == '' || $plugin_data['identification'] == '' || $plugin_data['identification']!=$plugin_data['dir']) { showmessage(L('plugin_lack_of_necessary_configuration_items','','plugin')); } if(!pluginkey_check($plugin_data['identification'])) { showmessage(L('plugin_illegal_id','','plugin')); } if(is_array($plugin_data['plugin_var'])) { foreach($plugin_data['plugin_var'] as $config) { if(!pluginkey_check($config['fieldname'])) { showmessage(L('plugin_illegal_variable','','plugin')); } } } if($this->db->get_one(array('identification'=>$plugin_data['identification']))) { showmessage(L('plugin_duplication_name','','plugin')); }; $filename = PC_PATH.'plugin'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.$plugin_data['plugin']['installfile']; if(file_exists($filename)) { @include_once $filename; } if($op_status) { //向插件表中插入数据 $plugin = array('name'=>new_addslashes($plugin_data['plugin']['name']),'identification'=>$plugin_data['identification'],'appid'=>$plugin_data['appid'],'description'=>new_addslashes($plugin_data['plugin']['description']),'dir'=>$plugin_data['dir'],'copyright'=>new_addslashes($plugin_data['plugin']['copyright']),'setting'=>array2string($plugin_data['plugin']['setting']),'iframe'=>array2string($plugin_data['plugin']['iframe']),'version'=>$plugin_data['plugin']['version'],'disable'=>'0'); $pluginid = $this->db->insert($plugin,TRUE); //向插件变量表中插入数据 if(is_array($plugin_data['plugin_var'])) { foreach($plugin_data['plugin_var'] as $config) { $plugin_var = array(); $plugin_var['pluginid'] = $pluginid; foreach($config as $_k => $_v) { if(!in_array($_k, array('title','description','fieldname','fieldtype','setting','listorder','value','formattribute'))) continue; if($_k == 'setting') $_v = array2string($_v); $plugin_var[$_k] = $_v; } $this->db_var->insert($plugin_var); } } plugin_install_stat($plugin_data['appid']); setcache($plugin_data['identification'], $plugin,'plugins'); $this->set_var_cache($pluginid); showmessage(L('plugin_install_success','','plugin'),'?m=admin&c=plugin'); } else { showmessage(L('plugin_install_fail','','plugin'),'?m=admin&c=plugin'); } } /** * 应用升级 */ public function upgrade() { //TODO } /** * 应用排序 */ public function listorder() { if(isset($_POST['dosubmit'])) { foreach($_POST['listorders'] as $pluginid => $listorder) { $this->db->update(array('listorder'=>$listorder),array('pluginid'=>$pluginid)); } $this->set_hook_cache(); showmessage(L('operation_success'),'?m=admin&c=plugin'); } else { showmessage(L('operation_failure'),'?m=admin&c=plugin'); } } /** * 应用中心 * Enter description here ... */ public function appcenter() { $data = array(); $p = intval($_GET[p]) ? intval($_GET[p]) : 1; $s = 8; $data = file_get_contents('http://open.phpcms.cn/index.php?m=open&c=api&a=get_applist&s='.$s.'&p='.$p); $data = array_iconv(json_decode($data, true),'utf-8',CHARSET); $recommed_data = file_get_contents('http://open.phpcms.cn/index.php?m=open&c=api&a=get_recommed_applist&s=5&p=1'); $recommed_data = array_iconv(json_decode($recommed_data, true),'utf-8',CHARSET); $focus_data = file_get_contents('http://open.phpcms.cn/index.php?m=open&c=api&a=get_app_focus&num=3'); $focus_data = array_iconv(json_decode($focus_data, true),'utf-8',CHARSET); $pages = $data['pages']; $pre_page = $p <= 1 ? 1 : $p - 1; $next_page = $p >= $pages ? $pages : $p + 1; $pages = '<a class="a1">'.$data['total'].L('plugin_item','','plugin').'</a> <a href="?m=admin&c=plugin&a=appcenter&p=1">'.L('plugin_firstpage').'</a> <a href="?m=admin&c=plugin&a=appcenter&p='.$pre_page.'">'.L('plugin_prepage').'</a> <a href="?m=admin&c=plugin&a=appcenter&p='.$next_page.'">'.L('plugin_nextpage').'</a> <a href="?m=admin&c=plugin&a=appcenter&p='.$pages.'">'.L('plugin_lastpage').'</a>'; $show_header = 1; include $this->admin_tpl('plugin_appcenter'); } /** * 显示应用详情 */ public function appcenter_detail() { $data = array(); $id = intval($_GET['id']); $data = file_get_contents('http://open.phpcms.cn/index.php?m=open&c=api&a=get_detail_byappid&id='.$id); $data = array_iconv(json_decode($data, true),'utf-8',CHARSET); extract($data); if($appname) { include $this->admin_tpl('plugin_appcenter_detail'); } else { showmessage(L('plugin_not_exist_or_pending','','plugin')); } } /** * 在线安装 */ public function install_online() { $data = array(); $id = intval($_GET['id']); $data = file_get_contents('http://open.phpcms.cn/index.php?m=open&c=api&a=get_detail_byappid&id='.$id); $data = array_iconv(json_decode($data, true),'utf-8',CHARSET); //如果为iframe类型应用,无需下载压缩包,之间创建插件文件夹 if(!empty($data['iframe'])) { $appdirname = PC_PATH.'plugin'.DIRECTORY_SEPARATOR.$data['appenname']; if(!file_exists($appdirname)) { if(!mkdir($appdirname)) { showmessage(L('plugin_mkdir_fail', '', 'plugin')); } else { //创建安装、配置文件 $installdata = <<<EOF <?php defined('IN_PHPCMS') or exit('No permission resources.'); \$op_status = TRUE; ?> EOF; $uninstallres = @file_put_contents($appdirname.DIRECTORY_SEPARATOR.'uninstall.php', $installdata); $installres = @file_put_contents($appdirname.DIRECTORY_SEPARATOR.'install.php', $installdata); $cfgdata = <<<EOF <?php return array ( 'identification' => '$data[appenname]', 'dir' => '$data[appenname]', 'appid' => '$data[id]', 'plugin'=> array( 'version' => '1.0', 'name' => '$data[appname]', 'copyright' => 'phpcms team', 'description' =>'$data[description]', 'installfile' => 'install.php', 'uninstallfile' => 'uninstall.php', 'iframe' => array('width'=>'960','height'=>'640','url'=>'$data[iframe]'), ), 'plugin_var'=> array( array('title'=>'宽度','description'=>'','fieldname'=>'width','fieldtype'=>'text','value'=>'960','formattribute'=>'style="width:50px"','listorder'=>'1',), array('title'=>'高度','description'=>'','fieldname'=>'height','fieldtype'=>'text','value'=>'640','formattribute'=>'style="width:50px"','listorder'=>'2',), ), ); ?> EOF; $cfgres = @file_put_contents($appdirname.DIRECTORY_SEPARATOR.'plugin_'.$data['appenname'].'.cfg.php', $cfgdata); //检查配置文件是否写入成功 if($installres*$uninstallres*$cfgres > 0) { showmessage(L('plugin_configure_success', '', 'plugin'), 'index.php?m=admin&c=plugin&a=import&dir='.$data['appenname']); } else { showmessage(L('plugin_install_fail', '', 'plugin')); } } } else { showmessage(L('plugin_allready_exists', '', 'plugin')); } } else { //远程压缩包地址 $upgradezip_url = $data['downurl']; if(empty($upgradezip_url)) { showmessage(L('download_fail', '', 'plugin'), 'index.php?m=admin&c=plugin&a=appcenter'); } //创建缓存文件夹 if(!file_exists(CACHE_PATH.'caches_open')) { @mkdir(CACHE_PATH.'caches_open'); } //保存到本地地址 $upgradezip_path = CACHE_PATH.'caches_open'.DIRECTORY_SEPARATOR.$data['id'].'.zip'; //解压路径 $upgradezip_source_path = CACHE_PATH.'caches_open'.DIRECTORY_SEPARATOR.$data['id']; //下载压缩包 @file_put_contents($upgradezip_path, @file_get_contents($upgradezip_url)); //解压缩 pc_base::load_app_class('pclzip', 'upgrade', 0); $archive = new PclZip($upgradezip_path); if($archive->extract(PCLZIP_OPT_PATH, $upgradezip_source_path, PCLZIP_OPT_REPLACE_NEWER) == 0) { die("Error : ".$archive->errorInfo(true)); } //删除压缩包 @unlink($upgradezip_path); //拷贝gbk/upload文件夹到根目录 $copy_from = $upgradezip_source_path.DIRECTORY_SEPARATOR.CHARSET; //动态程序路径 $copy_to_pcpath = PC_PATH.'plugin'; //静态程序路径 $copy_to_staticspath = PHPCMS_PATH.'statics'.DIRECTORY_SEPARATOR.'plugin'; //应用文件夹名称 $appdirname = $data['appenname']; $this->copyfailnum = 0; $this->copydir($copy_from.DIRECTORY_SEPARATOR.'phpcms'.DIRECTORY_SEPARATOR.'plugin', $copy_to_pcpath, $_GET['cover']); $this->copydir($copy_from.DIRECTORY_SEPARATOR.'statics'.DIRECTORY_SEPARATOR.'plugin', $copy_to_staticspath, $_GET['cover']); $this->deletedir($copy_from); //检查文件操作权限,是否复制成功 if($this->copyfailnum > 0) { showmessage(L('download_fail', '', 'plugin'), 'index.php?m=admin&c=plugin&a=appcenter'); } else { showmessage(L('download_success', '', 'plugin'), 'index.php?m=admin&c=plugin&a=import&dir='.$appdirname); } } } /** * 异步方式调用详情 * Enter description here ... */ public function public_appcenter_ajx_detail() { $id = intval($_GET['id']); $data = file_get_contents('http://open.phpcms.cn/index.php?m=open&c=api&a=get_detail_byappid&id='.$id); //$data = json_decode($data, true); echo $_GET['jsoncallback'].'(',$data,')'; exit; } /** * 配置应用. */ public function config() { if(isset($_POST['dosubmit'])) { $pluginid = intval($_POST['pluginid']); foreach ($_POST['info'] as $_k => $_v) { $this->db_var->update(array('value'=>$_v),array('pluginid'=>$pluginid,'fieldname'=>$_k)); } $this->set_var_cache($pluginid); showmessage(L('operation_success'),HTTP_REFERER); } else { $pluginid = intval($_GET['pluginid']); $plugin_menus = array(); $info = $this->db->get_one(array('pluginid'=>$pluginid)); extract($info); if(!isset($_GET['module'])) { $plugin_menus[] =array('name'=>L('plugin_desc','','plugin'),'url'=>'','status'=>'1'); if($disable){ if($info_var = $this->db_var->select(array('pluginid'=>$pluginid),'*','','listorder ASC,id DESC')) { $plugin_menus[] =array('name'=>L('plugin_config','','plugin'),'url'=>'','status'=>'0'); $form = $this->creatconfigform($info_var); } $meun_total = count($plugin_menus);; $setting = string2array($setting); if(is_array($setting)) { foreach($setting as $m) { $plugin_menus[] = array('name'=>$m['menu'],'extend'=>1,'url'=>$m['name']); $mods[] = $m['name']; } } } include $this->admin_tpl('plugin_setting'); } else { define('PLUGIN_ID', $identification); $plugin_module = trim($_GET['module']); $plugin_admin_path = PC_PATH.'plugin'.DIRECTORY_SEPARATOR.$identification.DIRECTORY_SEPARATOR.'plugin_admin.class.php'; if (file_exists($plugin_admin_path)) { include $plugin_admin_path; $plugin_admin = new plugin_admin($pluginid); call_user_func(array($plugin_admin, $plugin_module)); } } } } /** * 开启/关闭插件 * Enter description here ... */ public function status() { $disable = intval($_GET['disable']); $pluginid = intval($_GET['pluginid']); $this->db->update(array('disable'=>$disable),array('pluginid'=>$pluginid)); $this->set_cache($pluginid); showmessage(L('operation_success'),HTTP_REFERER); } /** * 设置字段缓存 * @param int $pluginid */ private function set_var_cache($pluginid) { if($info = $this->db_var->select(array('pluginid'=>$pluginid))) { $plugin_data = $this->db->get_one(array('pluginid'=>$pluginid)); foreach ($info as $_value) { $plugin_vars[$_value['fieldname']] = $_value['value']; } setcache($plugin_data['identification'].'_var', $plugin_vars,'plugins'); } } /** * 设置缓存 * @param int $pluginid */ private function set_cache($pluginid) { if($info = $this->db->get_one(array('pluginid'=>$pluginid))) { setcache($info['identification'], $info,'plugins'); } $this->set_hook_cache(); } /** * 设置hook缓存 */ function set_hook_cache() { if($info = $this->db->select(array('disable'=>1),'*','','listorder DESC')) { foreach($info as $i) { $id = $i['identification']; $hook_file = PC_PATH.'plugin'.DIRECTORY_SEPARATOR.$id.DIRECTORY_SEPARATOR.'hook.class.php'; if(file_exists($hook_file)) { $hook[$i['appid']] = $i['identification']; } } } setcache('hook',$hook,'plugins'); } /** * 创建配置表单 * @param array $data */ private function creatconfigform($data) { if(!is_array($data) || empty($data)) return false; foreach ($data as $r) { $form .= '<tr><th width="120">'.$r['title'].'</th><td class="y-bg">'.$this->creatfield($r).'</td></tr>'; } return $form; } /** * 创建配置表单字段 * @param array $data */ private function creatfield($data) { extract($data); $fielda_array = array('text','radio','checkbox','select','datetime','textarea'); if(in_array($fieldtype, $fielda_array)) { if($fieldtype == 'text') { return '<input type="text" name="info['.$fieldname.']" id="'.$fieldname.'" value="'.$value.'" class="input-text" '.$formattribute.' > '.' '.$description; } elseif($fieldtype == 'checkbox') { return form::checkbox(string2array($setting),$value,"name='info[$fieldname]' $formattribute",'',$fieldname).' '.$description; } elseif($fieldtype == 'radio') { return form::radio(string2array($setting),$value,"name='info[$fieldname]' $formattribute",'',$fieldname).' '.$description; } elseif($fieldtype == 'select') { return form::select(string2array($setting),$value,"name='info[$fieldname]' $formattribute",'',$fieldname).' '.$description; } elseif($fieldtype == 'datetime') { return form::date("info[$fieldname]",$value,$isdatetime,1).' '.$description; } elseif($fieldtype == 'textarea') { return '<textarea name="info['.$fieldname.']" id="'.$fieldname.'" '.$formattribute.'>'.$value.'</textarea>'.' '.$description; } } } /** * 执行SQL * @param string $sql 要执行的sql语句 */ private function _sql_execute($sql) { $sqls = $this->_sql_split($sql); if(is_array($sqls)) { foreach($sqls as $sql) { if(trim($sql) != '') { $this->db->query($sql); } } } else { $this->db->query($sqls); } return true; } /** * 分割SQL语句 * @param string $sql 要执行的sql语句 */ private function _sql_split($sql) { $database = pc_base::load_config('database'); $db_charset = $database['default']['charset']; if($this->db->version() > '4.1' && $db_charset) { $sql = preg_replace("/TYPE=(InnoDB|MyISAM|MEMORY)( DEFAULT CHARSET=[^; ]+)?/", "ENGINE=\\1 DEFAULT CHARSET=".$db_charset,$sql); } $sql = str_replace("\r", "\n", $sql); $ret = array(); $num = 0; $queriesarray = explode(";\n", trim($sql)); unset($sql); foreach($queriesarray as $query) { $ret[$num] = ''; $queries = explode("\n", trim($query)); $queries = array_filter($queries); foreach($queries as $query) { $str1 = substr($query, 0, 1); if($str1 != '#' && $str1 != '-') $ret[$num] .= $query; } $num++; } return($ret); } private function copydir($dirfrom, $dirto, $cover='') { //如果遇到同名文件无法复制,则直接退出 if(is_file($dirto)){ die(L('have_no_pri').$dirto); } //如果目录不存在,则建立之 if(!file_exists($dirto)){ mkdir($dirto); } $handle = opendir($dirfrom); //打开当前目录 //循环读取文件 while(false !== ($file = readdir($handle))) { if($file != '.' && $file != '..'){ //排除"."和"." //生成源文件名 $filefrom = $dirfrom.DIRECTORY_SEPARATOR.$file; //生成目标文件名 $fileto = $dirto.DIRECTORY_SEPARATOR.$file; if(is_dir($filefrom)){ //如果是子目录,则进行递归操作 $this->copydir($filefrom, $fileto, $cover); } else { //如果是文件,则直接用copy函数复制 if(!empty($cover)) { if(!copy($filefrom, $fileto)) { $this->copyfailnum++; echo L('copy').$filefrom.L('to').$fileto.L('failed')."<br />"; } } else { if(fileext($fileto) == 'html' && file_exists($fileto)) { } else { if(!copy($filefrom, $fileto)) { $this->copyfailnum++; echo L('copy').$filefrom.L('to').$fileto.L('failed')."<br />"; } } } } } } } private function deletedir($dirname){ $result = false; if(! is_dir($dirname)){ echo " $dirname is not a dir!"; exit(0); } $handle = opendir($dirname); //打开目录 while(($file = readdir($handle)) !== false) { if($file != '.' && $file != '..'){ //排除"."和"." $dir = $dirname.DIRECTORY_SEPARATOR.$file; //$dir是目录时递归调用deletedir,是文件则直接删除 is_dir($dir) ? $this->deletedir($dir) : unlink($dir); } } closedir($handle); $result = rmdir($dirname) ? true : false; return $result; } } ?>
108wo
phpcms/modules/admin/plugin.php
PHP
asf20
23,033
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); class cache_all extends admin { private $cache_api; public function init() { if (isset($_POST['dosubmit']) || isset($_GET['dosubmit'])) { $page = $_GET['page'] ? intval($_GET['page']) : 0; $modules = array( array('name' => L('module'), 'function' => 'module'), array('name' => L('sites'), 'mod' => 'admin', 'file' => 'sites', 'function' => 'set_cache'), array('name' => L('category'), 'function' => 'category'), array('name' => L('downservers'), 'function' => 'downservers'), array('name' => L('badword_name'), 'function' => 'badword'), array('name' => L('ipbanned'), 'function' => 'ipbanned'), array('name' => L('keylink'), 'function' => 'keylink'), array('name' => L('linkage'), 'function' => 'linkage'), array('name' => L('position'), 'function' => 'position'), array('name' => L('admin_role'), 'function' => 'admin_role'), array('name' => L('urlrule'), 'function' => 'urlrule'), array('name' => L('sitemodel'), 'function' => 'sitemodel'), array('name' => L('type'), 'function' => 'type', 'param' => 'content'), array('name' => L('workflow'), 'function' => 'workflow'), array('name' => L('dbsource'), 'function' => 'dbsource'), array('name' => L('member_setting'), 'function' => 'member_setting'), array('name' => L('member_group'), 'function' => 'member_group'), array('name' => L('membermodel'), 'function' => 'membermodel'), array('name' => L('member_model_field'), 'function' => 'member_model_field'), array('name' => L('search_type'), 'function' => 'type', 'param' => 'search'), array('name' => L('search_setting'), 'function' => 'search_setting'), array('name' => L('update_vote_setting'), 'function' => 'vote_setting'), array('name' => L('update_link_setting'), 'function' => 'link_setting'), array('name' => L('special'), 'function' => 'special'), array('name' => L('setting'), 'function' => 'setting'), array('name' => L('database'), 'function' => 'database'), array('name' => L('update_formguide_model'), 'mod' => 'formguide', 'file' => 'formguide', 'function' => 'public_cache'), array('name' => L('cache_file'), 'function' => 'cache2database'), array('name' => L('cache_copyfrom'), 'function' => 'copyfrom'), array('name' => L('clear_files'), 'function' => 'del_file'), ); $this->cache_api = pc_base::load_app_class('cache_api', 'admin'); $m = $modules[$page]; if ($m['mod'] && $m['function']) { if ($m['file'] == '') $m['file'] = $m['function']; $M = getcache('modules', 'commons'); if (in_array($m['mod'], array_keys($M))) { $cache = pc_base::load_app_class($m['file'], $m['mod']); $cache->$m['function'](); } } else if($m['target']=='iframe') { echo '<script type="text/javascript">window.parent.frames["hidden"].location="index.php?'.$m['link'].'";</script>'; } else { $this->cache_api->cache($m['function'], $m['param']); } $page++; if (!empty($modules[$page])) { echo '<script type="text/javascript">window.parent.addtext("<li>'.L('update').$m['name'].L('cache_file_success').'..........</li>");</script>'; showmessage(L('update').$m['name'].L('cache_file_success'), '?m=admin&c=cache_all&page='.$page.'&dosubmit=1&pc_hash='.$_SESSION['pc_hash'], 0); } else { echo '<script type="text/javascript">window.parent.addtext("<li>'.L('update').$m['name'].L('site_cache_success').'..........</li>")</script>'; showmessage(L('update').$m['name'].L('site_cache_success'), 'blank'); } } else { include $this->admin_tpl('cache_all'); } } } ?>
108wo
phpcms/modules/admin/cache_all.php
PHP
asf20
3,753
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); pc_base::load_sys_class('form','',0); class search_type extends admin { function __construct() { parent::__construct(); $this->db = pc_base::load_model('type_model'); $this->siteid = $this->get_siteid(); $this->model = getcache('model','commons'); $this->yp_model = getcache('yp_model','model'); $this->module_db = pc_base::load_model('module_model'); } public function init () { $datas = array(); $page = isset($_GET['page']) && trim($_GET['page']) ? intval($_GET['page']) : 1; $result_datas = $this->db->listinfo(array('siteid'=>$this->siteid,'module'=>'search'),'listorder ASC', $page); $pages = $this->db->pages; foreach($result_datas as $r) { $r['modelname'] = $this->model[$r['modelid']]['name']; $datas[] = $r; } $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=search&c=search_type&a=add\', title:\''.L('add_search_type').'\', width:\'580\', height:\'240\', lock:true}, function(){var d = window.top.art.dialog({id:\'add\'}).data.iframe;var form = d.document.getElementById(\'dosubmit\');form.click();return false;}, function(){window.top.art.dialog({id:\'add\'}).close()});void(0);', L('add_search_type')); $this->cache(); include $this->admin_tpl('type_list'); } public function add() { if(isset($_POST['dosubmit'])) { $_POST['info']['siteid'] = $this->siteid; $_POST['info']['module'] = 'search'; if($_POST['module']=='content') { $_POST['info']['modelid'] = intval($_POST['info']['modelid']); $_POST['info']['typedir'] = $_POST['module']; } elseif($_POST['module']=='yp') { $_POST['info']['modelid'] = intval($_POST['info']['yp_modelid']); $_POST['info']['typedir'] = $_POST['module']; } else { $_POST['info']['typedir'] = $_POST['module']; $_POST['info']['modelid'] = 0; } //删除黄页模型变量无该字段 unset($_POST['info']['yp_modelid']); $this->db->insert($_POST['info']); showmessage(L('add_success'), '', '', 'add'); } else { $show_header = $show_validator = ''; foreach($this->model as $_key=>$_value) { if($_value['siteid']!=$this->siteid) continue; $model_data[$_key] = $_value['name']; } foreach($this->yp_model as $_key=>$_value) { if($_value['siteid']!=$this->siteid) continue; $yp_model_data[$_key] = $_value['name']; } $module_data = array('special' => L('special'),'content' => L('content').L('module'),'yp'=>L('yp')); include $this->admin_tpl('type_add'); } } public function edit() { if(isset($_POST['dosubmit'])) { $typeid = intval($_POST['typeid']); if($_POST['module']=='content') { $_POST['info']['modelid'] = intval($_POST['info']['modelid']); } elseif($_POST['module']=='yp') { $_POST['info']['modelid'] = intval($_POST['info']['yp_modelid']); $_POST['info']['typedir'] = $_POST['module']; } else { $_POST['info']['typedir'] = $_POST['typedir']; $_POST['info']['modelid'] = 0; } //删除黄页模型变量无该字段 unset($_POST['info']['yp_modelid']); $this->db->update($_POST['info'],array('typeid'=>$typeid)); showmessage(L('update_success'), '', '', 'edit'); } else { $show_header = $show_validator = ''; $typeid = intval($_GET['typeid']); foreach($this->model as $_key=>$_value) { if($_value['siteid']!=$this->siteid) continue; $model_data[$_key] = $_value['name']; } foreach($this->yp_model as $_key=>$_value) { if($_value['siteid']!=$this->siteid) continue; $yp_model_data[$_key] = $_value['name']; } $module_data = array('special' => L('special'),'content' => L('content').L('module'),'yp'=>L('yp')); $r = $this->db->get_one(array('typeid'=>$typeid)); extract($r); include $this->admin_tpl('type_edit'); } } public function delete() { $_GET['typeid'] = intval($_GET['typeid']); $this->db->delete(array('typeid'=>$_GET['typeid'])); showmessage(L('operation_success'), HTTP_REFERER); } /** * 排序 */ public function listorder() { if(isset($_POST['dosubmit'])) { foreach($_POST['listorders'] as $id => $listorder) { $this->db->update(array('listorder'=>$listorder),array('typeid'=>$id)); } showmessage(L('operation_success')); } else { showmessage(L('operation_failure')); } } public function cache() { $datas = $search_model = array(); $result_datas = $result_datas2 = $this->db->select(array('siteid'=>$this->siteid,'module'=>'search'),'*',1000,'listorder ASC'); foreach($result_datas as $_key=>$_value) { if(!$_value['modelid']) continue; $datas[$_value['modelid']] = $_value['typeid']; $search_model[$_value['modelid']]['typeid'] = $_value['typeid']; $search_model[$_value['modelid']]['name'] = $_value['name']; $search_model[$_value['modelid']]['sort'] = $_value['listorder']; } setcache('type_model_'.$this->siteid,$datas,'search'); $datas = array(); foreach($result_datas2 as $_key=>$_value) { if($_value['modelid']) continue; $datas[$_value['typedir']] = $_value['typeid']; $search_model[$_value['typedir']]['typeid'] = $_value['typeid']; $search_model[$_value['typedir']]['name'] = $_value['name']; } setcache('type_module_'.$this->siteid,$datas,'search'); //搜索header头中使用类型缓存 setcache('search_model_'.$this->siteid,$search_model,'search'); return true; } } ?>
108wo
phpcms/modules/search/search_type.php
PHP
asf20
5,601
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin'); ?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}}); $("#name").formValidator({onshow:"<?php echo L("input").L('type_name')?>",onfocus:"<?php echo L("input").L('type_name')?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('type_name')?>"}).regexValidator({regexp:"ps_username",datatype:"enum",onerror:"<?php echo L('type_name').L('format_incorrect', '','member')?>"}); }) //--> </script> <div class="pad-lr-10"> <form action="?m=search&c=search_type&a=edit" method="post" id="myform"> <table width="100%" class="table_form"> <tr> <th width="120"><?php echo L('select_module_name')?>:</th> <td class="y-bg"><?php if($modelid && $typedir == 'yp') { $module = 'yp'; } elseif($modelid && $typedir != 'yp') { $module = 'content'; } else { $module = $module; } echo form::select($module_data,$module,'name="module" onchange="change_module(this.value)" disabled')?></td> <input name="module" type="hidden" value="<?php echo $module?>"><input name="typedir" type="hidden" value="<?php echo $typedir?>"> </tr> <?php if($modelid && $typedir != 'yp') {?> <tr id="modelid_display"> <th width="120"><?php echo L('select_model_name')?>:</th> <td class="y-bg"><?php echo form::select($model_data,$modelid,'name="info[modelid]"')?></td> </tr> <?php }?> <?php if($modelid && $typedir == 'yp') {?> <tr id="yp_modelid_display"> <th width="120"><?php echo L('select_model_name')?>:</th> <td class="y-bg"><?php echo form::select($yp_model_data,$modelid,'name="info[yp_modelid]"')?></td> </tr> <?php }?> <tr> <th width="120"><?php echo L('type_name')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="info[name]" id="name" size="30" value="<?php echo $name?>"/></td> </tr> <tr> <th><?php echo L('description')?>:</th> <td class="y-bg"><textarea name="info[description]" maxlength="255" style="width:300px;height:60px;"><?php echo $description?></textarea></td> </tr> </table> <div class="bk15"></div> <input type="hidden" name="typeid" value="<?php echo $typeid?>"> <input type="submit" class="dialog" id="dosubmit" name="dosubmit" value="<?php echo L('submit')?>" /> </form> </div> <SCRIPT LANGUAGE="JavaScript"> <!-- function change_module(module) { redirect('?m=search&c=search_type&a=edit&typeid=<?php echo $typeid?>&module='+module+'&pc_hash=<?php echo $_SESSION['pc_hash']?>'); } //--> </SCRIPT> </body> </html>
108wo
phpcms/modules/search/templates/type_edit.tpl.php
PHP
asf20
2,857
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin');?> <form name="myform" action="?m=search&c=search_type&a=listorder" method="post"> <div class="pad_10"> <div class="table-list"> <div class="explain-col"> <?php echo L('searh_notice')?> </div> <div class="bk10"></div> <table width="100%" cellspacing="0" > <thead> <tr> <th width="55"><?php echo L('sort')?></td> <th width="35">ID</th> <th width="120"><?php echo L('catname')?></th> <th width="80"><?php echo L('modulename')?></th> <th width="80"><?php echo L('modlename')?></th> <th width="*"><?php echo L('catdescription')?></th> <th width="80"><?php echo L('opreration')?></th> </tr> </thead> <tbody> <?php foreach($datas as $r) { ?> <tr> <td align="center"><input type="text" name="listorders[<?php echo $r['typeid']?>]" value="<?php echo $r['listorder']?>" size="3" class='input-text-c'></td> <td align="center"><?php echo $r['typeid']?></td> <td align="center"><?php echo $r['name']?></td> <td align="center"><?php echo $r['modelid'] && $r['typedir'] !='yp' ? L('content_module') : $r['typedir'];?></td> <td align="center"><?php echo $this->model[$r['modelid']]['name'] ? $this->model[$r['modelid']]['name'] : $this->yp_model[$r['modelid']]['name']?></td> <td ><?php echo $r['description']?></td> <td align="center"><a href="javascript:edit('<?php echo $r['typeid']?>','<?php echo $r['name']?>')"><?php echo L('modify')?></a> | <a href="?m=search&c=search_type&a=delete&typeid=<?php echo $r['typeid']?>" onclick="return confirm('<?php echo L('sure_delete', '', 'member')?>')"><?php echo L('delete')?></a> </td> </tr> <?php } ?> </tbody> </table> <div class="btn"><input type="submit" class="button" name="dosubmit" value="<?php echo L('listorder')?>" /></div> </div> </div> <div id="pages"><?php echo $pages;?></div> </div> </form> <script type="text/javascript"> <!-- function edit(id, name) { window.top.art.dialog({id:'edit'}).close(); window.top.art.dialog({title:'<?php echo L('edit_cat')?>《'+name+'》',id:'edit',iframe:'?m=search&c=search_type&a=edit&typeid='+id,width:'580',height:'240'}, function(){var d = window.top.art.dialog({id:'edit'}).data.iframe;d.document.getElementById('dosubmit').click();return false;}, function(){window.top.art.dialog({id:'edit'}).close()}); } function data_delete(obj,id,name){ window.top.art.dialog({content:name, fixed:true, style:'confirm', id:'data_delete'}, function(){ $.get('?m=search&c=search_type&a=delete&typeid='+id+'&pc_hash='+pc_hash,function(data){ if(data) { $(obj).parent().parent().fadeOut("slow"); } }) }, function(){}); }; //--> </script> </body> </html>
108wo
phpcms/modules/search/templates/type_list.tpl.php
PHP
asf20
2,795
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin');?> <form method="post" action="?m=search&c=search_admin&a=setting"> <div class="pad_10"> <div class="col-tab"> <ul class="tabBut cu-li"> <li id="tab_setting_1" class="on" onclick="SwapTab('setting','on','',2,1);"><?php echo L('basic_setting')?></li> <li id="tab_setting_2" onclick="SwapTab('setting','on','',2,2);"><?php echo L('sphinx_setting')?></li> </ul> <div id="div_setting_1" class="contentList pad-10"> <table width="100%" class="table_form"> <tr> <th width="200"><?php echo L('enable_search')?></th> <td class="y-bg"> <input type='radio' name='setting[fulltextenble]' value='1' <?php if($fulltextenble == 1) {?>checked<?php }?>> <?php echo L('yes')?>&nbsp;&nbsp;&nbsp;&nbsp; <input type='radio' name='setting[fulltextenble]' value='0' <?php if($fulltextenble == 0) {?>checked<?php }?>> <?php echo L('no')?></td> </tr> <tr> <th width="200"><?php echo L('relationenble')?></th> <td class="y-bg"> <input type='radio' name='setting[relationenble]' value='1' <?php if($relationenble == 1) {?>checked<?php }?>> <?php echo L('yes')?>&nbsp;&nbsp;&nbsp;&nbsp; <input type='radio' name='setting[relationenble]' value='0' <?php if($relationenble == 0) {?>checked<?php }?>> <?php echo L('no')?> <?php echo L('relationenble_note')?></td> </tr> <tr> <th width="200"><?php echo L('suggestenable')?></th> <td class="y-bg"> <input type='radio' name='setting[suggestenable]' value='1' <?php if($suggestenable == 1) {?>checked<?php }?>> <?php echo L('yes')?>&nbsp;&nbsp;&nbsp;&nbsp; <input type='radio' name='setting[suggestenable]' value='0' <?php if($suggestenable == 0) {?>checked<?php }?>> <?php echo L('no')?> <?php echo L('suggestenable_note')?></td> </tr> </table> </div> <div id="div_setting_2" class="contentList pad-10 hidden"> <table width="100%" class="table_form"> <tr> <th width="200"><?php echo L('sphinxenable')?></th> <td class="y-bg"> <input type='radio' name='setting[sphinxenable]' value='1' <?php if($sphinxenable == 1) {?>checked<?php }?>> <?php echo L('yes')?>&nbsp;&nbsp;&nbsp;&nbsp; <input type='radio' name='setting[sphinxenable]' value='0' <?php if($sphinxenable == 0) {?>checked<?php }?>> <?php echo L('no')?> </td> </tr> <tr> <th><?php echo L('host')?></th> <td class="y-bg"> <input name="setting[sphinxhost]" id="sphinxhost" value="<?php echo $sphinxhost?>" type="text" class="input-text"></td> </tr> <tr> <th><?php echo L('port')?></th> <td class="y-bg"><input name="setting[sphinxport]" id="sphinxport" value="<?php echo $sphinxport?>" type="text" class="input-text"></td> </tr> <tr> <th></th> <td class="y-bg"><input name="button" type="button" value="<?php echo L('test')?>" class="button" onclick="test_sphinx()"> <span id='testing'></span></td> </tr> </table> </div> <div class="bk15"></div> <input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="button"> </div> </form> </body> <script type="text/javascript"> function SwapTab(name,cls_show,cls_hide,cnt,cur){ for(i=1;i<=cnt;i++){ if(i==cur){ $('#div_'+name+'_'+i).show(); $('#tab_'+name+'_'+i).attr('class',cls_show); }else{ $('#div_'+name+'_'+i).hide(); $('#tab_'+name+'_'+i).attr('class',cls_hide); } } } function showsmtp(obj,hiddenid){ hiddenid = hiddenid ? hiddenid : 'smtpcfg'; var status = $(obj).val(); if(status == 1) $("#"+hiddenid).show(); else $("#"+hiddenid).hide(); } function test_sphinx() { $('#testing').html('<?php echo L('testing')?>'); $.post('?m=search&c=search_admin&a=public_test_sphinx',{sphinxhost:$('#sphinxhost').val(),sphinxport:$('#sphinxport').val()}, function(data){ message = ''; if(data == 1) { message = '<?php echo L('testsuccess')?>'; } else if(data == -1) { message = '<?php echo L('hostempty')?>'; } else if(data == -2) { message = '<?php echo L('portempty')?>'; } else { message = data; } $('#testing').html(message); //window.top.art.dialog({content:message,lock:true,width:'200',height:'50'},function(){}); }); } </script> </html>
108wo
phpcms/modules/search/templates/setting.tpl.php
PHP
asf20
4,311
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin');?> <div class="pad-10"> <div class="explain-col"> <form action="" method="get"> <input type="hidden" name="m" value="search"> <input type="hidden" name="c" value="search_admin"> <input type="hidden" name="a" value="createindex"> <input type="hidden" name="menuid" value="909"> <?php echo L('re_index_note');?> <input type="text" name="pagesize" value="100" size="5"> <?php echo L('tiao');?> <input type="submit" name="dosubmit" class="button" value="<?php echo L('confirm_reindex');?>"></form> </div> <script language="JavaScript"> <!-- window.top.$('#display_center_id').css('display','none'); //--> </script>
108wo
phpcms/modules/search/templates/createindex.tpl.php
PHP
asf20
735
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin'); ?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}}); $("#name").formValidator({onshow:"<?php echo L("input").L('type_name')?>",onfocus:"<?php echo L("input").L('type_name')?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('type_name')?>"}).regexValidator({regexp:"ps_username",datatype:"enum",onerror:"<?php echo L('type_name').L('format_incorrect', '','member')?>"}); }) //--> </script> <div class="pad-lr-10"> <form action="?m=search&c=search_type&a=add" method="post" id="myform"> <table width="100%" class="table_form"> <tr> <th width="120"><?php echo L('select_module_name')?>:</th> <td class="y-bg"><?php echo form::select($module_data,$_GET['module'],'name="module" onchange="change_module(this.value)"')?></td> </tr> <?php if($_GET['module'] == 'content') {?> <tr id="modelid_display"> <th width="120"><?php echo L('select_model_name')?>:</th> <td class="y-bg"><?php echo form::select($model_data,'','name="info[modelid]"')?></td> </tr> <?php }?> <?php if($_GET['module'] == 'yp') {?> <tr id="yp_modelid_display"> <th width="120"><?php echo L('select_model_name')?>:</th> <td class="y-bg"><?php echo form::select($yp_model_data,'','name="info[yp_modelid]"')?></td> </tr> <?php }?> <tr> <th width="120"><?php echo L('type_name')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="info[name]" id="name" size="30" /></td> </tr> <tr> <th><?php echo L('description')?>:</th> <td class="y-bg"><textarea name="info[description]" maxlength="255" style="width:300px;height:60px;"></textarea></td> </tr> </table> <div class="bk15"></div> <input type="submit" class="dialog" id="dosubmit" name="dosubmit" value="<?php echo L('submit')?>" /> </form> </div> <SCRIPT LANGUAGE="JavaScript"> <!-- function change_module(module) { redirect('?m=search&c=search_type&a=add&module='+module+'&pc_hash=<?php echo $_SESSION['pc_hash']?>'); } //--> </SCRIPT> </body> </html>
108wo
phpcms/modules/search/templates/type_add.tpl.php
PHP
asf20
2,386
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); pc_base::load_sys_class('form','',0); class search_admin extends admin { function __construct() { parent::__construct(); $this->siteid = $this->get_siteid(); $this->db = pc_base::load_model('search_model'); $this->module_db = pc_base::load_model('module_model'); $this->type_db = pc_base::load_model('type_model'); } public function setting() { $siteid = get_siteid(); if(isset($_POST['dosubmit'])) { //合并数据库缓存与新提交缓存 $r = $this->module_db->get_one(array('module'=>'search')); $search_setting = string2array($r['setting']); $search_setting[$siteid] = $_POST['setting']; $setting = array2string($search_setting); setcache('search', $search_setting); $this->module_db->update(array('setting'=>$setting),array('module'=>'search')); showmessage(L('operation_success'),HTTP_REFERER); } else { $r = $this->module_db->get_one(array('module'=>'search')); $setting = string2array($r['setting']); extract($setting[$siteid]); $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=search&c=search_type&a=add\', title:\''.L('add_search_type').'\', width:\'580\', height:\'240\', lock:true}, function(){var d = window.top.art.dialog({id:\'add\'}).data.iframe;var form = d.document.getElementById(\'dosubmit\');form.click();return false;}, function(){window.top.art.dialog({id:\'add\'}).close()});void(0);', L('add_search_type')); include $this->admin_tpl('setting'); } } /** * 创建索引 */ public function createindex() { if(isset($_GET['dosubmit'])) { //重建索引首先清空表所有数据,然后根据搜索类型接口重新全部重建索引 if(!isset($_GET['have_truncate'])) { $db_tablepre = $this->db->db_tablepre; //删除该站点全文索引 $this->db->delete(array('siteid'=>$this->siteid)); $types = $this->type_db->select(array('siteid'=> $this->siteid,'module'=>'search')); setcache('search_types',$types, 'search'); } else{ $types = getcache('search_types', 'search'); } //$key typeid 的索引 $key = isset($_GET['key']) ? intval($_GET['key']) : 0; foreach ($types as $_k=>$_v) { if($key==$_k) { $typeid = $_v['typeid']; if($_v['modelid']) { if ($_v['typedir']!=='yp') { $search_api = pc_base::load_app_class('search_api','content'); } else { $search_api = pc_base::load_app_class('search_api',$_v['typedir']); } if(!isset($_GET['total'])) { $total = $search_api->total($_v['modelid']); } else { $total = intval($_GET['total']); $search_api->set_model($_v['modelid']); } } else { $module = trim($_v['typedir']); $search_api = pc_base::load_app_class('search_api',$module); if(!isset($_GET['total'])) { $total = $search_api->total(); } else { $total = intval($_GET['total']); } } $pagesize = $_GET['pagesize'] ? intval($_GET['pagesize']) : 50; $page = max(intval($_GET['page']), 1); $pages = ceil($total/$pagesize); $datas = $search_api->fulltext_api($pagesize,$page); foreach ($datas as $id=>$r) { $this->db->update_search($typeid ,$id, $r['fulltextcontent'],$r['title'],$r['adddate'], 1); } $page++; if($pages>=$page) showmessage("正在更新 <span style='color:#ff0000;font-size:14px;text-decoration:underline;' >{$_v['name']}</span> - 总数:{$total} - 当前第 <font color='red'>{$page}</font> 页","?m=search&c=search_admin&a=createindex&menuid=909&page={$page}&total={$total}&key={$key}&pagesize={$pagesize}&have_truncate=1&dosubmit=1"); $key++; showmessage("开始更新: <span style='color:#ff0000;font-size:14px;text-decoration:underline;' >{$_v['name']}</span> - 总数:{$total}条","?m=search&c=search_admin&a=createindex&menuid=909&page=1&key={$key}&pagesize={$pagesize}&have_truncate=1&dosubmit=1"); } } showmessage('全站索引更新完成','blank'); } else { $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=search&c=search_type&a=add\', title:\''.L('add_search_type').'\', width:\'580\', height:\'240\', lock:true}, function(){var d = window.top.art.dialog({id:\'add\'}).data.iframe;var form = d.document.getElementById(\'dosubmit\');form.click();return false;}, function(){window.top.art.dialog({id:\'add\'}).close()});void(0);', L('add_search_type')); include $this->admin_tpl('createindex'); } } public function public_test_sphinx() { $sphinxhost = !empty($_POST['sphinxhost']) ? $_POST['sphinxhost'] : exit('-1'); $sphinxport = !empty($_POST['sphinxport']) ? intval($_POST['sphinxport']) : exit('-2'); $fp = @fsockopen($sphinxhost, $sphinxport, $errno, $errstr , 2); if (!$fp) { exit($errno.':'.$errstr); } else { exit('1'); } } } ?>
108wo
phpcms/modules/search/search_admin.php
PHP
asf20
5,042
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_sys_class('form','',0); pc_base::load_sys_class('format','',0); class index { function __construct() { $this->db = pc_base::load_model('search_model'); $this->content_db = pc_base::load_model('content_model'); } /** * 关键词搜索 */ public function init() { //获取siteid $siteid = isset($_REQUEST['siteid']) && trim($_REQUEST['siteid']) ? intval($_REQUEST['siteid']) : 1; //搜索配置 $search_setting = getcache('search'); $setting = $search_setting[$siteid]; $search_model = getcache('search_model_'.$siteid); $type_module = getcache('type_module_'.$siteid); if(isset($_GET['q'])) { if(trim($_GET['q'])=='') { header('Location: '.APP_PATH.'index.php?m=search');exit; } $typeid = empty($_GET['typeid']) ? 48 : intval($_GET['typeid']); $time = empty($_GET['time']) ? 'all' : trim($_GET['time']); $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $pagesize = 10; $q = safe_replace(trim($_GET['q'])); $q = htmlspecialchars(strip_tags($q)); $q = str_replace('%', '', $q); //过滤'%',用户全文搜索 $search_q = $q; //搜索原内容 //按时间搜索 if($time == 'day') { $search_time = SYS_TIME - 86400; $sql_time = ' AND adddate > '.$search_time; } elseif($time == 'week') { $search_time = SYS_TIME - 604800; $sql_time = ' AND adddate > '.$search_time; } elseif($time == 'month') { $search_time = SYS_TIME - 2592000; $sql_time = ' AND adddate > '.$search_time; } elseif($time == 'year') { $search_time = SYS_TIME - 31536000; $sql_time = ' AND adddate > '.$search_time; } else { $search_time = 0; $sql_time = ''; } if($page==1 && !$setting['sphinxenable']) { //精确搜索 $commend = $this->db->get_one("`typeid` = '$typeid' $sql_time AND `data` like '%$q%'"); } else { $commend = ''; } //如果开启sphinx if($setting['sphinxenable']) { $sphinx = pc_base::load_app_class('search_interface', '', 0); $sphinx = new search_interface(); $offset = $pagesize*($page-1); $res = $sphinx->search($q, array($siteid), array($typeid), array($search_time, SYS_TIME), $offset, $pagesize, '@weight desc'); $totalnums = $res['total']; //如果结果不为空 if(!empty($res['matches'])) { $result = $res['matches']; } } else { pc_base::load_sys_class('segment', '', 0); $segment = new segment(); //分词结果 $segment_q = $segment->get_keyword($segment->split_result($q)); //如果分词结果为空 if(!empty($segment_q)) { $sql = "`siteid`= '$siteid' AND `typeid` = '$typeid' $sql_time AND MATCH (`data`) AGAINST ('$segment_q' IN BOOLEAN MODE)"; } else { $sql = "`siteid`= '$siteid' AND `typeid` = '$typeid' $sql_time AND `data` like '%$q%'"; } $result = $this->db->listinfo($sql, 'searchid DESC', $page, 10); } //如果开启相关搜索功能 if($setting['relationenble']) { //如果关键词长度在8-16之间,保存关键词作为relation search $this->keyword_db = pc_base::load_model('search_keyword_model'); if(strlen($q) < 17 && strlen($q) > 5 && !empty($segment_q)) { $res = $this->keyword_db->get_one(array('keyword'=>$q)); if($res) { //关键词搜索数+1 //$this->keyword_db->update(array('searchnums'=>'+=1'), array('keyword'=>$q)); } else { //关键词转换为拼音 pc_base::load_sys_func('iconv'); $pinyin = gbk_to_pinyin($q); if(is_array($pinyin)) { $pinyin = implode('', $pinyin); } $this->keyword_db->insert(array('keyword'=>$q, 'searchnums'=>1, 'data'=>$segment_q, 'pinyin'=>$pinyin)); } } //相关搜索 if(!empty($segment_q)) { $relation_q = str_replace(' ', '%', $segment_q); } else { $relation_q = $q; } $relation = $this->keyword_db->select("MATCH (`data`) AGAINST ('%$relation_q%' IN BOOLEAN MODE)", '*', 10, 'searchnums DESC'); } //如果结果不为空 if(!empty($result) || !empty($commend['id'])) { //开启sphinx后文章id取法不同 if($setting['sphinxenable']) { foreach($result as $_v) { $sids[] = $_v['attrs']['id']; } } else { foreach($result as $_v) { $sids[] = $_v['id']; } } if(!empty($commend['id'])) { $sids[] = $commend['id']; } $sids = array_unique($sids); $where = to_sqls($sids, '', 'id'); //获取模型id $model_type_cache = getcache('type_model_'.$siteid,'search'); $model_type_cache = array_flip($model_type_cache); $modelid = $model_type_cache[$typeid]; //是否读取其他模块接口 if($modelid) { $this->content_db->set_model($modelid); /** * 如果表名为空,则为黄页模型 */ if(empty($this->content_db->model_tablename)) { $this->content_db = pc_base::load_model('yp_content_model'); $this->content_db->set_model($modelid); } if($setting['sphinxenable']) { $data = $this->content_db->listinfo($where, 'id DESC', 1, $pagesize); $pages = pages($totalnums, $page, $pagesize); } else { $data = $this->content_db->select($where, '*'); $pages = $this->db->pages; $totalnums = $this->db->number; } //如果分词结果为空 if(!empty($segment_q)) { $replace = explode(' ', $segment_q); foreach($replace as $replace_arr_v) { $replace_arr[] = '<font color=red>'.$replace_arr_v.'</font>'; } foreach($data as $_k=>$_v) { $data[$_k]['title'] = str_replace($replace, $replace_arr, $_v['title']); $data[$_k]['description'] = str_replace($replace, $replace_arr, $_v['description']); } } else { foreach($data as $_k=>$_v) { $data[$_k]['title'] = str_replace($q, '<font color=red>'.$q.'</font>', $_v['title']); $data[$_k]['description'] = str_replace($q, '<font color=red>'.$q.'</font>', $_v['description']); } } } else { //读取专辑搜索接口 $special_api = pc_base::load_app_class('search_api', 'special'); $data = $special_api->get_search_data($sids); } } $execute_time = execute_time(); $pages = isset($pages) ? $pages : ''; $totalnums = isset($totalnums) ? $totalnums : 0; $data = isset($data) ? $data : ''; include template('search','list'); } else { include template('search','index'); } } public function public_get_suggest_keyword() { $url = $_GET['url'].'&q='.$_GET['q']; $res = @file_get_contents($url); if(CHARSET != 'gbk') { $res = iconv('gbk', CHARSET, $res); } echo $res; } /** * 提示搜索接口 * TODO 暂时未启用,用的是google的接口 */ public function public_suggest_search() { //关键词转换为拼音 pc_base::load_sys_func('iconv'); $pinyin = gbk_to_pinyin($q); if(is_array($pinyin)) { $pinyin = implode('', $pinyin); } $this->keyword_db = pc_base::load_model('search_keyword_model'); $suggest = $this->keyword_db->select("pinyin like '$pinyin%'", '*', 10, 'searchnums DESC'); foreach($suggest as $v) { echo $v['keyword']."\n"; } } } ?>
108wo
phpcms/modules/search/index.php
PHP
asf20
7,464
<?php /** * 搜索接口 * */ class search_interface { public function __construct() { //初始化sphinx pc_base::load_app_class('sphinxapi', '', 0); $this->cl = new SphinxClient(); $siteid = get_siteid(); $search_setting = getcache('search'); $setting = $search_setting[$siteid]; $mode = SPH_MATCH_EXTENDED2; //匹配模式 $host = $setting['sphinxhost']; //服务ip $port = intval($setting['sphinxport']); //服务端口 $ranker = SPH_RANK_PROXIMITY_BM25; //统计相关度计算模式,仅使用BM25评分计算 $this->cl->SetServer($host, $port); $this->cl->SetConnectTimeout(1); $this->cl->SetArrayResult(true); $this->cl->SetMatchMode($mode); $this->cl->SetRankingMode($ranker); } /** * 搜索 * @param string $q 关键词 类似sql like'%$q%' * @param array $siteids 站点id数组 * @param array $typeids 类型ids 类似sql IN('') * @param array $adddate 时间范围数组 类似sql between start AND end 格式:array('start','end'); * @param int $offset 偏移量 * @param int $limit 匹配项数目限制 类似sql limit $offset, $limit * @param string $orderby 排序字段 类似sql order by $orderby {id:文章id,weight:权重} */ public function search($q, $siteids=array(1), $typeids='', $adddate='', $offset=0, $limit=20, $orderby='@id desc') { if(CHARSET != 'utf-8') { $utf8_q = iconv(CHARSET, 'utf-8', $q); } if($orderby) { //按一种类似SQL的方式将列组合起来,升序或降序排列。 $this->cl->SetSortMode(SPH_SORT_EXTENDED, $orderby); } if($limit) { $this->cl->SetLimits($offset, $limit, ($limit>1000) ? $limit : 1000); } //过滤类型 if($typeids) { $this->cl->SetFilter('typeid', $typeids); } //过滤站点 if($siteids) { $this->cl->SetFilter('siteid', $siteids); } //过滤时间 if($adddate) { $this->cl->SetFilterRange('adddate', $adddate[0], $adddate[1], false); } $res = $this->cl->Query($utf8_q, 'main, delta'); return $res; } }
108wo
phpcms/modules/search/classes/search_interface.class.php
PHP
asf20
2,117
<?php /** * sphinx搜索接口类 */ // // $Id: sphinxapi.php 2055 2009-11-06 23:09:58Z shodan $ // // // Copyright (c) 2001-2008, Andrew Aksyonoff. All rights reserved. // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License. You should have // received a copy of the GPL license along with this program; if you // did not, you can find it at http://www.gnu.org/ // ///////////////////////////////////////////////////////////////////////////// // PHP version of Sphinx searchd client (PHP API) ///////////////////////////////////////////////////////////////////////////// /// known searchd commands define ( "SEARCHD_COMMAND_SEARCH", 0 ); define ( "SEARCHD_COMMAND_EXCERPT", 1 ); define ( "SEARCHD_COMMAND_UPDATE", 2 ); define ( "SEARCHD_COMMAND_KEYWORDS",3 ); define ( "SEARCHD_COMMAND_PERSIST", 4 ); define ( "SEARCHD_COMMAND_STATUS", 5 ); define ( "SEARCHD_COMMAND_QUERY", 6 ); /// current client-side command implementation versions define ( "VER_COMMAND_SEARCH", 0x116 ); define ( "VER_COMMAND_EXCERPT", 0x100 ); define ( "VER_COMMAND_UPDATE", 0x102 ); define ( "VER_COMMAND_KEYWORDS", 0x100 ); define ( "VER_COMMAND_STATUS", 0x100 ); define ( "VER_COMMAND_QUERY", 0x100 ); /// known searchd status codes define ( "SEARCHD_OK", 0 ); define ( "SEARCHD_ERROR", 1 ); define ( "SEARCHD_RETRY", 2 ); define ( "SEARCHD_WARNING", 3 ); /// known match modes define ( "SPH_MATCH_ALL", 0 ); define ( "SPH_MATCH_ANY", 1 ); define ( "SPH_MATCH_PHRASE", 2 ); define ( "SPH_MATCH_BOOLEAN", 3 ); define ( "SPH_MATCH_EXTENDED", 4 ); define ( "SPH_MATCH_FULLSCAN", 5 ); define ( "SPH_MATCH_EXTENDED2", 6 ); // extended engine V2 (TEMPORARY, WILL BE REMOVED) /// known ranking modes (ext2 only) define ( "SPH_RANK_PROXIMITY_BM25", 0 ); ///< default mode, phrase proximity major factor and BM25 minor one define ( "SPH_RANK_BM25", 1 ); ///< statistical mode, BM25 ranking only (faster but worse quality) define ( "SPH_RANK_NONE", 2 ); ///< no ranking, all matches get a weight of 1 define ( "SPH_RANK_WORDCOUNT", 3 ); ///< simple word-count weighting, rank is a weighted sum of per-field keyword occurence counts define ( "SPH_RANK_PROXIMITY", 4 ); define ( "SPH_RANK_MATCHANY", 5 ); define ( "SPH_RANK_FIELDMASK", 6 ); /// known sort modes define ( "SPH_SORT_RELEVANCE", 0 ); define ( "SPH_SORT_ATTR_DESC", 1 ); define ( "SPH_SORT_ATTR_ASC", 2 ); define ( "SPH_SORT_TIME_SEGMENTS", 3 ); define ( "SPH_SORT_EXTENDED", 4 ); define ( "SPH_SORT_EXPR", 5 ); /// known filter types define ( "SPH_FILTER_VALUES", 0 ); define ( "SPH_FILTER_RANGE", 1 ); define ( "SPH_FILTER_FLOATRANGE", 2 ); /// known attribute types define ( "SPH_ATTR_INTEGER", 1 ); define ( "SPH_ATTR_TIMESTAMP", 2 ); define ( "SPH_ATTR_ORDINAL", 3 ); define ( "SPH_ATTR_BOOL", 4 ); define ( "SPH_ATTR_FLOAT", 5 ); define ( "SPH_ATTR_BIGINT", 6 ); define ( "SPH_ATTR_MULTI", 0x40000000 ); /// known grouping functions define ( "SPH_GROUPBY_DAY", 0 ); define ( "SPH_GROUPBY_WEEK", 1 ); define ( "SPH_GROUPBY_MONTH", 2 ); define ( "SPH_GROUPBY_YEAR", 3 ); define ( "SPH_GROUPBY_ATTR", 4 ); define ( "SPH_GROUPBY_ATTRPAIR", 5 ); // important properties of PHP's integers: // - always signed (one bit short of PHP_INT_SIZE) // - conversion from string to int is saturated // - float is double // - div converts arguments to floats // - mod converts arguments to ints // the packing code below works as follows: // - when we got an int, just pack it // if performance is a problem, this is the branch users should aim for // // - otherwise, we got a number in string form // this might be due to different reasons, but we assume that this is // because it didn't fit into PHP int // // - factor the string into high and low ints for packing // - if we have bcmath, then it is used // - if we don't, we have to do it manually (this is the fun part) // // - x64 branch does factoring using ints // - x32 (ab)uses floats, since we can't fit unsigned 32-bit number into an int // // unpacking routines are pretty much the same. // - return ints if we can // - otherwise format number into a string /// pack 64-bit signed function sphPackI64 ( $v ) { assert ( is_numeric($v) ); // x64 if ( PHP_INT_SIZE>=8 ) { $v = (int)$v; return pack ( "NN", $v>>32, $v&0xFFFFFFFF ); } // x32, int if ( is_int($v) ) return pack ( "NN", $v < 0 ? -1 : 0, $v ); // x32, bcmath if ( function_exists("bcmul") ) { if ( bccomp ( $v, 0 ) == -1 ) $v = bcadd ( "18446744073709551616", $v ); $h = bcdiv ( $v, "4294967296", 0 ); $l = bcmod ( $v, "4294967296" ); return pack ( "NN", (float)$h, (float)$l ); // conversion to float is intentional; int would lose 31st bit } // x32, no-bcmath $p = max(0, strlen($v) - 13); $lo = abs((float)substr($v, $p)); $hi = abs((float)substr($v, 0, $p)); $m = $lo + $hi*1316134912.0; // (10 ^ 13) % (1 << 32) = 1316134912 $q = floor($m/4294967296.0); $l = $m - ($q*4294967296.0); $h = $hi*2328.0 + $q; // (10 ^ 13) / (1 << 32) = 2328 if ( $v<0 ) { if ( $l==0 ) $h = 4294967296.0 - $h; else { $h = 4294967295.0 - $h; $l = 4294967296.0 - $l; } } return pack ( "NN", $h, $l ); } /// pack 64-bit unsigned function sphPackU64 ( $v ) { assert ( is_numeric($v) ); // x64 if ( PHP_INT_SIZE>=8 ) { assert ( $v>=0 ); // x64, int if ( is_int($v) ) return pack ( "NN", $v>>32, $v&0xFFFFFFFF ); // x64, bcmath if ( function_exists("bcmul") ) { $h = bcdiv ( $v, 4294967296, 0 ); $l = bcmod ( $v, 4294967296 ); return pack ( "NN", $h, $l ); } // x64, no-bcmath $p = max ( 0, strlen($v) - 13 ); $lo = (int)substr ( $v, $p ); $hi = (int)substr ( $v, 0, $p ); $m = $lo + $hi*1316134912; $l = $m % 4294967296; $h = $hi*2328 + (int)($m/4294967296); return pack ( "NN", $h, $l ); } // x32, int if ( is_int($v) ) return pack ( "NN", 0, $v ); // x32, bcmath if ( function_exists("bcmul") ) { $h = bcdiv ( $v, "4294967296", 0 ); $l = bcmod ( $v, "4294967296" ); return pack ( "NN", (float)$h, (float)$l ); // conversion to float is intentional; int would lose 31st bit } // x32, no-bcmath $p = max(0, strlen($v) - 13); $lo = (float)substr($v, $p); $hi = (float)substr($v, 0, $p); $m = $lo + $hi*1316134912.0; $q = floor($m / 4294967296.0); $l = $m - ($q * 4294967296.0); $h = $hi*2328.0 + $q; return pack ( "NN", $h, $l ); } // unpack 64-bit unsigned function sphUnpackU64 ( $v ) { list ( $hi, $lo ) = array_values ( unpack ( "N*N*", $v ) ); if ( PHP_INT_SIZE>=8 ) { if ( $hi<0 ) $hi += (1<<32); // because php 5.2.2 to 5.2.5 is totally fucked up again if ( $lo<0 ) $lo += (1<<32); // x64, int if ( $hi<=2147483647 ) return ($hi<<32) + $lo; // x64, bcmath if ( function_exists("bcmul") ) return bcadd ( $lo, bcmul ( $hi, "4294967296" ) ); // x64, no-bcmath $C = 100000; $h = ((int)($hi / $C) << 32) + (int)($lo / $C); $l = (($hi % $C) << 32) + ($lo % $C); if ( $l>$C ) { $h += (int)($l / $C); $l = $l % $C; } if ( $h==0 ) return $l; return sprintf ( "%d%05d", $h, $l ); } // x32, int if ( $hi==0 ) { if ( $lo>0 ) return $lo; return sprintf ( "%u", $lo ); } $hi = sprintf ( "%u", $hi ); $lo = sprintf ( "%u", $lo ); // x32, bcmath if ( function_exists("bcmul") ) return bcadd ( $lo, bcmul ( $hi, "4294967296" ) ); // x32, no-bcmath $hi = (float)$hi; $lo = (float)$lo; $q = floor($hi/10000000.0); $r = $hi - $q*10000000.0; $m = $lo + $r*4967296.0; $mq = floor($m/10000000.0); $l = $m - $mq*10000000.0; $h = $q*4294967296.0 + $r*429.0 + $mq; $h = sprintf ( "%.0f", $h ); $l = sprintf ( "%07.0f", $l ); if ( $h=="0" ) return sprintf( "%.0f", (float)$l ); return $h . $l; } // unpack 64-bit signed function sphUnpackI64 ( $v ) { list ( $hi, $lo ) = array_values ( unpack ( "N*N*", $v ) ); // x64 if ( PHP_INT_SIZE>=8 ) { if ( $hi<0 ) $hi += (1<<32); // because php 5.2.2 to 5.2.5 is totally fucked up again if ( $lo<0 ) $lo += (1<<32); return ($hi<<32) + $lo; } // x32, int if ( $hi==0 ) { if ( $lo>0 ) return $lo; return sprintf ( "%u", $lo ); } // x32, int elseif ( $hi==-1 ) { if ( $lo<0 ) return $lo; return sprintf ( "%.0f", $lo - 4294967296.0 ); } $neg = ""; $c = 0; if ( $hi<0 ) { $hi = ~$hi; $lo = ~$lo; $c = 1; $neg = "-"; } $hi = sprintf ( "%u", $hi ); $lo = sprintf ( "%u", $lo ); // x32, bcmath if ( function_exists("bcmul") ) return $neg . bcadd ( bcadd ( $lo, bcmul ( $hi, "4294967296" ) ), $c ); // x32, no-bcmath $hi = (float)$hi; $lo = (float)$lo; $q = floor($hi/10000000.0); $r = $hi - $q*10000000.0; $m = $lo + $r*4967296.0; $mq = floor($m/10000000.0); $l = $m - $mq*10000000.0 + $c; $h = $q*4294967296.0 + $r*429.0 + $mq; if ( $l==10000000 ) { $l = 0; $h += 1; } $h = sprintf ( "%.0f", $h ); $l = sprintf ( "%07.0f", $l ); if ( $h=="0" ) return $neg . sprintf( "%.0f", (float)$l ); return $neg . $h . $l; } function sphFixUint ( $value ) { if ( PHP_INT_SIZE>=8 ) { // x64 route, workaround broken unpack() in 5.2.2+ if ( $value<0 ) $value += (1<<32); return $value; } else { // x32 route, workaround php signed/unsigned braindamage return sprintf ( "%u", $value ); } } /// sphinx searchd client class class SphinxClient { var $_host; ///< searchd host (default is "localhost") var $_port; ///< searchd port (default is 9312) var $_offset; ///< how many records to seek from result-set start (default is 0) var $_limit; ///< how many records to return from result-set starting at offset (default is 20) var $_mode; ///< query matching mode (default is SPH_MATCH_ALL) var $_weights; ///< per-field weights (default is 1 for all fields) var $_sort; ///< match sorting mode (default is SPH_SORT_RELEVANCE) var $_sortby; ///< attribute to sort by (defualt is "") var $_min_id; ///< min ID to match (default is 0, which means no limit) var $_max_id; ///< max ID to match (default is 0, which means no limit) var $_filters; ///< search filters var $_groupby; ///< group-by attribute name var $_groupfunc; ///< group-by function (to pre-process group-by attribute value with) var $_groupsort; ///< group-by sorting clause (to sort groups in result set with) var $_groupdistinct;///< group-by count-distinct attribute var $_maxmatches; ///< max matches to retrieve var $_cutoff; ///< cutoff to stop searching at (default is 0) var $_retrycount; ///< distributed retries count var $_retrydelay; ///< distributed retries delay var $_anchor; ///< geographical anchor point var $_indexweights; ///< per-index weights var $_ranker; ///< ranking mode (default is SPH_RANK_PROXIMITY_BM25) var $_maxquerytime; ///< max query time, milliseconds (default is 0, do not limit) var $_fieldweights; ///< per-field-name weights var $_overrides; ///< per-query attribute values overrides var $_select; ///< select-list (attributes or expressions, with optional aliases) var $_error; ///< last error message var $_warning; ///< last warning message var $_connerror; ///< connection error vs remote error flag var $_reqs; ///< requests array for multi-query var $_mbenc; ///< stored mbstring encoding var $_arrayresult; ///< whether $result["matches"] should be a hash or an array var $_timeout; ///< connect timeout ///////////////////////////////////////////////////////////////////////////// // common stuff ///////////////////////////////////////////////////////////////////////////// /// create a new client object and fill defaults function SphinxClient () { // per-client-object settings $this->_host = "localhost"; $this->_port = 9312; $this->_path = false; $this->_socket = false; // per-query settings $this->_offset = 0; $this->_limit = 20; $this->_mode = SPH_MATCH_ALL; $this->_weights = array (); $this->_sort = SPH_SORT_RELEVANCE; $this->_sortby = ""; $this->_min_id = 0; $this->_max_id = 0; $this->_filters = array (); $this->_groupby = ""; $this->_groupfunc = SPH_GROUPBY_DAY; $this->_groupsort = "@group desc"; $this->_groupdistinct= ""; $this->_maxmatches = 1000; $this->_cutoff = 0; $this->_retrycount = 0; $this->_retrydelay = 0; $this->_anchor = array (); $this->_indexweights= array (); $this->_ranker = SPH_RANK_PROXIMITY_BM25; $this->_maxquerytime= 0; $this->_fieldweights= array(); $this->_overrides = array(); $this->_select = "*"; $this->_error = ""; // per-reply fields (for single-query case) $this->_warning = ""; $this->_connerror = false; $this->_reqs = array (); // requests storage (for multi-query case) $this->_mbenc = ""; $this->_arrayresult = false; $this->_timeout = 0; } function __destruct() { if ( $this->_socket !== false ) fclose ( $this->_socket ); } /// get last error message (string) function GetLastError () { return $this->_error; } /// get last warning message (string) function GetLastWarning () { return $this->_warning; } /// get last error flag (to tell network connection errors from searchd errors or broken responses) function IsConnectError() { return $this->_connerror; } /// set searchd host name (string) and port (integer) function SetServer ( $host, $port = 0 ) { assert ( is_string($host) ); if ( $host[0] == '/') { $this->_path = 'unix://' . $host; return; } if ( substr ( $host, 0, 7 )=="unix://" ) { $this->_path = $host; return; } assert ( is_int($port) ); $this->_host = $host; $this->_port = $port; $this->_path = ''; } /// set server connection timeout (0 to remove) function SetConnectTimeout ( $timeout ) { assert ( is_numeric($timeout) ); $this->_timeout = $timeout; } function _Send ( $handle, $data, $length ) { if ( feof($handle) || fwrite ( $handle, $data, $length ) !== $length ) { $this->_error = 'connection unexpectedly closed (timed out?)'; $this->_connerror = true; return false; } return true; } ///////////////////////////////////////////////////////////////////////////// /// enter mbstring workaround mode function _MBPush () { $this->_mbenc = ""; if ( ini_get ( "mbstring.func_overload" ) & 2 ) { $this->_mbenc = mb_internal_encoding(); mb_internal_encoding ( "latin1" ); } } /// leave mbstring workaround mode function _MBPop () { if ( $this->_mbenc ) mb_internal_encoding ( $this->_mbenc ); } /// connect to searchd server function _Connect () { if ( $this->_socket!==false ) { // we are in persistent connection mode, so we have a socket // however, need to check whether it's still alive if ( !@feof ( $this->_socket ) ) return $this->_socket; // force reopen $this->_socket = false; } $errno = 0; $errstr = ""; $this->_connerror = false; if ( $this->_path ) { $host = $this->_path; $port = 0; } else { $host = $this->_host; $port = $this->_port; } if ( $this->_timeout<=0 ) $fp = @fsockopen ( $host, $port, $errno, $errstr ); else $fp = @fsockopen ( $host, $port, $errno, $errstr, $this->_timeout ); if ( !$fp ) { if ( $this->_path ) $location = $this->_path; else $location = "{$this->_host}:{$this->_port}"; $errstr = trim ( $errstr ); $this->_error = "connection to $location failed (errno=$errno, msg=$errstr)"; $this->_connerror = true; return false; } // send my version // this is a subtle part. we must do it before (!) reading back from searchd. // because otherwise under some conditions (reported on FreeBSD for instance) // TCP stack could throttle write-write-read pattern because of Nagle. if ( !$this->_Send ( $fp, pack ( "N", 1 ), 4 ) ) { fclose ( $fp ); $this->_error = "failed to send client protocol version"; return false; } // check version list(,$v) = unpack ( "N*", fread ( $fp, 4 ) ); $v = (int)$v; if ( $v<1 ) { fclose ( $fp ); $this->_error = "expected searchd protocol version 1+, got version '$v'"; return false; } return $fp; } /// get and check response packet from searchd server function _GetResponse ( $fp, $client_ver ) { $response = ""; $len = 0; $header = fread ( $fp, 8 ); if ( strlen($header)==8 ) { list ( $status, $ver, $len ) = array_values ( unpack ( "n2a/Nb", $header ) ); $left = $len; while ( $left>0 && !feof($fp) ) { $chunk = fread ( $fp, $left ); if ( $chunk ) { $response .= $chunk; $left -= strlen($chunk); } } } if ( $this->_socket === false ) fclose ( $fp ); // check response $read = strlen ( $response ); if ( !$response || $read!=$len ) { $this->_error = $len ? "failed to read searchd response (status=$status, ver=$ver, len=$len, read=$read)" : "received zero-sized searchd response"; return false; } // check status if ( $status==SEARCHD_WARNING ) { list(,$wlen) = unpack ( "N*", substr ( $response, 0, 4 ) ); $this->_warning = substr ( $response, 4, $wlen ); return substr ( $response, 4+$wlen ); } if ( $status==SEARCHD_ERROR ) { $this->_error = "searchd error: " . substr ( $response, 4 ); return false; } if ( $status==SEARCHD_RETRY ) { $this->_error = "temporary searchd error: " . substr ( $response, 4 ); return false; } if ( $status!=SEARCHD_OK ) { $this->_error = "unknown status code '$status'"; return false; } // check version if ( $ver<$client_ver ) { $this->_warning = sprintf ( "searchd command v.%d.%d older than client's v.%d.%d, some options might not work", $ver>>8, $ver&0xff, $client_ver>>8, $client_ver&0xff ); } return $response; } ///////////////////////////////////////////////////////////////////////////// // searching ///////////////////////////////////////////////////////////////////////////// /// set offset and count into result set, /// and optionally set max-matches and cutoff limits function SetLimits ( $offset, $limit, $max=0, $cutoff=0 ) { assert ( is_int($offset) ); assert ( is_int($limit) ); assert ( $offset>=0 ); assert ( $limit>0 ); assert ( $max>=0 ); $this->_offset = $offset; $this->_limit = $limit; if ( $max>0 ) $this->_maxmatches = $max; if ( $cutoff>0 ) $this->_cutoff = $cutoff; } /// set maximum query time, in milliseconds, per-index /// integer, 0 means "do not limit" function SetMaxQueryTime ( $max ) { assert ( is_int($max) ); assert ( $max>=0 ); $this->_maxquerytime = $max; } /// set matching mode function SetMatchMode ( $mode ) { assert ( $mode==SPH_MATCH_ALL || $mode==SPH_MATCH_ANY || $mode==SPH_MATCH_PHRASE || $mode==SPH_MATCH_BOOLEAN || $mode==SPH_MATCH_EXTENDED || $mode==SPH_MATCH_FULLSCAN || $mode==SPH_MATCH_EXTENDED2 ); $this->_mode = $mode; } /// set ranking mode function SetRankingMode ( $ranker ) { assert ( $ranker==SPH_RANK_PROXIMITY_BM25 || $ranker==SPH_RANK_BM25 || $ranker==SPH_RANK_NONE || $ranker==SPH_RANK_WORDCOUNT || $ranker==SPH_RANK_PROXIMITY ); $this->_ranker = $ranker; } /// set matches sorting mode function SetSortMode ( $mode, $sortby="" ) { assert ( $mode==SPH_SORT_RELEVANCE || $mode==SPH_SORT_ATTR_DESC || $mode==SPH_SORT_ATTR_ASC || $mode==SPH_SORT_TIME_SEGMENTS || $mode==SPH_SORT_EXTENDED || $mode==SPH_SORT_EXPR ); assert ( is_string($sortby) ); assert ( $mode==SPH_SORT_RELEVANCE || strlen($sortby)>0 ); $this->_sort = $mode; $this->_sortby = $sortby; } /// bind per-field weights by order /// DEPRECATED; use SetFieldWeights() instead function SetWeights ( $weights ) { assert ( is_array($weights) ); foreach ( $weights as $weight ) assert ( is_int($weight) ); $this->_weights = $weights; } /// bind per-field weights by name function SetFieldWeights ( $weights ) { assert ( is_array($weights) ); foreach ( $weights as $name=>$weight ) { assert ( is_string($name) ); assert ( is_int($weight) ); } $this->_fieldweights = $weights; } /// bind per-index weights by name function SetIndexWeights ( $weights ) { assert ( is_array($weights) ); foreach ( $weights as $index=>$weight ) { assert ( is_string($index) ); assert ( is_int($weight) ); } $this->_indexweights = $weights; } /// set IDs range to match /// only match records if document ID is beetwen $min and $max (inclusive) function SetIDRange ( $min, $max ) { assert ( is_numeric($min) ); assert ( is_numeric($max) ); assert ( $min<=$max ); $this->_min_id = $min; $this->_max_id = $max; } /// set values set filter /// only match records where $attribute value is in given set function SetFilter ( $attribute, $values, $exclude=false ) { assert ( is_string($attribute) ); assert ( is_array($values) ); assert ( count($values) ); if ( is_array($values) && count($values) ) { foreach ( $values as $value ) assert ( is_numeric($value) ); $this->_filters[] = array ( "type"=>SPH_FILTER_VALUES, "attr"=>$attribute, "exclude"=>$exclude, "values"=>$values ); } } /// set range filter /// only match records if $attribute value is beetwen $min and $max (inclusive) function SetFilterRange ( $attribute, $min, $max, $exclude=false ) { assert ( is_string($attribute) ); assert ( is_numeric($min) ); assert ( is_numeric($max) ); assert ( $min<=$max ); $this->_filters[] = array ( "type"=>SPH_FILTER_RANGE, "attr"=>$attribute, "exclude"=>$exclude, "min"=>$min, "max"=>$max ); } /// set float range filter /// only match records if $attribute value is beetwen $min and $max (inclusive) function SetFilterFloatRange ( $attribute, $min, $max, $exclude=false ) { assert ( is_string($attribute) ); assert ( is_float($min) ); assert ( is_float($max) ); assert ( $min<=$max ); $this->_filters[] = array ( "type"=>SPH_FILTER_FLOATRANGE, "attr"=>$attribute, "exclude"=>$exclude, "min"=>$min, "max"=>$max ); } /// setup anchor point for geosphere distance calculations /// required to use @geodist in filters and sorting /// latitude and longitude must be in radians function SetGeoAnchor ( $attrlat, $attrlong, $lat, $long ) { assert ( is_string($attrlat) ); assert ( is_string($attrlong) ); assert ( is_float($lat) ); assert ( is_float($long) ); $this->_anchor = array ( "attrlat"=>$attrlat, "attrlong"=>$attrlong, "lat"=>$lat, "long"=>$long ); } /// set grouping attribute and function function SetGroupBy ( $attribute, $func, $groupsort="@group desc" ) { assert ( is_string($attribute) ); assert ( is_string($groupsort) ); assert ( $func==SPH_GROUPBY_DAY || $func==SPH_GROUPBY_WEEK || $func==SPH_GROUPBY_MONTH || $func==SPH_GROUPBY_YEAR || $func==SPH_GROUPBY_ATTR || $func==SPH_GROUPBY_ATTRPAIR ); $this->_groupby = $attribute; $this->_groupfunc = $func; $this->_groupsort = $groupsort; } /// set count-distinct attribute for group-by queries function SetGroupDistinct ( $attribute ) { assert ( is_string($attribute) ); $this->_groupdistinct = $attribute; } /// set distributed retries count and delay function SetRetries ( $count, $delay=0 ) { assert ( is_int($count) && $count>=0 ); assert ( is_int($delay) && $delay>=0 ); $this->_retrycount = $count; $this->_retrydelay = $delay; } /// set result set format (hash or array; hash by default) /// PHP specific; needed for group-by-MVA result sets that may contain duplicate IDs function SetArrayResult ( $arrayresult ) { assert ( is_bool($arrayresult) ); $this->_arrayresult = $arrayresult; } /// set attribute values override /// there can be only one override per attribute /// $values must be a hash that maps document IDs to attribute values function SetOverride ( $attrname, $attrtype, $values ) { assert ( is_string ( $attrname ) ); assert ( in_array ( $attrtype, array ( SPH_ATTR_INTEGER, SPH_ATTR_TIMESTAMP, SPH_ATTR_BOOL, SPH_ATTR_FLOAT, SPH_ATTR_BIGINT ) ) ); assert ( is_array ( $values ) ); $this->_overrides[$attrname] = array ( "attr"=>$attrname, "type"=>$attrtype, "values"=>$values ); } /// set select-list (attributes or expressions), SQL-like syntax function SetSelect ( $select ) { assert ( is_string ( $select ) ); $this->_select = $select; } ////////////////////////////////////////////////////////////////////////////// /// clear all filters (for multi-queries) function ResetFilters () { $this->_filters = array(); $this->_anchor = array(); } /// clear groupby settings (for multi-queries) function ResetGroupBy () { $this->_groupby = ""; $this->_groupfunc = SPH_GROUPBY_DAY; $this->_groupsort = "@group desc"; $this->_groupdistinct= ""; } /// clear all attribute value overrides (for multi-queries) function ResetOverrides () { $this->_overrides = array (); } ////////////////////////////////////////////////////////////////////////////// /// connect to searchd server, run given search query through given indexes, /// and return the search results function Query ( $query, $index="*", $comment="" ) { assert ( empty($this->_reqs) ); $this->AddQuery ( $query, $index, $comment ); $results = $this->RunQueries (); $this->_reqs = array (); // just in case it failed too early if ( !is_array($results) ) return false; // probably network error; error message should be already filled $this->_error = $results[0]["error"]; $this->_warning = $results[0]["warning"]; if ( $results[0]["status"]==SEARCHD_ERROR ) return false; else return $results[0]; } /// helper to pack floats in network byte order function _PackFloat ( $f ) { $t1 = pack ( "f", $f ); // machine order list(,$t2) = unpack ( "L*", $t1 ); // int in machine order return pack ( "N", $t2 ); } /// add query to multi-query batch /// returns index into results array from RunQueries() call function AddQuery ( $query, $index="*", $comment="" ) { // mbstring workaround $this->_MBPush (); // build request $req = pack ( "NNNNN", $this->_offset, $this->_limit, $this->_mode, $this->_ranker, $this->_sort ); // mode and limits $req .= pack ( "N", strlen($this->_sortby) ) . $this->_sortby; $req .= pack ( "N", strlen($query) ) . $query; // query itself $req .= pack ( "N", count($this->_weights) ); // weights foreach ( $this->_weights as $weight ) $req .= pack ( "N", (int)$weight ); $req .= pack ( "N", strlen($index) ) . $index; // indexes $req .= pack ( "N", 1 ); // id64 range marker $req .= sphPackU64 ( $this->_min_id ) . sphPackU64 ( $this->_max_id ); // id64 range // filters $req .= pack ( "N", count($this->_filters) ); foreach ( $this->_filters as $filter ) { $req .= pack ( "N", strlen($filter["attr"]) ) . $filter["attr"]; $req .= pack ( "N", $filter["type"] ); switch ( $filter["type"] ) { case SPH_FILTER_VALUES: $req .= pack ( "N", count($filter["values"]) ); foreach ( $filter["values"] as $value ) $req .= sphPackI64 ( $value ); break; case SPH_FILTER_RANGE: $req .= sphPackI64 ( $filter["min"] ) . sphPackI64 ( $filter["max"] ); break; case SPH_FILTER_FLOATRANGE: $req .= $this->_PackFloat ( $filter["min"] ) . $this->_PackFloat ( $filter["max"] ); break; default: assert ( 0 && "internal error: unhandled filter type" ); } $req .= pack ( "N", $filter["exclude"] ); } // group-by clause, max-matches count, group-sort clause, cutoff count $req .= pack ( "NN", $this->_groupfunc, strlen($this->_groupby) ) . $this->_groupby; $req .= pack ( "N", $this->_maxmatches ); $req .= pack ( "N", strlen($this->_groupsort) ) . $this->_groupsort; $req .= pack ( "NNN", $this->_cutoff, $this->_retrycount, $this->_retrydelay ); $req .= pack ( "N", strlen($this->_groupdistinct) ) . $this->_groupdistinct; // anchor point if ( empty($this->_anchor) ) { $req .= pack ( "N", 0 ); } else { $a =& $this->_anchor; $req .= pack ( "N", 1 ); $req .= pack ( "N", strlen($a["attrlat"]) ) . $a["attrlat"]; $req .= pack ( "N", strlen($a["attrlong"]) ) . $a["attrlong"]; $req .= $this->_PackFloat ( $a["lat"] ) . $this->_PackFloat ( $a["long"] ); } // per-index weights $req .= pack ( "N", count($this->_indexweights) ); foreach ( $this->_indexweights as $idx=>$weight ) $req .= pack ( "N", strlen($idx) ) . $idx . pack ( "N", $weight ); // max query time $req .= pack ( "N", $this->_maxquerytime ); // per-field weights $req .= pack ( "N", count($this->_fieldweights) ); foreach ( $this->_fieldweights as $field=>$weight ) $req .= pack ( "N", strlen($field) ) . $field . pack ( "N", $weight ); // comment $req .= pack ( "N", strlen($comment) ) . $comment; // attribute overrides $req .= pack ( "N", count($this->_overrides) ); foreach ( $this->_overrides as $key => $entry ) { $req .= pack ( "N", strlen($entry["attr"]) ) . $entry["attr"]; $req .= pack ( "NN", $entry["type"], count($entry["values"]) ); foreach ( $entry["values"] as $id=>$val ) { assert ( is_numeric($id) ); assert ( is_numeric($val) ); $req .= sphPackU64 ( $id ); switch ( $entry["type"] ) { case SPH_ATTR_FLOAT: $req .= $this->_PackFloat ( $val ); break; case SPH_ATTR_BIGINT: $req .= sphPackI64 ( $val ); break; default: $req .= pack ( "N", $val ); break; } } } // select-list $req .= pack ( "N", strlen($this->_select) ) . $this->_select; // mbstring workaround $this->_MBPop (); // store request to requests array $this->_reqs[] = $req; return count($this->_reqs)-1; } /// connect to searchd, run queries batch, and return an array of result sets function RunQueries () { if ( empty($this->_reqs) ) { $this->_error = "no queries defined, issue AddQuery() first"; return false; } // mbstring workaround $this->_MBPush (); if (!( $fp = $this->_Connect() )) { $this->_MBPop (); return false; } // send query, get response $nreqs = count($this->_reqs); $req = join ( "", $this->_reqs ); $len = 4+strlen($req); $req = pack ( "nnNN", SEARCHD_COMMAND_SEARCH, VER_COMMAND_SEARCH, $len, $nreqs ) . $req; // add header if ( !( $this->_Send ( $fp, $req, $len+8 ) ) || !( $response = $this->_GetResponse ( $fp, VER_COMMAND_SEARCH ) ) ) { $this->_MBPop (); return false; } // query sent ok; we can reset reqs now $this->_reqs = array (); // parse and return response return $this->_ParseSearchResponse ( $response, $nreqs ); } /// parse and return search query (or queries) response function _ParseSearchResponse ( $response, $nreqs ) { $p = 0; // current position $max = strlen($response); // max position for checks, to protect against broken responses $results = array (); for ( $ires=0; $ires<$nreqs && $p<$max; $ires++ ) { $results[] = array(); $result =& $results[$ires]; $result["error"] = ""; $result["warning"] = ""; // extract status list(,$status) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4; $result["status"] = $status; if ( $status!=SEARCHD_OK ) { list(,$len) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4; $message = substr ( $response, $p, $len ); $p += $len; if ( $status==SEARCHD_WARNING ) { $result["warning"] = $message; } else { $result["error"] = $message; continue; } } // read schema $fields = array (); $attrs = array (); list(,$nfields) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4; while ( $nfields-->0 && $p<$max ) { list(,$len) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4; $fields[] = substr ( $response, $p, $len ); $p += $len; } $result["fields"] = $fields; list(,$nattrs) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4; while ( $nattrs-->0 && $p<$max ) { list(,$len) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4; $attr = substr ( $response, $p, $len ); $p += $len; list(,$type) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4; $attrs[$attr] = $type; } $result["attrs"] = $attrs; // read match count list(,$count) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4; list(,$id64) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4; // read matches $idx = -1; while ( $count-->0 && $p<$max ) { // index into result array $idx++; // parse document id and weight if ( $id64 ) { $doc = sphUnpackU64 ( substr ( $response, $p, 8 ) ); $p += 8; list(,$weight) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4; } else { list ( $doc, $weight ) = array_values ( unpack ( "N*N*", substr ( $response, $p, 8 ) ) ); $p += 8; $doc = sphFixUint($doc); } $weight = sprintf ( "%u", $weight ); // create match entry if ( $this->_arrayresult ) $result["matches"][$idx] = array ( "id"=>$doc, "weight"=>$weight ); else $result["matches"][$doc]["weight"] = $weight; // parse and create attributes $attrvals = array (); foreach ( $attrs as $attr=>$type ) { // handle 64bit ints if ( $type==SPH_ATTR_BIGINT ) { $attrvals[$attr] = sphUnpackI64 ( substr ( $response, $p, 8 ) ); $p += 8; continue; } // handle floats if ( $type==SPH_ATTR_FLOAT ) { list(,$uval) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4; list(,$fval) = unpack ( "f*", pack ( "L", $uval ) ); $attrvals[$attr] = $fval; continue; } // handle everything else as unsigned ints list(,$val) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4; if ( $type & SPH_ATTR_MULTI ) { $attrvals[$attr] = array (); $nvalues = $val; while ( $nvalues-->0 && $p<$max ) { list(,$val) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4; $attrvals[$attr][] = sphFixUint($val); } } else { $attrvals[$attr] = sphFixUint($val); } } if ( $this->_arrayresult ) $result["matches"][$idx]["attrs"] = $attrvals; else $result["matches"][$doc]["attrs"] = $attrvals; } list ( $total, $total_found, $msecs, $words ) = array_values ( unpack ( "N*N*N*N*", substr ( $response, $p, 16 ) ) ); $result["total"] = sprintf ( "%u", $total ); $result["total_found"] = sprintf ( "%u", $total_found ); $result["time"] = sprintf ( "%.3f", $msecs/1000 ); $p += 16; while ( $words-->0 && $p<$max ) { list(,$len) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4; $word = substr ( $response, $p, $len ); $p += $len; list ( $docs, $hits ) = array_values ( unpack ( "N*N*", substr ( $response, $p, 8 ) ) ); $p += 8; $result["words"][$word] = array ( "docs"=>sprintf ( "%u", $docs ), "hits"=>sprintf ( "%u", $hits ) ); } } $this->_MBPop (); return $results; } ///////////////////////////////////////////////////////////////////////////// // excerpts generation ///////////////////////////////////////////////////////////////////////////// /// connect to searchd server, and generate exceprts (snippets) /// of given documents for given query. returns false on failure, /// an array of snippets on success function BuildExcerpts ( $docs, $index, $words, $opts=array() ) { assert ( is_array($docs) ); assert ( is_string($index) ); assert ( is_string($words) ); assert ( is_array($opts) ); $this->_MBPush (); if (!( $fp = $this->_Connect() )) { $this->_MBPop(); return false; } ///////////////// // fixup options ///////////////// if ( !isset($opts["before_match"]) ) $opts["before_match"] = "<b>"; if ( !isset($opts["after_match"]) ) $opts["after_match"] = "</b>"; if ( !isset($opts["chunk_separator"]) ) $opts["chunk_separator"] = " ... "; if ( !isset($opts["limit"]) ) $opts["limit"] = 256; if ( !isset($opts["around"]) ) $opts["around"] = 5; if ( !isset($opts["exact_phrase"]) ) $opts["exact_phrase"] = false; if ( !isset($opts["single_passage"]) ) $opts["single_passage"] = false; if ( !isset($opts["use_boundaries"]) ) $opts["use_boundaries"] = false; if ( !isset($opts["weight_order"]) ) $opts["weight_order"] = false; ///////////////// // build request ///////////////// // v.1.0 req $flags = 1; // remove spaces if ( $opts["exact_phrase"] ) $flags |= 2; if ( $opts["single_passage"] ) $flags |= 4; if ( $opts["use_boundaries"] ) $flags |= 8; if ( $opts["weight_order"] ) $flags |= 16; $req = pack ( "NN", 0, $flags ); // mode=0, flags=$flags $req .= pack ( "N", strlen($index) ) . $index; // req index $req .= pack ( "N", strlen($words) ) . $words; // req words // options $req .= pack ( "N", strlen($opts["before_match"]) ) . $opts["before_match"]; $req .= pack ( "N", strlen($opts["after_match"]) ) . $opts["after_match"]; $req .= pack ( "N", strlen($opts["chunk_separator"]) ) . $opts["chunk_separator"]; $req .= pack ( "N", (int)$opts["limit"] ); $req .= pack ( "N", (int)$opts["around"] ); // documents $req .= pack ( "N", count($docs) ); foreach ( $docs as $doc ) { assert ( is_string($doc) ); $req .= pack ( "N", strlen($doc) ) . $doc; } //////////////////////////// // send query, get response //////////////////////////// $len = strlen($req); $req = pack ( "nnN", SEARCHD_COMMAND_EXCERPT, VER_COMMAND_EXCERPT, $len ) . $req; // add header if ( !( $this->_Send ( $fp, $req, $len+8 ) ) || !( $response = $this->_GetResponse ( $fp, VER_COMMAND_EXCERPT ) ) ) { $this->_MBPop (); return false; } ////////////////// // parse response ////////////////// $pos = 0; $res = array (); $rlen = strlen($response); for ( $i=0; $i<count($docs); $i++ ) { list(,$len) = unpack ( "N*", substr ( $response, $pos, 4 ) ); $pos += 4; if ( $pos+$len > $rlen ) { $this->_error = "incomplete reply"; $this->_MBPop (); return false; } $res[] = $len ? substr ( $response, $pos, $len ) : ""; $pos += $len; } $this->_MBPop (); return $res; } ///////////////////////////////////////////////////////////////////////////// // keyword generation ///////////////////////////////////////////////////////////////////////////// /// connect to searchd server, and generate keyword list for a given query /// returns false on failure, /// an array of words on success function BuildKeywords ( $query, $index, $hits ) { assert ( is_string($query) ); assert ( is_string($index) ); assert ( is_bool($hits) ); $this->_MBPush (); if (!( $fp = $this->_Connect() )) { $this->_MBPop(); return false; } ///////////////// // build request ///////////////// // v.1.0 req $req = pack ( "N", strlen($query) ) . $query; // req query $req .= pack ( "N", strlen($index) ) . $index; // req index $req .= pack ( "N", (int)$hits ); //////////////////////////// // send query, get response //////////////////////////// $len = strlen($req); $req = pack ( "nnN", SEARCHD_COMMAND_KEYWORDS, VER_COMMAND_KEYWORDS, $len ) . $req; // add header if ( !( $this->_Send ( $fp, $req, $len+8 ) ) || !( $response = $this->_GetResponse ( $fp, VER_COMMAND_KEYWORDS ) ) ) { $this->_MBPop (); return false; } ////////////////// // parse response ////////////////// $pos = 0; $res = array (); $rlen = strlen($response); list(,$nwords) = unpack ( "N*", substr ( $response, $pos, 4 ) ); $pos += 4; for ( $i=0; $i<$nwords; $i++ ) { list(,$len) = unpack ( "N*", substr ( $response, $pos, 4 ) ); $pos += 4; $tokenized = $len ? substr ( $response, $pos, $len ) : ""; $pos += $len; list(,$len) = unpack ( "N*", substr ( $response, $pos, 4 ) ); $pos += 4; $normalized = $len ? substr ( $response, $pos, $len ) : ""; $pos += $len; $res[] = array ( "tokenized"=>$tokenized, "normalized"=>$normalized ); if ( $hits ) { list($ndocs,$nhits) = array_values ( unpack ( "N*N*", substr ( $response, $pos, 8 ) ) ); $pos += 8; $res [$i]["docs"] = $ndocs; $res [$i]["hits"] = $nhits; } if ( $pos > $rlen ) { $this->_error = "incomplete reply"; $this->_MBPop (); return false; } } $this->_MBPop (); return $res; } function EscapeString ( $string ) { $from = array ( '\\', '(',')','|','-','!','@','~','"','&', '/', '^', '$', '=' ); $to = array ( '\\\\', '\(','\)','\|','\-','\!','\@','\~','\"', '\&', '\/', '\^', '\$', '\=' ); return str_replace ( $from, $to, $string ); } ///////////////////////////////////////////////////////////////////////////// // attribute updates ///////////////////////////////////////////////////////////////////////////// /// batch update given attributes in given rows in given indexes /// returns amount of updated documents (0 or more) on success, or -1 on failure function UpdateAttributes ( $index, $attrs, $values, $mva=false ) { // verify everything assert ( is_string($index) ); assert ( is_bool($mva) ); assert ( is_array($attrs) ); foreach ( $attrs as $attr ) assert ( is_string($attr) ); assert ( is_array($values) ); foreach ( $values as $id=>$entry ) { assert ( is_numeric($id) ); assert ( is_array($entry) ); assert ( count($entry)==count($attrs) ); foreach ( $entry as $v ) { if ( $mva ) { assert ( is_array($v) ); foreach ( $v as $vv ) assert ( is_int($vv) ); } else assert ( is_int($v) ); } } // build request $req = pack ( "N", strlen($index) ) . $index; $req .= pack ( "N", count($attrs) ); foreach ( $attrs as $attr ) { $req .= pack ( "N", strlen($attr) ) . $attr; $req .= pack ( "N", $mva ? 1 : 0 ); } $req .= pack ( "N", count($values) ); foreach ( $values as $id=>$entry ) { $req .= sphPackU64 ( $id ); foreach ( $entry as $v ) { $req .= pack ( "N", $mva ? count($v) : $v ); if ( $mva ) foreach ( $v as $vv ) $req .= pack ( "N", $vv ); } } // connect, send query, get response if (!( $fp = $this->_Connect() )) return -1; $len = strlen($req); $req = pack ( "nnN", SEARCHD_COMMAND_UPDATE, VER_COMMAND_UPDATE, $len ) . $req; // add header if ( !$this->_Send ( $fp, $req, $len+8 ) ) return -1; if (!( $response = $this->_GetResponse ( $fp, VER_COMMAND_UPDATE ) )) return -1; // parse response list(,$updated) = unpack ( "N*", substr ( $response, 0, 4 ) ); return $updated; } ///////////////////////////////////////////////////////////////////////////// // persistent connections ///////////////////////////////////////////////////////////////////////////// function Open() { if ( $this->_socket !== false ) { $this->_error = 'already connected'; return false; } if ( !$fp = $this->_Connect() ) return false; // command, command version = 0, body length = 4, body = 1 $req = pack ( "nnNN", SEARCHD_COMMAND_PERSIST, 0, 4, 1 ); if ( !$this->_Send ( $fp, $req, 12 ) ) return false; $this->_socket = $fp; return true; } function Close() { if ( $this->_socket === false ) { $this->_error = 'not connected'; return false; } fclose ( $this->_socket ); $this->_socket = false; return true; } ////////////////////////////////////////////////////////////////////////// // status ////////////////////////////////////////////////////////////////////////// function Status () { $this->_MBPush (); if (!( $fp = $this->_Connect() )) { $this->_MBPop(); return false; } $req = pack ( "nnNN", SEARCHD_COMMAND_STATUS, VER_COMMAND_STATUS, 4, 1 ); // len=4, body=1 if ( !( $this->_Send ( $fp, $req, 12 ) ) || !( $response = $this->_GetResponse ( $fp, VER_COMMAND_STATUS ) ) ) { $this->_MBPop (); return false; } $res = substr ( $response, 4 ); // just ignore length, error handling, etc $p = 0; list ( $rows, $cols ) = array_values ( unpack ( "N*N*", substr ( $response, $p, 8 ) ) ); $p += 8; $res = array(); for ( $i=0; $i<$rows; $i++ ) for ( $j=0; $j<$cols; $j++ ) { list(,$len) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4; $res[$i][] = substr ( $response, $p, $len ); $p += $len; } $this->_MBPop (); return $res; } } // // $Id: sphinxapi.php 2055 2009-11-06 23:09:58Z shodan $ //
108wo
phpcms/modules/search/classes/sphinxapi.class.php
PHP
asf20
46,062
<?php defined('IN_PHPCMS') or exit('Access Denied'); defined('UNINSTALL') or exit('Access Denied'); return array('message','message_data','message_group'); ?>
108wo
phpcms/modules/message/uninstall/model.php
PHP
asf20
163
<?php defined('IN_PHPCMS') or exit('Access Denied'); defined('UNINSTALL') or exit('Access Denied'); ?>
108wo
phpcms/modules/message/uninstall/extention.inc.php
PHP
asf20
106
<?php ?>
108wo
phpcms/modules/message/templates/message.tpl.php
PHP
asf20
9
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin'); ?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}}); $("#subject").formValidator({onshow:"<?php echo L('input','',admin).L('subject')?>",onfocus:"<?php echo L('input','',admin).L('subject')?>"}).inputValidator({min:1,onerror:"<?php echo L('input','',admin).L('subject')?>"}); $("#content").formValidator({onshow:"<?php echo L('input','',admin).L('content')?>",onfocus:"<?php echo L('input','',admin).L('content')?>"}).inputValidator({min:1,onerror:"<?php echo L('input','',admin).L('content')?>"}); }) //--> </script> <div class="pad_10"> <form action="?m=message&c=message&a=message_send" method="post" name="myform" id="myform"> <table cellpadding="2" cellspacing="1" class="table_form" width="100%"> <tr> <th width="80"><?php echo L('sendto')?>:</th> <td> <input name="info[type]" type="radio" value="1" checked="checked" style="border:0" onclick="$('#groupid').show();$('#roleid').hide()" class="radio_style"> <?php echo L('group')?>&nbsp;&nbsp;&nbsp;&nbsp; </td> </tr> <tr> <th width="80"><?php echo L('group')?>:</th> <td> <select name="info[groupid]" id="groupid"> <?php $i=0; foreach($member_group_infos as $groupid=>$member_group){ $i++; ?> <option value="<?php echo $member_group['groupid'];?>"><?php echo $member_group['name'];?></option> <?php }?> </select> <select name="info[roleid]" id="roleid" style="display:none" > <?php $j=0; foreach($role_infos as $roleid=>$role){ $j++; ?> <option value="<?php echo $role['roleid'];?>"><?php echo $role['rolename'];?></option> <?php }?> </select> </td> </tr> <tr> <th width="80"><?php echo L('subject')?>:</th> <td><input type="text" name="info[subject]" id="subject" size="30" class="input-text"></td> </tr> <tr> <th><?php echo L('content')?>:</th> <td><textarea name="info[content]" id="content" cols="50" rows="6"></textarea></td> </tr> <input type="submit" name="dosubmit" id="dosubmit" class="dialog" value=" <?php echo L('submit')?> "> </table> </form> </div> </body> </html>
108wo
phpcms/modules/message/templates/message_send.tpl.php
PHP
asf20
2,446