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_dialog = 1; include $this->admin_tpl('header','admin'); ?> <div class="pad-lr-10"> <form name="searchform" action="?m=message&c=message&a=search_message&menuid=<?php echo $_GET['menuid'];?>" method="post" > <table width="100%" cellspacing="0" class="search-form"> <tbody> <tr> <td><div class="explain-col"><?php echo L('query_type')?>:<?php echo form::select($trade_status,$status,'name="search[status]"', L('all'))?> <?php echo L('username')?>: <input type="text" value="<?php echo $username;?>" class="input-text" name="search[username]"> <?php echo L('time')?>: <?php echo form::date('search[start_time]',$start_time,'')?> <?php echo L('to')?> <?php echo form::date('search[end_time]',$end_time,'')?> <input type="submit" value="<?php echo L('search')?>" class="button" name="dosubmit"> </div> </td> </tr> </tbody> </table> </form> <form name="myform" action="?m=message&c=message&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('messageid[]');"></th> <th><?php echo L('subject')?></th> <th width="35%" align="center"><?php echo L('content')?></th> <th width="10%" align="center"><?php echo L('fromuserid')?></th> <th width='10%' align="center"><?php echo L('touserid')?></th> <th width="15%" align="center"><?php echo L('operations_manage')?></th> </tr> </thead> <tbody> <?php if(is_array($infos)){ foreach($infos as $info){ ?> <tr> <td align="center" width="35"><input type="checkbox" name="messageid[]" value="<?php echo $info['messageid']?>"></td> <td><?php echo $info['subject']?></td> <td align="" widht="35%"><?php echo $info['content'];?></td> <td align="center" width="10%"><?php echo $info['send_from_id']?></td> <td align="center" width="10%"><?php echo $info['send_to_id'];?></td> <td align="center" width="15%"><a href='?m=message&c=message&a=delete&messageid=<?php echo $info['messageid']?>' onClick="return confirm('<?php echo L('confirm', array('message' => $info['subject']))?>')"><?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 name="submit" type="submit" class="button" value="<?php echo L('remove_all_selected')?>" onClick="return confirm('<?php echo L('confirm', array('message' => L('selected')))?>')">&nbsp;&nbsp;</div> <div id="pages"><?php echo $pages?></div> </div> </form> </div> <script type="text/javascript"> function see_all(id, name) { window.top.art.dialog({id:'sell_all'}).close(); window.top.art.dialog({title:'<?php echo L('details');//echo L('edit')?> '+name+' ',id:'edit',iframe:'?m=message&c=message&a=see_all&messageid='+id,width:'700',height:'450'}, function(){var d = window.top.art.dialog({id:'see_all'}).data.iframe;var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'see_all'}).close()}); } function checkuid() { var ids=''; $("input[name='messageid[]']: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> </body> </html>
108wo
phpcms/modules/message/templates/message_search_list.tpl.php
PHP
asf20
3,766
<?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" action="?m=message&c=message&a=delete_group" 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('message_group_id[]');"></th> <th><?php echo L('subject')?></th> <th width="35%" align="center"><?php echo L('content')?></th> <th width="15%" align="center"><?php echo L('sendtime')?></th> <th width='10%' align="center"><?php echo L('status')?></th> <th width="10%" align="center"><?php echo L('operations_manage')?></th> </tr> </thead> <tbody> <?php if(is_array($infos)){ foreach($infos as $info){ ?> <tr> <td align="center" width="35"><input type="checkbox" name="message_group_id[]" value="<?php echo $info['id']?>"></td> <td><?php echo $info['subject']?></td> <td align="" widht="35%"><?php echo $info['content'];?></td> <td align="center" width="15%"><?php echo date('Y-m-d H:i:s',$info['inputtime']);?></td> <td align="center" width="10%"><?php if($info['status']==1){echo L('show_m');}else {echo '<font color=red>'.L('close').'</font>';}?></td> <td align="center" width="10%"> <a href='?m=message&c=message&a=delete_group&message_group_id=<?php echo $info['id']?>' onClick="return confirm('<?php echo L('confirm', array('message' => new_addslashes($info['subject'])))?>')"><?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 name="submit" type="submit" class="button" value="<?php echo L('remove_all_selected')?>" onClick="return confirm('<?php echo L('confirm', array('message' => L('selected')))?>')">&nbsp;&nbsp;</div> <div id="pages"><?php echo $pages?></div> </div> </form> </div> <script type="text/javascript"> function see_all(id, name) { window.top.art.dialog({id:'sell_all'}).close(); window.top.art.dialog({title:'<?php echo L('details');//echo L('edit')?> '+name+' ',id:'edit',iframe:'?m=message&c=message&a=see_all&messageid='+id,width:'700',height:'450'}, function(){var d = window.top.art.dialog({id:'see_all'}).data.iframe;var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'see_all'}).close()}); } function checkuid() { var ids=''; $("input[name='message_group_id[]']: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> </body> </html>
108wo
phpcms/modules/message/templates/message_group_list.tpl.php
PHP
asf20
3,099
<?php defined('IN_ADMIN') or exit('No permission resources.'); $show_dialog = 1; include $this->admin_tpl('header','admin'); ?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}}); $("#subject").formValidator({onshow:"<?php echo L('input','','admin').L('subject')?>",onfocus:"<?php echo L('subject').L('no_empty')?>"}).inputValidator({min:1,max:999,onerror:"<?php echo L('subject').L('no_empty')?>"}); $("#con").formValidator({onshow:"<?php echo L('content').L('no_empty')?>",onfocus:"<?php echo L('content').L('no_empty')?>"}).inputValidator({min:1,max:999,onerror:"<?php echo L('content').L('no_empty')?>"}); $("#tousername").formValidator({onshow:"<?php echo L('input','','admin').L('touserid')?>",onfocus:"<?php echo L('touserid').L('no_empty')?>"}).inputValidator({min:1,onerror:"<?php echo L('input','','admin').L('touserid')?>"}).ajaxValidator({type : "get",url : "",data :"m=message&c=message&a=public_name",datatype : "html",async:'true',success : function(data){if( data == 1 ){return true;}else{return false;}},buttons: $("#dosubmit"),onerror : "<?php echo L('not_myself')?>! ",onwait : "<?php echo L('connecting')?>"}); }) //--> </script> <div class="pad-lr-10"> <form action="?m=message&c=message&a=send_one" method="post" name="myform" id="myform"> <table cellpadding="2" cellspacing="1" class="table_form" width="100%"> <tr> <th width="100"><?php echo L('subject')?>:</th> <td><input type="text" name="info[subject]" id="subject" size="30" class="input-text"></td> </tr> <tr> <th width="100"><?php echo L('touserid')?>:</th> <td><input type="text" name="info[send_to_id]" id="tousername" size="20" class="input-text" value=""></td> </tr> <tr> <th><?php echo L('content')?>:</th> <td><textarea name="info[content]" id="con" cols="50" rows="6"></textarea></td> </tr> <tr> <th></th> <td><input type="submit" name="dosubmit" id="dosubmit" class="button" value=" <?php echo L('submit')?> "></td> </tr> </table> </form> </div> </body> </html>
108wo
phpcms/modules/message/templates/message_send_one.tpl.php
PHP
asf20
2,142
<?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" action="?m=message&c=message&a=delete_inbox" 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('messageid[]');"></th> <th><?php echo L('subject')?></th> <th width="35%" align="center"><?php echo L('content')?></th> <th width="10%" align="center"><?php echo L('message_sender')?></th> <th width='15%' align="center"><?php echo L('send_time')?></th> <th width="15%" align="center"><?php echo L('operations_manage')?></th> </tr> </thead> <tbody> <?php if(is_array($infos)){ foreach($infos as $info){ ?> <tr> <td align="center" width="35"><input type="checkbox" name="messageid[]" value="<?php echo $info['messageid']?>"></td> <td><?php echo $info['subject']?></td> <td align="" widht="35%"><?php echo $info['content'];?></td> <td align="center" width="10%"><?php echo $info['send_from_id'];?></td> <td align="center" width="15%"><?php echo date("Y-m-d H:i:s",$info['message_time']);?></td> <td align="center" width="15%"><a href='?m=message&c=message&a=delete&messageid=<?php echo $info['messageid']?>' onClick="return confirm('<?php echo L('confirm', array('message' => new_addslashes($info['subject'])))?>')"><?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 name="submit" type="submit" class="button" value="<?php echo L('remove_all_selected')?>" onClick="return confirm('<?php echo L('confirm', array('message' => L('selected')))?>')">&nbsp;&nbsp;</div> <div id="pages"><?php echo $pages?></div> </div> </form> </div> <script type="text/javascript"> function see_all(id, name) { window.top.art.dialog({id:'sell_all'}).close(); window.top.art.dialog({title:'<?php echo L('details');//echo L('edit')?> '+name+' ',id:'edit',iframe:'?m=message&c=message&a=see_all&messageid='+id,width:'700',height:'450'}, function(){var d = window.top.art.dialog({id:'see_all'}).data.iframe;var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'see_all'}).close()}); } function checkuid() { var ids=''; $("input[name='messageid[]']: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> </body> </html>
108wo
phpcms/modules/message/templates/message_inbox_list.tpl.php
PHP
asf20
3,015
<?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" action="?m=message&c=message&a=delete_outbox" 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('messageid[]');"></th> <th><?php echo L('subject')?></th> <th width="35%" align="center"><?php echo L('content')?></th> <th width="10%" align="center"><?php echo L('touserid')?></th> <th width='15%' align="center"><?php echo L('send_time')?></th> <th width="15%" align="center"><?php echo L('operations_manage')?></th> </tr> </thead> <tbody> <?php if(is_array($infos)){ foreach($infos as $info){ ?> <tr> <td align="center" width="35"><input type="checkbox" name="messageid[]" value="<?php echo $info['messageid']?>"></td> <td><?php echo $info['subject']?></td> <td align="" widht="35%"><?php echo $info['content'];?></td> <td align="center" width="10%"><?php echo $info['send_to_id'];?></td> <td align="center" width="15%"><?php echo date("Y-m-d H:i:s",$info['message_time']);?></td> <td align="center" width="15%"> <a href='?m=message&c=message&a=delete&messageid=<?php echo $info['messageid']?>' onClick="return confirm('<?php echo L('confirm', array('message' => new_addslashes($info['subject'])))?>')"><?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 name="submit" type="submit" class="button" value="<?php echo L('remove_all_selected')?>" onClick="return confirm('<?php echo L('confirm', array('message' => L('selected')))?>')">&nbsp;&nbsp;</div> <div id="pages"><?php echo $pages?></div> </div> </form> </div> <script type="text/javascript"> function see_all(id, name) { window.top.art.dialog({id:'sell_all'}).close(); window.top.art.dialog({title:'<?php echo L('details');//echo L('edit')?> '+name+' ',id:'edit',iframe:'?m=message&c=message&a=see_all&messageid='+id,width:'700',height:'450'}, function(){var d = window.top.art.dialog({id:'see_all'}).data.iframe;var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'see_all'}).close()}); } function checkuid() { var ids=''; $("input[name='messageid[]']: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> </body> </html>
108wo
phpcms/modules/message/templates/message_outbox_list.tpl.php
PHP
asf20
3,017
<?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=message&c=message&a=search_message&menuid=<?php echo $_GET['menuid'];?>" method="post" > <table width="100%" cellspacing="0" class="search-form"> <tbody> <tr> <td><div class="explain-col"><?php echo L('query_type')?>:<?php echo form::select($trade_status,$status,'name="search[status]"', L('all'))?> <?php echo L('username')?>: <input type="text" value="" class="input-text" name="search[username]"> <?php echo L('time')?>: <?php echo form::date('search[start_time]','','')?> <?php echo L('to')?> <?php echo form::date('search[end_time]','','')?> <input type="submit" value="<?php echo L('search')?>" class="button" name="dosubmit"> </div> </td> </tr> </tbody> </table> </form> <form name="myform" action="?m=message&c=message&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('messageid[]');"></th> <th><?php echo L('subject')?></th> <th width="35%" align="center"><?php echo L('content')?></th> <th width="10%" align="center"><?php echo L('fromuserid')?></th> <th width='10%' align="center"><?php echo L('touserid')?></th> <th width="15%" align="center"><?php echo L('operations_manage')?></th> </tr> </thead> <tbody> <?php if(is_array($infos)){ foreach($infos as $info){ ?> <tr> <td align="center" width="35"><input type="checkbox" name="messageid[]" value="<?php echo $info['messageid']?>"></td> <td><?php echo $info['subject']?></td> <td align="" widht="35%"><?php echo $info['content'];?></td> <td align="center" width="10%"><?php echo $info['send_from_id'];?></td> <td align="center" width="10%"><?php echo $info['send_to_id'];?></td> <td align="center" width="15%"> <a href='?m=message&c=message&a=delete&messageid=<?php echo $info['messageid']?>' onClick="return confirm('<?php echo L('confirm', array('message' => new_addslashes($info['subject'])))?>')"><?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 name="submit" type="submit" class="button" value="<?php echo L('remove_all_selected')?>" onClick="return confirm('<?php echo L('confirm', array('message' => L('selected')))?>')">&nbsp;&nbsp;</div> <div id="pages"><?php echo $pages?></div> </div> </form> </div> <script type="text/javascript"> function see_all(id, name) { window.top.art.dialog({id:'sell_all'}).close(); window.top.art.dialog({title:'<?php echo L('details');//echo L('edit')?> '+name+' ',id:'edit',iframe:'?m=message&c=message&a=see_all&messageid='+id,width:'700',height:'450'}, function(){var d = window.top.art.dialog({id:'see_all'}).data.iframe;var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'see_all'}).close()}); } function checkuid() { var ids=''; $("input[name='messageid[]']: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> </body> </html>
108wo
phpcms/modules/message/templates/message_list.tpl.php
PHP
asf20
3,745
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('foreground','member');//加载foreground 应用类. 自动判断是否登陆. pc_base::load_sys_class('format', '', 0); pc_base::load_sys_class('form', '', 0); class index extends foreground { function __construct() { parent::__construct(); $this->message_db = pc_base::load_model('message_model'); $this->message_group_db = pc_base::load_model('message_group_model'); $this->message_data_db = pc_base::load_model('message_data_model'); $this->_username = param::get_cookie('_username'); $this->_userid = param::get_cookie('_userid'); $this->_groupid = get_memberinfo($this->_userid,'groupid'); pc_base::load_app_func('global'); //定义站点ID常量,选择模版使用 $siteid = isset($_GET['siteid']) ? intval($_GET['siteid']) : get_siteid(); define("SITEID",$siteid); } public function init() { $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $where = array('send_to_id'=>$this->_username,'replyid'=>'0'); $infos = $this->message_db->listinfo($where,$order = 'messageid DESC',$page, 10); $infos = new_html_special_chars($infos); $pages = $this->message_db->pages; include template('message', 'inbox'); } /** * 发送消息 */ public function send() { if(isset($_POST['dosubmit'])) { $username = $this->_username; $tousername = $_POST['info']['send_to_id']; $subject = new_html_special_chars($_POST['info']['subject']); $content = new_html_special_chars($_POST['info']['content']); $this->message_db->add_message($tousername,$username,$subject,$content,true); showmessage(L('operation_success'),HTTP_REFERER); } else { //判断当前会员,是否可发,短消息. $this->message_db->messagecheck($this->_userid); $show_validator = $show_scroll = $show_header = true; include template('message', 'send'); } } /* *判断收件人是否存在 */ public function public_name() { $username = isset($_GET['username']) && trim($_GET['username']) ? (pc_base::load_config('system', 'charset') == 'gbk' ? iconv('utf-8', 'gbk', trim($_GET['username'])) : trim($_GET['username'])) : exit('0'); $member_interface = pc_base::load_app_class('member_interface', 'member'); if ($username) { $username = safe_replace($username); //判断收件人不能为自己 if($username == $this->_username){ exit('0'); } $data = $member_interface->get_member_info($username, 2); if ($data!='-1') { exit('1'); } else { exit('0'); } } else { exit('0'); } } /** * 发件箱 */ public function outbox() { $where = array('send_from_id'=>$this->_username,'del_type'=>'0'); $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1; $infos = $this->message_db->listinfo($where,$order = 'messageid DESC',$page, $pages = '8'); $infos = new_html_special_chars($infos); $pages = $this->message_db->pages; include template('message', 'outbox'); } /** * 收件箱 */ public function inbox() { $where = array('send_to_id'=>$this->_username,'folder'=>'inbox'); $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1; $infos = $this->message_db->listinfo($where,$order = 'messageid DESC',$page, $pages = '8'); $infos = new_html_special_chars($infos); if (is_array($infos) && !empty($infos)) { foreach ($infos as $infoid=>$info){ $reply_num = $this->message_db->count(array("replyid"=>$info['messageid'])); $infos[$infoid]['reply_num'] = $reply_num; } } $pages = $this->message_db->pages; include template('message', 'inbox'); } /** * 群发邮件 */ public function group() { //查询自己有权限看的消息 $where = array('typeid'=>1,'groupid'=>$this->_groupid,'status'=>1); $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1; $infos = $this->message_group_db->listinfo($where,$order = 'id DESC',$page, $pages = '8'); $infos = new_html_special_chars($infos); $status = array(); if (is_array($infos) && !empty($infos)) { foreach ($infos as $info){ $d = $this->message_data_db->select(array('userid'=>$this->_userid,'group_message_id'=>$info['id'])); if(!$d){ $status[$info['id']] = 0;//未读 红色 }else { $status[$info['id']] = 1; } } } $pages = $this->message_group_db->pages; include template('message', 'group'); } /** * 删除收件箱-短消息 * @param intval $sid 短消息ID,递归删除(修改状态为outbox) */ public function delete() { if((!isset($_GET['messageid']) || empty($_GET['messageid'])) && (!isset($_POST['messageid']) || empty($_POST['messageid']))) { showmessage(L('illegal_parameters'), HTTP_REFERER); } else { if(is_array($_POST['messageid'])){ foreach($_POST['messageid'] as $messageid_arr) { $this->message_db->update(array('folder'=>'outbox'),array('messageid'=>$messageid_arr,'send_to_id'=>$this->_username)); } showmessage(L('operation_success'), HTTP_REFERER); } } } /** * 删除发件箱 - 短消息 * @param intval $sid 短消息ID,递归删除( 修改状态为del_type =1 ) */ public function del_type() { if((!isset($_POST['messageid']) || empty($_POST['messageid']))) { showmessage(L('illegal_parameters'), HTTP_REFERER); } else { if(is_array($_POST['messageid'])){ foreach($_POST['messageid'] as $messageid_arr) { $this->message_db->update(array('del_type'=>'1'),array('messageid'=>$messageid_arr,'send_from_id'=>$this->_username)); } showmessage(L('operation_success'), HTTP_REFERER); } } } /** * 查看短消息 */ public function read() { if((!isset($_GET['messageid']) || empty($_GET['messageid'])) && (!isset($_POST['messageid']) || empty($_POST['messageid']))) return false; //查看过修改状态 为 0 $this->message_db->update(array('status'=>'0'),array('messageid'=>$_GET['messageid'])); //查询消息详情 $infos = $this->message_db->get_one(array('messageid'=>$_GET['messageid'])); if($infos['send_from_id']!='SYSTEM') $infos = new_html_special_chars($infos); //查询回复消息 $where = array('replyid'=>$infos['messageid']); $reply_infos = $this->message_db->listinfo($where,$order = 'messageid ASC',$page, $pages = '10'); $show_validator = $show_scroll = $show_header = true; include template('message', 'read'); } /** * 查看自己发的短消息 */ public function read_only() { if((!isset($_GET['messageid']) || empty($_GET['messageid'])) && (!isset($_POST['messageid']) || empty($_POST['messageid']))) return false; //查询消息详情 $infos = $this->message_db->get_one(array('messageid'=>$_GET['messageid'])); $infos = new_html_special_chars($infos); //查询回复消息 $where = array('replyid'=>$infos['messageid']); $reply_infos = $this->message_db->listinfo($where,$order = 'messageid ASC',$page, $pages = '10'); $show_validator = $show_scroll = $show_header = true; include template('message', 'read_only'); } /** * 查看系统短消息 */ public function read_group(){ if((!isset($_GET['group_id']) || empty($_GET['group_id'])) && (!isset($_POST['group_id']) || empty($_POST['group_id']))) return false; //查询消息详情 $infos = $this->message_group_db->get_one(array('id'=>$_GET['group_id'])); $infos = new_html_special_chars($infos); if(!is_array($infos))showmessage(L('message_not_exist'),'blank'); //检查查看表是否有记录,无则向message_data 插入浏览记录 $check = $this->message_data_db->select(array('userid'=>$this->_userid,'group_message_id'=>$_GET['group_id'])); if(!$check){ $this->message_data_db->insert(array('userid'=>$this->_userid,'group_message_id'=>$_GET['group_id'])); } include template('message', 'read_group'); } /** * 回复短消息 */ public function reply() { if(isset($_POST['dosubmit'])) { //判断当前会员,是否可发,短消息. $this->message_db->messagecheck($this->_userid); $_POST['info']['send_from_id'] = $this->_username; $_POST['info']['message_time'] = SYS_TIME; $_POST['info']['status'] = '1'; $_POST['info']['folder'] = 'inbox'; if(empty($_POST['info']['send_to_id'])) { showmessage(L('user_noempty'),HTTP_REFERER); } $messageid = $this->message_db->insert($_POST['info'],true); if(!$messageid) return FALSE; showmessage(L('operation_success'),HTTP_REFERER); } else { $show_validator = $show_scroll = $show_header = true; include template('message', 'send'); } } } ?>
108wo
phpcms/modules/message/index.php
PHP
asf20
8,873
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); class message extends admin { function __construct() { parent::__construct(); $this->db = pc_base::load_model('message_model'); $this->group_db = pc_base::load_model('message_group_model'); $this->_username = param::get_cookie('admin_username'); $this->_userid = param::get_cookie('userid'); pc_base::load_sys_class('form'); foreach(L('select') as $key=>$value) { $trade_status[$key] = $value; } $this->trade_status = $trade_status; } public function init() { $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1; $infos = $this->db->listinfo($where,$order = 'messageid DESC',$page, $pages = '12'); $pages = $this->db->pages; $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=message&c=message&a=message_send\', title:\''.L('all_send_message').'\', width:\'550\', height:\'300\'}, 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('all_send_message')); $trade_status = $this->trade_status; include $this->admin_tpl('message_list'); } /** * 群发消息管理 ... */ public function message_group_manage() { $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1; $infos = $this->group_db->listinfo($where,$order = 'id DESC',$page, $pages = '12'); $pages = $this->db->pages; $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=message&c=message&a=message_send\', title:\''.L('all_send_message').'\', width:\'550\', height:\'300\'}, 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('all_send_message')); include $this->admin_tpl('message_group_list'); } /* *判断用户名是否存在 */ public function public_name() { $tousername = isset($_GET['tousername']) && trim($_GET['tousername']) ? (pc_base::load_config('system', 'charset') == 'gbk' ? iconv('utf-8', 'gbk', trim($_GET['tousername'])) : trim($_GET['tousername'])) : exit('0'); //不能发给自己 if($tousername == $this->_username){ exit('0'); } //判断用户名是否存在 $member_interface = pc_base::load_app_class('member_interface', 'member'); if ($tousername) { $data = $member_interface->get_member_info($tousername, 2); if ($data!='-1') { exit('1'); } else { exit('0'); } } else { exit('0'); } } /** * 删除短消息 * @param intval $sid 短消息ID,递归删除 */ public function delete() { if((!isset($_GET['messageid']) || empty($_GET['messageid'])) && (!isset($_POST['messageid']) || empty($_POST['messageid']))) { showmessage(L('illegal_parameters'), HTTP_REFERER); } else { if(is_array($_POST['messageid'])){ foreach($_POST['messageid'] as $messageid_arr) { //批量删除友情链接 $this->db->delete(array('messageid'=>$messageid_arr)); } showmessage(L('operation_success'),'?m=message&c=message'); }else{ $messageid = intval($_GET['messageid']); if($messageid < 1) return false; //删除短消息 $result = $this->db->delete(array('messageid'=>$messageid)); if($result) { showmessage(L('operation_success'),'?m=message&c=message'); }else { showmessage(L("operation_failure"),'?m=message&c=message'); } } showmessage(L('operation_success'), HTTP_REFERER); } } /** * 删除系统 短消息 * @param intval $sid 群发短消息ID,递归删除 */ public function delete_group() { if((!isset($_GET['message_group_id']) || empty($_GET['message_group_id'])) && (!isset($_POST['message_group_id']) || empty($_POST['message_group_id']))) { showmessage(L('illegal_parameters'), HTTP_REFERER); } else { if(is_array($_POST['message_group_id'])){ foreach($_POST['message_group_id'] as $messageid_arr) { //批量删除系统消息 $this->group_db->delete(array('id'=>$messageid_arr)); } showmessage(L('operation_success'),'?m=message&c=message&a=message_group_manage'); }else{ $group_id = intval($_GET['message_group_id']); if($group_id < 1) return false; //删除短消息 $result = $this->group_db->delete(array('id'=>$group_id)); if($result){ showmessage(L('operation_success'),'?m=message&c=message&a=message_group_manage'); } else { showmessage(L("operation_failure"),'?m=message&c=message&a=message_group_manage'); } } showmessage(L('operation_success'), HTTP_REFERER); } } /** * 管理按组或角色 群发消息 */ public function message_send() { if(isset($_POST['dosubmit'])) { //插入群发表 $group_message = array (); if(empty($_POST['info']['subject'])||empty($_POST['info']['content'])) return false; $group_message['subject'] = $_POST['info']['subject']; $group_message['content'] = $_POST['info']['content']; $group_message['typeid'] = $_POST['info']['type']; $group_message['inputtime'] = SYS_TIME; if($group_message['typeid']==1){ $group_message['groupid'] = $_POST['info']['groupid']; }else { $group_message['groupid'] = $_POST['info']['roleid']; } $result_id = $this->group_db->insert($group_message,true); if(!$result_id){ showmessage(L('mass_failure'),HTTP_REFERER); } showmessage(L('operation_success'),HTTP_REFERER,'', 'add'); } else { $show_validator = $show_scroll = $show_header = true; //LOAD 会员组模型 $member_group = pc_base::load_model('member_group_model'); $member_group_infos = $member_group->select('','*','',$order = 'groupid ASC'); //LOAD 管理员角色模型 $role = pc_base::load_model('admin_role_model'); $role_infos = $role->select('','*','',$order = 'roleid ASC'); include $this->admin_tpl('message_send'); } } /** * 发消息 */ public function send_one() { if(isset($_POST['dosubmit'])) { $username= $this->_username; $tousername =$_POST['info']['send_to_id']; $subject = $_POST['info']['subject']; $content = $_POST['info']['content']; $this->db->add_message($tousername,$username,$subject,$content,true); showmessage(L('operation_success'),HTTP_REFERER); } else { $show_validator = $show_scroll = true; $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=message&c=message&a=message_send\', title:\''.L('all_send_message').'\', width:\'550\', height:\'300\'}, 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('all_send_message')); include $this->admin_tpl('message_send_one'); } } /** * 收件箱 */ public function my_inbox() { $where = array('send_to_id'=>$this->_username,'folder'=>'inbox'); $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1; $infos = $this->db->listinfo($where,$order = 'messageid DESC',$page, $pages = '12'); $pages = $this->db->pages; $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=message&c=message&a=message_send\', title:\''.L('all_send_message').'\', width:\'550\', height:\'300\'}, 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('all_send_message')); $trade_status = $this->trade_status; include $this->admin_tpl('message_inbox_list'); } /** * 删除-收件箱短消息 * @param intval $sid 短消息ID,递归删除 */ public function delete_inbox() { if((!isset($_GET['messageid']) || empty($_GET['messageid'])) && (!isset($_POST['messageid']) || empty($_POST['messageid']))) { showmessage(L('illegal_parameters'), HTTP_REFERER); } else { if(is_array($_POST['messageid'])){ foreach($_POST['messageid'] as $messageid_arr) { //批量删除短消息 $this->db->update(array('folder'=>'outbox'),array('messageid'=>$messageid_arr,'send_to_id'=>$this->_username)); } showmessage(L('operation_success'), HTTP_REFERER); }else{ $messageid = intval($_GET['messageid']); if($messageid < 1) return false; //删除单个短消息 $result = $this->db->update(array('folder'=>'outbox'),array('messageid'=>$messageid,'send_to_id'=>$this->_username)); showmessage(L('operation_success'), HTTP_REFERER); } } } /** * 发件箱 */ public function my_outbox() { $where = array('send_from_id'=>$this->_username,'del_type'=>'0'); $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1; $infos = $this->db->listinfo($where,$order = 'messageid DESC',$page, $pages = '12'); $pages = $this->db->pages; $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=message&c=message&a=message_send\', title:\''.L('all_send_message').'\', width:\'550\', height:\'350\'}, 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('all_send_message')); $trade_status = $this->trade_status; include $this->admin_tpl('message_outbox_list'); } /** * 删除-发件箱短消息 * @param intval $sid 短消息ID,递归删除 */ public function delete_outbox() { if((!isset($_GET['messageid']) || empty($_GET['messageid'])) && (!isset($_POST['messageid']) || empty($_POST['messageid']))) { showmessage(L('illegal_parameters'), HTTP_REFERER); } else { if(is_array($_POST['messageid'])){ foreach($_POST['messageid'] as $messageid_arr) { //批量删除短消息 $this->db->update(array('del_type'=>'1'),array('messageid'=>$messageid_arr,'send_from_id'=>$this->_username)); } showmessage(L('operation_success'), HTTP_REFERER); }else{ $messageid = intval($_GET['messageid']); if($messageid < 1) return false; //删除单个短消息 $result = $this->db->update(array('del_type'=>'1'),array('messageid'=>$messageid,'send_from_id'=>$this->_username)); showmessage(L('operation_success'), HTTP_REFERER); } } } /** * 短消息搜索 */ public function search_message() { if(isset($_POST['dosubmit'])){ $where = ''; extract($_POST['search']); if(!$username && !$start_time && !$end_time){ $where = ""; } if($username){ //判断是查询类型,收件还是发件记录 if($status==""){ $where .= $where ? " AND send_from_id='$username' or send_to_id='$username'" : " send_from_id='$username' or send_to_id='$username'"; } else { $where .= $where ? " AND $status='$username'" : " $status='$username'"; } } if($start_time && $end_time) { $start = strtotime($start_time); $end = strtotime($end_time); //$where .= "AND `message_time` >= '$start' AND `message_time` <= '$end' "; $where .= $where ? "AND `message_time` >= '$start' AND `message_time` <= '$end' " : " `message_time` >= '$start' AND `message_time` <= '$end' "; } } $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1; $infos = $this->db->listinfo($where,$order = 'messageid DESC',$page, $pages = '12'); $pages = $this->db->pages; $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=message&c=message&a=message_send\', title:\''.L('all_send_message').'\', width:\'700\', height:\'450\'}, 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('all_send_message')); $trade_status = $this->trade_status; include $this->admin_tpl('message_search_list'); } } ?>
108wo
phpcms/modules/message/message.php
PHP
asf20
12,522
<?php defined('IN_PHPCMS') or exit('No permission resources.'); class message_tag { private $message_db; public function __construct() { $this->message_db = pc_base::load_model('message_model'); $this->message_group_db = pc_base::load_model('message_group_model'); $this->message_data_db = pc_base::load_model('message_data_model'); $this->_username = param::get_cookie('_username'); $this->_userid = param::get_cookie('_userid'); $this->_groupid = get_memberinfo($this->_userid,'groupid'); } /** * 检测是否有新邮件 * @param $typeid 分类ID */ public function check_new(){ $where = array('send_to_id'=>$this->_username,'folder'=>'inbox','status'=>'1'); $new_count = $this->message_db->count($where); //检查是否有未查看的新系统短信 //检查该会员所在会员组 的系统公告,再查询message_data表. 是否有记录. 无则加入 未读NUM. $group_num = 0; $group_where = array('typeid'=>'1','groupid'=>$this->_groupid,'status'=>'1'); $group_arr = $this->message_group_db->select($group_where); foreach ($group_arr as $groupid=>$group){ $group_message_id = $group['id']; $where = array('group_message_id'=>$group_message_id,'userid'=>$this->_userid); $result = $this->message_data_db->select($where); if(!$result) $group_num++; } //生成一个新数组,并返回此数组 $new_arr = array(); $new_arr['new_count'] = $new_count; $new_arr['new_group_count'] = $group_num; return $new_arr; } } ?>
108wo
phpcms/modules/message/classes/message_tag.class.php
PHP
asf20
1,559
<?php defined('IN_PHPCMS') or exit('Access Denied'); defined('INSTALL') or exit('Access Denied'); return array('message','message_group','message_data'); ?>
108wo
phpcms/modules/message/install/model.php
PHP
asf20
162
{template 'member', 'header'} <script language="javascript" type="text/javascript" src="{JS_PATH}admin_common.js"></script> <link href="{CSS_PATH}dialog.css" rel="stylesheet" type="text/css" /> <script language="javascript" type="text/javascript" src="{JS_PATH}dialog.js"></script> <div id="memberArea"> {template 'member', 'left'} <div class="col-auto"> <div class="col-1 "> <h6 class="title">收件箱</h6> <div class="content"> <form name="myform" id="myform" action="{APP_PATH}index.php?m=message&c=index&a=delete" method="post" onsubmit="checkuid();return false;"> <table width="100%" cellspacing="0" class="table-list"> <thead> <tr> <th width="5%"><input type="checkbox" value="" id="check_box" onclick="selectall('messageid[]');"></th> <th width="35%">标 题</th> <th width="8%">回 复</th> <th width="15%">发件人</th> <th width="15%">发送时间</th> </tr> </thead> <tbody> {loop $infos $info} <tr> <td width="5%" align="center"><input type="checkbox" name="messageid[]" value="{$info['messageid']}"></td> <td width="35%" align=""><a href="{APP_PATH}index.php?m=message&c=index&a=read&messageid={$info['messageid']}">{if $info['status']==1}<font color=red><b>{$info['subject']}</b></font>{else}{$info['subject']}{/if}</a></td> <td width="8%" align="center">{if $info['status']!=2}{/if}{$info['reply_num']}</td> <td width="15%" align="center">{$info['send_from_id']}</td> <td width="15%" align="center">{date('Y-m-d H:i:s',$info['message_time'])} </a> </tr> {/loop} </tbody> </table> <div class="btn"><a href="#" onClick="javascript:$('input[type=checkbox]').attr('checked', true)">全选</a>/<a href="#" onClick="javascript:$('input[type=checkbox]').attr('checked', false)">取消</a> <input name="submit" type="submit" class="button" value="删除选中" onClick="return confirm('确认要删除 『 选中 』 吗?')">&nbsp;&nbsp;</div> </form> <div id="pages">{$pages}</div> </div> <span class="o1"></span><span class="o2"></span><span class="o3"></span><span class="o4"></span> </div> </div> </div> <script type="text/javascript"> function read(id, name) { window.top.art.dialog({id:'sell_all'}).close(); window.top.art.dialog({title:'查看详情'+name+' ',id:'edit',iframe:'?m=message&c=index&a=read&messageid='+id,width:'700',height:'450'}, function(){var d = window.top.art.dialog({id:'see_all'}).data.iframe;var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'see_all'}).close()}); } function checkuid() { var ids=''; $("input[name='messageid[]']:checked").each(function(i, n){ ids += $(n).val() + ','; }); if(ids=='') { window.top.art.dialog({content:'请选择再执行操作',lock:true,width:'200',height:'50',time:1.5},function(){}); return false; } else { myform.submit(); } } </script> {template 'member', 'footer'}
108wo
phpcms/modules/message/install/templates/inbox.html
HTML
asf20
3,033
{template 'member', 'header'} <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}}); $("#subject").formValidator({empty:true,onshow:"标题,可以为空",onfocus:"请输入标题",oncorrect:"输入正确!",onempty:"不填替标题了吗?"}).inputValidator({min:1,onerror:"请输入标题"}); $("#con").formValidator({onshow:"请输入内容",onfocus:"内容不能为空"}).inputValidator({min:1,max:999,onerror:"内容不能为空"}); $("#code").formValidator({onshow:"请输入验证码",onfocus:"验证码不能为空"}).inputValidator({min:1,max:999,onerror:"验证码不能为空"}).ajaxValidator({ type : "get", url : "", data :"m=pay&c=deposit&a=public_checkcode", datatype : "html", async:'false', success : function(data){ if(data == 1) { return true; } else { return false; } }, buttons: $("#dosubmit"), onerror : "验证码错误", onwait : "验证中" }); }) //--> </script> <div id="memberArea"> {template 'member', 'left'} <div class="col-auto"> <div class="col-1 "> <h6 class="title">系统短消息记录</h6> <div class="content"> <table width="100%" cellspacing="0" class="table_form"> <tr> <th><div align=center><img src="{IMG_PATH}member/nophoto.gif" width="50" height="50"><br><font color=red>{$infos['send_from_id']}</font></div></th> <td><b>{$infos['subject']}</b> - {date('Y-m-d H:i:s',$infos['inputtime'])}<br><br>{nl2br($infos['content'])}</td> </tr> {loop $reply_infos $reply_info} <tr> <th><div align=center><img src="{IMG_PATH}member/nophoto.gif" width="50" height="50"></img><br>{$reply_info['send_from_id']}</div></th> <td>{$reply_info['subject']} - {date('Y-m-d H:i:s',$reply_info['message_time'])}<br><br></br><b>{$reply_info['content']}</b></td> </tr> {/loop} </label></td> </tr> </table> </div> <span class="o1"></span><span class="o2"></span><span class="o3"></span><span class="o4"></span> </div> <div class="bk10"></div> </div> </div> {template 'member', 'footer'}
108wo
phpcms/modules/message/install/templates/read_group.html
HTML
asf20
2,257
{template 'member', 'header'} <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}}); $("#subject").formValidator({empty:true,onshow:"标题,可以为空",onfocus:"请输入标题",oncorrect:"输入正确!",onempty:"不填替标题了吗?"}).inputValidator({min:1,onerror:"请输入标题"}); $("#con").formValidator({onshow:"请输入内容",onfocus:"内容不能为空"}).inputValidator({min:1,max:999,onerror:"内容不能为空"}); $("#code").formValidator({onshow:"请输入验证码",onfocus:"验证码不能为空"}).inputValidator({min:1,max:999,onerror:"验证码不能为空"}).ajaxValidator({ type : "get", url : "", data :"m=pay&c=deposit&a=public_checkcode", datatype : "html", async:'false', success : function(data){ if(data == 1) { return true; } else { return false; } }, buttons: $("#dosubmit"), onerror : "验证码错误", onwait : "验证中" }); }) //--> </script> <div id="memberArea"> {template 'member', 'left'} <div class="col-auto"> <div class="col-1 "> <h6 class="title">与 {$infos['send_from_id']} 的短消息记录</h6> <div class="content"> <form name="myform" action="?m=message&c=index&a=reply" method="post" id="myform"> <table width="100%" cellspacing="0" class="table_form"> <tr> <th><div align=center><img src="{IMG_PATH}member/nophoto.gif" width="50" height="50"><br><font color=red>{$infos['send_from_id']}</font></div></th> <td>{$infos['subject']} - {date('Y-m-d H:i:s',$infos['message_time'])}<br><br><b>{$infos['content']}</b></td> </tr> {loop $reply_infos $reply_info} <tr> <th><div align=center><img src="{IMG_PATH}member/nophoto.gif" width="50" height="50"></img><br>{$reply_info['send_from_id']}</div></th> <td>{$reply_info['subject']} - {date('Y-m-d H:i:s',$reply_info['message_time'])}<br><br></br><b>{$reply_info['content']}</b></td> </tr> {/loop} </label></td> </tr> </table> </form> </div> <span class="o1"></span><span class="o2"></span><span class="o3"></span><span class="o4"></span> </div> <div class="bk10"></div> <div class="col-1 "> <h5 class="title">回复此消息 </h5> <div class="content"> <form name="myform" action="?m=message&c=index&a=reply" method="post" id="myform"> <table width="100%" cellspacing="0" class="table_form"> <tr> <th>标 题:</th> <td><input name="info[subject]" type="text" id="subject" size="30" value="Re: {$infos[subject]}" class="input-text"/></td> </tr> <tr> <th>内 容:</th> <td><textarea name="info[content]" id="con" rows="5" cols="50"></textarea></td> </tr> <input type="hidden" name="info[replyid]" value="{$infos['messageid']}" /> <input type="hidden" name="info[send_to_id]" value="{$infos['send_from_id']}" /> <tr> <th>验证码:</th> <td><input name="code" type="text" id="code" size="10" class="input-text"/> {form::checkcode('code_img','4','14',110,30)}</td> </tr> <tr> <td></td> <td colspan="2"><label> <input type="submit" name="dosubmit" id="dosubmit" value="确 定" class="button"/> </label></td> </tr> </table> </form> </div> <span class="o1"></span><span class="o2"></span><span class="o3"></span><span class="o4"></span> </div> </div> </div> {template 'member', 'footer'}
108wo
phpcms/modules/message/install/templates/read.html
HTML
asf20
3,500
{template 'member', 'header'} <script language="javascript" type="text/javascript" src="{JS_PATH}admin_common.js"></script> <link href="{CSS_PATH}dialog.css" rel="stylesheet" type="text/css" /> <script language="javascript" type="text/javascript" src="{JS_PATH}dialog.js"></script> <div id="memberArea"> {template 'member', 'left'} <div class="col-auto"> <div class="col-1 "> <h6 class="title">系统消息</h6> <div class="content"> <table width="100%" cellspacing="0" class="table-list"> <thead> <tr> <th>标 题</th> <th width="20%">发送时间</th> </tr> </thead> <tbody> {loop $infos $info} <tr> <td><a href="?m=message&c=index&a=read_group&group_id={$info['id']}">{if $status[$info['id']]==0}<font color=red><b>{$info['subject']}</b></font>{else}{$info['subject']}{/if}</a></td> <td width="20%" align="center">{date('Y-m-d H:i:s',$info['inputtime'])} </a> </tr> {/loop} </tbody> </table> <div id="pages">{$pages}</div> </div> <span class="o1"></span><span class="o2"></span><span class="o3"></span><span class="o4"></span> </div> </div> </div> <script type="text/javascript"> function read(id, name) { window.top.art.dialog({id:'sell_all'}).close(); window.top.art.dialog({title:'查看详情'+name+' ',id:'edit',iframe:'?m=message&c=index&a=read&messageid='+id,width:'700',height:'450'}, function(){var d = window.top.art.dialog({id:'see_all'}).data.iframe;var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'see_all'}).close()}); } function checkuid() { var ids=''; $("input[name='messageid[]']:checked").each(function(i, n){ ids += $(n).val() + ','; }); if(ids=='') { window.top.art.dialog({content:'请选择再执行操作',lock:true,width:'200',height:'50',time:1.5},function(){}); return false; } else { myform.submit(); } } </script> {template 'member', 'footer'}
108wo
phpcms/modules/message/install/templates/group.html
HTML
asf20
2,011
{template 'member', 'header'} <script language="javascript" type="text/javascript" src="{JS_PATH}admin_common.js"></script> <link href="{CSS_PATH}dialog.css" rel="stylesheet" type="text/css" /> <script language="javascript" type="text/javascript" src="{JS_PATH}dialog.js"></script> <div id="memberArea"> {template 'member', 'left'} <div class="col-auto"> <div class="col-1 "> <h6 class="title">已发消息</h6> <div class="content"> <form name="myform" id="myform" action="?m=message&c=index&a=del_type" method="post" onsubmit="checkuid();return false;"> <table width="100%" cellspacing="0" class="table-list"> <thead> <tr> <th width="5%"><input type="checkbox" value="" id="check_box" onclick="selectall('messageid[]');"></th> <th width="35%">标 题</th> <th width="8%">回 复</th> <th width="15%">收件人</th> <th width="15%">发送时间</th> </tr> </thead> <tbody> {loop $infos $info} <tr> <td width="5%" align="center"><input type="checkbox" name="messageid[]" value="{$info['messageid']}"></td> <td width="35%" align=""><a href="{APP_PATH}index.php?m=message&c=index&a=read_only&messageid={$info['messageid']}">{$info['subject']}</a></td> <td width="8%" align="center">{$info['payment']}</td> <td width="15%" align="center">{$info['send_to_id']}</td> <td width="15%" align="center">{date('Y-m-d H:i:s',$info['message_time'])} </a> </tr> {/loop} </tbody> </table> <div class="btn"><a href="#" onClick="javascript:$('input[type=checkbox]').attr('checked', true)">全选</a>/<a href="#" onClick="javascript:$('input[type=checkbox]').attr('checked', false)">取消</a> <input name="submit" type="submit" class="button" value="删除选中" onClick="return confirm('确认要删除 『 选中 』 吗?')">&nbsp;&nbsp;</div> </form> <div id="pages">{$pages}</div> </div> <span class="o1"></span><span class="o2"></span><span class="o3"></span><span class="o4"></span> </div> </div> </div> <script type="text/javascript"> function see_all(id, name) { window.top.art.dialog({id:'sell_all'}).close(); window.top.art.dialog({title:'查看详情'+name+' ',id:'edit',iframe:'?m=message&c=message&a=see_all&messageid='+id,width:'700',height:'450'}, function(){var d = window.top.art.dialog({id:'see_all'}).data.iframe;var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'see_all'}).close()}); } function checkuid() { var ids=''; $("input[name='messageid[]']:checked").each(function(i, n){ ids += $(n).val() + ','; }); if(ids=='') { window.top.art.dialog({content:'请选择再执行操作',lock:true,width:'200',height:'50',time:1.5},function(){}); return false; } else { myform.submit(); } } </script> {template 'member', 'footer'}
108wo
phpcms/modules/message/install/templates/outbox.html
HTML
asf20
2,914
{template 'member', 'header'} <div id="memberArea"> {template 'member', 'left'} <div class="col-auto"> <div class="col-1 "> <h6 class="title">发送短消息</h6> <div class="content"> <form name="myform" action="{APP_PATH}index.php?m=message&c=index&a=send" method="post" id="myform"> <table width="100%" cellspacing="0" class="table_form"> <tr> <th>收信人:</th> <td><input name="info[send_to_id]" type="text" id="username" size="30" value="" class="input-text"/> </td> </tr> <tr> <th>标 题:</th> <td><input name="info[subject]" type="text" id="subject" size="30" value="" class="input-text"/></td> </tr> <tr> <th>内 容:</th> <td><textarea name="info[content]" id="con" rows="5" cols="50"></textarea></td> </tr> <tr> <th>验证码:</th> <td><input name="code" type="text" id="code" size="10" class="input-text"/> {form::checkcode('code_img','4','14',110,30)}</td> </tr> <tr> <td></td> <td colspan="2"><label> <input type="submit" name="dosubmit" id="dosubmit" value="确 定" class="button"/> </label></td> </tr> </table> </form> </div> <span class="o1"></span><span class="o2"></span><span class="o3"></span><span class="o4"></span> </div> </div> </div> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}}); $("#subject").formValidator({onshow:"请输入标题",onfocus:"标题不能为空"}).inputValidator({min:1,max:999,onerror:"标题不能为空"}); $("#con").formValidator({onshow:"请输入内容",onfocus:"内容不能为空"}).inputValidator({min:1,max:999,onerror:"内容不能为空"}); $("#username").formValidator({onshow:"请填写收信人",onfocus:"收信人不能为空"}).inputValidator({min:1,onerror:"<?php echo L("input").L('touserid')?>"}).ajaxValidator({type : "get",url : "",data :"m=message&c=index&a=public_name",datatype : "html",async:'false',success : function(data){if( data == 1 ){return true;}else{return false;}},buttons: $("#dosubmit"),onerror : "没有此用户! ",onwait : "<?php echo L('connecting')?>"}); $("#code").formValidator({onshow:"请输入验证码",onfocus:"验证码不能为空"}).inputValidator({min:1,max:999,onerror:"验证码不能为空"}).ajaxValidator({ type : "get", url : "", data :"m=pay&c=deposit&a=public_checkcode", datatype : "html", async:'false', success : function(data){ if(data == 1) { return true; } else { return false; } }, buttons: $("#dosubmit"), onerror : "验证码错误", onwait : "验证中" }); }) $(function(){ $(".payment-show").each(function(i){ if(i==0){ $(this).addClass("payment-show-on"); } $(this).click( function(){ $(this).addClass("payment-show-on"); $(this).siblings().removeClass("payment-show-on"); } ) }); }) //--> </script> {template 'member', 'footer'}
108wo
phpcms/modules/message/install/templates/send.html
HTML
asf20
3,126
{template 'member', 'header'} <div id="memberArea"> {template 'member', 'left'} <div class="col-auto"> <div class="col-1 "> <h6 class="title">查看已发消息</h6> <div class="content"> <table width="100%" cellspacing="0" class="table_form"> <tr> <th><div align=center><img src="{IMG_PATH}member/nophoto.gif" width="50" height="50"><br><font color=red>{$infos['send_from_id']}</font></div></th> <td><b>{$infos['subject']}</b> - {date('Y-m-d H:i:s',$infos['inputtime'])}<br><br>{nl2br($infos['content'])}</td> </tr> {loop $reply_infos $reply_info} <tr> <th><div align=center><img src="{IMG_PATH}member/nophoto.gif" width="50" height="50"></img><br>{$reply_info['send_from_id']}</div></th> <td>{$reply_info['subject']} - {date('Y-m-d H:i:s',$reply_info['message_time'])}<br><br></br><b>{$reply_info['content']}</b></td> </tr> {/loop} </label></td> </tr> </table> </div> <span class="o1"></span><span class="o2"></span><span class="o3"></span><span class="o4"></span> </div> <div class="bk10"></div> </div> </div> {template 'member', 'footer'}
108wo
phpcms/modules/message/install/templates/read_only.html
HTML
asf20
1,187
<?php defined('IN_PHPCMS') or exit('Access Denied'); defined('INSTALL') or exit('Access Denied'); $parentid = $menu_db->insert(array('name'=>'message', 'parentid'=>29, 'm'=>'message', 'c'=>'message', 'a'=>'init', 'data'=>'', 'listorder'=>0, 'display'=>'1'), true); $menu_db->insert(array('name'=>'send_one', 'parentid'=>$parentid, 'm'=>'message', 'c'=>'message', 'a'=>'send_one', 'data'=>'', 'listorder'=>0, 'display'=>'1')); $menu_db->insert(array('name'=>'delete_message', 'parentid'=>$parentid, 'm'=>'message', 'c'=>'message', 'a'=>'delete', 'data'=>'', 'listorder'=>0, 'display'=>'0')); $menu_db->insert(array('name'=>'message_send', 'parentid'=>$parentid, 'm'=>'message', 'c'=>'message', 'a'=>'message_send', 'data'=>'', 'listorder'=>0, 'display'=>'0')); $menu_db->insert(array('name'=>'message_group_manage', 'parentid'=>$parentid, 'm'=>'message', 'c'=>'message', 'a'=>'message_group_manage', 'data'=>'', 'listorder'=>0, 'display'=>'1')); $language = array('message'=>'短消息', 'send_one'=>'发送消息', 'delete_message'=>'删除短消息', 'message_send'=>'群发短消息', 'message_group_manage'=>'群发短消息管理'); ?>
108wo
phpcms/modules/message/install/extention.inc.php
PHP
asf20
1,150
<?php defined('IN_PHPCMS') or exit('Access Denied'); defined('INSTALL') or exit('Access Denied'); $module = 'message'; $modulename = '短消息'; $introduce = '短消息模块'; $author = 'phpcms Team'; $authorsite = 'http://www.phpcms.cn'; $authoremail = ''; ?>
108wo
phpcms/modules/message/install/config.inc.php
PHP
asf20
272
INSERT INTO `phpcms_module` VALUES ('message', '短消息', '', '0', '1.0', '', '', '0', '0', '2010-09-06', '2010-09-06');
108wo
phpcms/modules/message/install/module.php
PHP
asf20
122
<?php $LANG['send_message'] = '发送短消息'; $LANG['all_send_message'] = '群发短消息'; $LANG['message'] = '短消息'; $LANG['send'] = '发送'; $LANG['sendto'] = '发送到'; $LANG['subject'] = '标题'; $LANG['content'] = '内容'; $LANG['setting'] = '配置'; $LANG['touserid'] = '收件人'; $LANG['fromuserid'] = '发件人'; $LANG['send_time'] = '发信时间'; $LANG['reply'] = '回复'; $LANG['is_reply'] = '是否回复'; $LANG['remove_all_selected'] = '删除选中'; $LANG['user_noempty'] = '收件人不能为空'; $LANG['username'] = '用户名'; $LANG['time'] = '时 间'; $LANG['see_info'] = '查看详情'; $LANG['no_empty'] = '不能为空'; $LANG['before_select_operation'] = '请选择再执行操作'; $LANG['no_thisuser'] = '没有此用户'; $LANG['connecting'] = '正在连接,请稍候。'; $LANG['group'] = '按会员组'; $LANG['role'] = '按角色'; $LANG['send_num'] = '每轮发送次数'; $LANG['select']['send_from_id'] = '发件人'; $LANG['select']['send_to_id'] = '收件人'; $LANG['not_myself'] = '禁止给自己或非注册用户发送消息'; $LANG['sendtime'] = '发送时间'; $LANG['show_m'] = '显示'; $LANG['details'] = '查看详情'; $LANG['message_sender'] = '发 信 人'; $LANG['query_type'] = '查询类型'; $LANG['to'] = '至'; $LANG['message_not_exist'] = '短消息不存在'; $LANG['mass_failure'] = '群发失败,请检查!'; ?>
108wo
phpcms/modules/message/install/languages/zh-cn/message.lang.php
PHP
asf20
1,557
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin'); ?> <div class="pad_10"> <form name="searchform" action="" method="get" > <input type="hidden" value="order" name="m"> <input type="hidden" value="order" name="c"> <input type="hidden" value="init" name="a"> <input type="hidden" value="<?php echo $_GET['menuid']; ?>" name="menuid"> <table width="100%" cellspacing="0" class="search-form"> <tbody> <tr> <td> <div class="explain-col"> 搜索类型:<select name="field"> <option value="oid">清单号</option> <option value="username">会员名</option> <option value="title">清单标题</option> </select> 关键字:<input type="text" name="keywords" value="" /> <input type="submit" name="search" class="button" value="<?php echo L('search')?>" /> </div> </td> </tr> </tbody> </table> </form> <div class="bk10"></div> <div class="table-list"> <div>注:<span style="color:orange;">黄色标题</span> 表示首选清单</div> <form action="" method="get"> <input type="hidden" name="m" value="order" /> <input type="hidden" name="c" value="order" /> <input type="hidden" name="a" id="action" value="delete" /> <table width="100%" cellspacing="0"> <thead> <tr> <th width="50"><input type="checkbox" value="" id="check_box" onclick="selectall('id[]');"></th> <th width="50">排序</th> <th>清单号</th> <th>会员名</th> <th>标题</th> <th>备注</th> <th>创建时间</th> <th>最后更新时间</th> <th>相关操作</th> </tr> </thead> <tbody> <?php if(is_array($data)) foreach($data as $v){ ?> <tr> <td width="50" align="center"><input type="checkbox" value="<?php echo $v['id']?>" name="id[]"></td> <td><input type="text" name="listorder[]" value="<?php echo $v['sort']?>" size="5" /></td> <td align="center"><?php echo $v['oid']?></td> <td align="center"><?php echo $v['username']?></td> <td align="center" <?php if($v['selected']==1) echo 'style="color:orange;"'; ?>><?php echo $v['title']?></td> <td align="center"><?php echo $v['note']?></td> <td align="center"><?php echo date('Y-m-d H:i:s', $v['inputtime'])?></td> <td align="center"><?php echo date('Y-m-d H:i:s', $v['updatetime'])?></td> <td align="center"><a href="?m=order&c=order&a=detail_list&oid=<?php echo $v['oid']?>">清单详情</a> | <a href="?m=order&c=order&a=delete&id=<?php echo $v['id']?>" onclick="return confirm('<?php echo htmlspecialchars(new_addslashes(L('confirm', array('message'=>$v['title']))))?>')">删除</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('delete')?>" onclick="return confirm('您确认删除么,该操作无法恢复!')" /> <input type="submit" class="button" name="dosubmit" onclick="$('#action').val('listorder')" value=" 更新排序 " </div> </from> </div> </div> <div id="pages"><?php echo $pages?></div> <script type="text/javascript"> window.top.$('#display_center_id').css('display','none'); </script> </body> </html>
108wo
phpcms/modules/order/templates/order_list.tpl.php
PHP
asf20
3,248
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin'); ?> <style type="text/css"> html{_overflow-y:scroll} </style> <script language="JavaScript" src="<?php echo JS_PATH; ?>jquery.imgpreview.js"></script> <script type="text/javascript"> $(document).ready(function(){ var obj=$("#imgPreview td.img[rel]"); if(obj.length>0) { $('#imgPreview td.img[rel]').imgPreview({ srcAttr: 'rel', imgCSS: { width: 200 } }); } }); </script> <div class="pad_10"> <div class="table-list"> <h3>清单:<?php echo $order['title']; ?> ( <?php echo $order['oid'];?> )</h3> <form action="" method="get"> <input type="hidden" name="m" value="order" /> <input type="hidden" name="c" value="order" /> <input type="hidden" name="a" id="action" value="delete" /> <input type="hidden" name="oid" id="action" value="<?php echo $_GET['oid']; ?>" /> <table width="100%" cellspacing="0" id="imgPreview"> <thead> <tr> <th width="50"><input type="checkbox" value="" id="check_box" onclick="selectall('id[]');"></th> <th>清单号</th> <th>会员名</th> <th>产品名称</th> <th>备注</th> <th>供应商/设计师</th> <th>创建时间</th> <th>最后更新时间</th> <th>相关操作</th> </tr> </thead> <tbody> <?php if(is_array($data)) foreach($data as $v){ ?> <tr> <td width="50" align="center"><input type="checkbox" value="<?php echo $v['id']?>" name="id[]"></td> <td align="center"><?php echo $v['oid']?></td> <td align="center"><?php echo $v['username']?></td> <td align="center" class="img" rel="<?php echo WEB_PATH.$v['thumb']?>"><?php echo $v['producttitle']?></td> <td align="center"><?php echo $v['note']?></td> <td align="center"><?php echo $v['suppliername']?></td> <td align="center"><?php echo date('Y-m-d H:i:s', $v['inputtime'])?></td> <td align="center"><?php echo date('Y-m-d H:i:s', $v['updatetime'])?></td> <td align="center"><a href="?m=order&c=order&a=detail_delete&oid=<?php echo $v['oid']?>&id=<?php echo $v['id']?>" onclick="return confirm('<?php echo htmlspecialchars(new_addslashes(L('confirm', array('message'=>$v['producttitle']))))?>')">删除</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('delete')?>" onclick="return confirm('您确认删除么,该操作无法恢复!')" /> </div> </from> </div> </div> <div id="pages"><?php echo $pages?></div> </body> </html>
108wo
phpcms/modules/order/templates/order_detail_list.tpl.php
PHP
asf20
2,650
<?php defined('IN_PHPCMS') or exit('No permission resources.'); class index { function __construct() { pc_base::load_app_func('global'); $this->order = pc_base::load_model('order_model');//投票标题 $this->username = param::get_cookie('_username'); $this->userid = param::get_cookie('_userid'); $this->ip = ip(); $siteid = isset($_GET['siteid']) ? intval($_GET['siteid']) : get_siteid(); define("SITEID",$siteid); if (!$this->userid) { $this->output(false, '您没有权限进行此操作,请您先登录!', APP_PATH.'index.php?m=member&c=index&a=login'); } } /** * 我的清单 * eddy */ public function lists() { $member_model = pc_base::load_model('member_model'); $memberinfo = $member_model->get_one(array('userid' => $this->userid)); $order_model = pc_base::load_model('order_model'); $content_total = $order_model->count('`userid`='.$this->userid); $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1; $pagesize = 12; $offset = ($page - 1) * $pagesize; $order_pages = pages($content_total, $page, $pagesize); $order_data = $order_model->select('`userid`='.$this->userid, '*', $offset.",".$pagesize, 'selected DESC, updatetime DESC'); $SEO['title'] = '我的清单 - 会员中心'; include template('order', 'order'); } /** * 更新 */ public function update() { $in = array_merge($_GET, $_POST); $in = new_addslashes($in); if (!isset($in['id'])) { $this->output(false, '参数不正确!'); } $id = intval($in['id']); if ($in['dosubmit'] == 1) { $order_title = htmlspecialchars(trim($in['title'])); if(empty($order_title)) { $this->output(false, '请输入清单标题!'); } if($this->order->count("`title`='".$order_title."' AND `id`!=".$id) > 0) { $this->output(false, '您已经存在同名的清单标题!'); } $data = array( 'userid' => $this->userid, 'title' => $order_title, 'selected' => (isset($in['selected']) && $in['selected']>0) ? 1 : 0, 'note' => htmlspecialchars(trim($in['note'])), 'inputtime' => time() ); if($this->order->update($data, array('id'=>$id))) { if($data['selected'] == 1) { //更新首选清单 $this->order->update(array('selected' => 0), '`userid`='.$this->userid. ' AND `id`!='.$id); } $this->output(true, '编辑清单成功!'); } else $this->output(false, '编辑清单失败!'); } else { $order = $this->order->get_one(array('id' => $id)); include template('order','update'); } } /** * 删除 */ public function delete() { $in = new_addslashes(array_merge($_GET, $_POST)); if (isset($in['id']) && intval($in['id'])) { $id = intval($in['id']); $order = $this->order->get_one(array('id'=>$id)); if ($this->userid != $order['userid']) { $this->output(false, '抱歉,您没有权限删除此清单!'); } if ($order && $this->order->delete(array('id'=>$id))) { //删除清单详情 $order_detail_model = pc_base::load_model('order_detail_model'); $order_detail_model->delete(array('oid'=>$order['oid'])); //重置首选清单 if($order['selected'] == 1) { $orders = $this->order->select(array('userid'=>$order['userid']), 'id', 1000, 'updatetime DESC'); if ($orders && !empty($orders)) { $this->order->update(array('selected'=>'1'), array('id'=>$orders[0]['id'])); } } } $this->output(true, '删除成功!'); } } /** * 下载 */ public function download() { $in = new_addslashes(array_merge($_GET, $_POST)); if(!class_exists('ZipArchive')) { showmessage('该服务器不支持ZIP压缩,请联系网站管理员!', HTTP_REFERER); } if (isset($_GET['id']) && intval($_GET['id'])) { $orderid = intval($_GET['id']); $order_model = pc_base::load_model('order_model'); $order = $order_model->get_one(array('id'=>$orderid)); $order_detail_model = pc_base::load_model('order_detail_model'); $order_detail_data = $order_detail_model->select(array('oid' => $order['oid'])); $CATEGORYS = getcache('category_content_'.get_siteid(),'commons'); $dirs = array(); $order_detail_titles = array(); foreach($order_detail_data AS &$val) { if ($val['topcatid'] > 0) { //判断是否重名 if (key_exists($val['producttitle'], $order_detail_titles[$val['topcatid']])) { $order_detail_titles[$val['topcatid']][$val['producttitle']]++; $val['producttitle'] = '('.$order_detail_titles[$val['topcatid']][$val['producttitle']].')'.$val['producttitle']; } else { $order_detail_titles[$val['topcatid']][$val['producttitle']] = 1; } if(!in_array($CATEGORYS[$val['topcatid']]['catname'], $dirs)) { $dirs[] = $CATEGORYS[$val['topcatid']]['catname']; } if (!empty($CATEGORYS[$val['topcatid']]['catname'])) { $val['producttitle'] = $CATEGORYS[$val['topcatid']]['catname'].'/'.$val['producttitle']; } } } if (!$order_detail_data) { showmessage('您要下载的清单没有添加产品!', HTTP_REFERER); } $year = date('Y', SYS_TIME); $month = date('m', SYS_TIME); $base_path = realpath(PC_PATH.'../uploadfile/order').'/'; if (!file_exists($base_path.$year)) { @mkdir($base_path.$year, 0775); } if (!file_exists($base_path.$year.'/'.$month)) { @mkdir($base_path.$year.'/'.$month, 0775); } $path = $base_path.$year.'/'.$month.'/'; //判断是否存在此清单压缩文件,如存在则删除 $dir = dir($path); while (false !== ($entry = $dir->read())) { if (strpos($entry, $order['oid'].'.zip')) { @unlink($path.$entry); } } $dir->close(); //创建清单压缩文件 $zip = new ZipArchive(); $filename = $order['oid'].'.zip'; if ($zip->open($path.$filename, ZIPARCHIVE::CREATE)!==TRUE) { showmessage('无法生成下载文件,请联系网站管理员!', HTTP_REFERER); } $zip->addEmptyDir(iconv("UTF-8", "GBK", $order['title'])); foreach($dirs as $dir) { $zip->addEmptyDir(iconv("UTF-8", "GBK", $order['title'].'/'.$dir)); } foreach ($order_detail_data AS $od) { $source = $od['thumb']; $localname = explode('/', $source); $localname = $localname[count($localname)-1]; $localname_ext = substr($localname, strpos($localname, '.')); $localname = iconv("UTF-8", "GBK", $order['title'].'/'.$od['producttitle'].$localname_ext); $zip->addFile($source, $localname); } $zip->close(); /** sleep(10); //延迟10秒 //执行下载 //判断要下载的文件是否存在 $file_path = $path.$filename; if(!file_exists($path.$filename)) { showmessage('对不起,你要下载的文件不存在!', HTTP_REFERER); } $file_size = filesize($file_path); header("Content-type: application/x-zip-compressed"); header("Accept-Ranges: bytes"); header("Accept-Length: $file_size"); header("Content-Disposition: attachment; filename=".$filename); $fp = fopen($file_path,"r"); $buffer_size = 1024; $cur_pos = 0; while(!feof($fp)&&$file_size-$cur_pos>$buffer_size) { $buffer = fread($fp,$buffer_size); echo $buffer; $cur_pos += $buffer_size; } $buffer = fread($fp,$file_size-$cur_pos); echo $buffer; fclose($fp); //unlink($file_path); */ header('Location:'.APP_PATH.'uploadfile/order/'.$year.'/'.$month.'/'.$filename); } else { showmessage('没有您要下载的清单!', HTTP_REFERER); } } /** * 更新备注 */ public function update_note() { $in = array_merge($_GET, $_POST); $in = new_addslashes($in); if (!isset($in['id']) || !intval($in['id'])) { $this->output(false, '参数不正确!'); } $id = intval($in['id']); if ($in['dosubmit'] == 1) { $data = array( 'note' => htmlspecialchars(trim($in['note'])) ); if($this->order->update($data, array('id'=>$id))) { $this->output(true, '编辑清单备注成功!'); } else $this->output(false, '编辑清单备注失败!'); } else { $order = $this->order->get_one(array('id' => $id)); include template('order','update_note'); } } /** * 创建清单 * Enter description here ... */ public function add() { $in = array_merge($_GET, $_POST); $in = new_addslashes($in); if ($in['dosubmit'] == 1) { $order_title = htmlspecialchars(trim($in['title'])); if(empty($order_title)) { $this->output(false, '请输入清单标题!'); } if($this->order->count("`title`='".$order_title."'") > 0) { $this->output(false, '您已经存在同名的清单标题!'); } //如果是第一个清单,默认首选 if (!$this->order->count('`userid`='.$this->userid)) { $in['selected'] = 1; } $data = array( 'userid' => $this->userid, 'title' => $order_title, 'selected' => (isset($in['selected']) && $in['selected']>0) ? 1 : 0, 'note' => htmlspecialchars(trim($in['note'])), 'inputtime' => time() ); if($data = $this->order->add($data)) { if($data['selected'] == 1) { //更新首选清单 $this->order->update(array('selected' => 0), '`userid`='.$this->userid. ' AND `id`!='.$data['id']); } $this->output(true, '添加清单成功!'); } else $this->output(false, '添加清单失败!'); } else { include template('order','add'); } } /** * 设置首选清单 * Enter description here ... * @param unknown_type $code * @param unknown_type $msg */ public function setSelected() { $id = intval($_GET['id']); if ($this->order->count('`userid`='.$this->userid. ' AND `id`='.$id)) { $this->order->update(array('selected' => 0), '`userid`='.$this->userid); $this->order->update(array('selected' => 1), '`id`='.$id); } } /** * 复制给好友 */ public function copy() { $in = array_merge($_GET, $_POST); $in = new_addslashes($in); $SEO = seo(get_siteid()); $id = intval($in['id']); $order = $this->order->get_one(array('id'=>$id)); $member_db = pc_base::load_model('member_model'); if ($in['dosubmit'] == 1) { $member = $member_db->get_one(array('username'=>$in['username']), 'userid,username'); if ($member) { //创建清单 if ($member['userid'] == $this->userid) { $this->output(false, '不能复制给自己!'); } $data = array( 'userid' => $member['userid'], 'title' => $order['title'], 'note' => $order['note'], 'parentid' => $this->userid, 'parentname' => $this->username, 'parentnickname' => param::get_cookie('_nickname'), 'selected' => 0, 'inputtime' => time(), ); if($data = $this->order->add($data)) { //复制清单详细 $order_detail_db = pc_base::load_model('order_detail_model'); $order_details = $order_detail_db->select(array('oid'=>$order['oid'])); foreach ($order_details AS $v) { $v['oid'] = $data['oid']; $v['ordertitle'] = $data['title']; $v['userid'] = $member['userid']; $v['username'] = $member['username']; $v['inputtime'] = time(); unset($v['id']); $order_detail_db->insert($v); } if (isset($in['sendmail']) && $in['sendmail']) { //发送邮件 pc_base::load_sys_func('mail'); $date = date('Y-m-d', time()); $_nickname = param::get_cookie('_nickname'); $rmessage = <<<str 尊敬的{$in['username']}: 您好! 您的好友({$_nickname} <{$this->username}>)给转发了新的清单。<a href="http://www.108wo.com/">立即查看</a> 。 本邮件由系统自动发送,请勿回复! {$SEO['name']} {$date} str; sendmail($in['username'], '来自108wo的清单转发信息', nl2br($rmessage)); } $this->output(true, '操作成功!'); } else $this->output(false, '操作失败!'); } else { $this->output(false, '不存在此会员!'); } } //获取最多的转发的会员 $arruserids = $this->order->select(array('parentid'=>$this->userid), 'userid', 100, 'count(parentid) DESC', 'userid'); $userids = $members = ''; if ($arruserids) { foreach ($arruserids AS $v) { $userids .= $v['userid'].','; } $userids = rtrim($userids, ','); if ($userids) $members = $member_db->select('`userid` IN('.$userids.')', 'userid,username,nickname', '', 'find_in_set(userid,"'.$userids.'")'); } include template('order','copy'); } protected function output($code, $msg, $url='') { $in = array_merge($_GET, $_POST); if($in['ajax']) { die(json_encode(array('code' => $code, 'msg' => $msg))); } else { $forward = !empty($url) ? $url : HTTP_REFERER; showmessage($msg, $forward); } } } ?>
108wo
phpcms/modules/order/index.php
PHP
asf20
13,273
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); class order extends admin { protected $order_db, $order_detail_db; function __construct() { parent::__construct(); $this->order_db = pc_base::load_model('order_model'); $this->order_detail_db = pc_base::load_model('order_detail_model'); } public function init() { $where = '1'; if (isset($_GET['keywords']) && $_GET['keywords']!='') { if ($_GET['field']=='title' || $_GET['field']=='oid') { $where .= ' AND `'.$_GET['field'].'`="'.mysql_escape_string($_GET['keywords']).'"'; } else { $user_db = pc_base::load_model('member_model'); $user = $user_db->get_one(array('username'=>$_GET['keywords']), 'userid'); if ($user) { $where .= ' AND `userid`="'.mysql_escape_string($user['userid']).'"'; } } } $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1; $data = $this->order_db->listinfo($where,'id desc', $page, 20); $pages = $this->order_db->pages; $member_model = pc_base::load_model('member_model'); foreach ($data AS &$d) { $memberinfo = $member_model->get_one(array('userid' => $d['userid']), 'username'); $d['username'] = $memberinfo['username']; } include $this->admin_tpl('order_list'); } public function delete() { if($_GET['id']){ if(is_array($_GET['id'])){ $_GET['id'] = implode(',', $_GET['id']); $this->order_db->query("DELETE FROM `".$this->order_db->db_tablepre."order` WHERE `id` in ($_GET[id])"); }else{ $this->order_db->query("DELETE FROM `".$this->order_db->db_tablepre."order` WHERE `id` in ($_GET[id])"); } showmessage('操作成功', '?m=order&c=order&a=init'); }else{ showmessage('参数不正确', '?m=order&c=order&a=init'); } } public function listorder(){ $ids = $_GET['id']; if($ids){ foreach($ids as $n=>$id){ if(!$id)continue; $this->order_db->update('`sort`='.intval($_GET['listorder'][$n]), array('id'=>$id)); } showmessage('更新成功!', '?m=order&c=order&a=init'); }else{ showmessage('参数不正确', '?m=order&c=order&a=init'); } } /** * 清单详情列表 * */ public function detail_list() { $order = $this->order_db->get_one(array('oid'=>$_GET['oid'])); $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1; $data = $this->order_detail_db->listinfo(array('oid'=>$_GET['oid']),'id desc', $page, 20); $pages = $this->order_detail_db->pages; include $this->admin_tpl('order_detail_list'); } /** * 清单详情列表删除 */ public function detail_delete() { if($_GET['id']){ if(is_array($_GET['id'])){ $_GET['id'] = implode(',', $_GET['id']); $this->order_detail_db->query("DELETE FROM `".$this->order_detail_db->db_tablepre."order_detail` WHERE `id` in ($_GET[id])"); }else{ $this->order_detail_db->query("DELETE FROM `".$this->order_detail_db->db_tablepre."order_detail` WHERE `id` in ($_GET[id])"); } showmessage('操作成功', '?m=order&c=order&a=detail_list&oid='.$_GET['oid']); }else{ showmessage('参数不正确', '?m=order&c=order&a=detail_list&oid='.$_GET['oid']); } } /** * 更新缓存 */ public function cache() { $num = 100; if (!isset($_GET['total'])) { $total = $this->order_detail_db->count(); } else { $total = $_GET['total']; } if (!isset($_GET['limit'])) { $limit = 0; } else { $limit = intval($_GET['limit']); } if ($limit > $total) { showmessage('更新完成', APP_PATH.'index.php?m=brand&c=brand'); } $data = $this->order_detail_db->select('', 'id,bid', $limit.','.$num, 'id DESC'); $brand_db = pc_base::load_model('brand_model'); foreach ($data AS $v) { $update_data = array(); if ($v['bid'] > 0) { $brand = $brand_db->get_one(array('id'=>$v['bid']), 'id,parentid,pcompanyname,prealname,pqq,paddress,ptel'); if ($brand) { if ($brand['parentid']!=0) { $brand = $brand_db->get_one(array('id'=>$brand['parentid']), 'id,parentid,pcompanyname,prealname,pqq,paddress,ptel'); } $update_data['companyname'] = $brand['pcompanyname']; $update_data['nickname'] = $brand['prealname']; $update_data['qq'] = $brand['pqq']; $update_data['tel'] = $brand['ptel']; } } else { $update_data['companyname'] = ''; $update_data['nickname'] = ''; $update_data['qq'] = ''; $update_data['tel'] = ''; } if ($update_data) { $this->order_detail_db->update($update_data, array('id'=>$v['id'])); } } if ($limit+$num > $total) { showmessage('更新完成', APP_PATH.'index.php?m=brand&c=brand'); } else { showmessage('已完成'.intval($limit+$num).'/'.$total.'!', APP_PATH.'index.php?m=order&c=order&a=cache&limit='.intval($limit+$num).'&total='.$total.'&menuid='.$_GET['menuid'].'&pc_hash='.$_GET['pc_hash']); } } } ?>
108wo
phpcms/modules/order/order.php
PHP
asf20
5,121
<?php defined('IN_PHPCMS') or exit('No permission resources.'); class vote_tag { public function __construct() { $this->subject_db = pc_base::load_model('vote_subject_model'); $this->option_db = pc_base::load_model('vote_option_model'); } /** * 显示 * @param $data */ public function show($data) { $subjectid = $data['subjectid'];//投票ID if($subjectid){ if(is_int($subjectid)) return false; $sql = array('subjectid'=>$subjectid); }else { $sql = ''; } return $this->subject_db->select($sql, '*', $data['limit']); } /** * 其它投票 * @param $data */ public function other_vote($data) { $siteid = $_GET['siteid']; $sql = array('siteid'=>$siteid); return $this->subject_db->select($sql, '*', $data['limit'], $data['order']); } /** * 投票热度排行 * @param $data 传入的数组参数 */ public function hits($data) { $siteid = intval($data['siteid']); $enabled = $data['enabled']?$data['enabled'] : 1;//状态:是否启用 if (empty($siteid)){ $siteid = get_siteid(); } switch ($enabled) { case all://不限 $sql = array('siteid'=>$siteid); break; default://默认按选择项 $sql = array('siteid'=>$siteid,'enabled'=>$enabled); } return $this->subject_db->select($sql, '*', $data['limit'], 'votenumber '.$data['order']); } /** * * 投票列表 * @param $data 数组参数 */ public function lists($data) { $siteid = intval($data['siteid']); $enabled = $data['enabled']?$data['enabled'] : 1;//状态:是否启用 $order = $data['order']?$data['order'] : 'subjectid desc';//状态:是否启用 if (empty($siteid)){ $siteid = get_siteid(); } switch ($enabled) { case all://不限 $sql = array('siteid'=>$siteid); break; default://默认按选择项 $sql = array('siteid'=>$siteid,'enabled'=>$enabled); } return $this->subject_db->select($sql, '*', $data['limit'], $order); } /** * 投票概况 */ public function get_vote($data) { $subjectid = intval($data['subjectid']); if (empty($subjectid)) return false; return $this->subject_db->get_one(array('subjectid'=>$subjectid)); } /** * 计数 */ public function count($data) { if(isset($data['where'])) { $sql = $data['where']; } else { $siteid = intval($data['siteid']); $enabled = $data['enabled']?$data['enabled'] : 1;//状态:是否启用 if (empty($siteid)){ $siteid = get_siteid(); } switch ($enabled) { case all://不限 $sql = array('siteid'=>$siteid); break; default://默认按选择项 $sql = array('siteid'=>$siteid,'enabled'=>$enabled); } return $this->subject_db->count($sql); } } /** * pc 标签调用 */ public function pc_tag() { $sites = pc_base::load_app_class('sites','admin'); $sitelist = $sites->pc_tag_list(); return array( 'action'=>array('lists'=>L('list','', 'comment'),'get_vote'=>L('vote_overview','','vote')), 'lists'=>array( 'siteid'=>array('name'=>L('site_id', '', 'comment'),'htmltype'=>'input_select', 'data'=>$sitelist,'validator'=>array('min'=>1)), 'enabled'=>array('name'=>L('vote_status','','vote'), 'htmltype'=>'select', 'data'=>array('all'=>L('vote_Lockets','','vote'),'1'=>L('vote_use','','vote'), '0'=>L('vote_lock','','vote'))), 'order'=>array('name'=>L('sort', '', 'comment'), 'htmltype'=>'select','data'=>array('subjectid desc'=>L('subjectid_desc', '', 'vote'), 'subjectid asc'=>L('subjectid_asc', '', 'vote'))), ), 'get_vote'=>array( 'subjectid'=>array('name'=>L('vote_voteid','','vote'),'htmltype'=>'input', 'validator'=>array('min'=>1)), ), ); } }
108wo
phpcms/modules/order/classes/vote_tag.class.php
PHP
asf20
3,815
<?php defined('IN_PHPCMS') or exit('No permission resources.'); class order_detail { function __construct() { pc_base::load_app_func('global'); $this->order_detail = pc_base::load_model('order_detail_model');//投票标题 $this->username = param::get_cookie('_username'); $this->userid = param::get_cookie('_userid'); $this->ip = ip(); $siteid = isset($_GET['siteid']) ? intval($_GET['siteid']) : get_siteid(); define("SITEID",$siteid); if (!$this->userid) { $this->output(false, '您没有权限进行此操作,请您先登录!', APP_PATH.'index.php?m=member&c=index&a=login'); } } public function add() { $in = array_merge($_GET, $_POST); $in = new_addslashes($in); //查询首选清单 $order_model= pc_base::load_model('order_model'); $order = $order_model->get_one('`userid`='.$this->userid.' AND selected=1'); if (!$order) { $this->output(false, '请您先创建清单号!'); } $content_model = pc_base::load_model('content_model'); $content_model->set_model(13); $product = $content_model->get_one('id='.$in['productid']); if (!$product) { $this->output(false, '抱歉,不存在此产品!'); } //栏目 $CATEGORYS = getcache('category_content_'.SITEID,'commons'); $cat = $CATEGORYS[$product['catid']]; $arrparentid = explode(',', $cat['arrparentid']); $topcat = $CATEGORYS[$arrparentid[2]]; //品牌 $top_bid = (empty($product['bids']) ? '' : array_shift(explode(',', $product['bids']))); if ($top_bid) { $brand_db = pc_base::load_model('brand_model'); $brand = $brand_db->get_one(array('id'=>$top_bid)); } if ($brand['userid']) { $member_model = pc_base::load_model('member_model'); $member = $member_model->get_one('userid='.$brand['userid']); $member_model->set_model($member['modelid']); $member_ext = $member_model->get_one(array('userid' => $brand['userid'])); $member = array_merge($member, $member_ext); if ($member['vip'] == 1 && $member['overduedate'] > SYS_TIME) { $member_vip = true; } } //查询此清单已有数据数量 $has_num = $this->order_detail->count(array('oid' => $order['oid'], 'userid' => $this->userid)); if ($has_num > 200) { $this->output(false, '添加失败,每个清单最多200个产品!'); } //检测是否已存在于此清单中 if ($this->order_detail->count(array('oid' => $order['oid'], 'userid' => $this->userid, 'productid' => intval($in['productid'])))) { $this->output(true, '加入清单成功!'); } //插入数据 $data = array( 'oid' => $order['oid'], 'ordertitle' => $order['title'], 'topcatid' => $topcat['catid'], 'catid' => $product['catid'], 'bid' => ($top_bid ? $top_bid : ''), 'userid' => $this->userid, 'username' => $this->username, 'supplierid' => isset($brand['userid']) ? $brand['userid'] : '', 'nickname' => (isset($brand['prealname']) && $member_vip) ? $brand['prealname'] : '', 'suppliername' => (isset($member['username']) && $member_vip) ? $member['username'] : '', 'companyname' => (isset($brand['pcompanyname']) && $member_vip) ? $brand['pcompanyname'] : '', 'qq' => (isset($brand['pqq']) && $member_vip) ? $brand['pqq'] : '', 'tel' => (isset($brand['ptel']) && $member_vip) ? $brand['ptel'] : '', 'productid' => intval($in['productid']), 'producttitle' => $product['title'], 'thumb' => substr($product['thumb'], strpos($product['thumb'], 'uploadfile/')), 'note' => '', 'inputtime' => time() ); //查找上一次添加的产品备注信息 $old_order_detail = $this->order_detail->get_one(array('userid'=>$this->userid, 'productid'=>intval($in['productid'])), 'note'); if ($old_order_detail && $old_order_detail['note']!='') { $data['note'] = $old_order_detail['note']; } if ($insertid = $this->order_detail->insert($data, true)) { //更新加入清单次数 $ordernum = $product['ordernum'] + 1; $monthordernum = (date('Ym', $product['updatetime']) == date('Ym', SYS_TIME)) ? ($product['monthordernum'] + 1) : 1; $sql = array('ordernum'=>$ordernum,'monthordernum'=>$monthordernum,'updatetime'=>SYS_TIME); $content_model->update($sql, array('id'=>$product['id'])); $this->output(true, '加入清单成功!'); } else { $this->output(true, '加入清单失败!'); } } /** * 我的清单 详情 * eddy */ public function lists() { $member_model = pc_base::load_model('member_model'); $memberinfo = $member_model->get_one(array('userid' => $this->userid)); //关联栏目 eddy //$category_model = pc_base::load_model('category_model'); //$memberinfo['category'] = $category_model->get_one(array('userid' => $this->userid)); if (isset($_GET['id']) && intval($_GET['id'])) { $id = intval($_GET['id']); $order_model = pc_base::load_model('order_model'); $order_model->update(array('look'=>1), 'id='.$id); //更新为已读状态 $order = $order_model->get_one('id='.$id); if (!$order) { showmessage("没有此清单~", 'index.php?m=order&c=index&a=lists'); } if ($order['userid'] != $this->userid) { showmessage("抱歉,此清单不是您所创建的~", 'index.php?m=member&c=index&a=order'); } $order_detail_model = pc_base::load_model('order_detail_model'); $where = array('oid' => $order['oid']); /*if(!isset($_GET['topcatid'])) { $cat_db = pc_base::load_model('category_model'); $topcat = $cat_db->get_one(array('parentid'=>TOP_PRODUCT_CATID), 'catid'); $_GET['topcatid'] = $topcat['catid']; }*/ if (isset($_GET['topcatid']) && $_GET['topcatid'] > 0) { $_GET['topcatid'] = intval($_GET['topcatid']); $where['topcatid'] = intval($_GET['topcatid']); } $content_total = $order_detail_model->count($where); $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1; $pagesize = 10; $offset = ($page - 1) * $pagesize; $order_detail_pages = pages($content_total, $page, $pagesize); $order_detail_data = $order_detail_model->select($where, '*', $offset.",".$pagesize, 'updatetime DESC'); //获取顶部分类 $categorys = getcache('category_content_'.SITEID,'commons'); $topcategorys = array(); foreach ($categorys AS $catid=>$cat) { if ($cat['parentid'] == 7) { if($siteid && $cat['siteid']!=$siteid) continue; if (strpos($cat['url'], '://') === false) { $cat['url'] = substr($site['domain'],0,-1).$cat['url']; } $cat['productnum'] = 0; $topcategorys[$catid] = $cat; } } //计算每个分类下的产品数量 $order_detail_data2 = $order_detail_model->select(array('oid' => $order['oid']), '*', "200", 'updatetime DESC'); foreach ($order_detail_data2 AS &$order_detail) { if (isset($topcategorys[$order_detail['topcatid']])) { $topcategorys[$order_detail['topcatid']]['productnum']++; } } $SEO['title'] = '我的清单 - 会员中心'; include template('order', 'order_detail'); } else { showmessage("参数错误~", 'index.php?m=member&c=index&a=order'); } } /** * 更新备注 * Enter description here ... * @param unknown_type $code * @param unknown_type $msg * @param unknown_type $url */ public function update_note() { $in = new_addslashes(array_merge($_GET, $_POST)); $this->order_detail->update(array('note'=> trim($in['note'])), array('id' => intval($in['id']))); $this->output(true, "备注更新成功!"); } /** * 删除 * Enter description here ... */ public function delete() { $in = new_addslashes(array_merge($_GET, $_POST)); if (isset($in['id']) && intval($in['id'])) { $id = intval($in['id']); $this->order_detail->delete(array('id'=>$id)); $this->output(true, '删除成功!'); } } /** * 询价 * Enter description here ... * @param unknown_type $code * @param unknown_type $msg * @param unknown_type $url */ public function update_price() { $in = new_addslashes(array_merge($_GET, $_POST)); if (!isset($in['id'])) { $this->output(false, '参数错误!'); } $id = intval($in['id']); $order_detail = $this->order_detail->get_one(array('id'=>$id)); switch ($order_detail['enquiry']) { case 0: //开始询价 $this->order_detail->update(array('enquiry'=>1, 'enquirytime' => SYS_TIME), array('id'=>$id)); $this->output(true, '询价成功,等待供应商提供价格!'); break; case 1: //回复询价 case 2: if (!isset($in['price'])) { $this->output(false, '您提供的价格数据不规范!'); } $price = floatval($in['price']); $this->order_detail->update(array('enquiry'=>2, 'price'=>$price), array('id'=>$id)); $this->output(true, '价格发送成功!'); break; } } protected function output($code, $msg, $url='') { $in = array_merge($_GET, $_POST); if($in['ajax']) { die(json_encode(array('code' => $code, 'msg' => $msg))); } else { $forward = !empty($url) ? $url : HTTP_REFERER; showmessage($msg, $forward); } } } ?>
108wo
phpcms/modules/order/order_detail.php
PHP
asf20
9,143
<?php defined('IN_PHPCMS') or exit('Access Denied'); defined('INSTALL') or exit('Access Denied'); return array('order'); ?>
108wo
phpcms/modules/order/install/model.php
PHP
asf20
129
<?php defined('IN_PHPCMS') or exit('Access Denied'); defined('INSTALL') or exit('Access Denied'); $module = 'order'; $modulename = '清单管理'; $introduce = '清单管理模块'; $author = 'eddy0909'; $authorsite = '#'; $authoremail = ''; ?>
108wo
phpcms/modules/order/install/config.inc.php
PHP
asf20
254
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin');?> <script type="text/javascript"> $(document).ready(function() { $.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}}); $("#name").formValidator({onshow:"请输入分类名称",onfocus:"分类名称不能为空"}).inputValidator({min:1,max:999,onerror:"分类名称不能为空"}); }) </script> <div class="pad_10"> <div class="common-form"> <form name="myform" action="?m=brand&c=brand&a=editClass&bid=<?php echo $brand['id']; ?>" method="post" id="myform"> <table width="100%" class="table_form contentWrap"> <tr> <td>当前品牌</td> <td> <?php echo $brand['name']; ?> </td> </tr> <tr> <td>分类名称</td> <td> <input type="text" name="info[name]" value="<?php echo $brand['name']; ?>" class="input-text" id="name" size="30"></input> </td> </tr> </table> <div class="bk15"></div> <input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="dialog" id="dosubmit"> </form> </div> </div> </body> </html>
108wo
phpcms/modules/brand/templates/brand_editClass.tpl.php
PHP
asf20
1,075
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin');?> <script type="text/javascript"> $(document).ready(function() { $.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}}); $("#name").formValidator({onshow:"请输入品牌名称",onfocus:"品牌名称不能为空"}).inputValidator({min:1,max:999,onerror:"品牌名称不能为空"}); $("#child").formValidator({onshow:"多个分类请用 , 隔开",onfocus:"多个分类请用 , 隔开"}); }) </script> <div class="pad_10"> <div class="common-form"> <form name="myform" action="?m=brand&c=brand&a=add" method="post" id="myform"> <table width="100%" class="table_form contentWrap"> <tr> <td>品牌名称</td> <td> <input type="text" name="info[name]" value="" class="input-text" id="name" size="30"></input> </td> </tr> <tr> <td>所属栏目</td> <td> <select name="info[catid_1]" id="catid_1"> <?php foreach ($cats AS $v) { echo "<option value='".$v['catid']."'>".$v['catname']."</option>"; } ?> </select> <select name="info[catid_2]" id="catid_2"> <?php foreach ($cats[0]['child'] AS $v) { echo "<option value='".$v['catid']."'>".$v['catname']."</option>"; } ?> </select> </td> </tr> <tr> <td>关联会员</td> <td> <select name="info[userid]"> <?php foreach ($members AS $u) { echo "<option value='".$u['userid']."'>".$u['username']."</option>"; } ?> </select> </td> </tr> <tr> <td>供应商名称</td> <td><input type="text" name="info[pcompanyname]" value="" class="input-text" id="pcompanyname" size="30"></input></td> </tr> <tr> <td>联系人姓名</td> <td><input type="text" name="info[prealname]" value="" class="input-text" id="prealname" size="30"></input></td> </tr> <tr> <td>联系人QQ</td> <td><input type="text" name="info[pqq]" value="" class="input-text" id="pqq" size="30"></input></td> </tr> <tr> <td>联系人电话</td> <td><input type="text" name="info[ptel]" value="" class="input-text" id="ptel" size="30"></input></td> </tr> <tr> <td>营销地址</td> <td><input type="text" name="info[paddress]" value="" class="input-text" id="paddress" size="30"></input></td> </tr> <tr> <td>分类列表</td> <td> <input type="text" name="info[child]" value="" class="input-text" id="child" size="40" /> </td> </tr> </table> <div class="bk15"></div> <input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="dialog" id="dosubmit"> </form> </div> </div> <script type="text/javascript"> var cats = <?php echo $cats_json; ?>; $(function(){ $("#catid_1").change(function(){ var catid_1 = this.value; var html=""; for(i in cats) { if(cats[i].catid == catid_1) { for(j in cats[i].child) { html += "<option value='"+cats[i].child[j].catid+"'>"+cats[i].child[j].catname+"</option>"; } $("#catid_2").html(html); } } }); }); </script> </body> </html>
108wo
phpcms/modules/brand/templates/brand_add.tpl.php
PHP
asf20
2,887
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin');?> <script type="text/javascript"> $(document).ready(function() { $.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}}); $("#name").formValidator({onshow:"请输入品牌名称",onfocus:"品牌名称不能为空"}).inputValidator({min:1,max:999,onerror:"品牌名称不能为空"}); $("#child").formValidator({onshow:"多个分类请用 , 隔开",onfocus:"多个分类请用 , 隔开"}); }) </script> <div class="pad_10"> <div class="common-form"> <form name="myform" action="?m=brand&c=brand&a=edit&bid=<?php echo $brand['id']; ?>&dosubmit=1" method="post" id="myform"> <table width="100%" class="table_form contentWrap"> <tr> <td>品牌名称</td> <td> <input type="text" name="info[name]" value="<?php echo $brand['name']; ?>" class="input-text" id="name" size="30"></input> </td> </tr> <tr> <td>所属栏目</td> <td> <select name="info[catid_1]" id="catid_1"> <?php foreach ($cats AS $v) { echo "<option value='".$v['catid']."'".($cat_1['catid']==$v['catid'] ? " selected":"").">".$v['catname']."</option>"; } ?> </select> <select name="info[catid_2]" id="catid_2"> <?php foreach ($cats AS $v) { if ($v['catid'] == $cat_1['catid']) { foreach ($v['child'] AS $v2) { echo "<option value='".$v2['catid']."'".($cat_2['catid']==$v2['catid'] ? " selected":"").">".$v2['catname']."</option>"; } } } ?> </select> </td> </tr> <tr> <td>关联会员</td> <td> <select name="info[userid]"> <?php foreach ($members AS $u) { echo "<option value='".$u['userid']."'".($brand['userid']==$u['userid'] ? ' selected':'').">".$u['username']."</option>"; } ?> </select> </td> </tr> <tr> <td>供应商名称</td> <td><input type="text" name="info[pcompanyname]" value="<?php echo $brand['pcompanyname']; ?>" class="input-text" id="pcompanyname" size="30"></input></td> </tr> <tr> <td>联系人姓名</td> <td><input type="text" name="info[prealname]" value="<?php echo $brand['prealname']; ?>" class="input-text" id="prealname" size="30"></input></td> </tr> <tr> <td>联系人QQ</td> <td><input type="text" name="info[pqq]" value="<?php echo $brand['pqq']; ?>" class="input-text" id="pqq" size="30"></input></td> </tr> <tr> <td>联系人电话</td> <td><input type="text" name="info[ptel]" value="<?php echo $brand['ptel']; ?>" class="input-text" id="ptel" size="30"></input></td> </tr> <tr> <td>营销地址</td> <td><input type="text" name="info[paddress]" value="<?php echo $brand['paddress']; ?>" class="input-text" id="paddress" size="30"></input></td> </tr> </table> <div class="bk15"></div> <input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="dialog" id="dosubmit"> </form> </div> </div> <script type="text/javascript"> var cats = <?php echo $cats_json; ?>; $(function(){ $("#catid_1").change(function(){ var catid_1 = this.value; var html=""; for(i in cats) { if(cats[i].catid == catid_1) { for(j in cats[i].child) { html += "<option value='"+cats[i].child[j].catid+"'>"+cats[i].child[j].catname+"</option>"; } $("#catid_2").html(html); } } }); }); </script> </body> </html>
108wo
phpcms/modules/brand/templates/brand_edit.tpl.php
PHP
asf20
3,218
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin');?> <script type="text/javascript"> $(document).ready(function() { $.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}}); $("#name").formValidator({onshow:"请输入分类名称",onfocus:"分类名称不能为空"}).inputValidator({min:1,max:999,onerror:"分类名称不能为空"}); }) </script> <div class="pad_10"> <div class="common-form"> <form name="myform" action="?m=brand&c=brand&a=addClass&bid=<?php echo $_GET['bid']; ?>" method="post" id="myform"> <table width="100%" class="table_form contentWrap"> <tr> <td>当前品牌</td> <td> <?php echo $brand['name']; ?> </td> </tr> <tr> <td>分类名称</td> <td> <input type="text" name="info[name]" value="" class="input-text" id="name" size="30"></input> </td> </tr> </table> <div class="bk15"></div> <input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="dialog" id="dosubmit"> </form> </div> </div> </body> </html>
108wo
phpcms/modules/brand/templates/brand_addClass.tpl.php
PHP
asf20
1,045
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin');?> <script type="text/javascript"> var cats = <?php echo $cats_json; ?>; $(function(){ $("#catid_1").change(function(){ var catid_1 = this.value; var html="<option value='all'>全部</option>"; if(catid_1 == 'all') { $("#catid_2").html(html); return ; } for(i in cats) { if(cats[i].catid == catid_1) { for(j in cats[i].child) { html += "<option value='"+cats[i].child[j].catid+"'>"+cats[i].child[j].catname+"</option>"; } $("#catid_2").html(html); } } }); }); </script> <div class="pad_10"> <form name="searchform" action="" method="get" > <input type="hidden" value="brand" name="m"> <input type="hidden" value="brand" name="c"> <input type="hidden" value="init" name="a"> <input type="hidden" value="<?php echo $_GET['menuid']; ?>" name="menuid"> <table width="100%" cellspacing="0" class="search-form"> <tbody> <tr> <td> <div class="explain-col"> 所属栏目:<select name="info[catid_1]" id="catid_1"> <option value="all">全部</option> <?php foreach ($cats AS $v) { echo "<option value='".$v['catid']."' ".($_GET['info']['catid_1']==$v['catid'] ? ' selected':'').">".$v['catname']."</option>"; } ?> </select> <select name="info[catid_2]" id="catid_2"> <option value="all">全部</option> <?php foreach ($cats[0]['child'] AS $v) { echo "<option value='".$v['catid']."' ".($_GET['info']['catid_2']==$v['catid'] ? ' selected':'').">".$v['catname']."</option>"; } ?> </select> 关联会员: <select name="info[userid]"> <?php foreach ($members AS $u) { echo "<option value='".$u['userid']."' ".($_GET['info']['userid']==$u['userid'] ? ' selected':'').">".$u['username']."</option>"; } ?> </select> <input type="submit" name="search" class="button" value="<?php echo L('search')?>" /> </div> </td> </tr> </tbody> </table> </form> <div class="bk10"></div> <div class="table-list"> <table width="100%" cellspacing="0"> <thead> <tr> <th width="6%">ID</th> <th align="left" >名称</th> <th align="left" >所属栏目</th> <th width="15%" align="left" >关联会员</th> <th width="10%" >创建时间</th> <th width="15%" >管理操作</th> </tr> </thead> <tbody> <?php if(is_array($infos)){ foreach($infos as $info){ ?> <tr> <td align="center"><?php echo $info['id']?></td> <td><?php echo ($info['parentid']>0 ? "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" : "").$info['name']?></td> <td><?php echo $info['top_catname']?></td> <td><?php echo $info['username']?></td> <td><?php echo date('Y-m-d H:i', $info['create_time']); ?></td> <td> <?php if ($info['parentid']==0) { ?> <a href="javascript:void(0);" onclick="addClass('<?php echo $info['id']; ?>','<?php echo new_addslashes($info['name']); ?>')">添加分类</a> | <a href="javascript:void(0);" onclick="edit('<?php echo $info['id']?>','<?php echo new_addslashes($info['name'])?>')"><?php echo L('edit')?></a> | <a href="javascript:confirmurl('?m=brand&c=brand&a=delete&bid=<?php echo $info['id']?>', '确认删除?')"><?php echo L('delete')?></a> <?php } else {?> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0);" onclick="editClass('<?php echo $info['id']?>','<?php echo new_addslashes($info['name'])?>')"><?php echo L('edit')?></a> | <a href="javascript:confirmurl('?m=brand&c=brand&a=delete&bid=<?php echo $info['id']?>', '确认删除?')"><?php echo L('delete')?></a> <?php }?> </td> </tr> <?php } } ?> </tbody> </table> </div> <div id="pages"><?php echo $pages?></div> </div> <script type="text/javascript"> <!-- window.top.$('#display_center_id').css('display','none'); function edit(id, name) { window.top.art.dialog({id:'edit'}).close(); window.top.art.dialog({title:name,id:'edit',iframe:'?m=brand&c=brand&a=edit&bid='+id,width:'500',height:'400'}, 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 addClass(id, name) { window.top.art.dialog({id:'addClass'}).close(); window.top.art.dialog({title:name+' 添加分类',id:'addClass',iframe:'?m=brand&c=brand&a=addClass&bid='+id,width:'500',height:'100'}, function(){var d = window.top.art.dialog({id:'addClass'}).data.iframe;d.document.getElementById('dosubmit').click();return false;}, function(){window.top.art.dialog({id:'addClass'}).close()}); } function editClass(id, name) { window.top.art.dialog({id:'editClass'}).close(); window.top.art.dialog({title:name,id:'editClass',iframe:'?m=brand&c=brand&a=editClass&bid='+id,width:'500',height:'250'}, function(){var d = window.top.art.dialog({id:'editClass'}).data.iframe;d.document.getElementById('dosubmit').click();return false;}, function(){window.top.art.dialog({id:'editClass'}).close()}); } //--> </script> </body> </html>
108wo
phpcms/modules/brand/templates/brand_manage.tpl.php
PHP
asf20
5,106
<?php /** * 会员前台品牌管理 */ defined('IN_PHPCMS') or exit('No permission resources.'); class index{ private $db; public $siteid; public $memberinfo; /** * 我的品牌 * Enter description here ... */ function __construct() { $this->db = pc_base::load_model('brand_model'); $this->siteid = get_siteid(); //获取当前用户信息 $memberModel = pc_base::load_model('member_model'); $userid = param::get_cookie('_userid'); if (!$userid) { showmessage("您的会话已过期,请重新登录!", "?m=content"); } //验证用户,获取用户信息 $this->memberinfo = $memberModel->get_one(array('userid'=>$userid)); //获取用户模型信息 $memberModel->set_model($this->memberinfo['modelid']); $this->_member_modelinfo = $memberModel->get_one(array('userid'=>$userid)); $this->_member_modelinfo = $this->_member_modelinfo ? $this->_member_modelinfo : array(); $memberModel->set_model(); if(is_array($this->memberinfo)) { $this->memberinfo = array_merge($this->memberinfo, $this->_member_modelinfo); } } /** * 品牌列表 */ public function init() { $in = new_addslashes(array_merge($_GET, $_POST)); $siteid = get_siteid(); $CATEGORYS = getcache('category_content_'.$siteid,'commons'); $total = $this->db->count(array('parentid'=>0, 'userid'=>$this->memberinfo['userid'])); $brands = $this->db->select(array('userid'=>$this->memberinfo['userid']), 'id,name,parentid,top_catname', '', 'sort DESC, parentid ASC'); $memberinfo = $this->memberinfo; $SEO['title'] = '我的品牌 - 会员中心'; include template('brand', 'init'); } /** * 添加品牌 */ public function add() { $memberinfo = $this->memberinfo; $catModel = pc_base::load_model('category_model'); if ($memberinfo['doupload'] != 1) { die('抱歉,您暂时没有权限执行添加操作,请联系管理员开启!'); } if ($_POST['dosubmit'] == 1) { //判断供应商品牌数量 最多添加6个品牌 if ($this->db->count(array('parentid'=>0, 'userid'=>$this->memberinfo['userid'])) > 5) { showmessage('最多添加6个品牌!'); } $catid_1 = intval($_POST['info']['catid_1']); $catid_2 = intval($_POST['info']['catid_2']); $cat_1 = $catModel->get_one(array('catid'=>$catid_1), 'catid,catname'); $cat_2 = $catModel->get_one(array('catid'=>$catid_2), 'catid,catname'); $data = array( 'userid' => $memberinfo['userid'], 'username' => $memberinfo['username'], 'catid' => $catid_2, 'top_catname' => $cat_1['catname'].' > '.$cat_2['catname'], 'name' => $_POST['info']['name'], 'parentid' => 0, 'create_time' => SYS_TIME, 'pcompanyname' => $_POST['info']['pcompanyname'] ? $_POST['info']['pcompanyname']:$memberinfo['companyname'], 'prealname' => $_POST['info']['prealname'] ? $_POST['info']['prealname']:$memberinfo['realname'], 'pqq' => $_POST['info']['pqq'] ? $_POST['info']['pqq']:$memberinfo['qq'], 'ptel' => $_POST['info']['ptel'] ? $_POST['info']['ptel']:$memberinfo['tel'], 'paddress' => $_POST['info']['paddress'] ? $_POST['info']['paddress']:$memberinfo['address'], ); if ($bid = $this->db->insert($data, true)) { $this->db->update(array('sort'=>$bid), 'id='.$bid); //添加子类 if (!empty($_POST['info']['child'])) { $_POST['info']['child'] = str_replace(',', ',', $_POST['info']['child']); $childs = explode(',', $_POST['info']['child']); foreach ($childs as $v) { $data['parentid'] = $bid; $data['name'] = trim($v); $data['sort'] = $bid; $this->db->insert($data); } } showmessage('操作成功!'); } else { showmessage('添加失败!'); } } //栏目 $cats = array(); $first_cats = $catModel->select(array('parentid' => TOP_PRODUCT_CATID, 'ismenu'=>1), 'catid, catname'); foreach ($first_cats AS $v) { $v['child'] = $catModel->select(array('parentid' => $v['catid']), 'catid, catname'); if ($v['child']) { $cats[] = $v; } } $cats_json = json_encode($cats); include template('brand', 'add'); } /** * 添加分类 */ public function addClass() { $memberinfo = $this->memberinfo; if (!intval($_GET['id'])) { showmessage('品牌不存在'); } $brand = $this->db->get_one(array('id'=>intval($_GET['id']))); if ($brand['parentid'] != 0) { showmessage('数据错误!'); } if ($memberinfo['userid'] != $brand['userid']) { showmessage('您没有权限对该品牌进行添加分类操作!'); } if (isset($_POST['info']['name'])) { $catModel = pc_base::load_model('category_model'); $data = array( 'userid' => $brand['userid'], 'username' => $brand['username'], 'catid' => $brand['catid'], 'top_catname' => $brand['top_catname'], 'name' => $_POST['info']['name'], 'parentid' => $brand['id'], 'sort' => $brand['id'], 'create_time' => SYS_TIME ); if ($this->db->insert($data)) { showmessage('操作成功!'); }else { showmessage('添加失败!'); } } include template('brand', 'addClass'); } /** * 编辑品牌 * */ public function edit() { $bid = intval($_GET['id']); $brand = $this->db->get_one('`id`='.$bid); $memberinfo = $this->memberinfo; $catModel = pc_base::load_model('category_model'); if ($_POST['dosubmit']) { $update_data = array( 'name' => $_POST['info']['name'], ); //栏目 /*if ($_POST['info']['catid_2'] != $brand['catid']) { $cat_2 = $catModel->get_one('catid='.$_POST['info']['catid_2'], 'catid,catname,parentid'); $cat_1 = $catModel->get_one('catid='.$cat_2['parentid'], 'catid,catname,parentid'); $update_data['catid'] = $cat_2['catid']; $update_data['top_catname'] = $cat_1['catname'].' > '.$cat_2['catname']; }*/ //会员 if ($brand['userid'] != $_POST['info']['userid']) { $update_data['pcompanyname'] = ($_POST['info']['pcompanyname'] ? $_POST['info']['pcompanyname']:$memberinfo['companyname']); $update_data['prealname'] = ($_POST['info']['prealname'] ? $_POST['info']['prealname']:$memberinfo['realname']); $update_data['pqq'] = ($_POST['info']['pqq'] ? $_POST['info']['pqq']:$memberinfo['qq']); $update_data['ptel'] = ($_POST['info']['ptel'] ? $_POST['info']['ptel']:$memberinfo['tel']); $update_data['paddress'] = ($_POST['info']['paddress'] ? $_POST['info']['paddress']:$memberinfo['address']); } $this->db->update($update_data, array('id'=>$bid)); //更新子分类 unset($update_data['name']); $this->db->update($update_data, array('parentid'=>$bid)); //更新关联产品信息 /*if (isset($cat_2['catid']) && $cat_2['catid']>0) { $this->db->updateRelativeProduct($brand['id'], $cat_2['catid']); }*/ showmessage('操作成功!'); } //栏目 $cats = array(); $first_cats = $catModel->select(array('parentid' => TOP_PRODUCT_CATID, 'ismenu'=>1), 'catid, catname'); foreach ($first_cats AS $v) { $v['child'] = $catModel->select(array('parentid' => $v['catid']), 'catid, catname'); if ($v['child']) { $cats[] = $v; } } $cats_json = json_encode($cats); $cat_2 = $catModel->get_one('catid='.$brand['catid'], 'catid,catname,parentid'); $cat_1 = $catModel->get_one('catid='.$cat_2['parentid'], 'catid,catname,parentid'); include template('brand', 'edit'); } /** * 更新分类 */ public function editClass() { $bid = intval($_GET['id']); $brand = $this->db->get_one('`id`='.$bid); if ($_POST['dosubmit'] == 1) { $this->db->update(array('name'=>$_POST['info']['name']), '`id`='.$bid); showmessage('操作成功!'); } include template('brand', 'editClass'); } /** * 删除品牌 */ public function delete() { $bid = intval($_GET['id']); if ($bid > 0) { $brands = $this->db->select('`id`='.$bid.' OR `parentid`='.$bid, 'id'); $ids = $bid; foreach ($brands AS $v) { $ids .= ','.$v['id']; } if (!empty($ids)) { $content_model = pc_base::load_model('content_model'); $content_model->set_model(13); //只针对产品模型 $content_model->update(array('bids'=>""), '`bids` IN('.$ids.')'); } $this->db->delete("`id`=".$bid." or `parentid`=".$bid); } header('Location:'.APP_PATH.'index.php?m=brand'); } /** * 栏目转换成品牌 */ public function change() { set_time_limit(0); $default_userid = 39; $default_username = '108wo@163.com'; $top_catid = TOP_PRODUCT_CATID; $cat_db = pc_base::load_model('category_model'); $cat_priv_db = pc_base::load_model('category_priv_model'); $content_db = pc_base::load_model('content_model'); $content_db->set_model(13); $brand_db = pc_base::load_model('brand_model'); $hits_db = pc_base::load_model('hits_model'); $tags_content_db = pc_base::load_model('tags_content_model'); $attachment_db = pc_base::load_model('attachment_model'); $attachment_index_db = pc_base::load_model('attachment_index_model'); $user_db = pc_base::load_model('member_model'); //$user_db->set_model(); //10供应商 12设计师 $level1_cats = $cat_db->select('parentid='.$top_catid, 'catid,catname'); foreach ($level1_cats AS $l1) { $level1_catid = $l1['catid']; $level1_catname = $l1['catname']; $level2_cats = $cat_db->select('parentid='.$level1_catid, 'catid,catname'); foreach ($level2_cats AS $l2) { //获取3级栏目 $level3_cats = $cat_db->select('parentid='.$l2['catid'], 'catid,userid,catname'); if ($level3_cats) { foreach ($level3_cats AS $l3) { //创建品牌 if (!$l3['userid']) { $l3['userid'] = $default_userid; } $level3_user = $user_db->get_one(array('userid'=>$l3['userid']), 'userid,username,modelid'); $user_db->set_model($level3_user['modelid']); $level3_user = array_merge($level3_user, $user_db->get_one(array('userid'=>$l3['userid']))); $user_db->set_model(""); $level1_brand = array( 'userid' => ($level3_user['userid'] ? $level3_user['userid'] : ''), 'username' => ($level3_user['username'] ? $level3_user['username'] : ''), 'catid' => $l2['catid'], 'top_catname' => $level1_catname.' > '.$l2['catname'], 'name' => $l3['catname'], 'parentid' => 0, 'sort' => 0, 'pcompanyname' => $level3_user['companyname'], 'prealname' => $level3_user['realname'], 'pqq' => $level3_user['qq'], 'paddress' => $level3_user['address'], 'ptel' => $level3_user['tel'], ); $level1_bid = $this->insertBrand($level1_brand); $level4_cats = $cat_db->select('parentid='.$l3['catid'], 'catid,userid,catname'); if ($level4_cats) { //存在4级栏目 foreach ($level4_cats AS $l4) { //创建分类 $level2_brand = $level1_brand; $level2_brand['name'] = $l4['catname']; $level2_brand['parentid'] = $level1_bid; $level2_brand['sort'] = $level1_id; $level2_bid = $this->insertBrand($level2_brand); //更新内容 $content_list = $content_db->select('catid='.$l4['catid'], 'id,catid'); if ($content_list) { foreach ($content_list AS $c) { $content_db->update(array('catid'=>$l2['catid'], 'bids'=>$level2_bid), 'id='.$c['id']); $hits_db->update(array('catid'=>$l2['catid']), 'hitsid="c-13-'.$c['id'].'"'); $tags_content_db->update(array('catid'=>$l2['catid'], 'contentid='.$c['id'])); //附件关联表 $att = $attachment_index_db->select(array('keyid'=>'c-'.$c['catid'].'-'.$c['id']), 'keyid,aid'); if ($att) { foreach ($att AS $at) { $attachment_index_db->update(array('keyid'=>'c-'.$l2['catid'].'-'.$c['id']), 'keyid="'.$at['keyid'].'"'); } } } } //更新附件表 $attachment_db->update(array('catid'=>$l2['catid']), 'catid='.$l4['catid']); //删除栏目 $cat_db->delete(array('catid'=>$l4['catid'])); $cat_priv_db->delete(array('catid'=>$l4['catid'])); } } else { //没有4级栏目 //更新内容 $content_list = $content_db->select('catid='.$l3['catid'], 'id,catid'); if ($content_list) { foreach ($content_list AS $c) { $content_db->update(array('catid'=>$l2['catid'], 'bids'=>$level1_bid), 'id='.$c['id']); $hits_db->update(array('catid'=>$l2['catid']), 'hitsid="c-13-'.$c['id'].'"'); $tags_content_db->update(array('catid'=>$l2['catid'], 'contentid='.$c['id'])); //附件关联表 $att = $attachment_index_db->select(array('keyid'=>'c-'.$c['catid'].'-'.$c['id']), 'keyid,aid'); if ($att) { foreach ($att AS $at) { $attachment_index_db->update(array('keyid'=>'c-'.$l2['catid'].'-'.$c['id']), 'keyid="'.$at['keyid'].'"'); } } } } } //更新附件表 $attachment_db->update(array('catid'=>$l2['catid']), 'catid='.$l3['catid']); //删除栏目 $cat_db->delete(array('catid'=>$l3['catid'])); $cat_priv_db->delete(array('catid'=>$l3['catid'])); unset($level3_user); } } } } die('over!'); } /** * 添加品牌 */ private function insertBrand($data) { $brand_db = pc_base::load_model('brand_model'); $data['create_time'] = time(); $insert_id = $brand_db->insert($data, true); if ($data['sort'] == 0) { $brand_db->update(array('sort'=>$insert_id), 'id='.$insert_id); } return $insert_id; } /** * 转换清单中的商品 */ public function changeOrderDetail() { set_time_limit(0); $cat_db = pc_base::load_model('category_model'); $cat_priv_db = pc_base::load_model('category_priv_model'); $content_db = pc_base::load_model('content_model'); $content_db->set_model(13); $brand_db = pc_base::load_model('brand_model'); $order_detail_db = pc_base::load_model('order_detail_model'); $order_details = $order_detail_db->select('','id,productid'); foreach ($order_details AS $od) { $product = $content_db->get_one(array('id'=>$od['productid']), 'id,catid,title,bids'); if ($product) { $catid = $product['catid']; if ($product['bids']) { $brand = $brand_db->get_one(array('id'=>$product['bids'])); if ($brand) { if ($brand['parentid']==0) { $bid = $brand['id']; } else { $bid = $brand['parentid']; } $update_data = array( 'catid' => $catid, 'bid' => $bid, 'supplierid' => $brand['userid'], 'suppliername' => $brand['username'], 'companyname' => $brand['pcompanyname'], 'nickname' => $brand['prealname'], 'qq' => $brand['pqq'], 'tel' => $brand['ptel'], ); $order_detail_db->update($update_data, 'id='.$od['id']); } } } } die('OVER'); } }
108wo
phpcms/modules/brand/index.php
PHP
asf20
15,024
<?php /** * 后台品牌管理 */ defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); class brand extends admin { private $db; public $siteid; function __construct() { parent::__construct(); $this->db = pc_base::load_model('brand_model'); $this->siteid = $this->get_siteid(); } /** * 品牌管理列表 */ public function init() { $catModel = pc_base::load_model('category_model'); $where = '1'; if (isset($_GET['info']['catid_1']) && $_GET['info']['catid_1']>0) { if (isset($_GET['info']['catid_2']) && $_GET['info']['catid_2']>0) { $where .= ' AND `catid`='.$_GET['info']['catid_2']; } else { $cat_1 = $catModel->get_one("`catid`=".$_GET['info']['catid_1'], 'arrchildid'); $where .= ' AND `catid` IN('.$cat_1['arrchildid'].')'; } } if (isset($_GET['info']['userid']) && $_GET['info']['userid']>0) { $where .= ' AND `userid`='.$_GET['info']['userid']; } $order = 'sort DESC, parentid ASC'; $page = (isset($_GET['page']) && $_GET['page']>0) ? $_GET['page'] : 1; $pagesize = 20; $infos = $this->db->listinfo($where, $order, $page, $pagesize); $pages = $this->db->pages; $memberModel = pc_base::load_model('member_model'); //栏目 $cats = array(); $first_cats = $catModel->select(array('parentid' => TOP_PRODUCT_CATID), 'catid, catname'); foreach ($first_cats AS $v) { $v['child'] = $catModel->select(array('parentid' => $v['catid']), 'catid, catname'); if ($v['child']) { $cats[] = $v; } } if (!$cats) { showmessage('请先添加栏目', WEB_PATH.'/index.php?m=admin&c=category', '', 'add'); } $cats_json = json_encode($cats); //会员 $where = '`groupid`=6 AND `vip`=1 AND `overduedate`>'.SYS_TIME; $members = $memberModel->select($where, 'userid, username', '', 'username ASC'); $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=brand&c=brand&a=add\', title:\'添加品牌\', width:\'560\', height:\'400\', 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);', '添加品牌'); include $this->admin_tpl('brand_manage'); } /** * 添加 */ public function add() { $catModel = pc_base::load_model('category_model'); $memberModel = pc_base::load_model('member_model'); if (isset($_POST['info']['name'])) { $catid_1 = intval($_POST['info']['catid_1']); $catid_2 = intval($_POST['info']['catid_2']); $cat_1 = $catModel->get_one(array('catid'=>$catid_1), 'catid,catname'); $cat_2 = $catModel->get_one(array('catid'=>$catid_2), 'catid,catname'); $user = $memberModel->get_one(array('userid'=>$_POST['info']['userid']), 'userid,username,modelid'); $memberModel->set_model($user['modelid']); $user = $memberModel->get_one(array('userid'=>$_POST['info']['userid'])); $data = array( 'userid' => $user['userid'], 'username' => $user['username'], 'catid' => $catid_2, 'top_catname' => $cat_1['catname'].'-'.$cat_2['catname'], 'name' => $_POST['info']['name'], 'parentid' => 0, 'create_time' => SYS_TIME, 'pcompanyname' => $_POST['info']['pcompanyname'] ? $_POST['info']['pcompanyname']:$user['companyname'], 'prealname' => $_POST['info']['prealname'] ? $_POST['info']['prealname']:$user['realname'], 'pqq' => $_POST['info']['pqq'] ? $_POST['info']['pqq']:$user['qq'], 'ptel' => $_POST['info']['ptel'] ? $_POST['info']['ptel']:$user['tel'], 'paddress' => $_POST['info']['paddress'] ? $_POST['info']['paddress']:$user['address'], ); if ($bid = $this->db->insert($data, true)) { $this->db->update(array('sort'=>$bid), 'id='.$bid); //添加子类 if (!empty($_POST['info']['child'])) { $_POST['info']['child'] = str_replace(',', ',', $_POST['info']['child']); $childs = explode(',', $_POST['info']['child']); foreach ($childs as $v) { $data['parentid'] = $bid; $data['name'] = trim($v); $data['sort'] = $bid; $this->db->insert($data); } } showmessage(L('operation_success'), '', '', 'add'); } } //栏目 $cats = array(); $first_cats = $catModel->select(array('parentid' => TOP_PRODUCT_CATID), 'catid, catname'); foreach ($first_cats AS $v) { $v['child'] = $catModel->select(array('parentid' => $v['catid']), 'catid, catname'); if ($v['child']) { $cats[] = $v; } } if (!$cats) { showmessage('请先添加栏目', '/index.php?m=admin&c=category', '', 'add'); } $cats_json = json_encode($cats); //会员 $where = '`groupid`=6 AND `vip`=1 AND `overduedate`>'.SYS_TIME; $members = $memberModel->select($where, 'userid, username', '', 'username ASC'); $show_header = true; $show_validator = true; include $this->admin_tpl('brand_add'); } /** * 添加分类 */ public function addClass() { if (!intval($_GET['bid'])) { showmessage('品牌不存在', '', '', 'add'); } $brand = $this->db->get_one(array('id'=>intval($_GET['bid']))); if (isset($_POST['info']['name'])) { $catModel = pc_base::load_model('category_model'); $data = array( 'userid' => $brand['userid'], 'username' => $brand['username'], 'catid' => $brand['catid'], 'top_catname' => $brand['top_catname'], 'name' => $_POST['info']['name'], 'parentid' => $brand['id'], 'sort' => $brand['id'], 'create_time' => SYS_TIME ); if ($this->db->insert($data)) { showmessage(L('operation_success'), '', '', 'addClass'); } } $show_header = true; $show_validator = true; include $this->admin_tpl('brand_addClass'); } /** * 编辑品牌 * */ public function edit() { $bid = intval($_GET['bid']); $brand = $this->db->get_one('`id`='.$bid); $catModel = pc_base::load_model('category_model'); $memberModel = pc_base::load_model('member_model'); if ($_GET['dosubmit'] && $_POST['info']['name']) { $update_data = array( 'name' => $_POST['info']['name'], ); //栏目 if ($_POST['info']['catid_2'] != $brand['catid']) { $cat_2 = $catModel->get_one('catid='.$_POST['info']['catid_2'], 'catid,catname,parentid'); $cat_1 = $catModel->get_one('catid='.$cat_2['parentid'], 'catid,catname,parentid'); $update_data['catid'] = $cat_2['catid']; $update_data['top_catname'] = $cat_1['catname'].'-'.$cat_2['catname']; } //会员 $user = $memberModel->get_one(array('userid'=>$_POST['info']['userid']), 'userid,username,modelid'); $memberModel->set_model($user['modelid']); $user = array_merge($user,$memberModel->get_one(array('userid'=>$_POST['info']['userid']))); $update_data['userid'] = $user['userid']; $update_data['username'] = $user['username']; $update_data['pcompanyname'] = ($_POST['info']['pcompanyname'] ? $_POST['info']['pcompanyname']:$user['companyname']); $update_data['prealname'] = ($_POST['info']['prealname'] ? $_POST['info']['prealname']:$user['realname']); $update_data['pqq'] = ($_POST['info']['pqq'] ? $_POST['info']['pqq']:$user['qq']); $update_data['ptel'] = ($_POST['info']['ptel'] ? $_POST['info']['ptel']:$user['tel']); $update_data['paddress'] = ($_POST['info']['paddress'] ? $_POST['info']['paddress']:$user['address']); $this->db->update($update_data, array('id'=>$bid)); //更新子分类 unset($update_data['name']); $this->db->update($update_data, array('parentid'=>$bid)); //更新关联产品信息 if (isset($cat_2['catid']) && $cat_2['catid']>0) { $this->db->updateRelativeProduct($brand['id'], $cat_2['catid']); } showmessage('操作成功!', '', '', 'edit'); } //栏目 $cats = array(); $first_cats = $catModel->select(array('parentid' => TOP_PRODUCT_CATID), 'catid, catname'); foreach ($first_cats AS $v) { $v['child'] = $catModel->select(array('parentid' => $v['catid']), 'catid, catname'); if ($v['child']) { $cats[] = $v; } } if (!$cats) { showmessage('请先添加栏目', '/index.php?m=admin&c=category', '', 'add'); } $cats_json = json_encode($cats); //会员 $where = '`groupid`=6 AND `vip`=1 AND `overduedate`>'.SYS_TIME; $members = $memberModel->select($where, 'userid, username', '', 'username ASC'); $cat_2 = $catModel->get_one('catid='.$brand['catid'], 'catid,catname,parentid'); $cat_1 = $catModel->get_one('catid='.$cat_2['parentid'], 'catid,catname,parentid'); $show_header = true; $show_validator = true; include $this->admin_tpl('brand_edit'); } /** * 更新分类 */ public function editClass() { $bid = intval($_GET['bid']); $brand = $this->db->get_one('`id`='.$bid); if (isset($_POST['info']['name']) && !empty($_POST['info']['name'])) { $this->db->update(array('name'=>$_POST['info']['name']), '`id`='.$bid); showmessage('操作成功 !', '', '', 'editClass'); } $show_header = true; $show_validator = true; include $this->admin_tpl('brand_editClass'); } /** * 删除品牌 */ public function delete() { $bid = intval($_GET['bid']); if ($bid > 0) { $brands = $this->db->select('`id`='.$bid.' OR `parentid`='.$bid, 'id'); $ids = $bid; foreach ($brands AS $v) { $ids .= ','.$v['id']; } if (!empty($ids)) { $content_model = pc_base::load_model('content_model'); $content_model->set_model(13); //只针对产品模型 $content_model->update(array('bids'=>""), '`bids` IN('.$ids.')'); } $this->db->delete("`id`=".$bid." or `parentid`=".$bid); showmessage('操作成功!', APP_PATH.'index.php?m=brand&c=brand'); } else { showmessage('操作失败!', APP_PATH.'index.php?m=brand&c=brand'); } } /** * 更新品牌缓存 */ public function cache() { set_time_limit(0); $user_db = pc_base::load_model('member_model'); $cat_db = pc_base::load_model('category_model'); $brands = $this->db->select(); foreach ($brands AS $v) { if ($v['userid']=="") { $this->db->delete('`id`='.$v['id'].' OR `parentid`='.$v['id']); continue; } $update_data = array(); if ($v['userid'] && $v['pcompanyname']=='' && $v['prealname']=='' && $v['ptel']=='' && $v['paddress']=='') { $user = $user_db->get_one(array('userid'=>$v['userid']), 'userid,username,modelid'); $user_db->set_model($user['modelid']); $user = array_merge($user, $user_db->get_one(array('userid'=>$v['userid']))); $user_db->set_model(""); $update_data = array( 'pcompanyname' => $user['companyname'], 'prealname' => $user['realname'], 'pqq' => $user['qq'], 'paddress' => $user['address'], 'ptel' => $user['tel'], ); } if ($v['catid']) { $cat_2 = $cat_db->get_one(array('catid'=>$v['catid']), 'catid,catname,parentid,arrparentid'); $update_data['top_catname'] = $cat_2['catname']; if (count(explode(',', $cat_2['arrparentid'])) == 3) { $cat_1 = $cat_db->get_one(array('catid'=>$cat_2['parentid']), 'catid,catname,arrparentid'); $update_data['top_catname'] = $cat_1['catname'] . ' > ' . $cat_2['catname']; } } if ($update_data) { $this->db->update($update_data, '`id`='.$v['id']); } } showmessage('更新成功!', APP_PATH.'index.php?m=brand&c=brand&a=init'); } }
108wo
phpcms/modules/brand/brand.php
PHP
asf20
11,338
<?php defined('IN_PHPCMS') or exit('Access Denied'); defined('INSTALL') or exit('Access Denied'); return array('brand'); ?>
108wo
phpcms/modules/brand/install/model.php
PHP
asf20
129
<?php defined('IN_PHPCMS') or exit('Access Denied'); defined('INSTALL') or exit('Access Denied'); $module = 'brand'; $modulename = '品牌管理'; $introduce = '品牌管理模块'; $author = 'eddy0909'; $authorsite = '#'; $authoremail = ''; ?>
108wo
phpcms/modules/brand/install/config.inc.php
PHP
asf20
254
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin'); ?> <div class="pad-lr-10"> <div class="table-list"> <form action="?m=template&c=style&a=updatename" method="post"> <table width="100%" cellspacing="0"> <thead> <tr> <th width="80"><?php echo L("style_identity")?></th> <th><?php echo L("style_chinese_name")?></th> <th><?php echo L("author")?></th> <th><?php echo L("style_version")?></th> <th><?php echo L("status")?></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['dirname']?></td> <td align="center"><input type="text" name="name[<?php echo $v['dirname']?>]" value="<?php echo $v['name']?>" /></td> <td align="center"><?php if($v['homepage']) {echo '<a href="'.$v['homepage'].'" target="_blank">';}?><?php echo $v['author']?><?php if($v['homepage']) {echo '</a>';}?></td> <td align="center"><?php echo $v['version']?></td> <td align="center"><?php if($v['disable']){echo L('icon_locked');}else{echo L("icon_unlock");}?></td> <td align="center" width="150"><a href="?m=template&c=style&a=disable&style=<?php echo $v['dirname']?>"><?php if($v['disable']){echo L("enable");}else{echo L('disable');}?></a> | <a href="?m=template&c=file&a=init&style=<?php echo $v['dirname']?>"><?php echo L("detail")?></a> | <a href="?m=template&c=style&a=export&style=<?php echo $v['dirname']?>"><?php echo L('export')?></a></td> </tr> <?php endforeach; endif; ?> </tbody> </table> <div class="btn"><input type="submit" class="button" name="dosubmit" value="<?php echo L('submit')?>" /></div> </form> </div> </div> <div id="pages"><?php echo $pages?></div> </body> </html>
108wo
phpcms/modules/template/templates/style_list.tpl.php
PHP
asf20
1,838
<?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();})}}); $("#cache").formValidator({onshow:"<?php echo L("enter_the_cache_input_will_not_be_cached")?>",onfocus:"<?php echo L("enter_the_cache_input_will_not_be_cached")?>",empty:true}).regexValidator({regexp:"num1",datatype:'enum',param:'i',onerror:"<?php echo L("cache_time_can_only_be_positive")?>"}); $("#num").formValidator({onshow:"<?php echo L('input').L("num")?>",onfocus:"<?php echo L('input').L("num")?>",empty:true}).regexValidator({regexp:"num1",datatype:'enum',param:'i',onerror:"<?php echo L('that_shows_only_positive_numbers')?>"}); $("#return").formValidator({onshow:"<?php echo L("please_enter_the_data_returned_value_by_default")?>:data。",onfocus:"<?php echo L("please_enter_the_data_returned_value_by_default")?>:data。",empty:true}); show_action('<?php echo $_GET['action']?>'); }) function show_action(obj) { $('.pc_action_list').hide(); $('#action_'+obj).show(); } //--> </script> <div class="pad-10"> <form action="?m=template&c=file&a=edit_pc_tag&style=<?php echo $this->style?>&dir=<?php echo $dir?>&file=<?php echo urlencode($file)?>&op=<?php echo $op?>&tag_md5=<?php echo $_GET['tag_md5']?>" method="post" id="myform"> <fieldset> <legend><?php echo L("module_configuration")?></legend> <table width="100%" class="table_form"> <tr> <th width="80"><?php echo L("module")?>:</th> <td class="y-bg"><?php echo $op?></td> </tr> <tr> <th width="80"><?php echo L('operation')?>:</th> <td class="y-bg"> <?php if(isset($html['action']) && is_array($html['action'])) { foreach($html['action'] as $key=>$value) { $checked = $_GET['action']==$key ? 'checked' : ''; echo '<label><input type="radio" name="action" onclick="location.href=\'?'.creat_url($key).'\'" '.$checked.' value="'.$key.'"> '.$value."</label>"; } }?></td> </tr> <?php if(isset($html[$_GET['action']]) && is_array($html[$_GET['action']])): foreach($html[$_GET['action']] as $k=>$v): ?> <tr> <th width="80"><?php echo $v['name']?>:</th> <td class="y-bg"><?php echo creat_form($k,$v,$_GET[$k], $op)?></td> </tr> <?php if(isset($v['ajax']['name']) && !empty($v['ajax']['name'])) {?> <tr> <th width="80"><?php echo $v['ajax']['name']?>:<?php if(isset($_GET[$v['ajax']['id']]) && !empty($_GET[$v['ajax']['id']])) echo '<script type="text/javascript">$.get(\'?m=template&c=file&a=public_ajax_get\', { html: \''.$_GET[$k].'\', id:\''.$v['ajax']['id'].'\', value:\''.$_GET[$v['ajax']['id']].'\', action: \''.$v['ajax']['action'].'\', op: \''.$op.'\', style: \'default\'}, function(data) {$(\'#'.$k.'_td\').html(data)});</script>'?></th> <td class="y-bg"><input type="text" size="20" value="<?php echo $_GET[$v['ajax']['id']]?>" id="<?php echo $v['ajax']['id']?>" name="<?php echo $v['ajax']['id']?>" class="input-text"><span id="<?php echo $k?>_td"></span></td> </tr> <?php }?> <?php endforeach;endif;?> </table> </fieldset> <div class="bk15"></div> <fieldset> <legend><?php echo L('vlan')?></legend> <table width="100%" class="table_form"> <tr> <th width="80"><?php echo L("public_allowpageing")?>:</th> <td class="y-bg"><input type="radio" name="page" value="$page"<?php if (isset($_GET['page'])) {echo ' checked';}?> /> <?php echo L("yes")?> <input type="radio" name="page" value=""<?php if (!isset($_GET['page'])) {echo ' checked';}?> /> <?php echo L("no")?></td> </tr> <tr> <th width="80"><?php echo L("num")?>:</th> <td class="y-bg"><input type="text" name="num" id="num" size="30" value="<?php echo $_GET['num']?>" /></td> </tr> <tr> <th width="80"><?php echo L("check")?>:</th> <td class="y-bg"><input type="text" name="return" id="return" size="30" value="<?php echo $_GET['return']?>" /> </td> </tr> <tr> <th width="80"><?php echo L("buffer_time")?>:</th> <td class="y-bg"><input type="text" name="cache" id="cache" size="30" value="<?php echo $_GET['cache']?>" /> </td> </tr> </table> </fieldset> <input type="submit" class="dialog" id="dosubmit" name="dosubmit" value="<?php echo L('submit')?>" /> </div> </form> </body> </html>
108wo
phpcms/modules/template/templates/pc_tag_modules.tpl.php
PHP
asf20
4,557
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin'); ?> <style type="text/css"> html{_overflow:hidden} .frmaa{float:left;width:80%; min-width: 870px; _width:870px;} .rraa{float: right; width:230px;} .pt{margin-top: 4px;} </style> <body style="overflow:hidden"> <div class="pad-10" style="padding-bottom:0px"> <div class="col-right"> <h3 class="f14"><?php echo L('common_variables')?></h3> <input type="button" class="button pt" onClick="javascript:insertText('{CSS_PATH}')" value="{CSS_PATH}" title="<?php echo L('click_into')?>"/><br /> <input type="button" class="button pt" onClick="javascript:insertText('{JS_PATH}')" value="{JS_PATH}" title="<?php echo L('click_into')?>"/><br /> <input type="button" class="button pt" onClick="javascript:insertText('{IMG_PATH}')" value="{IMG_PATH}" title="<?php echo L('click_into')?>"/><br /> <input type="button" class="button pt" onClick="javascript:insertText('{APP_PATH}')" value="{APP_PATH}" title="<?php echo L('click_into')?>"/><br /> <input type="button" class="button pt" onClick="javascript:insertText('{get_siteid()}')" value="{get_siteid()}" title="获取站点ID"/><br /> <input type="button" class="button pt" onClick="javascript:insertText('{loop $data $n $r}')" value="{loop $data $n $r}" title="<?php echo L('click_into')?>"/><br /> <input type="button" class="button pt" onClick="javascript:insertText('{$r[\'url\']}')" value="{$r['url']}" title="<?php echo L('click_into')?>"/><br /> <input type="button" class="button pt" onClick="javascript:insertText('{$r[\'title\']}')" value="{$r['title']}" title="<?php echo L('click_into')?>"/><br /> <input type="button" class="button pt" onClick="javascript:insertText('{$r[\'thumb\']}')" value="{$r['thumb']}" title="<?php echo L('click_into')?>"/><br /> <input type="button" class="button pt" onClick="javascript:insertText('{strip_tags($r[description])}')" value="{strip_tags($r[description])}" title="<?php echo L('click_into')?>"/><br /> <?php if (is_array($file_t_v[$file_t])) { foreach($file_t_v[$file_t] as $k => $v) {?> <input type="button" class="button pt" onClick="javascript:insertText('<?php echo $k?>')" value="<?php echo $k?>" title="<?php echo $v ? $v :L('click_into')?>"/><br /> <?php } }?> </div> <div class="col-auto"> <form action="?m=template&c=file&a=edit_file&style=<?php echo $this->style?>&dir=<?php echo $dir?>&file=<?php echo $file?>" method="post" name="myform" id="myform"> <textarea name="code" id="code" style="height: 280px;width:96%; visibility:inherit"><?php echo $data?></textarea> <div class="bk10"></div> <input type="text" id="text" value="" /><input type="button" class="button" onClick="fnSearch()" value="<?php echo L('find_code')?>" /> <?php if ($is_write==0){echo '<font color="red">'.L("file_does_not_writable").'</font>';}?> <?php if (module_exists('tag')) {?><input type="button" class="button" onClick="create_tag()" value="<?php echo L('create_tag')?>" /> <input type="button" class="button" onClick="select_tag()" value="<?php echo L('select_tag')?>" /> <?php }?> <BR><input type="submit" id="dosubmit" class="button pt" name="dosubmit" value="<?php echo L('submit')?>" /> </form> </div> </div> <script type="text/javascript"> var oRange; var intCount = 0; var intTotalCount = 100; function fnSearch() { var strBeReplaced; var strReplace; strBeReplaced = $('#text').val(); fnNext(); $('#code').focus(); oRange = document.getElementById('code').createTextRange(); for (i=1; oRange.findText(strBeReplaced)!=false; i++) { if(i==intCount){ oRange.select(); oRange.scrollIntoView(); break; } oRange.collapse(false); } } function create_tag() { window.top.art.dialog({id:'add',iframe:'?m=tag&c=tag&a=add&ac=js', title:"<?php echo L('create_tag')?>", 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()}); } function insertText(text) { $('#code').focus(); var str = document.selection.createRange(); str.text = text; } function call(text) { $('#code').focus(); var str = document.selection.createRange(); var text_lenght = parseInt($('#text_lenght').val()); str.moveStart("character", text_lenght); str.select(); str.text = text; } function GetPoint() { if ($.browser.msie) { rng = event.srcElement.createTextRange(); rng.moveToPoint(event.x,event.y); rng.moveStart("character",-event.srcElement.value.length); var text_lenght = rng.text.length; } else { //alert($('#code').selectionStart); } $('#text_lenght').val(text_lenght); } function select_tag() { window.top.art.dialog({id:'list',iframe:'?m=tag&c=tag&a=lists', title:"<?php echo L('tag_list')?>", 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:'list'}).close()}); } function fnNext(){ if (intCount > 0 && intCount < intTotalCount){ intCount = intCount + 1; } else { intCount = 1 ; } } //--> </SCRIPT> </script> </body> </html>
108wo
phpcms/modules/template/templates/file_edit_file.tpl.php
PHP
asf20
5,351
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin'); ?> <div class="pad-10"> <form action="?m=template&c=style&a=import" method="post" id="myform" enctype="multipart/form-data"> <div> <table width="100%" class="table_form"> <tr> <th width="80"><?php echo L('mode')?>:</th> <td class="y-bg"><input type="radio" name="type" value="1" checked /> <?php echo L('upload_file')?> <input type="radio" name="type" value="2"/> <?php echo L('enter_coad')?></td> </tr> <tbody id="upfile"> <tr> <th width="80"><?php echo L('upload_file')?>:</th> <td class="y-bg"><input type="file" class="input-text" name="file"/> <?php echo L('only_allowed_to_upload_txt_files')?></td> </tr> </tbody> <tbody id="code" style="display: none"> <tr> <th width="80" valign="top"><?php echo L('enter_coad')?>:</th> <td class="y-bg"><textarea name="code" style="width:386px;height:178px;"></textarea></td> </tr> </tbody> </table> <div class="bk15"></div> <input type="submit" class="dialog" id="dosubmit" name="dosubmit" value="<?php echo L('submit')?>" /> </div> </form> </div> <script type="text/javascript"> <!-- $(function(){$("input[type='radio'][name='type']").click(function(){ if ($(this).val()==1) { $('#upfile').show(); $('#code').hide(); } else{ $('#code').show(); $('#upfile').hide(); } })}) //--> </script> </body> </html>
108wo
phpcms/modules/template/templates/style_import.tpl.php
PHP
asf20
1,473
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin'); ?> <div class="subnav"> <h1 class="title-2 line-x"><?php echo $this->style_info['name'].' - '.L('detail')?></h1> </div> <div class="pad-lr-10"> <div class="table-list"> <form action="?m=template&c=file&a=updatefilename&style=<?php echo $this->style?>" method="post"> <table width="100%" cellspacing="0"> <thead> <tr> <th align="left" ><?php echo L("dir")?></th> <th align="left" ><?php echo L('desc')?></th> <th align="left" ><?php echo L('operation')?></th> </tr> </thead> <tbody> <tr> <td align="left" colspan="3"><?php echo L("local_dir")?>:<?php echo $local?></td> </tr> <?php if ($dir !='' && $dir != '.'):?> <tr> <td align="left" colspan="3"><a href="<?php echo '?m=template&c=file&a=init&style='.$this->style.'&dir='.stripslashes(dirname($dir))?>"><img src="<?php echo IMG_PATH?>folder-closed.gif" /><?php echo L("parent_directory")?></a></td> </tr> <?php endif;?> <?php if(is_array($list)): foreach($list as $v): $filename = basename($v); ?> <tr> <?php if (is_dir($v)) { echo '<td align="left"><img src="'.IMG_PATH.'folder-closed.gif" /> <a href="?m=template&c=file&a=init&style='.$this->style.'&dir='.(isset($_GET['dir']) && !empty($_GET['dir']) ? stripslashes($_GET['dir']).DIRECTORY_SEPARATOR : '').$filename.'"><b>'.$filename.'</b></a></td><td align="left"><input type="text" name="file_explan['.$encode_local.']['.$filename.']" value="'.(isset($file_explan[$encode_local][$filename]) ? $file_explan[$encode_local][$filename] : "").'"></td><td></td>'; } else { if (substr($filename,-4,4) == 'html') { echo '<td align="left"><img src="'.IMG_PATH.'file.gif" /> '.$filename.'</td><td align="left"><input type="text" name="file_explan['.$encode_local.']['.$filename.']" value="'.(isset($file_explan[$encode_local][$filename]) ? $file_explan[$encode_local][$filename] : "").'"></td><td> <a href="?m=template&c=file&a=edit_file&style='.$this->style.'&dir='.urlencode(stripslashes($dir)).'&file='.$filename.'">['.L('edit').']</a> <a href="?m=template&c=file&a=visualization&style='.$this->style.'&dir='.urlencode(stripslashes($dir)).'&file='.$filename.'" target="_blank">['.L('visualization').']</a> <a href="javascript:history_file(\''.$filename.'\')">['.L('histroy').']</a></td>'; } }?> </tr> <?php endforeach; endif; ?></tbody> </table> <div class="btn"><input type="button" onclick="location.href='?m=template&c=style&a=init&pc_hash=<?php echo $_SESSION['pc_hash'];?>'" class="button" name="dosubmit" value="<?php echo L('returns_list_style')?>" /> <input type="button" class="button" name="dosubmit" value="<?php echo L('new')?>" onclick="add_file()" /> <input type="submit" class="button" name="dosubmit" value="<?php echo L('update')?>" ></div> </form> </div> <div id="pages"><?php echo $pages?></div> </div> <script type="text/javascript"> <!-- function history_file(name) { window.top.art.dialog({title:'《'+name+'》<?php echo L("histroy")?>',id:'history',iframe:'?m=template&c=template_bak&a=init&style=<?php echo $this->style;?>&dir=<?php echo urlencode(stripslashes($dir))?>&filename='+name,width:'700',height:'521'}, function(){var d = window.top.art.dialog({id:'history'}).close();return false;}, function(){window.top.art.dialog({id:'history'}).close()}); } function add_file() { window.top.art.dialog({title:'<?php echo L("new")?>',id:'add_file',iframe:'?m=template&c=file&a=add_file&style=<?php echo $this->style;?>&dir=<?php echo urlencode(stripslashes($dir))?>',width:'500',height:'100'}, function(){var d = window.top.art.dialog({id:'add_file'}).data.iframe;d.document.getElementById('dosubmit').click();return false;}, function(){window.top.art.dialog({id:'add_file'}).close()}); } //--> </script> </body> </html>
108wo
phpcms/modules/template/templates/file_list.tpl.php
PHP
asf20
3,861
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin'); ?> <div class="pad-10"> <form action="?m=template&c=file&a=edit_pc_tag&style=<?php echo $this->style?>&dir=<?php echo $dir?>&file=<?php echo urlencode($file)?>&op=<?php echo $op?>&tag_md5=<?php echo $_GET['tag_md5']?>" method="post" id="myform"> <table width="100%" class="table_form"> <tr> <th width="80"><?php echo L("toolbox_type")?>:</th> <td class="y-bg"><?php echo $op?></td> </tr> <tr> <th width="80"><?php echo L("data_address")?>:</th> <td class="y-bg"><input type="text" name="url" id="url" size="30" value="<?php echo $_GET['url']?>" /></td> </tr> <tr> <th width="80"><?php echo L("check")?>:</th> <td class="y-bg"><input type="text" name="return" id="return" size="30" value="<?php echo $_GET['return']?>" /> </td> </tr> <tr> <th width="80"><?php echo L("buffer_time")?>:</th> <td class="y-bg"><input type="text" name="cache" id="cache" size="30" value="<?php echo $_GET['cache']?>" /> <?php echo L("unit_second")?></td> </tr> </table> <div class="bk15"></div> <input type="submit" class="dialog" id="dosubmit" name="dosubmit" value="<?php echo L('submit')?>" /> </form> </div> <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();})}}); $("#url").formValidator({onshow:"<?php echo L("input").L("data_address")?>",onfocus:"<?php echo L("input").L("data_address")?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L("data_address")?>"}).regexValidator({regexp:"^http:\/\/(.*)",param:'i',onerror:"<?php echo L('data_address_reg_sg')?>"}); $("#cache").formValidator({onshow:"<?php echo L("input").L('buffer_time')?>",onfocus:"<?php echo L("input").L('buffer_time')?>"}).regexValidator({regexp:"num1",datatype:'enum',param:'i',onerror:"<?php echo L('cache_time_can_only_be_positive')?>"}); }) //--> </script> </body> </html>
108wo
phpcms/modules/template/templates/pc_tag_tools_json_xml.tpl.php
PHP
asf20
2,155
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin'); ?> <div class="pad-10"> <form action="?m=template&c=file&a=add_file&style=<?php echo $this->style?>&dir=<?php echo $dir?>" method="post" id="myform"> <div> <table width="100%" class="table_form"> <tr> <th width="80"><?php echo L('name')?>:</th> <td class="y-bg"><input type="text" name="name" id="name" /></td> </tr> </table> <div class="bk15"></div> <input type="submit" class="dialog" id="dosubmit" name="dosubmit" value="<?php echo L('submit')?>" /> </div> </form> </div> <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('name').L('without_the_input_name_extension')?>",onfocus:"<?php echo L("input").L('name').L('without_the_input_name_extension')?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('name')?>"}).regexValidator({regexp:"username",datatype:'enum',param:'i',onerror:"<?php echo L('name_datatype_error')?>"}).ajaxValidator({type : "get",url : "",data :"m=template&c=file&a=public_name&style=<?php echo $this->style?>&dir=<?php echo $dir?>",datatype : "html",async:'false',success : function(data){ if( data == "1" ){return true;}else{return false;}},buttons: $("#dosubmit"),onerror : "<?php echo L('exists')?>",onwait : "<?php echo L('connecting')?>"}); }) //--> </script> </body> </html>
108wo
phpcms/modules/template/templates/file_add_file.tpl.php
PHP
asf20
1,642
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin'); ?> <div class="bk15"></div> <div class="pad_10"> <div class="table-list"> <table width="100%" cellspacing="0"> <thead> <tr> <th><?php echo L('time')?></th> <th><?php echo L('who')?></th> <th width="150"><?php echo L('operations_manage')?></th> </tr> </thead> <tbody> <?php if(is_array($list)): foreach($list as $v): ?> <tr> <td align="center"><?php echo format::date($v['creat_at'], 1)?></td> <td align="center"><?php echo $v['username']?></td> <td align="center"><a href="?m=template&c=template_bak&a=restore&id=<?php echo $v['id']?>&style=<?php echo $this->style?>&dir=<?php echo $this->dir?>&filename=<?php echo $this->filename?>" onclick="return confirm('<?php echo L('are_you_sure_you_want_to_restore')?>')"><?php echo L('restore')?></a> | <a href="?m=template&c=template_bak&a=del&id=<?php echo $v['id']?>&style=<?php echo $this->style?>&dir=<?php echo $this->dir?>&filename=<?php echo $this->filename?>" onclick="return confirm('<?php echo L('confirm', array('message'=>format::date($v['creat_at'], 1)))?>')"><?php echo L('delete')?></a></td> </tr> <?php endforeach; endif; ?> </tbody> </table> </from> </div> </div> <div id="pages"><?php echo $pages?></div> </body> </html>
108wo
phpcms/modules/template/templates/template_bak_list.tpl.php
PHP
asf20
1,367
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin'); ?> <div class="pad-10"> <form action="?m=template&c=file&a=edit_pc_tag&style=<?php echo $this->style?>&dir=<?php echo $dir?>&file=<?php echo urlencode($file)?>&op=<?php echo $op?>&tag_md5=<?php echo $_GET['tag_md5']?>" method="post" id="myform"> <table width="100%" class="table_form"> <tr> <th width="80"><?php echo L("toolbox_type")?>:</th> <td class="y-bg"><?php echo $op?></td> </tr> <tr> <th width="80">SQL:</th> <td class="y-bg"><textarea name="sql" id="sql" style="width:386px;height:178px;"><?php echo $_GET['sql']?></textarea></td> </tr> <tr> <th width="80"><?php echo L('dbsource')?>:</th> <td class="y-bg"><?php echo form::select($dbsource_list, $_GET['dbsource'], 'name="dbsource" id="dbsource"')?></td> </tr> <tr> <th width="80"><?php echo L("check")?>:</th> <td class="y-bg"><input type="text" name="return" id="return" size="30" value="<?php echo $_GET['return']?>" /> </td> </tr> <tr> <th width="80"><?php echo L("buffer_time")?>:</th> <td class="y-bg"><input type="text" name="cache" id="cache" size="30" value="<?php echo $_GET['cache']?>" /> </td> </tr> </table> <div class="bk15"></div> <input type="submit" class="dialog" id="dosubmit" name="dosubmit" value="<?php echo L('submit')?>" /> </form> </div> <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();})}}); $("#sql").formValidator({onshow:"<?php echo L("input").'SQL'?>",onfocus:"<?php echo L("input").'SQL'?>"}).inputValidator({min:1,onerror:"<?php echo L("input").'SQL'?>"}); $("#dbsource").formValidator({onshow:"<?php echo L("input").L("dbsource")?>",onfocus:"<?php echo L("input").L("dbsource")?>"}); $("#cache").formValidator({onshow:"<?php echo L("enter_the_cache_input_will_not_be_cached")?>",onfocus:"<?php echo L("enter_the_cache_input_will_not_be_cached")?>",empty:true}).regexValidator({regexp:"num1",datatype:'enum',param:'i',onerror:"<?php echo L("cache_time_can_only_be_positive")?>"}); $("#num").formValidator({onshow:"<?php echo L('input').L("num")?>",onfocus:"<?php echo L('input').L("num")?>",empty:true}).regexValidator({regexp:"num1",datatype:'enum',param:'i',onerror:"<?php echo L('that_shows_only_positive_numbers')?>"}); }) //--> </script> </body> </html>
108wo
phpcms/modules/template/templates/pc_tag_tools_get.tpl.php
PHP
asf20
2,596
<?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_class('format', '', 0); class file extends admin { //模板文件夹 private $filepath; //风格名 private $style; //风格属性 private $style_info; //是否允许在线编辑模板 private $tpl_edit; public function __construct() { $this->style = isset($_GET['style']) && trim($_GET['style']) ? str_replace(array('..\\', '../', './', '.\\', '/', '\\'), '', trim($_GET['style'])) : showmessage(L('illegal_operation'), HTTP_REFERER); if (empty($this->style)) { showmessage(L('illegal_operation'), HTTP_REFERER); } $this->filepath = PC_PATH.'templates'.DIRECTORY_SEPARATOR.$this->style.DIRECTORY_SEPARATOR; if (file_exists($this->filepath.'config.php')) { $this->style_info = include $this->filepath.'config.php'; if (!isset($this->style_info['name'])) $this->style_info['name'] = $this->style; } $this->tpl_edit = pc_base::load_config('system', 'tpl_edit'); parent::__construct(); } public function init() { $dir = isset($_GET['dir']) && trim($_GET['dir']) ? str_replace(array('..\\', '../', './', '.\\'), '', trim($_GET['dir'])) : ''; $filepath = $this->filepath.$dir; $list = glob($filepath.DIRECTORY_SEPARATOR.'*'); if(!empty($list)) ksort($list); $local = str_replace(array(PC_PATH, DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR), array('',DIRECTORY_SEPARATOR), $filepath); if (substr($local, -1, 1) == '.') { $local = substr($local, 0, (strlen($local)-1)); } $encode_local = str_replace(array('/', '\\'), '|', $local); $file_explan = $this->style_info['file_explan']; $show_header = true; include $this->admin_tpl('file_list'); } public function updatefilename() { $file_explan = isset($_POST['file_explan']) ? $_POST['file_explan'] : ''; if (!isset($this->style_info['file_explan'])) $this->style_info['file_explan'] = array(); $this->style_info['file_explan'] = array_merge($this->style_info['file_explan'], $file_explan); @file_put_contents($this->filepath.'config.php', '<?php return '.var_export($this->style_info, true).';?>'); showmessage(L('operation_success'), HTTP_REFERER); } public function edit_file() { if (empty($this->tpl_edit)) { showmessage(L('tpl_edit')); } $dir = isset($_GET['dir']) && trim($_GET['dir']) ? str_replace(array('..\\', '../', './', '.\\'), '', urldecode(trim($_GET['dir']))) : ''; $file = isset($_GET['file']) && trim($_GET['file']) ? trim($_GET['file']) : ''; if ($file) { preg_match('/^([a-zA-Z0-9])?([^.|-|_]+)/i', $file, $file_t); $file_t = $file_t[0]; $file_t_v = array('header'=>array('{$SEO[\'title\']}'=>L('seo_title'), '{$SEO[\'site_title\']}'=>L('site_title'), '{$SEO[\'keyword\']}'=>L('seo_keyword'), '{$SEO[\'description\']}'=>L('seo_des')), 'category'=>array('{$catid}'=>L('cat_id'), '{$catname}'=>L('cat_name'), '{$url}'=>L('cat_url'), '{$r[catname]}'=>L('cat_name'), '{$r[url]}'=>'URL', '{$CATEGORYS}'=>L('cats')), 'list'=>array('{$catid}'=>L('cat_id'), '{$catname}'=>L('cat_name'), '{$url}'=>L('cat_url'), '{$CATEGORYS}'=>L('cats')), 'show'=> array('{$title}'=>L('title'), '{$inputtime}'=>L('inputtime'), '{$copyfrom}'=>L('comeform'), '{$content}'=>L('content'), '{$previous_page[url]}'=>L('pre_url'), '{$previous_page[title]}'=>L('pre_title'), '{$next_page[url]}'=>L('next_url'), '{$next_page[title]}'=>L('next_title')), 'page'=>array('{$CATEGORYS}'=>L('cats'), '{$content}'=>L('content'))); } if (substr($file, -4, 4) != 'html') showmessage(L("can_edit_html_files")); $filepath = $this->filepath.$dir.DIRECTORY_SEPARATOR.$file; $is_write = 0; if (is_writable($filepath)) { $is_write = 1; } if ($_POST['dosubmit']) { $code = isset($_POST['code']) ? stripslashes($_POST['code']) : showmessage(L('illegal_operation'), HTTP_REFERER); if ($is_write == 1) { pc_base::load_app_func('global'); creat_template_bak($filepath, $this->style, $dir); file_put_contents($filepath,htmlspecialchars_decode($code)); showmessage(L('operation_success'), HTTP_REFERER); } else{ showmessage(L("file_does_not_writable"), HTTP_REFERER); } } else { if (file_exists($filepath)) { $data = htmlspecialchars(file_get_contents($filepath)); } else { showmessage(L('file_does_not_exists')); } } $show_header = true; include $this->admin_tpl('file_edit_file'); } public function add_file() { if (empty($this->tpl_edit)) { showmessage(L('tpl_edit')); } $dir = isset($_GET['dir']) && trim($_GET['dir']) ? str_replace(array('..\\', '../', './', '.\\'), '', urldecode(trim($_GET['dir']))) : ''; $filepath = $this->filepath.$dir.DIRECTORY_SEPARATOR; $is_write = 0; if (is_writable($filepath)) { $is_write = 1; } if (!$is_write) { showmessage('dir_not_writable'); } if ($_POST['dosubmit']) { $name = isset($_POST['name']) && trim($_POST['name']) ? trim($_POST['name']) : showmessage(''); if (!preg_match('/^[\w]+$/i', $name)) { showmessage(L('name_datatype_error'), HTTP_REFERER); } if ($is_write == 1) { @file_put_contents($filepath.$name.'.html',''); showmessage('','','', 'add_file'); } else { showmessage(L("dir_not_writable"), HTTP_REFERER); } } $show_header = $show_validator = true; include $this->admin_tpl('file_add_file'); } public function public_name() { $dir = isset($_GET['dir']) && trim($_GET['dir']) ? str_replace(array('..\\', '../', './', '.\\'), '', urldecode(trim($_GET['dir']))) : ''; $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'); $filepath = $this->filepath.$dir.DIRECTORY_SEPARATOR.$name.'.html'; if (file_exists($filepath)) { exit('0'); } else { exit('1'); } } public function visualization() { echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'; $dir = isset($_GET['dir']) && trim($_GET['dir']) ? str_replace(array('..\\', '../', './', '.\\'), '', urldecode(trim($_GET['dir']))) : showmessage(L('illegal_operation'), HTTP_REFERER); $file = isset($_GET['file']) && trim($_GET['file']) ? trim($_GET['file']) : showmessage(L('illegal_operation'), HTTP_REFERER); ob_start(); include template($dir,basename($file, '.html'),$this->style); $html = ob_get_contents(); ob_clean(); pc_base::load_app_func('global'); $html = visualization($html, $this->style, $dir, $file); echo $html; } public function public_ajax_get() { $op_tag = pc_base::load_app_class($_GET['op']."_tag", $_GET['op']); $html = $op_tag->$_GET['action']($_GET['html'], $_GET['value'], $_GET['id']); echo $html; } public function edit_pc_tag() { if (empty($this->tpl_edit)) { showmessage(L('tpl_edit')); } $dir = isset($_GET['dir']) && trim($_GET['dir']) ? str_replace(array('..\\', '../', './', '.\\'), '', urldecode(trim($_GET['dir']))) : showmessage(L('illegal_operation')); $file = isset($_GET['file']) && trim($_GET['file']) ? urldecode(trim($_GET['file'])) : showmessage(L('illegal_operation')); $op = isset($_GET['op']) && trim($_GET['op']) ? trim($_GET['op']) : showmessage(L('illegal_operation')); $tag_md5 = isset($_GET['tag_md5']) && trim($_GET['tag_md5']) ? trim($_GET['tag_md5']) : showmessage(L('illegal_operation')); $show_header = $show_scroll = $show_validator = true; pc_base::load_app_func('global'); pc_base::load_sys_class('form', '', 0); $filepath = $this->filepath.$dir.DIRECTORY_SEPARATOR.$file; switch ($op) { case 'xml': case 'json': if ($_POST['dosubmit']) { $url = isset($_POST['url']) && trim($_POST['url']) ? trim($_POST['url']) : showmessage(L('data_address').L('empty')); $cache = isset($_POST['cache']) && trim($_POST['cache']) ? trim($_POST['cache']) : 0; $return = isset($_POST['return']) && trim($_POST['return']) ? trim($_POST['return']) : ''; if (!preg_match('/http:\/\//i', $url)) { showmessage(L('data_address_reg_sg'), HTTP_REFERER); } $tag_md5_list = tag_md5($filepath); $pc_tag = creat_pc_tag($op, array('url'=>$url, 'cache'=>$cache, 'return'=>$return)); if (in_array($tag_md5, $tag_md5_list[0])) { $old_pc_tag = $tag_md5_list[1][$tag_md5]; } if (replace_pc_tag($filepath, $old_pc_tag, $pc_tag, $this->style, $dir)) { showmessage('<script style="text/javascript">if(!window.top.right){parent.location.reload();}art.dialog({id:"edit"}).close();</script>', '', '', 'edit'); } else { showmessage(L('failure_the_document_may_not_to_write')); } } include $this->admin_tpl('pc_tag_tools_json_xml'); break; case 'get': if ($_POST['dosubmit']) { $sql = isset($_POST['sql']) && trim($_POST['sql']) ? trim($_POST['sql']) : showmessage('SQL'.L('empty')); $dbsource = isset($_POST['dbsource']) && trim($_POST['dbsource']) ? trim($_POST['dbsource']) : ''; $cache = isset($_POST['cache']) && intval($_POST['cache']) ? intval($_POST['cache']) : 0; $return = isset($_POST['return']) && trim($_POST['return']) ? trim($_POST['return']) : ''; $tag_md5_list = tag_md5($filepath); $pc_tag = creat_pc_tag($op, array('sql'=>$sql, 'dbsource'=>$dbsource, 'cache'=>$cache, 'return'=>$return)); if (in_array($tag_md5, $tag_md5_list[0])) { $old_pc_tag = $tag_md5_list[1][$tag_md5]; } if (replace_pc_tag($filepath, $old_pc_tag, $pc_tag, $this->style, $dir)) { showmessage('<script style="text/javascript">if(!window.top.right){parent.location.reload();}art.dialog({id:"edit"}).close();</script>', '', '', 'edit'); } else { showmessage(L('failure_the_document_may_not_to_write')); } } $dbsource_db = pc_base::load_model('dbsource_model'); $r = $dbsource_db->select('', 'name'); $dbsource_list = array(''=>L('please_select')); foreach ($r as $v) { $dbsource_list[$v['name']] = $v['name']; } include $this->admin_tpl('pc_tag_tools_get'); break; default: if (!file_exists(PC_PATH.DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR.$op.DIRECTORY_SEPARATOR.'classes'.DIRECTORY_SEPARATOR.$op.'_tag.class.php')) { showmessage(L('the_module_will_not_support_the_operation')); } $op_tag = pc_base::load_app_class($op."_tag", $op); if (!method_exists($op_tag, 'pc_tag')) { showmessage(L('the_module_will_not_support_the_operation')); } $html = $op_tag->pc_tag(); if ($_POST['dosubmit']) { $action = isset($_POST['action']) && trim($_POST['action']) ? trim($_POST['action']) : 0; $data = array('action'=>$action); if (isset($html[$action]) && is_array($html[$action])) { foreach ($html[$action] as $key=>$val) { $val['validator']['reg_msg'] = $val['validator']['reg_msg'] ? $val['validator']['reg_msg'] : $val['name'].L('inputerror'); if ($val['htmltype'] != 'checkbox') { $$key = isset($_POST[$key]) && trim($_POST[$key]) ? trim($_POST[$key]) : ''; } else { $$key = isset($_POST[$key]) && $_POST[$key] ? implode(',', $_POST[$key]) : ''; } if (isset($val['ajax']['id']) && !empty($val['ajax']['id'])) { $data[$val['ajax']['id']] = isset($_POST[$val['ajax']['id']]) && trim($_POST[$val['ajax']['id']]) ? trim($_POST[$val['ajax']['id']]) : ''; } if (!empty($val['validator'])) { if (isset($val['validator']['min']) && strlen($$key) < $val['validator']['min']) { showmessage($val['name'].L('should').L('is_greater_than').$val['validator']['min'].L('lambda')); } if (isset($val['validator']['max']) && strlen($$key) > $val['validator']['max']) { showmessage($val['name'].L('should').L('less_than').$val['validator']['max'].L('lambda')); } if (!preg_match('/'.$val['validator']['reg'].'/'.$val['validator']['reg_param'], $$key)) { showmessage($val['name'].$val['validator']['reg_msg']); } } $data[$key] = $$key; } } $page = isset($_POST['page']) && trim($_POST['page']) ? trim($_POST['page']) : ''; $num = isset($_POST['num']) && intval($_POST['num']) ? intval($_POST['num']) : 0; $return = isset($_POST['return']) && trim($_POST['return']) ? trim($_POST['return']) : ''; $cache = isset($_POST['cache']) && intval($_POST['cache']) ? intval($_POST['cache']) : 0; $data['page'] = $page; $data['num'] = $num; $data['return'] = $return; $data['cache'] = $cache; $tag_md5_list = tag_md5($filepath); $pc_tag = creat_pc_tag($op, $data); if (in_array($tag_md5, $tag_md5_list[0])) { $old_pc_tag = $tag_md5_list[1][$tag_md5]; } if (replace_pc_tag($filepath, $old_pc_tag, $pc_tag, $this->style, $dir)) { showmessage('<script style="text/javascript">if(!window.top.right){parent.location.reload();}art.dialog({id:"edit"}).close();</script>', '', '', 'edit'); } else { showmessage(L('failure_the_document_may_not_to_write')); } } include $this->admin_tpl('pc_tag_modules'); break; } } }
108wo
phpcms/modules/template/file.php
PHP
asf20
13,508
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin', 'admin', 0); class template_bak extends admin { private $db, $style, $dir, $filename, $filepath, $fileid; public function __construct() { parent::__construct(); $this->style = isset($_GET['style']) && trim($_GET['style']) ? str_replace(array('..\\', '../', './', '.\\', '/', '\\'), '', trim($_GET['style'])) : showmessage(L('illegal_operation')); $this->dir = isset($_GET['dir']) && trim($_GET['dir']) ? trim(urldecode($_GET['dir'])) : showmessage(L('illegal_operation')); $this->dir = safe_replace($this->dir); $this->filename = isset($_GET['filename']) && trim($_GET['filename']) ? trim($_GET['filename']) : showmessage(L('illegal_operation')); if (empty($this->style) || empty($this->dir) || empty($this->filename)) { showmessage(L('illegal_operation'), HTTP_REFERER); } $this->filepath = PC_PATH.'templates'.DIRECTORY_SEPARATOR.$this->style.DIRECTORY_SEPARATOR.$this->dir.DIRECTORY_SEPARATOR.$this->filename; $this->fileid = $this->style.'_'.$this->dir.'_'.$this->filename; $this->db = pc_base::load_model('template_bak_model'); } public function init() { $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1; $list = $this->db->listinfo(array('fileid'=>$this->fileid), 'creat_at desc', $page, 20); if (!$list) { showmessage(L('not_exist_versioning'), 'blank'); } $pages = $this->db->pages; $show_header = true; pc_base::load_sys_class('format', '', 0); include $this->admin_tpl('template_bak_list'); } public function restore() { $id = isset($_GET['id']) && intval($_GET['id']) ? intval($_GET['id']) : showmessage(L('illegal_operation'), HTTP_REFERER); if ($data = $this->db->get_one(array('id'=>$id))) { if (!is_writable($this->filepath)) { showmessage(L("file_does_not_writable"), HTTP_REFERER); } if (@file_put_contents($this->filepath, $data['template'])) { showmessage(L('operation_success'), HTTP_REFERER, '', 'history'); } else { showmessage(L('operation_success'), HTTP_REFERER, '', 'history'); } } else { showmessage(L('notfound'), HTTP_REFERER); } } public function del() { $id = isset($_GET['id']) && intval($_GET['id']) ? intval($_GET['id']) : showmessage(L('illegal_operation'), HTTP_REFERER); if ($data = $this->db->get_one(array('id'=>$id))) { $this->db->delete(array('id'=>$id)); showmessage(L('operation_success'), HTTP_REFERER); } else { showmessage(L('notfound'), HTTP_REFERER); } } } ?>
108wo
phpcms/modules/template/template_bak.php
PHP
asf20
2,612
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin', 'admin', 0); class style extends admin { //模板文件夹 private $filepath; public function __construct() { $this->filepath = PC_PATH.'templates'.DIRECTORY_SEPARATOR; parent::__construct(); } public function init() { pc_base::load_app_func('global', 'admin'); $list = template_list('', 1); $big_menu = array('javascript:window.top.art.dialog({id:\'import\',iframe:\'?m=template&c=style&a=import\', title:\''.L('import_style').'\', width:\'500\', height:\'250\', lock:true}, function(){var d = window.top.art.dialog({id:\'import\'}).data.iframe;var form = d.document.getElementById(\'dosubmit\');form.click();return false;}, function(){window.top.art.dialog({id:\'import\'}).close()});void(0);', L('import_style')); include $this->admin_tpl('style_list'); } public function disable() { $style = isset($_GET['style']) && trim($_GET['style']) ? trim($_GET['style']) : showmessage(L('illegal_operation'), HTTP_REFERER); $filepath = $this->filepath.$style.DIRECTORY_SEPARATOR.'config.php'; if (file_exists($filepath)) { $arr = include $filepath; if (!isset($arr['disable'])) { $arr['disable'] = 1; } else { if ($arr['disable'] ==1 ) { $arr['disable'] = 0; } else { $arr['disable'] = 1; } } if (is_writable($filepath)) { file_put_contents($filepath, '<?php return '.var_export($arr, true).';?>'); } else { showmessage(L('file_does_not_writable'), HTTP_REFERER); } } else { $arr = array('name'=>$style,'disable'=>1, 'dirname'=>$style); file_put_contents($filepath, '<?php return '.var_export($arr, true).';?>'); } showmessage(L('operation_success'), HTTP_REFERER); } public function export() { $style = isset($_GET['style']) && trim($_GET['style']) ? trim($_GET['style']) : showmessage(L('illegal_operation'), HTTP_REFERER); $filepath = $this->filepath.$style.DIRECTORY_SEPARATOR.'config.php'; if (file_exists($filepath)) { $arr = include $filepath; if (pc_base::load_config('system', 'charset') == 'gbk') { $arr = array_iconv($arr); } $data = base64_encode(json_encode($arr)); header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=pc_template_".$style.'.txt'); echo $data; } else { showmessage(L('file_does_not_exists'), HTTP_REFERER); } } public function import() { if (isset($_POST['dosubmit'])) { $type = isset($_POST['type']) && trim($_POST['type']) ? trim($_POST['type']) : showmessage(L('illegal_operation'), HTTP_REFERER); if ($type == 1) { $filename = $_FILES['file']['tmp_name']; if (strtolower(substr($_FILES['file']['name'], -3, 3)) != 'txt') { showmessage(L('only_allowed_to_upload_txt_files'), HTTP_REFERER); } $code = json_decode(base64_decode(file_get_contents($filename)), true); @unlink($filename); } elseif ($type == 2) { $code = isset($_POST['code']) && trim($_POST['code']) ? json_decode(base64_decode(trim($_POST['code'])),true) : showmessage(L('illegal_operation'), HTTP_REFERER); if (!isset($code['dirname'])) { showmessage(L('illegal_parameters'), HTTP_REFERER); } } if (pc_base::load_config('system', 'charset') == 'gbk') { $code = array_iconv($code, 'utf-8', 'gbk'); } echo $this->filepath.$code['dirname'].DIRECTORY_SEPARATOR.'config.php'; if (!file_exists($this->filepath.$code['dirname'].DIRECTORY_SEPARATOR.'config.php')) { if (@is_writable($this->filepath.$code['dirname'].DIRECTORY_SEPARATOR)) { @mkdir($this->filepath.$code['dirname'].DIRECTORY_SEPARATOR, 0755, true); @file_put_contents($this->filepath.$code['dirname'].DIRECTORY_SEPARATOR.'config.php', '<?php return '.var_export($code, true).';?>'); showmessage(L('operation_success'), HTTP_REFERER, '', 'import'); } else { showemssage(L('template_directory_not_write'), HTTP_REFERER); } } else { showmessage(L('file_exists'), HTTP_REFERER); } } else { $show_header = true; include $this->admin_tpl('style_import'); } } public function updatename() { $name = isset($_POST['name']) ? $_POST['name'] : showmessage(L('illegal_operation'), HTTP_REFERER); if (is_array($name)) { foreach ($name as $key=>$val) { $filepath = $this->filepath.$key.DIRECTORY_SEPARATOR.'config.php'; if (file_exists($filepath)) { $arr = include $filepath; $arr['name'] = $val; } else { $arr = array('name'=>$val,'disable'=>0, 'dirname'=>$key); } @file_put_contents($filepath, '<?php return '.var_export($arr, true).';?>'); } showmessage(L('operation_success'), HTTP_REFERER); } else { showmessage(L('illegal_parameters'), HTTP_REFERER); } } }
108wo
phpcms/modules/template/style.php
PHP
asf20
4,894
<?php defined('IN_PHPCMS') or exit('No permission resources.'); /** * 生成模板中所有PC标签的MD5 * @param $file 模板文件地址 */ function tag_md5($file) { $data = file_get_contents($file); preg_match_all("/\{pc:(\w+)\s+([^}]+)\}/i", stripslashes($data),$matches); $arr = array(); if(is_array($matches) && !empty($matches)) foreach($matches[0] as $k=>$v) { if (!$v) continue; $md5 = md5($v); $arr[0][$k] = $md5; $arr[1][$md5] = $v; } return $arr; } /** * 生成pc标签 * @param $op 操作名 * @param $data 数据 */ function creat_pc_tag($op, $data) { $str = '{pc:'.$op.' '; if (is_array($data)) { foreach ($data as $k=>$v) { if ($v) $str .= $str ? " $k=\"$v\"" : "$k=\"$v\""; } } else { $str .= $data; } return $str.'}'; } /** * 替换模板中的PC标签 * @param $filepath 文件地址 * @param $old_tag 老PC标签 * @param $new_tag 新PC标签 * @param $style 风格 * @param $dir 目录名 */ function replace_pc_tag($filepath, $old_tag, $new_tag, $style, $dir) { if (file_exists($filepath)) { creat_template_bak($filepath, $style, $dir); $data = @file_get_contents($filepath); $data = str_replace($old_tag, $new_tag, $data); if (!is_writable($filepath)) return false; @file_put_contents($filepath, $data); return true; } } /** * 生成模板临时文件 * @param $filepath 文件地址 * @param $style 风格 * @param $dir 目录名 */ function creat_template_bak($filepath, $style, $dir) { $filename = basename($filepath); $template_bak_db = pc_base::load_model('template_bak_model'); $template_bak_db->insert(array('creat_at'=>SYS_TIME,'fileid'=>$style."_".$dir."_".$filename, 'userid'=>param::get_cookie('userid'), 'username'=>param::get_cookie('admin_username'), 'template'=>new_addslashes(file_get_contents($filepath)))); } /** * 生成标签选项 * @param $id HTML ID号 * @param $data 生成条件 * @param $value 当前值 * @param $op 操作名 * @return html 返回HTML代码 */ function creat_form($id, $data, $value = '', $op = '') { pc_base::load_sys_class('form', '', 0); if (empty($value)) $value = $data['defaultvalue']; $str = $ajax = ''; if($data['ajax']['name']) { if($data['ajax']['m']) { $url = '$.get(\'?m=content&c=push&a=public_ajax_get\', {html: this.value, id:\''.$data['ajax']['id'].'\', action: \''.$data['ajax']['action'].'\', module: \''.$data['ajax']['m'].'\', pc_hash: \''.$_SESSION['pc_hash'].'\'}, function(data) {$(\'#'.$id.'_td\').html(data)});'; } else { $url = '$.get(\'?m=template&c=file&a=public_ajax_get\', { html: this.value, id:\''.$data['ajax']['id'].'\', action: \''.$data['ajax']['action'].'\', op: \''.$op.'\', style: \'default\', pc_hash: \''.$_SESSION['pc_hash'].'\'}, function(data) {$(\'#'.$id.'_td\').html(data)});'; } } switch ($data['htmltype']) { case 'input': if($data['ajax']['name']) { $ajax = 'onblur="'.$url.'"'; } $str .= '<input type="text" name="'.$id.'" id="'.$id.'" value="'.$value.'" size="30" />'; break; case 'select': if($data['ajax']['name']) { $ajax = 'onchange="'.$url.'"'; } $str .= form::select($data['data'], $value, "name='$id' id='$id' $ajax"); break; case 'checkbox': if($data['ajax']['name']) { $ajax = ' onclick="'.$url.'"'; } if (is_array($value)) implode(',', $value); $str .= form::checkbox($data['data'], $value, "name='".$id."[]'".$ajax, '', '120'); break; case 'radio': if($data['ajax']['name']) { $ajax = ' onclick="'.$url.'"'; } $str .= form::radio($data['data'], $value, "name='$id'$ajax", '', '120'); break; case 'input_select': if($data['ajax']['name']) { $ajax = ';'.$url; } $str .= '<input type="text" name="'.$id.'" id="'.$id.'" value="'.$value.'" size="30" />'.form::select($data['data'], $value, "name='select_$id' id='select_$id' onchange=\"$('#$id').val(this.value);$ajax\""); break; case 'input_select_category': if($data['ajax']['name']) { $ajax = ';'.$url; } $str .= '<input type="text" name="'.$id.'" id="'.$id.'" value="'.$value.'" size="30" />'.form::select_category('', $value, "name='select_$id' id='select_$id' onchange=\"$('#$id').val(this.value);$ajax\"", '', (isset($data['data']['modelid']) ? $data['data']['modelid'] : 0), (isset($data['data']['type']) ? $data['data']['type'] : -1), (isset($data['data']['onlysub']) ? $data['data']['onlysub'] : 0)); break; case 'select_yp_model': if($data['ajax']['name']) { $ajax = ';'.$url; } $yp_models = getcache('yp_model', 'commons'); $d = array(L('please_select')); if (is_array($yp_models) && !empty($yp_models)) { foreach ($yp_models as $k =>$v) { $d[$k] = $v['name']; } } $str .= '<input type="text" name="'.$id.'" id="'.$id.'" value="'.$value.'" size="30" />'.form::select($d, $value, "name='select_$id' id='select_$id' onchange=\"$('#$id').val(this.value);$ajax\""); break; } if (!empty($data['validator'])) { $str .= '<script type="text/javascript">$(function(){$("#'.$id.'").formValidator({onshow:"'.L('input').$data['name'].'。",onfocus:"'.L('input').$data['name'].'。"'.($data['empty'] ? ',empty:true' : '').'})'; if ($data['htmltype'] != 'select' && (isset($data['validator']['min']) || isset($data['validator']['max']))) { $str .= ".inputValidator({".(isset($data['validator']['min']) ? 'min:'.$data['validator']['min'].',' : '').(isset($data['validator']['max']) ? 'max:'.$data['validator']['max'].',' : '')." onerror:'".$data['name'].L('should', '', 'template').(isset($data['validator']['min']) ? ' '.L('is_greater_than', '', 'template').$data['validator']['min'].L('lambda', '', 'template') : '').(isset($data['validator']['max']) ? ' '.L('less_than', '', 'template').$data['validator']['max'].L('lambda', '', 'template') : '')."。'})"; } if ($data['htmltype'] != 'checkbox' && $data['htmltype'] != 'radio' && isset($data['validator']['reg'])) { $str .= '.regexValidator({regexp:"'.$data['validator']['reg'].'"'.(isset($data['validator']['reg_param']) ? ",param:'".$data['validator']['reg_param']."'" : '').(isset($data['validator']['reg_msg']) ? ',onerror:"'.$data['validator']['reg_msg'].'"' : '').'})'; } $str .=";});</script>"; } return $str; } /** * 编辑PC标签时,生成跳转URL地址 * @param $action 操作 */ function creat_url($action) { $url = ''; foreach ($_GET as $k=>$v) { if ($k=='action') $v = $action; $url .= $url ? "&$k=$v" : "$k=$v"; } return $url; } /** * 生成可视化模板 * @param $html 模板代码 * @param $style 风格 * @param $dir 目录 * @param $file 文件名 */ function visualization($html, $style = '', $dir = '', $file = '') { $change = "<link href=\"".CSS_PATH."dialog.css\" rel=\"stylesheet\" type=\"text/css\" /> <link rel=\"stylesheet\" type=\"text/css\" href=\"".CSS_PATH."admin_visualization.css\" /> <script language=\"javascript\" type=\"text/javascript\" src=\"".JS_PATH."dialog.js\"></script> <script type='text/javascript' src='".JS_PATH."jquery.min.js'></script> <script type='text/javascript'> var pc_hash = '".$_SESSION['pc_hash']."'; $(function(){ $('a').attr('href', 'javascript:void(0)').attr('target', ''); $('.admin_piao_edit').click(function(){ var url = '?m=template&c=file&a=edit_pc_tag'; if($(this).parent('.admin_piao').attr('pc_action') == 'block') url = '?m=block&c=block_admin&a=add'; window.top.art.dialog({title:'".L('pc_tag','' ,'template')."',id:'edit',iframe:url+'&style=$style&dir=$dir&file=$file&'+$(this).parent('.admin_piao').attr('data'),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()});}) $('.admin_block').click(function(){ window.top.art.dialog({title:'".L('pc_tag','' ,'template')."',id:'edit',iframe:'?m=block&c=block_admin&a=block_update&id='+$(this).attr('blockid'),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><div id=\"PC__contentHeight\" style=\"display:none\">80</div>"; $html = str_replace('</body>', $change.'</body>', $html, $num); if (!$num) $html .= $change; return $html; }
108wo
phpcms/modules/template/functions/global.func.php
PHP
asf20
8,548
<?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); pc_base::load_app_class('foreground','member'); pc_base::load_sys_class('format', '', 0); pc_base::load_sys_class('form', '', 0); pc_base::load_app_func('global'); class deposit extends foreground { private $pay_db,$member_db,$account_db; function __construct() { if (!module_exists(ROUTE_M)) showmessage(L('module_not_exists')); parent::__construct(); $this->pay_db = pc_base::load_model('pay_payment_model'); $this->account_db = pc_base::load_model('pay_account_model'); $this->_username = param::get_cookie('_username'); $this->_userid = intval(param::get_cookie('_userid')); $this->handle = pc_base::load_app_class('pay_deposit'); } public function init() { pc_base::load_app_class('pay_factory','',0); $where = ''; $page = $_GET['page'] ? intval($_GET['page']) : '1'; $where = "AND `userid` = '$this->_userid'"; $start = $end = $status = ''; if($_GET['dosubmit']){ $start_addtime = $_GET['info']['start_addtime']; $end_addtime = $_GET['info']['end_addtime']; $status = $_GET['info']['status']; if($start_addtime && $end_addtime) { $start = strtotime($start_addtime.' 00:00:00'); $end = strtotime($end_addtime.' 23:59:59'); $where .= "AND `addtime` >= '$start' AND `addtime` <= '$end'"; } if($status) $where .= "AND `status` LIKE '%$status%' "; } if($where) $where = substr($where, 3); $infos = $this->account_db->listinfo($where, 'addtime DESC', $page, '15'); if (is_array($infos) && !empty($infos)) { foreach($infos as $key=>$info) { if($info['status']=='unpay' && $info['pay_id']!= 0 && $info['pay_id']) { $payment = $this->handle->get_payment($info['pay_id']); $cfg = unserialize_config($payment['config']); $pay_name = ucwords($payment['pay_code']); $pay_fee = pay_fee($info['money'],$payment['pay_fee'],$payment['pay_method']); $logistics_fee = $info['logistics_fee']; $discount = $info['discount']; // calculate amount $info['price'] = $info['money'] + $pay_fee + $logistics_fee + $discount; // add order info $order_info['id'] = $info['trade_sn']; $order_info['quantity'] = $info['quantity']; $order_info['buyer_email'] = $info['email']; $order_info['order_time'] = $info['addtime']; //add product info $product_info['name'] = $info['contactname']; $product_info['body'] = $info['usernote']; $product_info['price'] = $info['price']; //add set_customerinfo $customerinfo['telephone'] = $info['telephone']; if($payment['is_online'] === '1') { $payment_handler = new pay_factory($pay_name, $cfg); $payment_handler->set_productinfo($product_info)->set_orderinfo($order_info)->set_customerinfo($customer_info); $infos[$key]['pay_btn'] = $payment_handler->get_code('value="'.L('pay_btn').'" class="pay-btn"'); } } else { $infos[$key]['pay_btn'] = ''; } } } foreach(L('select') as $key=>$value) { $trade_status[$key] = $value; } $pages = $this->account_db->pages; include template('pay', 'pay_list'); } public function pay() { $memberinfo = $this->memberinfo; $pay_types = $this->handle->get_paytype(); $trade_sn = create_sn(); param::set_cookie('trade_sn',$trade_sn); $show_validator = 1; include template('pay', 'deposit'); } /* * 充值方式支付 */ public function pay_recharge() { if(isset($_POST['dosubmit'])) { $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); } $pay_id = $_POST['pay_type']; if(!$pay_id) showmessage(L('illegal_pay_method')); $payment = $this->handle->get_payment($pay_id); $cfg = unserialize_config($payment['config']); $pay_name = ucwords($payment['pay_code']); if(!param::get_cookie('trade_sn')) {showmessage(L('illegal_creat_sn'));} $trade_sn = param::get_cookie('trade_sn'); $usernote = $_POST['info']['usernote'] ? $_POST['info']['name'].'['.$trade_sn.']'.'-'.new_html_special_chars(trim($_POST['info']['usernote'])) : $_POST['info']['name'].'['.$trade_sn.']'; $surplus = array( 'userid' => $this->_userid, 'username' => $this->_username, 'money' => trim(floatval($_POST['info']['price'])), 'quantity' => $_POST['quantity'] ? trim(intval($_POST['quantity'])) : 1, 'telephone' => trim($_POST['info']['telephone']), 'contactname' => $_POST['info']['name'] ? trim($_POST['info']['name']).L('recharge') : $this->_username.L('recharge'), 'email' => trim($_POST['info']['email']), 'addtime' => SYS_TIME, 'ip' => ip(), 'pay_type' => 'recharge', 'pay_id' => $payment['pay_id'], 'payment' => trim($payment['pay_name']), 'ispay' => '1', 'usernote' => $usernote, 'trade_sn' => $trade_sn, ); $recordid = $this->handle->set_record($surplus); $factory_info = $this->handle->get_record($recordid); if(!$factory_info) showmessage(L('order_closed_or_finish')); $pay_fee = pay_fee($factory_info['money'],$payment['pay_fee'],$payment['pay_method']); $logistics_fee = $factory_info['logistics_fee']; $discount = $factory_info['discount']; // calculate amount $factory_info['price'] = $factory_info['money'] + $pay_fee + $logistics_fee + $discount; // add order info $order_info['id'] = $factory_info['trade_sn']; $order_info['quantity'] = $factory_info['quantity']; $order_info['buyer_email'] = $factory_info['email']; $order_info['order_time'] = $factory_info['addtime']; //add product info $product_info['name'] = $factory_info['contactname']; $product_info['body'] = $factory_info['usernote']; $product_info['price'] = $factory_info['price']; //add set_customerinfo $customerinfo['telephone'] = $factory_info['telephone']; if($payment['is_online'] === '1') { pc_base::load_app_class('pay_factory','',0); $payment_handler = new pay_factory($pay_name, $cfg); $payment_handler->set_productinfo($product_info)->set_orderinfo($order_info)->set_customerinfo($customer_info); $code = $payment_handler->get_code('value="'.L('confirm_pay').'" class="button"'); } else { $this->account_db->update(array('status'=>'waitting','pay_type'=>'offline'),array('id'=>$recordid)); $code = '<div class="point">'.L('pay_tip').'</div>'; } } include template('pay', 'payment_cofirm'); } public function public_checkcode() { $code = $_GET['code']; if($_SESSION['code'] != strtolower($code)) { exit('0'); } else { exit('1'); } } } ?>
108wo
phpcms/modules/pay/deposit.php
PHP
asf20
7,078
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin'); ?> <div class="pad-10"> <div class="common-form"> <fieldset> <legend><?php echo L('basic_config')?></legend> <table width="100%" class="table_form"> <tr> <td width="120"><?php echo L('username')?></td> <td><?php echo $username?>[<?php echo $userid?>]</td> </tr> <tr> <td width="120"><?php echo L('contact_email')?></td> <td><?php echo $email?></td> </tr> <tr> <td width="120"><?php echo L('contact_phone')?></td> <td><?php echo $telephone?></td> </tr> </table> </fieldset> <div class="bk15"></div> <fieldset> <legend><?php echo L('order_info')?></legend> <table width="100%" class="table_form"> <tr> <td width="120"><?php echo L('order_sn')?></td> <td><?php echo $trade_sn?></td> </tr> <tr> <td width="120"><?php echo L('order_name')?></td> <td><?php echo $contactname?></td> </tr> <tr> <td width="120"><?php echo L('order_price')?></td> <td><?php echo $money?> <?php echo L('yuan')?></td> </tr> <tr> <td width="120"><?php echo L('order_discount')?></td> <td><?php echo $discount?> <?php echo L('yuan')?></td> </tr> <tr> <td width="120"><?php echo L('order_addtime')?></td> <td><?php echo date('Y:m:d H:i:s',$addtime)?></td> </tr> <tr> <td width="120"><?php echo L('order_ip')?></td> <td><?php echo $ip?></td> </tr> <tr> <td width="120"><?php echo L('payment_type')?></td> <td><?php echo $payment?></td> </tr> <tr> <td width="120"><?php echo L('order').L('usernote')?></td> <td><?php echo $usernote?></td> </tr> <?php if($adminnote) {?> <tr> <td width="120"><?php echo L('adminnote')?></td> <td><?php echo $adminnote?></td> </tr> <?php }?> </table> </fieldset> </div> </body> </html> <script type="text/javascript"> $(document).ready(function() { $("#paymethod input[type='radio']").click( function () { if($(this).val()== 0){ $("#rate").removeClass('hidden'); $("#fix").addClass('hidden'); $("#rate input").val('0'); } else { $("#fix").removeClass('hidden'); $("#rate").addClass('hidden'); $("#fix input").val('0'); } }); }); 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/pay/templates/pay_detail.tpl.php
PHP
asf20
2,401
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin'); ?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}}); $("#discount").formValidator({onshow:"<?php echo L('disount_notice')?>",onfocus:"<?php echo L('empty')?>"}).inputValidator({min:1,max:999,onerror:"<?php echo L('empty')?>"}); }) //--> </script> <div class="pad-10"> <div class="common-form"> <form name="myform" action="?m=pay&c=payment&a=<?php echo $_GET['a']?>" method="post" id="myform"> <table width="100%" class="table_form"> <tr> <td width="80"><?php echo L('order_sn')?></td> <td><?php echo $trade_sn?></td> </tr> <tr> <td><?php echo L('order_discount')?></td> <td><input type="text" name="discount" value="<?php echo $discount ? $discount : 0 ?>" class="input-text" id="discount" size="6"> <?php echo L('yuan')?> </td> </tr> </table> <input type="hidden" name="id" value="<?php echo $id?>" /> <input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="dialog" id="dosubmit"> </form> </div></div> </body> </html> <script type="text/javascript"> $(document).ready(function() { $("#paymethod input[type='radio']").click( function () { if($(this).val()== 0){ $("#rate").removeClass('hidden'); $("#fix").addClass('hidden'); $("#rate input").val('0'); } else { $("#fix").removeClass('hidden'); $("#rate").addClass('hidden'); $("#fix input").val('0'); } }); }); 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/pay/templates/pay_discount.tpl.php
PHP
asf20
1,776
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin'); ?> <div class="pad_10"> <div class="table-list"> <form name="searchform" action="" method="get" > <input type="hidden" value="pay" name="m"> <input type="hidden" value="payment" name="c"> <input type="hidden" value="pay_list" name="a"> <input type="hidden" value="<?php echo $_GET['menuid']?>" name="menuid"> <div class="explain-col search-form"> <?php echo L('order_sn')?> <input type="text" value="<?php echo $trade_sn?>" class="input-text" name="info[trade_sn]"> <?php echo L('username')?> <input type="text" value="<?php echo $username?>" class="input-text" name="info[username]"> <?php echo L('addtime')?> <?php echo form::date('info[start_addtime]',$start_addtime)?><?php echo L('to')?> <?php echo form::date('info[end_addtime]',$end_addtime)?> <?php echo form::select($trade_status,$status,'name="info[status]"', L('all_status'))?> <input type="submit" value="<?php echo L('search')?>" class="button" name="dosubmit"> </div> </form> <table width="100%" cellspacing="0"> <thead> <tr> <th width="10%"><?php echo L('username')?></th> <th width="20%"><?php echo L('order_sn')?></th> <th width="15%"><?php echo L('order_time')?></th> <th width="9%"><?php echo L('business_mode')?></th> <th width="8%"><?php echo L('payment_mode')?></th> <th width="8%"><?php echo L('deposit_amount')?></th> <th width="10%"><?php echo L('pay_status')?></th> <th width="20%"><?php echo L('operations_manage')?></th> </tr> </thead> <tbody> <?php if(is_array($infos)){ $sum_amount = $sum_amount_succ = $sum_point_succ = $sum_point = '0'; foreach($infos as $info){ if($info['type'] == 1) { $num_amount++; $sum_amount += $info['money']; if($info['status'] =='succ') $sum_amount_succ += $info['money']; } elseif ($info['type'] == 2) { $num_point++; $sum_point += $info['money']; if($info['status'] =='succ') $sum_point_succ += $info['money']; } ?> <tr> <td width="10%" align="center"><?php echo $info['username']?></td> <td width="20%" align="center"><?php echo $info['trade_sn']?> <a href="javascript:void(0);" onclick="detail('<?php echo $info['id']?>', '<?php echo $info['trade_sn']?>')"><img src="<?php echo IMG_PATH?>admin_img/detail.png"></a></td> <td width="15%" align="center"><?php echo date('Y-m-d H:i:s',$info['addtime'])?></td> <td width="9%" align="center"><?php echo L($info['pay_type'])?></td> <td width="8%" align="center"><?php echo $info['payment']?></td> <td width="8%" align="center"><?php echo $info['money']?> <?php echo ($info['type']==1) ? L('yuan') : L('dian')?></td> <td width="10%" align="center"><?php echo L($info['status'])?> </a> <td width="20%" align="center"> <?php if($info['status'] =='succ' || $info['status'] =='error' || $info['status'] =='failed' ||$info['status'] =='timeout' || $info['status'] =='cancel') {?> <font color="#cccccc"><?php echo L('change_price')?> | <?php echo L('closed')?> |</font> <a href="javascript:confirmurl('?m=pay&c=payment&a=pay_del&id=<?php echo $info['id']?>&menuid=<?php echo $_GET['menuid']?>', '<?php echo L('trade_record_del')?>')"><?php echo L('delete')?></a> <?php } elseif($info['status'] =='waitting' ) {?> <a href="javascript:confirmurl('?m=pay&c=payment&a=public_check&id=<?php echo $info['id']?>', '<?php echo L('check_confirm',array('sn'=>$info['trade_sn']))?>')"><?php echo L('check')?></a> | <a href="?m=pay&c=payment&a=pay_cancel&id=<?php echo $info['id']?>"><?php echo L('closed')?></a> | <a href="javascript:confirmurl('?m=pay&c=payment&a=pay_del&id=<?php echo $info['id']?>&menuid=<?php echo $_GET['menuid']?>', '<?php echo L('trade_record_del')?>')"><?php echo L('delete')?></a> <?php } else {?> <a href="javascript:void(0);" onclick="discount('<?php echo $info['id']?>', '<?php echo $info['trade_sn']?>')"><?php echo L('change_price')?></a> | <a href="?m=pay&c=payment&a=pay_cancel&id=<?php echo $info['id']?>"><?php echo L('closed')?></a> | <a href="javascript:confirmurl('?m=pay&c=payment&a=pay_del&id=<?php echo $info['id']?>&menuid=<?php echo $_GET['menuid']?>', '<?php echo L('trade_record_del')?>')"><?php echo L('delete')?></a> <?php }?> </td> </tr> <?php } } ?> </tbody> </table> <div class="btn text-r"> <?php echo L('thispage').L('totalize')?> <span class="font-fixh green"><?php echo $number?></span> <?php echo L('bi').L('trade')?>(<?php echo L('money')?>:<span class="font-fixh"><?php echo $num_amount?></span><?php echo L('bi')?>,<?php echo L('point')?>:<span class="font-fixh"><?php echo $num_point?></span><?php echo L('bi')?>),<?php echo L('total').L('amount')?>:<span class="font-fixh green"><?php echo $sum_amount?></span><?php echo L('yuan')?> ,<?php echo L('trade_succ').L('trade')?>:<span class="font-fixh green"><?php echo $sum_amount_succ?></span><?php echo L('yuan')?> ,总点数:<span class="font-fixh green"><?php echo $sum_point?></span><?php echo L('dian')?> ,<?php echo L('trade_succ').L('trade')?>:<span class="font-fixh green"><?php echo $sum_point_succ?></span><?php echo L('dian')?> </div> <div id="pages"> <?php echo $pages?></div> </div> </div> </form> </body> </html> <script type="text/javascript"> <!-- function discount(id, name) { window.top.art.dialog({title:'<?php echo L('discount')?>--'+name, id:'discount', iframe:'?m=pay&c=payment&a=discount&id='+id ,width:'500px',height:'200px'}, function(){var d = window.top.art.dialog({id:'discount'}).data.iframe; var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'discount'}).close()}); } function detail(id, name) { window.top.art.dialog({title:'<?php echo L('discount')?>--'+name, id:'discount', iframe:'?m=pay&c=payment&a=public_pay_detail&id='+id ,width:'500px',height:'550px'}); } //--> </script>
108wo
phpcms/modules/pay/templates/pay_list.tpl.php
PHP
asf20
6,075
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin'); ?> <div class="pad_10"> <div class="table-list"> <form name="searchform" action="" method="get" > <input type="hidden" value="pay" name="m"> <input type="hidden" value="spend" name="c"> <input type="hidden" value="init" name="a"> <input type="hidden" value="<?php echo $_GET['menuid']?>" name="menuid"> <table width="100%" cellspacing="0" class="search-form"> <tbody> <tr> <td> <div class="explain-col"> <?php echo form::select(array('1'=>L('username'), '2'=>L('userid')), $user_type, 'name="user_type"')?>: <input type="text" value="<?php echo $username?>" class="input-text" name="username"> <?php echo L('from')?> <?php echo form::date('starttime',format::date($starttime))?> <?php echo L('to')?> <?php echo form::date('endtime',format::date($endtime))?> <?php echo form::select(array(''=>L('op'), '1'=>L('username'), '2'=>L('userid')), $op_type, 'name="op_type"')?>: <input type="text" value="<?php echo $op?>" class="input-text" name="op"> <?php echo form::select(array(''=>L('expenditure_patterns'), '1'=>L('money'), '2'=>L('point')), $type, 'name="type"')?> <input type="submit" value="<?php echo L('search')?>" class="button" name="dosubmit"> </div> </td> </tr> </tbody> </table> </form> <table width="100%" cellspacing="0"> <thead> <tr> <th width="10%"><?php echo L('username')?></th> <th width="20%"><?php echo L('content_of_consumption')?></th> <th width="15%"><?php echo L('empdisposetime')?> </th> <th width="9%"><?php echo L('op')?></th> <th width="8%"><?php echo L('expenditure_patterns')?></th> <th width="8%"><?php echo L('consumption_quantity')?></th> </tr> </thead> <tbody> <?php if(is_array($list)){ $amount = $point = 0; foreach($list as $info){ ?> <tr> <td width="10%" align="center"><?php echo $info['username']?></td> <td width="20%" align="center"><?php echo $info['msg']?></td> <td width="15%" align="center"><?php echo format::date($info['creat_at'], 1)?></td> <td width="9%" align="center"><?php if (!empty($info['op_userid'])) {echo $info['op_username'];} else {echo L('self');}?></td> <td width="8%" align="center"><?php if ($info['type'] == 1) {echo L('money');} elseif($info['type'] == 2) {echo L('point');}?></td> <td width="8%" align="center"><?php echo $info['value']?></td> </tr> <?php } } ?> </tbody> </table> <div id="pages"> <?php echo $pages?></div> </div> </div> </form> </body> </html> <script type="text/javascript"> <!-- function discount(id, name) { window.top.art.dialog({title:'<?php echo L('discount')?>--'+name, id:'discount', iframe:'?m=pay&c=payment&a=public_discount&id='+id ,width:'500px',height:'200px'}, function(){var d = window.top.art.dialog({id:'discount'}).data.iframe; var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'discount'}).close()}); } function detail(id, name) { window.top.art.dialog({title:'<?php echo L('discount')?>--'+name, id:'discount', iframe:'?m=pay&c=payment&a=public_pay_detail&id='+id ,width:'500px',height:'550px'}); } //--> </script>
108wo
phpcms/modules/pay/templates/spend_list.tpl.php
PHP
asf20
3,371
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin'); ?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}}); $("#name").formValidator({onshow:"<?php echo L('input').L('payment_mode').L('name')?>",onfocus:"<?php echo L('payment_mode').L('name').L('empty')?>"}).inputValidator({min:1,max:999,onerror:"<?php echo L('payment_mode').L('name').L('empty')?>"}); }) //--> </script> <div class="pad-10"> <div class="common-form"> <form name="myform" action="?m=pay&c=payment&a=<?php echo $_GET['a']?>" method="post" id="myform"> <fieldset> <legend><?php echo L('basic_config')?></legend> <table width="100%" class="table_form"> <tr> <td width="120"><?php echo L('payment_mode')?></td> <td><?php echo $pay_name?></td> </tr> <tr> <td width="120"><?php echo L('payment_mode').L('name')?></td> <td><input type="text" name="name" value="<?php echo $name ? $name : $pay_name?>" class="input-text" id="name"></input></td> </tr> <tr> <td><?php echo L('payment_mode').L('desc')?></td> <td> <textarea name="description" rows="2" cols="10" id="description" class="inputtext" style="height:100px;width:300px;"><?php echo $pay_desc?></textarea> <?php echo form::editor('description', 'desc');?> </td> </tr> <tr> <td width="120"><?php echo L('listorder')?></td> <td><input type="text" name="pay_order" value="<?php echo $pay_order?>" class="input-text" id="pay_order" size="3"></input></td> </tr> <tr> <td width="120"><?php echo L('online')?>?</td> <td><?php echo $is_online ? L('yes'):L('no')?></td> </tr> <tr> <td width="120"><?php echo L('pay_factorage')?>:</td> <td id="paymethod"><input name="pay_method" value="0" type="radio" <?php echo ($pay_method == 1) ? '': 'checked'?>> <?php echo L('pay_method_rate')?>&nbsp;&nbsp;&nbsp;<input name="pay_method" value="1" type="radio" <?php echo ($pay_method == 0) ? '': 'checked'?>> <?php echo L('pay_method_fix')?>&nbsp;&nbsp;&nbsp; </td> </tr> <tr><td></td> <td> <div id="rate" <?php echo ($pay_method == 0) ? '': 'class="hidden"'?>> <?php echo L('pay_rate')?><input type="text" size="3" value="<?php echo $pay_fee?>" name="pay_rate">&nbsp;%&nbsp;&nbsp;&nbsp;&nbsp;<?php echo L('pay_method_rate_desc')?> </div> <div id="fix" <?php echo ($pay_method == 1) ? '': 'class="hidden"'?>> <?php echo L('pay_fix')?><input type="text" name="pay_fix" size="3" value="<?php echo $pay_fee?>">&nbsp;&nbsp;&nbsp;&nbsp; <?php echo L('pay_method_fix_desc')?> </div> </td> </tr> </table> </fieldset> <div class="bk15"></div> <fieldset> <legend><?php echo L('parameter_config')?></legend> <table width="100%" class="table_form"> <?php foreach ($config as $conf => $name) {?> <tr> <td><?php echo $name['name']?></td> <td> <?php if($name['type'] == 'text'){?> <input type="text" class="input-text" name="config_value[]" id="<?php echo $conf?>" value="<?php echo $name['value']?>" size="40"></input> <?php } elseif($name['type'] == 'select') { ?> <select name="config_value[]" value="0"> <?php foreach ($name['range'] as $key => $v) {?> <option value="<?php echo $key?>" <?php if($key == $name['value']){ ?> selected="" <?php } ?> ><?php echo $v?></option> <?php }?> </select> <?php }?> <input type="hidden" value="<?php echo $conf?>" name="config_name[]"/> </td> </tr> <?php }?> </table> </fieldset> <div class="bk15"></div> <input type="hidden" name="pay_name" value="<?php echo $pay_name?>" /> <input type="hidden" name="pay_id" value=<?php echo $pay_id?> /> <input type="hidden" name="pay_code" value=<?php echo $pay_code?> /> <input type="hidden" name="is_cod" value=<?php echo $is_cod?> /> <input type="hidden" name="is_online" value=<?php echo $is_online?> /> <input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="dialog" id="dosubmit"> </form> </div></div> </body> </html> <script type="text/javascript"> $(document).ready(function() { $("#paymethod input[type='radio']").click( function () { if($(this).val()== 0){ $("#rate").removeClass('hidden'); $("#fix").addClass('hidden'); $("#rate input").val('0'); } else { $("#fix").removeClass('hidden'); $("#rate").addClass('hidden'); $("#fix input").val('0'); } }); }); 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/pay/templates/payment_detail.tpl.php
PHP
asf20
4,597
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin'); ?> <div class="pad_10"> <div class="table-list"> <form name="searchform" action="" method="get" > <input type="hidden" value="pay" name="m"> <input type="hidden" value="payment" name="c"> <input type="hidden" value="pay_stat" name="a"> <input type="hidden" value="<?php echo $_GET['menuid']?>" name="menuid"> <div class="explain-col search-form"> <?php echo L('username')?> <input type="text" value="<?php echo $username?>" class="input-text" name="info[username]"> <?php echo L('addtime')?> <?php echo form::date('info[start_addtime]',$start_addtime)?><?php echo L('to')?> <?php echo form::date('info[end_addtime]',$end_addtime)?> <?php echo form::select($trade_status,$status,'name="info[status]"', L('all_status'))?> <input type="submit" value="<?php echo L('search')?>" class="button" name="dosubmit"> </div> </form> <fieldset> <legend><?php echo L('finance').L('totalize')?></legend> <table width="100%" class="table_form"> <tbody> <tr> <th width="80"><?php echo L('total').L('transactions')?></th> <td class="y-bg"><?php echo L('money')?>&nbsp;&nbsp;<span class="font-fixh green"><?php echo $total_amount_num?></span> <?php echo L('bi')?>(<?php echo L('trade_succ').L('trade')?>&nbsp;&nbsp;<span class="font-fixh"><?php echo $total_amount_num_succ?></span> <?php echo L('bi')?>)<br/><?php echo L('point')?>&nbsp;&nbsp;<span class="font-fixh green"><?php echo $total_point_num?></span> <?php echo L('bi')?>(<?php echo L('trade_succ').L('trade')?>&nbsp;&nbsp;<span class="font-fixh"><?php echo $total_point_num_succ?></span> <?php echo L('bi')?>)</td> </tr> <tr> <th width="80"><?php echo L('total').L('amount')?></th> <td class="y-bg"><span class="font-fixh green"><?php echo $total_amount?></span> <?php echo L('yuan')?>(<?php echo L('trade_succ').L('trade')?>&nbsp;&nbsp;<span class="font-fixh"><?php echo $total_amount_succ?></span><?php echo L('yuan')?>)<br/><span class="font-fixh green"><?php echo $total_point?></span><?php echo L('dian')?>(<?php echo L('trade_succ').L('trade')?>&nbsp;&nbsp;<span class="font-fixh"><?php echo $total_point_succ?></span><?php echo L('dian')?>)</td> </tr> </table> </fieldset> <div class="bk10"></div> <fieldset> <legend><?php echo L('query_stat')?></legend> <table width="100%" class="table_form"> <tbody> <?php if($num) {?> <tr> <th width="80"><?php echo L('total_transactions')?>:</th> <td class="y-bg"><?php echo L('money')?>:<span class="font-fixh green"><?php echo $amount_num?></span> <?php echo L('bi')?>(<?php echo L('transactions_success')?>:<span class="font-fixh"><?php echo $amount_num_succ?></span> <?php echo L('bi')?>)<br/><?php echo L('point')?>:<span class="font-fixh green"><?php echo $point_num?></span> <?php echo L('bi')?>(<?php echo L('transactions_success')?>:<span class="font-fixh"><?php echo $point_num_succ?></span> <?php echo L('bi')?>)</td> </tr> <tr> <th width="80"><?php echo L('total').L('amount')?>:</th> <td class="y-bg"><span class="font-fixh green"><?php echo $amount?></span><?php echo L('yuan')?>(<?php echo L('transactions_success')?>:<span class="font-fixh"><?php echo $amount_succ?></span><?php echo L('yuan')?>)<br/><span class="font-fixh green"><?php echo $point?></span><?php echo L('dian')?>(<?php echo L('transactions_success')?>:<span class="font-fixh"><?php echo $point_succ?></span><?php echo L('dian')?>)</td> </tr> <?php }?> </table> </fieldset> </div> </div> </form> </body> </html> <script type="text/javascript"> <!-- function discount(id, name) { window.top.art.dialog({title:'<?php echo L('discount')?>--'+name, id:'discount', iframe:'?m=pay&c=payment&a=public_discount&id='+id ,width:'500px',height:'200px'}, function(){var d = window.top.art.dialog({id:'discount'}).data.iframe; var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'discount'}).close()}); } function detail(id, name) { window.top.art.dialog({title:'<?php echo L('discount')?>--'+name, id:'discount', iframe:'?m=pay&c=payment&a=public_pay_detail&id='+id ,width:'500px',height:'550px'}); } //--> </script>
108wo
phpcms/modules/pay/templates/pay_stat.tpl.php
PHP
asf20
4,340
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin'); ?> <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('payment_mode').L('name')?></th> <th width="5%"><?php echo L('plus_version')?></th> <th width="15%"><?php echo L('plus_author')?></th> <th width="45%"><?php echo L('desc')?></th> <th width="10%"><?php echo L('listorder')?></th> <th width="15%"><?php echo L('operations_manage')?></th> </tr> </thead> <tbody> <?php if(is_array($infos['data'])){ foreach($infos['data'] as $info){ ?> <tr> <td width="10%"><?php echo $info['pay_name']?></td> <td width="5%" align="center"><?php echo $info['version']?></td> <td width="15%" align="center"><?php echo $info['author']?></td> <td width="45%" align="center"><?php echo $info['pay_desc']?></td> <td width="10%" align="center"><?php echo $info['pay_order']?></td> <td width="15%" align="center"> <?php if ($info['enabled']) {?> <a href="javascript:edit('<?php echo $info['pay_id']?>', '<?php echo $info['pay_name']?>')"><?php echo L('edit')?></a> | <a href="javascript:confirmurl('?m=pay&c=payment&a=delete&id=<?php echo $info['pay_id']?>', '<?php echo L('confirm',array('message'=>$info['pay_name']))?>')"><?php echo L('plus_uninstall')?></a> <?php } else {?> <a href="javascript:add('<?php echo $info['pay_code']?>', '<?php echo $info['pay_name']?>')"><?php echo L('plus_install')?></a> <?php }?> </td> </tr> <?php } } ?> </tbody> </table> <div class="btn"></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"> <!-- 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/pay/templates/payment_list.tpl.php
PHP
asf20
2,835
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin'); ?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}}); $("#unit").formValidator({onshow:"<?php echo L('input_price_to_change')?>",onfocus:"<?php echo L('number').L('empty')?>"}).inputValidator({min:1,max:999,onerror:"<?php echo L('number').L('empty')?>"}).regexValidator({regexp:"^(([1-9]{1}\\d*)|([0]{1}))(\\.(\\d){1,2})?$",onerror:"<?php echo L('must_be_price')?>"}); $("#username").formValidator({onshow:"<?php echo L('input').L('username')?>",onfocus:"<?php echo L('username').L('empty')?>"}).inputValidator({min:1,max:999,onerror:"<?php echo L('username').L('empty')?>"}).ajaxValidator({ type : "get", url : "", data :"m=pay&c=payment&a=public_checkname_ajax", datatype : "html", async:'false', success : function(data){ if(data!= 'FALSE') { $("#balance").html(data); return true; } else { $("#balance").html(''); return false; } }, buttons: $("#dosubmit"), onerror : "<?php echo L('user_not_exist')?>", onwait : "<?php echo L('checking')?>" }); $("#usernote").formValidator({onshow:"<?php echo L('input').L('reason_of_modify')?>",onfocus:"<?php echo L('usernote').L('empty')?>"}).inputValidator({min:1,max:999,onerror:"<?php echo L('usernote').L('empty')?>"}); }) //--> </script> <div class="pad-10"> <div class="common-form"> <form name="myform" action="?m=pay&c=payment&a=<?php echo $_GET['a']?>" method="post" id="myform"> <table width="100%" class="table_form"> <tr> <td width="120"><?php echo L('recharge_type')?></td> <td><input name="pay_type" value="1" type="radio" id="pay_type" checked> <?php echo L('money')?> <input name="pay_type" value="2" type="radio" id="pay_type"> <?php echo L('point')?></td> </tr> <tr> <td width="120"><?php echo L('username')?></td> <td><input type="text" name="username" size="15" value="<?php echo $username?>" id="username"><span id="balance"><span></td> </tr> <tr> <td width="120"><?php echo L('recharge_quota')?></td> <td><input name="pay_unit" value="1" type="radio" checked> <?php echo L('increase')?> <input name="pay_unit" value="0" type="radio"> <?php echo L('reduce')?> <input type="text" name="unit" size="10" value="<?php echo $unit?>" id="unit"></td> </tr> <tr> <td width="120"><?php echo L('trading').L('usernote')?></td> <td><textarea name="usernote" id="usernote" rows="5" cols="50"></textarea></td> </tr> <tr> <td width="120"><?php echo L('op_notice')?></td> <td><label><input type="checkbox" id="sendemail" name="sendemail" value="1" checked> <?php echo L('op_sendemail')?></label></td> </tr> </table> <div class="bk15"></div> <input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="button" id="dosubmit"> </form> </div> </body> </html> <script type="text/javascript"> $(document).ready(function() { $("#paymethod input[type='radio']").click( function () { if($(this).val()== 0){ $("#rate").removeClass('hidden'); $("#fix").addClass('hidden'); $("#rate input").val('0'); } else { $("#fix").removeClass('hidden'); $("#rate").addClass('hidden'); $("#fix input").val('0'); } }); }); 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/pay/templates/modify_deposit.tpl.php
PHP
asf20
3,620
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); class spend extends admin { private $db; public function __construct() { $this->db = pc_base::load_model('pay_spend_model'); parent::__construct(); } public function init() { pc_base::load_sys_class('form', '', 0); pc_base::load_sys_class('format', '', 0); $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1; $sql = ""; if (isset($_GET['dosubmit'])) { $username = isset($_GET['username']) && trim($_GET['username']) ? trim($_GET['username']) : ''; $op = isset($_GET['op']) && trim($_GET['op']) ? trim($_GET['op']) : ''; $user_type = isset($_GET['user_type']) && intval($_GET['user_type']) ? intval($_GET['user_type']) : ''; $op_type = isset($_GET['op_type']) && intval($_GET['op_type']) ? intval($_GET['op_type']) : ''; $type = isset($_GET['type']) && intval($_GET['type']) ? intval($_GET['type']) : ''; $endtime = isset($_GET['endtime']) && trim($_GET['endtime']) ? strtotime(trim($_GET['endtime'])) : ''; $starttime = isset($_GET['starttime']) && trim($_GET['starttime']) ? strtotime(trim($_GET['starttime'])) : ''; if (!empty($starttime) && empty($endtime)) { $endtime = SYS_TIME; } if (!empty($starttime) && !empty($endtime) && $endtime < $starttime) { showmessage(L('wrong_time_over_time_to_time_less_than')); } if (!empty($username) && $user_type == 1) { $sql .= $sql ? " AND `username` = '$username'" : " `username` = '$username'"; } if (!empty($username) && $user_type == 2) { $sql .= $sql ? " AND `userid` = '$username'" : " `userid` = '$username'"; } if (!empty($starttime)) { $sql .= $sql ? " AND `creat_at` BETWEEN '$starttime' AND '$endtime' " : " `creat_at` BETWEEN '$starttime' AND '$endtime' "; } if (!empty($op) && $op_type == 1) { $sql .= $sql ? " AND `op_username` = '$op' " : " `op_username` = '$op' "; } elseif (!empty($op) && $op_type == 2) { $sql .= $sql ? " AND `op_userid` = '$op' " : " `op_userid` = '$op' "; } if (!empty($type)) { $sql .= $sql ? " AND `type` = '$type' " : " `type` = '$type'"; } } $list = $this->db->listinfo($sql, '`id` desc', $page); $pages = $this->db->pages; include $this->admin_tpl('spend_list'); } }
108wo
phpcms/modules/pay/spend.php
PHP
asf20
2,413
<?php if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; $modules[$i]['code'] = basename(__FILE__, '.class.php'); $modules[$i]['name'] = L('sndapay', '', 'pay'); $modules[$i]['desc'] = L('sndapay_tip', '', 'pay'); $modules[$i]['is_cod'] = '0'; $modules[$i]['is_online'] = '1'; $modules[$i]['author'] = 'PHPCMS开发团队'; $modules[$i]['website'] = 'http://www.sdo.com'; $modules[$i]['version'] = '1.0.0'; $modules[$i]['config'] = array( array('name' => 'sndapay_account','type' => 'text','value' => ''), array('name' => 'sndapay_key','type' => 'text','value' => ''), ); return; } pc_base::load_app_class('pay_abstract','','0'); class Sndapay extends paymentabstract{ public function __construct($config = array()) { if (!empty($config)) $this->set_config($config); $this->config['gateway_url'] = 'http://netpay.sdo.com/paygate/default.aspx'; $this->config['gateway_method'] = 'POST'; $this->config['notify_url'] = return_url('sndapay',1); $this->config['return_url'] = return_url('sndapay'); } public function getpreparedata() { $prepare_data['Version'] = '3.0'; //gateway version $prepare_data['CurrencyType'] = 'RMB'; $prepare_data['NotifyUrlType'] = 'http'; $prepare_data['MerchantNo'] = $this->config['sndapay_account']; $prepare_data['MerchantUserId'] = ''; $prepare_data['SignType'] = '2'; $prepare_data['NotifyUrl'] = $this->config['notify_url']; $prepare_data['PostBackUrl'] = $this->config['return_url']; $prepare_data['BackUrl'] = ''; $prepare_data['PayChannel'] = ''; $prepare_data['DefaultChannel'] = '04'; // 商品信息 $prepare_data['ProductDesc'] = $this->product_info['name']; $prepare_data['Amount'] = $this->product_info['price']; $prepare_data['ProductNo'] = ''; $prepare_data['ProductUrl'] = ''; //订单信息 $prepare_data['OrderNo'] = $this->order_info['id']; $prepare_data['OrderTime'] = date('YmdHis',$this->order_info['order_time']); //买家信息 $prepare_data['Remark1'] = $this->product_info['body']; $data = $prepare_data['Version'].$prepare_data['Amount'].$prepare_data['OrderNo'].$prepare_data['MerchantNo'].$prepare_data['MerchantUserId'].$prepare_data['PayChannel'].$prepare_data['PostBackUrl'].$prepare_data['NotifyUrl'].$prepare_data['BackUrl'].$prepare_data['OrderTime'].$prepare_data['CurrencyType'].$prepare_data['NotifyUrlType'].$prepare_data['SignType'].$prepare_data['ProductNo'].$prepare_data['ProductDesc'].$prepare_data['Remark1'].$prepare_data['DefaultChannel'].$prepare_data['ProductUrl']; // 数字签名 $prepare_data['MAC'] = md5($data.$this->config['sndapay_key']); return $prepare_data; } /** * 客户端接收数据 * 状态码说明 (0 交易完成 1 交易失败 2 交易超时 3 交易处理中 4 交易未支付) */ public function receive() { $amount=$_POST["Amount"]; $payamount=$_POST["PayAmount"]; $orderid=$_POST["OrderNo"]; $serialno=$_POST["serialno"];//注意大小写,客服端回调首字母大写,服务端回调首字母小写 $status=$_POST["Status"]; $merid=$_POST["MerchantNo"]; $paychannel=$_POST["PayChannel"]; $discount=$_POST["Discount"]; $signtype=$_POST["SignType"]; $paytime=$_POST["PayTime"]; $ctype=$_POST["CurrencyType"]; $prono=$_POST["ProductNo"]; $prodesc=$_POST["ProductDesc"]; $remark1=$_POST["Remark1"]; $remark2=$_POST["Remark2"]; $ex=$_POST["ExInfo"]; $mac=$_POST["MAC"]; $signString=$amount."|".$payamount."|".$orderid."|".$serialno."|".$status."|".$merid."|".$paychannel."|".$discount."|".$signtype."|".$paytime."|".$ctype."|".$prono."|".$prodesc."|".$remark1."|".$remark2."|".$ex; if($signtype=="2") { $md5key=$this->config['sndapay_key']; $mac2 =md5($signString."|".$md5key); $ok = (strtoupper($mac)==strtoupper($mac2)); } if ($ok == 1) { $return_data['order_id'] = $orderid; $return_data['order_total'] = $amount; $return_data['price'] = $payamount; $return_data['order_status'] = 0; return $return_data; } elseif ($ok == 0) { showmessage(L('illegal_notice')); return false; } else { error_log(date('m-d H:i:s',SYS_TIME).'| GET: illegality notice : flase |'."\r\n", 3, CACHE_PATH.'pay_error_log.php'); showmessage(L('illegal_sign')); return false; } } /** * POST接收数据 * 状态码说明 (0 交易完成 1 交易失败 2 交易超时 3 交易处理中 4 交易未支付) */ public function notify() { $amount=$_POST["Amount"]; $payamount=$_POST["PayAmount"]; $orderid=$_POST["OrderNo"]; $serialno=$_POST["serialno"];//注意大小写,客服端回调首字母大写,服务端回调首字母小写 $status=$_POST["Status"]; $merid=$_POST["MerchantNo"]; $paychannel=$_POST["PayChannel"]; $discount=$_POST["Discount"]; $signtype=$_POST["SignType"]; $paytime=$_POST["PayTime"]; $ctype=$_POST["CurrencyType"]; $prono=$_POST["ProductNo"]; $prodesc=$_POST["ProductDesc"]; $remark1=$_POST["Remark1"]; $remark2=$_POST["Remark2"]; $ex=$_POST["ExInfo"]; $mac=$_POST["MAC"]; $signString=$amount."|".$payamount."|".$orderid."|".$serialno."|".$status."|".$merid."|".$paychannel."|".$discount."|".$signtype."|".$paytime."|".$ctype."|".$prono."|".$prodesc."|".$remark1."|".$remark2."|".$ex; if($signtype=="2") { $md5key=$this->config['sndapay_key']; $mac2 =md5($signString."|".$md5key); $ok = (strtoupper($mac)==strtoupper($mac2)); } if ($ok == 1) { $return_data['order_id'] = $orderid; $return_data['order_total'] = $amount; $return_data['price'] = $payamount; $return_data['order_status'] = 0; return $return_data; } elseif ($ok == 0) { return false; } else { error_log(date('m-d H:i:s',SYS_TIME).'| POST: illegality notice : flase |'."\r\n", 3, CACHE_PATH.'pay_error_log.php'); return false; } } /** * 相应服务器应答状态 * @param $result */ public function response($result) { if (FALSE == $result) echo 'bad'; else echo 'ok'; } /** * 返回字符过滤 * @param $parameter */ private function filterParameter($parameter) { $para = array(); foreach ($parameter as $key => $value) { if ('sign' == $key || 'sign_type' == $key || '' == $value || 'm' == $key || 'a' == $key || 'c' == $key || 'code' == $key ) continue; else $para[$key] = $value; } return $para; } } ?>
108wo
phpcms/modules/pay/classes/Sndapay.class.php
PHP
asf20
6,701
<?php /* * 支付模块调用工厂 */ class pay_factory { public function __construct($adapter_name = '', $adapter_config = array()) { $this->set_adapter($adapter_name, $adapter_config); } /** * 构造适配器 * @param $adapter_name 支付模块code * @param $adapter_config 支付模块配置 */ public function set_adapter($adapter_name, $adapter_config = array()) { if (!is_string($adapter_name)) return false; else { $class_name = ucwords($adapter_name); pc_base::load_app_class($class_name,'','0'); $this->adapter_instance = new $class_name($adapter_config); } return $this->adapter_instance; } public function __call($method_name, $method_args) { if (method_exists($this, $method_name)) return call_user_func_array(array(& $this, $method_name), $method_args); elseif ( !empty($this->adapter_instance) && ($this->adapter_instance instanceof paymentabstract) && method_exists($this->adapter_instance, $method_name) ) return call_user_func_array(array(& $this->adapter_instance, $method_name), $method_args); } } ?>
108wo
phpcms/modules/pay/classes/pay_factory.class.php
PHP
asf20
1,120
<?php abstract class paymentabstract { protected $config = array(); protected $product_info = array(); protected $customter_info = array(); protected $order_info = array(); protected $shipping_info = array(); public function set_config($config) { foreach ($config as $key => $value) $this->config[$key] = $value; return $this; } public function set_productinfo($product_info) { $this->product_info = $product_info; return $this; } public function set_customerinfo($customer_info) { $this->customer_info = $customer_info; return $this; } public function set_orderinfo($order_info) { $this->order_info = $order_info; return $this; } public function set_shippinginfo($shipping_info) { $this->shipping_info = $shipping_info; return $this; } public function get_code($button_attr = '') { if (strtoupper($this->config['gateway_method']) == 'POST') $str = '<form action="' . $this->config['gateway_url'] . '" method="POST" target="_blank">'; else $str = '<form action="' . $this->config['gateway_url'] . '" method="GET" target="_blank">'; $prepare_data = $this->getpreparedata(); foreach ($prepare_data as $key => $value) $str .= '<input type="hidden" name="' . $key . '" value="' . $value . '" />'; $str .= '<input type="submit" ' . $button_attr . ' />'; $str .= '</form>'; return $str; } protected function get_verify($url,$time_out = "60") { $urlarr = parse_url($url); $errno = ""; $errstr = ""; $transports = ""; if($urlarr["scheme"] == "https") { $transports = "ssl://"; $urlarr["port"] = "443"; } else { $transports = "tcp://"; $urlarr["port"] = "80"; } $fp=@fsockopen($transports . $urlarr['host'],$urlarr['port'],$errno,$errstr,$time_out); if(!$fp) { die("ERROR: $errno - $errstr<br />\n"); } else { fputs($fp, "POST ".$urlarr["path"]." HTTP/1.1\r\n"); fputs($fp, "Host: ".$urlarr["host"]."\r\n"); fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n"); fputs($fp, "Content-length: ".strlen($urlarr["query"])."\r\n"); fputs($fp, "Connection: close\r\n\r\n"); fputs($fp, $urlarr["query"] . "\r\n\r\n"); while(!feof($fp)) { $info[]=@fgets($fp, 1024); } fclose($fp); $info = implode(",",$info); return $info; } } abstract public function receive(); abstract public function notify(); abstract public function response($result); abstract public function getPrepareData(); }
108wo
phpcms/modules/pay/classes/pay_abstract.class.php
PHP
asf20
2,668
<?php class pay_deposit { public function __construct() { $this->pay_db = pc_base::load_model('pay_payment_model'); $this->account_db = pc_base::load_model('pay_account_model'); } /** * 生成流水记录 * @param unknown_type */ public function set_record($data){ $require_items = array('userid','username','email','contactname','telephone','trade_sn','money','quantity','addtime','paytime','usernote','usernote','pay_type','pay_id','payment','ip','status'); if(is_array($data)) { foreach($data as $key=>$item) { if(in_array($key,$require_items)) $info[$key] = $item; } } else { return false; } $trade_exist = $this->account_db->get_one(array('trade_sn'=>$info['trade_sn'])); if($trade_exist) return $trade_exist['id']; $this->account_db->insert($info); return $this->account_db->insert_id(); } /** * 获取流水记录 * @param init $id 流水帐号 */ public function get_record($id) { $id = intval($id); $result = array(); $result = $this->account_db->get_one(array('id'=>$id)); $status_arr = array('succ','failed','error','timeout','cancel'); return ($result && !in_array($result['status'],$status_arr)) ? $result: false; } /** * 获取充值方式信息 * @param unknown_type $pay_id * @return unknown */ public function get_payment($pay_id) { $pay_id = intval($pay_id); $result = array(); $result = $this->pay_db->get_one(array('pay_id'=>$pay_id)); return $result; } /** * 获取充值类型 */ public function get_paytype() { $result = $this->pay_db->select('','pay_id,name,pay_name,pay_code,pay_desc','','pay_order DESC,pay_id DESC'); $info = array(); foreach($result as $r) { $info[] = $r; } return $info; } } ?>
108wo
phpcms/modules/pay/classes/pay_deposit.class.php
PHP
asf20
1,797
<?php if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; $modules[$i]['code'] = basename(__FILE__, '.class.php'); $modules[$i]['name'] = L('bank_transfer', '', 'pay'); $modules[$i]['desc'] = L('transfer', '', 'pay'); $modules[$i]['is_cod'] = '0'; $modules[$i]['is_online'] = '0'; $modules[$i]['author'] = 'PHPCMS开发团队'; $modules[$i]['website'] = ''; $modules[$i]['version'] = '1.0.0'; $modules[$i]['config'] = array(); return; } ?>
108wo
phpcms/modules/pay/classes/Bank.class.php
PHP
asf20
559
<?php class pay_method { public function __construct($modules_path) { $this->db = pc_base::load_model('pay_payment_model'); $this->modules_path = $modules_path; } /** * 获取支付类型列表 */ public function get_list() { $list = $this->get_payment(); $install = $this->get_intallpayment(); if(is_array($list)) { foreach ($list as $code => $payment ) { if (isset($install[$code])) { $install[$code]['pay_desc'] = $list[$code]['pay_desc']; unset($list[$code]); } } } $all = @array_merge($install, $list); return array('data' => $all, array( 'all' => count($all), 'install' => count($install) ) ); } /** * 获取插件目录信息 * @param unknown_type $code */ public function get_payment( $code = '') { $modules = $this->read_payment($this->modules_path.DIRECTORY_SEPARATOR.'classes'); foreach($modules as $payment) { if ( empty($code) || $payment['code']) { $config = array(); foreach ($payment['config'] as $conf) { $name = $conf['name']; $conf['name'] = L($name); if ($conf['type'] == 'select') { $conf['range'] = L($name.'_range'); } $config[$name] = $conf; } } $payment_info[$payment['code']] = array( "pay_id" => 0, "pay_code" => $payment['code'], "pay_name" => $payment['name'], "pay_desc" => $payment['desc'], "pay_fee" => '0', "config" => $config, "is_cod" => $payment['is_cod'], "is_online" => $payment['is_online'], "enabled" => '0', "sort_order" => "", "author" => $payment['author'], "website" => $payment['website'], "version" => $payment['version'] ); } if (empty($code)) { return $payment_info; } else { return $payment_info[$code]; } } /** * 取得数据库中的支付列表 * @param $code */ public function get_intallpayment($code = '') { if (empty($code)) { $intallpayment = array(); $result = $this->db->select(); foreach($result as $r) { $r['pay_code'] = ucwords($r['pay_code']); $intallpayment[$r['pay_code']] = $r; } return $intallpayment; } else { return $this->db->get_one(array('pay_code'=>ucwords($code))); } } /** * 读取插件目录中插件列表 * @param unknown_type $directory */ public function read_payment($directory = ".") { $dir = @opendir($directory); $set_modules = true; $modules = array(); while (($file = @readdir($dir))!== false) { if ( preg_match( "/^[A-Z]{1}.*?\\.class.php\$/", $file ) ) { include_once( $directory.DIRECTORY_SEPARATOR.$file ); } } @closedir($dir); foreach ($modules as $key => $value ) { ksort($modules[$key] ); } ksort( $modules ); return $modules; } } ?>
108wo
phpcms/modules/pay/classes/pay_method.class.php
PHP
asf20
2,870
<?php if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; $modules[$i]['code'] = basename(__FILE__, '.class.php'); $modules[$i]['name'] = L('chinabank', '', 'pay'); $modules[$i]['desc'] = L('chinabank_tip', '', 'pay'); $modules[$i]['is_cod'] = '0'; $modules[$i]['is_online'] = '1'; $modules[$i]['author'] = 'PHPCMS开发团队'; $modules[$i]['website'] = 'http://www.chinabank.com.cn'; $modules[$i]['version'] = '1.0.0'; $modules[$i]['config'] = array( array('name' => 'chinabank_account','type' => 'text','value' => ''), array('name' => 'chinabank_key','type' => 'text','value' => ''), ); return; } pc_base::load_app_class('pay_abstract','','0'); class Chinabank extends paymentabstract{ public function __construct($config = array()) { if (!empty($config)) $this->set_config($config); $this->config['gateway_url'] = 'https://pay3.chinabank.com.cn/PayGate'; $this->config['gateway_method'] = 'POST'; $this->config['return_url'] = return_url('chinabank'); pc_base::load_app_func('alipay'); } public function getpreparedata() { $prepare_data['v_mid'] = $this->config['chinabank_account']; $prepare_data['v_url'] = $this->config['return_url']; $prepare_data['v_moneytype'] = 'CNY'; $prepare_data['return_url'] = $this->config['return_url']; // 商品信息 $prepare_data['v_rcvname'] = $this->product_info['name']; $prepare_data['v_amount'] = $this->product_info['price']; //订单信息 $prepare_data['v_oid'] = $this->order_info['id']; //买家信息 $prepare_data['v_rcvmobile'] = $this->customer_info['telephone']; $prepare_data['v_rcvemail'] = $this->order_info['buyer_email']; //备注 $prepare_data['remark1'] = $this->product_info['body']; $data =$prepare_data['v_amount'].$prepare_data['v_moneytype'].$prepare_data['v_oid'].$prepare_data['v_mid'].$prepare_data['v_url'].$this->config['chinabank_key']; // 数字签名 $prepare_data['v_md5info'] = strtoupper(md5($data)); return $prepare_data; } /** * 客户端接收数据 * 状态码说明 (0 交易完成 1 交易失败 2 交易超时 3 交易处理中 4 交易未支付) */ public function receive() { $receive_data = $this->filterParameter($_POST); $receive_data = arg_sort($receive_data); if ($receive_data) { $v_oid =trim($receive_data['v_oid']); $v_pmode =trim($receive_data['v_pmode']); $v_pstatus =trim($receive_data['v_pstatus']); $v_pstring =trim($receive_data['v_pstring']); $v_amount =trim($receive_data['v_amount']); $v_moneytype =trim($receive_data['v_moneytype']); $remark1 =trim($receive_data['remark1' ]); $remark2 =trim($receive_data['remark2' ]); $v_md5str =trim($receive_data['v_md5str' ]); $md5string=strtoupper(md5($v_oid.$v_pstatus.$v_amount.$v_moneytype.$this->config['chinabank_key'])); if ($v_md5str==$md5string) { $return_data['order_id'] = $v_oid; $return_data['order_total'] = $v_amount; $return_data['price'] = $v_amount; if($v_pstatus=="20") { $return_data['order_status'] = 0; return $return_data; } else { error_log(date('m-d H:i:s',SYS_TIME).'| chinabank GET: order_status=30 |'."\r\n", 3, CACHE_PATH.'pay_error_log.php'); return false; } } else { showmessage(L('illegal_sign')); return false; } } else { error_log(date('m-d H:i:s',SYS_TIME).'| GET: no return |'."\r\n", 3, CACHE_PATH.'pay_error_log.php'); showmessage(L('illegal_return')); return false; } } /** * POST接收数据 * 状态码说明 (0 交易完成 1 交易失败 2 交易超时 3 交易处理中 4 交易未支付) */ public function notify() { $receive_data = $this->filterParameter($_POST); $receive_data = arg_sort($receive_data); if ($receive_data) { $v_oid =trim($receive_data['v_oid']); $v_pmode =trim($receive_data['v_pmode']); $v_pstatus =trim($receive_data['v_pstatus']); $v_pstring =trim($receive_data['v_pstring']); $v_amount =trim($receive_data['v_amount']); $v_moneytype =trim($receive_data['v_moneytype']); $remark1 =trim($receive_data['remark1' ]); $remark2 =trim($receive_data['remark2' ]); $v_md5str =trim($receive_data['v_md5str' ]); $md5string=strtoupper(md5($v_oid.$v_pstatus.$v_amount.$v_moneytype.$this->config['chinabank_key'])); if ($v_md5str==$md5string) { $return_data['order_id'] = $v_oid; $return_data['order_total'] = $v_amount; $return_data['price'] = $v_amount; if($v_pstatus=="20") { $return_data['order_status'] = 0; } else { error_log(date('m-d H:i:s',SYS_TIME).'| chinabank notify: order_status=30 |'."\r\n", 3, CACHE_PATH.'pay_error_log.php'); return false; } } else { return false; } } else { error_log(date('m-d H:i:s',SYS_TIME).'| notify: no return |'."\r\n", 3, CACHE_PATH.'pay_error_log.php'); return false; } } /** * 相应服务器应答状态 * @param $result */ public function response($result) { if (FALSE == $result) echo 'ok'; else echo 'success'; } /** * 返回字符过滤 * @param $parameter */ private function filterParameter($parameter) { $para = array(); foreach ($parameter as $key => $value) { if ('sign' == $key || 'sign_type' == $key || '' == $value || 'm' == $key || 'a' == $key || 'c' == $key || 'code' == $key ) continue; else $para[$key] = $value; } return $para; } } ?>
108wo
phpcms/modules/pay/classes/Chinabank.class.php
PHP
asf20
5,781
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_func('global','pay'); class receipts { //数据库连接 protected static $db; /** * 数据库连接 */ protected static function connect() { self::$db = pc_base::load_model("pay_account_model"); } /** * 添加金钱入账记录 * 添加金钱入账记录操作放放 * @param integer $value 入账金额 * @param integer $userid 用户ID * @param string $username 用户名 * @param integer $trand_sn 操作订单ID,默认为自动生成 * @param string $pay_type 入账类型 (可选值 offline 线下充值,recharge 在线充值,selfincome 自助获取) * @param string $payment 入账方式 (如后台充值,支付宝,银行汇款/转账等此处为自定义) * @param string $status 入账状态 (可选值 succ 默认,入账成功,error 入账失败)注当且仅当为‘succ’时更改member数据 * @param string $op_username 管理员信息 */ public static function amount($value, $userid = '' , $username = '', $trade_sn = '', $pay_type = '', $payment = '', $op_username = '', $status = 'succ', $note = '') { return self::_add(array('username'=>$username, 'userid'=>$userid,'money'=>$value, 'trade_sn'=>$trade_sn, 'pay_type'=>$pay_type, 'payment'=>$payment, 'status'=>$status, 'type'=>1, 'adminnote'=>$op_username, 'usernote'=>$note)); } /** * 添加点数入账记录 * 添加点数入账记录操作放放 * @param integer $value 入账金额 * @param integer $userid 用户ID * @param string $username 用户名 * @param integer $trade_sn 操作订单ID,默认为自动生成 * @param string $pay_type 入账类型 (可选值 offline 线下充值,recharge 在线充值,selfincome 自助获取) * @param string $payment 入账方式 (如后台充值,支付宝,银行汇款/转账等此处为自定义) * @param string $status 入账状态 (可选值 succ 默认,入账成功,failed 入账失败) * @param string $op_username 管理员信息 */ public static function point($value, $userid = '' , $username = '', $trade_sn = '', $pay_type = '', $payment = '', $op_username = '', $status = 'succ', $note = '') { return self::_add(array('username'=>$username, 'userid'=>$userid,'money'=>$value, 'trade_sn'=>$trade_sn, 'pay_type'=>$pay_type, 'payment'=>$payment, 'status'=>$status, 'type'=>2, 'adminnote'=>$op_username, 'usernote'=>$note)); } /** * 添加入账记录 * @param array $data 添加入账记录参数 */ private static function _add($data) { $data['money'] = isset($data['money']) && floatval($data['money']) ? floatval($data['money']) : 0; $data['userid'] = isset($data['userid']) && intval($data['userid']) ? intval($data['userid']) : 0; $data['username'] = isset($data['username']) ? trim($data['username']) : ''; $data['trade_sn'] = (isset($data['trade_sn']) && $data['trade_sn']) ? trim($data['trade_sn']) : create_sn(); $data['pay_type'] = isset($data['pay_type']) ? trim($data['pay_type']) : 'selfincome'; $data['payment'] = isset($data['payment']) ? trim($data['payment']) : ''; $data['adminnote'] = isset($data['op_username']) ? trim($data['op_username']) : ''; $data['usernote'] = isset($data['usernote']) ? trim($data['usernote']) : ''; $data['status'] = isset($data['status']) ? trim($data['status']) : 'succ'; $data['type'] = isset($data['type']) && intval($data['type']) ? intval($data['type']) : 0; $data['addtime'] = SYS_TIME; $data['ip'] = ip(); //检察消费类型 if (!in_array($data['type'], array(1,2))) { return false; } //检查入账类型 if (!in_array($data['pay_type'], array('offline','recharge','selfincome'))) { return false; } //检查入账状态 if (!in_array($data['status'], array('succ','error','failed'))) { return false; } //检查消费描述 if (empty($data['payment'])) { return false; } //检查消费金额 if (empty($data['money'])) { return false; } //检查userid和username并偿试再次的获取 if (empty($data['userid']) || empty($data['username'])) { if (defined('IN_ADMIN')) { return false; } elseif (!$data['userid'] = param::get_cookie('_userid') || !$data['username'] = param::get_cookie('_username')) { return false; } else { return false; } } //检查op_userid和op_username并偿试再次的获取 if (defined('IN_ADMIN') && empty($data['adminnote'])) { $data['adminnote'] = param::get_cookie('admin_username'); } //数据库连接 if (empty(self::$db)) { self::connect(); } $member_db = pc_base::load_model('member_model'); $sql = array(); if ($data['type'] == 1) {//金钱方式充值 $sql = array('amount'=>"+=".$data['money']); } elseif ($data['type'] == 2) { //积分方式充值 $sql = array('point'=>'+='.$data['money']); } else { return false; } //进入数据库操作 $insertid = self::$db->insert($data,true); if($insertid && $data['status'] == 'succ') { return $member_db->update($sql, array('userid'=>$data['userid'], 'username'=>$data['username'])) ? true : false; } else { return false; } } }
108wo
phpcms/modules/pay/classes/receipts.class.php
PHP
asf20
5,331
<?php if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; $modules[$i]['code'] = basename(__FILE__, '.class.php'); $modules[$i]['name'] = L('alipay', '', 'pay'); $modules[$i]['desc'] = L('alipay_tip', '', 'pay'); $modules[$i]['is_cod'] = '0'; $modules[$i]['is_online'] = '1'; $modules[$i]['author'] = 'PHPCMS开发团队'; $modules[$i]['website'] = 'http://www.alipay.com'; $modules[$i]['version'] = '1.0.0'; $modules[$i]['config'] = array( array('name' => 'alipay_account','type' => 'text','value' => ''), array('name' => 'alipay_key','type' => 'text','value' => ''), array('name' => 'alipay_partner','type' => 'text','value' => ''), array('name' => 'service_type','type' => 'select','value' => '0'), ); return; } pc_base::load_app_class('pay_abstract','','0'); class Alipay extends paymentabstract{ public function __construct($config = array()) { if (!empty($config)) $this->set_config($config); if ($this->config['service_type']==1) $this->config['service'] = 'trade_create_by_buyer'; elseif($this->config['service_type']==2) $this->config['service'] = 'create_direct_pay_by_user'; else $this->config['service'] = 'create_partner_trade_by_buyer'; $this->config['gateway_url'] = 'https://www.alipay.com/cooperate/gateway.do?_input_charset='.CHARSET; $this->config['gateway_method'] = 'POST'; $this->config['notify_url'] = return_url('alipay',1); $this->config['return_url'] = return_url('alipay'); pc_base::load_app_func('alipay'); } public function getpreparedata() { $prepare_data['service'] = $this->config['service']; $prepare_data['payment_type'] = '1'; $prepare_data['seller_email'] = $this->config['alipay_account']; $prepare_data['partner'] = $this->config['alipay_partner']; $prepare_data['_input_charset'] = CHARSET; $prepare_data['notify_url'] = $this->config['notify_url']; $prepare_data['return_url'] = $this->config['return_url']; // 商品信息 $prepare_data['subject'] = $this->product_info['name']; $prepare_data['price'] = $this->product_info['price']; if (array_key_exists('url', $this->product_info)) $prepare_data['show_url'] = $this->product_info['url']; $prepare_data['body'] = $this->product_info['body']; //订单信息 $prepare_data['out_trade_no'] = $this->order_info['id']; $prepare_data['quantity'] = $this->order_info['quantity']; // 物流信息 if($this->config['service'] == 'create_partner_trade_by_buyer' || $this->config['service'] == 'trade_create_by_buyer') { $prepare_data['logistics_type'] = 'EXPRESS'; $prepare_data['logistics_fee'] = '0.00'; $prepare_data['logistics_payment'] = 'SELLER_PAY'; } //买家信息 $prepare_data['buyer_email'] = $this->order_info['buyer_email']; $prepare_data = arg_sort($prepare_data); // 数字签名 $prepare_data['sign'] = build_mysign($prepare_data,$this->config['alipay_key'],'MD5'); return $prepare_data; } /** * GET接收数据 * 状态码说明 (0 交易完成 1 交易失败 2 交易超时 3 交易处理中 4 交易未支付5交易取消6交易发生错误) */ public function receive() { $receive_sign = $_GET['sign']; $receive_data = $this->filterParameter($_GET); $receive_data = arg_sort($receive_data); if ($receive_data) { $verify_result = $this->get_verify('http://notify.alipay.com/trade/notify_query.do?partner=' . $this->config['alipay_partner'] . '&notify_id=' . $receive_data['notify_id']); if (preg_match('/true$/i', $verify_result)) { $sign = ''; $sign = build_mysign($receive_data,$this->config['alipay_key'],'MD5'); if ($sign != $receive_sign) { error_log(date('m-d H:i:s',SYS_TIME).'| GET: signature is bad |'."\r\n", 3, CACHE_PATH.'pay_error_log.php'); showmessage(L('illegal_sign')); return false; } else { $return_data['order_id'] = $receive_data['out_trade_no']; $return_data['order_total'] = $receive_data['total_fee']; $return_data['price'] = $receive_data['price']; switch ($receive_data['trade_status']) { case 'WAIT_BUYER_PAY': $return_data['order_status'] = 3; break; case 'WAIT_SELLER_SEND_GOODS': $return_data['order_status'] = 3; break; case 'WAIT_BUYER_CONFIRM_GOODS': $return_data['order_status'] = 3; break; case 'TRADE_CLOSED': $return_data['order_status'] = 5; break; case 'TRADE_FINISHED': $return_data['order_status'] = 0; break; case 'TRADE_SUCCESS': $return_data['order_status'] = 0; break; default: $return_data['order_status'] = 5; } return $return_data; } } else { error_log(date('m-d H:i:s',SYS_TIME).'| GET: illegality notice : flase |'."\r\n", 3, CACHE_PATH.'pay_error_log.php'); showmessage(L('illegal_notice')); return false; } } else { error_log(date('m-d H:i:s',SYS_TIME).'| GET: no return |'."\r\n", 3, CACHE_PATH.'pay_error_log.php'); showmessage(L('illegal_return')); return false; } } /** * POST接收数据 * 状态码说明 (0 交易完成 1 交易失败 2 交易超时 3 交易处理中 4 交易未支付 5交易取消6交易发生错误) */ public function notify() { $receive_sign = $_POST['sign']; $receive_data = $this->filterParameter($_POST); $receive_data = arg_sort($receive_data); if ($receive_data) { $verify_result = $this->get_verify('http://notify.alipay.com/trade/notify_query.do?service=notify_verify&partner=' . $this->config['alipay_partner'] . '&notify_id=' . $receive_data['notify_id']); if (preg_match('/true$/i', $verify_result)) { $sign = ''; $sign = build_mysign($receive_data,$this->config['alipay_key'],'MD5'); if ($sign != $receive_sign) { error_log(date('m-d H:i:s',SYS_TIME).'| POST: signature is bad |'."\r\n", 3, CACHE_PATH.'pay_error_log.php'); return false; } else { $return_data['order_id'] = $receive_data['out_trade_no']; $return_data['order_total'] = $receive_data['total_fee']; $return_data['price'] = $receive_data['price']; switch ($receive_data['trade_status']) { case 'WAIT_BUYER_PAY': $return_data['order_status'] = 3; break; case 'WAIT_SELLER_SEND_GOODS': $return_data['order_status'] = 3; break; case 'WAIT_BUYER_CONFIRM_GOODS': $return_data['order_status'] = 3; break; case 'TRADE_CLOSED': $return_data['order_status'] = 5; break; case 'TRADE_FINISHED': $return_data['order_status'] = 0; break; case 'TRADE_SUCCESS': $return_data['order_status'] = 0; break; default: $return_data['order_status'] = 5; } return $return_data; } } else { error_log(date('m-d H:i:s',SYS_TIME).'| POST: illegality notice : flase |'."\r\n", 3, CACHE_PATH.'pay_error_log.php'); return false; } } else { error_log(date('m-d H:i:s',SYS_TIME).'| POST: no post return |'."\r\n", 3, CACHE_PATH.'pay_error_log.php'); return false; } } /** * 相应服务器应答状态 * @param $result */ public function response($result) { if (FALSE == $result) echo 'fail'; else echo 'success'; } /** * 返回字符过滤 * @param $parameter */ private function filterParameter($parameter) { $para = array(); foreach ($parameter as $key => $value) { if ('sign' == $key || 'sign_type' == $key || '' == $value || 'm' == $key || 'a' == $key || 'c' == $key || 'code' == $key ) continue; else $para[$key] = $value; } return $para; } } ?>
108wo
phpcms/modules/pay/classes/Alipay.class.php
PHP
asf20
7,909
<?php defined('IN_PHPCMS') or exit('No permission resources.'); /** * 消费记录类使用说明 * @author chenzhouyu * * 直接使用pc_base::load_app_class('spend', 'pay', 0); * 进行加载。 * 使用spend::amonut()进行金钱的消费 * spend::point()进行积分消费 * 当函数返回的结果为false是,可使用spend::get_msg()获取错误原因 * */ class spend { //数据库连接 protected static $db; //错误代码 public static $msg; /** * 数据库连接 */ protected static function connect() { self::$db = pc_base::load_model("pay_spend_model"); } /** * 按用户名、时间、标识查询是否有消费记录 * @param integer $userid 用户名 * @param integer $time 时间。 从指定时间到现在的时间范围内。 * @param string $logo 标识 */ public static function spend_time($userid, $time, $logo) { if (empty(self::$db)) { self::connect(); } return self::$db->get_one("`userid` = '$userid' AND `creat_at` BETWEEN '$time' AND '".SYS_TIME."' AND `logo` = '$logo'"); } /** * 添加金钱消费记录 * @param integer $value 消费金额 * @param string $msg 消费信息 * @param integer $userid 用户ID * @param string $username 用户名 * @param integer $op_userid 操作人 * @param string $op_username 操作人用户名 * @param string $logo 特殊标识,如文章消费时,可以对文章进行标识,以满足在一段时间内,都可以再次的使用 */ public static function amount($value, $msg, $userid = '', $username = '', $op_userid = '', $op_username = '', $logo = '') { return self::_add(array('username'=>$username, 'userid'=>$userid, 'type'=>1, 'value'=>$value, 'op_userid'=>$op_userid, 'op_username'=>$op_username, 'msg'=>$msg,'logo'=>$logo)); } /** * 添加积分消费记录 * @param integer $value 消费金额 * @param string $msg 消费信息 * @param integer $userid 用户ID * @param string $username 用户名 * @param integer $op_userid 操作人 * @param string $op_username 操作人用户名 * @param string $logo 特殊标识,如文章消费时,可以对文章进行标识,以满足在一段时间内,都可以再次的使用 */ public static function point($value, $msg, $userid = '', $username = '', $op_userid = '', $op_username = '', $logo = '') { return self::_add(array('username'=>$username, 'userid'=>$userid, 'type'=>2, 'value'=>$value, 'op_userid'=>$op_userid, 'op_username'=>$op_username, 'msg'=>$msg,'logo'=>$logo)); } /** * 添加消费记录 * @param array $data 添加消费记录参数 */ private static function _add($data) { $data['userid'] = isset($data['userid']) && intval($data['userid']) ? intval($data['userid']) : 0; $data['username'] = isset($data['username']) ? trim($data['username']) : ''; $data['op_userid'] = isset($data['op_userid']) && intval($data['op_userid']) ? intval($data['op_userid']) : 0; $data['op_username'] = isset($data['op_username']) ? trim($data['op_username']) : ''; $data['type'] = isset($data['type']) && intval($data['type']) ? intval($data['type']) : 0; $data['value'] = isset($data['value']) && intval($data['value']) ? abs(intval($data['value'])) : 0; $data['msg'] = isset($data['msg']) ? trim($data['msg']) : ''; $data['logo'] = isset($data['logo']) ? trim($data['logo']) : ''; $data['creat_at'] = SYS_TIME; //检察消费类型 if (!in_array($data['type'], array(1,2))) { return false; } //检察消费描述 if (empty($data['msg'])) { self::$msg = 1; return false; } //检察消费金额 if (empty($data['value'])) { self::$msg = 2; return false; } //检察userid和username并偿试再次的获取 if (empty($data['userid']) || empty($data['username'])) { if (defined('IN_ADMIN')) { self::$msg = 3; return false; } elseif (!$data['userid'] = param::get_cookie('_userid') || !$data['username'] = param::get_cookie('_username')) { self::$msg = 3; return false; } else { self::$msg = 3; return false; } } //检察op_userid和op_username并偿试再次的获取 if (defined('IN_ADMIN') && (empty($data['op_userid']) || empty($data['op_username']))) { $data['op_username'] = param::get_cookie('admin_username'); $data['op_userid'] = param::get_cookie('userid'); } //数据库连接 if (empty(self::$db)) { self::connect(); } $member_db = pc_base::load_model('member_model'); //判断用户的金钱或积分是否足够。 if (!self::_check_user($data['userid'], $data['type'], $data['value'], $member_db)) { self::$msg = 6; return false; } $sql = array(); if ($data['type'] == 1) {//金钱方式消费 $sql = array('amount'=>"-=".$data['value']); } elseif ($data['type'] == 2) { //积分方式消费 $sql = array('point'=>'-='.$data['value']); } else { self::$msg = 7; return false; } //进入数据库操作 if ($member_db->update($sql, array('userid'=>$data['userid'], 'username'=>$data['username'])) && self::$db->insert($data)) { self::$msg = 0; return true; } else { self::$msg = 8; return false; } } /** * 判断用户的金钱、积分是否足够 * @param integer $userid 用户ID * @param integer $type 判断(1:金钱,2:积分) * @param integer $value 数量 * @param $db 数据库连接 */ private static function _check_user($userid, $type, $value, &$db) { if ($user = $db->get_one(array('userid'=>$userid), '`amount`, `point`')) { if ($type == 1) { //金钱消费 if ($user['amount'] < $value) { return false; } else { return true; } } elseif ($type == 2) { //积分 if ($user['point'] < $value) { return false; } else { return true; } } else { return false; } } else { return false; } } /** * * 获取详细的报错信息 */ public static function get_msg() { $msg = self::$msg; $arr = array( '1' => L('spend_msg_1', '', 'pay'), '2' => L('spend_msg_2', '', 'pay'), '3' => L('spend_msg_3', '', 'pay'), '6' => L('spend_msg_6', '', 'pay'), '7' => L('spend_msg_7', '', 'pay'), '8' => L('spend_msg_8', '', 'pay'), ); return isset($arr[$msg]) ? $arr[$msg] : false; } }
108wo
phpcms/modules/pay/classes/spend.class.php
PHP
asf20
6,619
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('foreground','member'); pc_base::load_sys_class('format', '', 0); pc_base::load_sys_class('form', '', 0); class spend_list extends foreground { private $spend_db; function __construct() { if (!module_exists(ROUTE_M)) showmessage(L('module_not_exists')); $this->spend_db = pc_base::load_model('pay_spend_model'); parent::__construct(); } public function init() { $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1; $userid = param::get_cookie('_userid'); $sql = " `userid` = '$userid'"; if (isset($_GET['dosubmit'])) { $type = isset($_GET['type']) && intval($_GET['type']) ? intval($_GET['type']) : ''; $endtime = isset($_GET['endtime']) && trim($_GET['endtime']) ? strtotime(trim($_GET['endtime'])) : ''; $starttime = isset($_GET['starttime']) && trim($_GET['starttime']) ? strtotime(trim($_GET['starttime'])) : ''; if (!empty($starttime) && empty($endtime)) { $endtime = SYS_TIME; } if (!empty($starttime) && !empty($endtime) && $endtime < $starttime) { showmessage(L('wrong_time_over_time_to_time_less_than')); } if (!empty($starttime)) { $sql .= $sql ? " AND `creat_at` BETWEEN '$starttime' AND '$endtime' " : " `creat_at` BETWEEN '$starttime' AND '$endtime' "; } if (!empty($type)) { $sql .= $sql ? " AND `type` = '$type' " : " `type` = '$type'"; } } $list = $this->spend_db->listinfo($sql, '`id` desc', $page); $pages = $this->spend_db->pages; include template('pay', 'spend_list'); } }
108wo
phpcms/modules/pay/spend_list.php
PHP
asf20
1,665
<?php defined('IN_PHPCMS') or exit('No permission resources.'); class respond { private $pay_db, $account_db,$member_db; function __construct() { pc_base::load_app_func('global'); } /** * return_url get形式响应 */ public function respond_get() { if ($_GET['code']){ $payment = $this->get_by_code($_GET['code']); if(!$payment) showmessage(L('payment_failed')); $cfg = unserialize_config($payment['config']); $pay_name = ucwords($payment['pay_code']); pc_base::load_app_class('pay_factory','',0); $payment_handler = new pay_factory($pay_name, $cfg); $return_data = $payment_handler->receive(); if($return_data) { if($return_data['order_status'] == 0) { $this->update_member_amount_by_sn($return_data['order_id']); } $this->update_recode_status_by_sn($return_data['order_id'],$return_data['order_status']); showmessage(L('pay_success'),APP_PATH.'index.php?m=pay&c=deposit'); } else { showmessage(L('pay_failed'),APP_PATH.'index.php?m=pay&c=deposit'); } } else { showmessage(L('pay_success')); } } /** * 服务器端 POST形式响应 */ public function respond_post() { $_POST['code'] = $_POST['code'] ? $_POST['code'] : $_GET['code']; if ($_POST['code']){ $payment = $this->get_by_code($_POST['code']); if(!$payment) error_log(date('m-d H:i:s',SYS_TIME).'| POST: payment is null |'."\r\n", 3, CACHE_PATH.'pay_error_log.php');; $cfg = unserialize_config($payment['config']); $pay_name = ucwords($payment['pay_code']); pc_base::load_app_class('pay_factory','',0); $payment_handler = new pay_factory($pay_name, $cfg); $return_data = $payment_handler->notify(); if($return_data) { if($return_data['order_status'] == 0) { $this->update_member_amount_by_sn($return_data['order_id']); } $this->update_recode_status_by_sn($return_data['order_id'],$return_data['order_status']); $result = TRUE; } else { $result = FALSE; } $payment_handler->response($result); } } /** * 更新订单状态 * @param unknown_type $trade_sn 订单ID * @param unknown_type $status 订单状态 */ private function update_recode_status_by_sn($trade_sn,$status) { $trade_sn = trim($trade_sn); $status = trim(intval($status)); $data = array(); $this->account_db = pc_base::load_model('pay_account_model'); $status = return_status($status); $data = array('status'=>$status); return $this->account_db->update($data,array('trade_sn'=>$trade_sn)); } /** * 更新用户账户余额 * @param unknown_type $trade_sn */ private function update_member_amount_by_sn($trade_sn) { $data = $userinfo = array(); $this->member_db = pc_base::load_model('member_model'); $orderinfo = $this->get_userinfo_by_sn($trade_sn); $userinfo = $this->member_db->get_one(array('userid'=>$orderinfo['userid'])); if($orderinfo){ $money = floatval($orderinfo['money']); $amount = $userinfo['amount'] + $money; $data = array('amount'=>$amount); return $this->member_db->update($data,array('userid'=>$orderinfo['userid'])); } else { error_log(date('m-d H:i:s',SYS_TIME).'| POST: rechange failed! trade_sn:'.$$trade_sn.' |'."\r\n", 3, CACHE_PATH.'pay_error_log.php'); return false; } } /** * 通过订单ID抓取用户信息 * @param unknown_type $trade_sn */ private function get_userinfo_by_sn($trade_sn) { $trade_sn = trim($trade_sn); $this->account_db = pc_base::load_model('pay_account_model'); $result = $this->account_db->get_one(array('trade_sn'=>$trade_sn)); $status_arr = array('succ','failed','error','timeout','cancel'); return ($result && !in_array($result['status'],$status_arr)) ? $result : false; } /** * 通过支付代码获取支付信息 * @param unknown_type $code */ private function get_by_code($code) { $result = array(); $code = trim($code); $this->pay_db = pc_base::load_model('pay_payment_model'); $result = $this->pay_db->get_one(array('pay_code'=>$code)); return $result; } } ?>
108wo
phpcms/modules/pay/respond.php
PHP
asf20
4,148
<?php /** * 生成流水号 */ function create_sn(){ mt_srand((double )microtime() * 1000000 ); return date("YmdHis" ).str_pad( mt_rand( 1, 99999 ), 5, "0", STR_PAD_LEFT ); } /** * 返回响应地址 */ function return_url($code, $is_api = 0){ if($is_api){ return APP_PATH.'index.php?m=pay&c=respond&a=respond_post&code='.$code; } else { return APP_PATH.'index.php?m=pay&c=respond&a=respond_get&code='.$code; } } function unserialize_config($cfg){ if (is_string($cfg) ) { $arr = string2array($cfg); $config = array(); foreach ($arr AS $key => $val) { $config[$key] = $val['value']; } return $config; } else { return false; } } /** * 返回订单状态 */ function return_status($status) { $trade_status = array('0'=>'succ', '1'=>'failed', '2'=>'timeout', '3'=>'progress', '4'=>'unpay', '5'=>'cancel','6'=>'error'); return $trade_status[$status]; } /** * 返回订单手续费 * @param $amount 订单价格 * @param $fee 手续费比率 * @param $method 手续费方式 */ function pay_fee($amount, $fee=0, $method=0) { $pay_fee = 0; if($method == 0) { $val = floatval($fee) / 100; $pay_fee = $val > 0 ? $amount * $val : 0; } elseif($method == 1) { $pay_fee = $fee; } return round($pay_fee, 2); } /** * 生成支付按钮 * @param $data 按钮数据 * @param $attr 按钮属性 如样式等 * @param $ishow 是否显示描述 */ function mk_pay_btn($data,$attr='class="payment-show"',$ishow='1') { $pay_type = ''; if(is_array($data)){ foreach ($data as $v) { $pay_type .= '<label '.$attr.'>'; $pay_type .='<input name="pay_type" type="radio" value="'.$v['pay_id'].'"> <em>'.$v['name'].'</em>'; $pay_type .=$ishow ? '<span class="payment-desc">'.$v['pay_desc'].'</span>' :''; $pay_type .= '</label>'; } } return $pay_type; } ?>
108wo
phpcms/modules/pay/functions/global.func.php
PHP
asf20
1,927
<?php /** *功能:支付宝接口公用函数 *详细:该页面是请求、通知返回两个文件所调用的公用函数核心处理文件,不需要修改 *版本:3.0 *修改日期:2010-05-24 '说明: '以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。 '该代码仅供学习和研究支付宝接口使用,只是提供一个参考。 */ /** * 生成签名结果 * @param $array要加密的数组 * @param return 签名结果字符串 */ function build_mysign($sort_array,$security_code,$sign_type = "MD5") { $prestr = create_linkstring($sort_array); //把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串 $prestr = $prestr.$security_code; //把拼接后的字符串再与安全校验码直接连接起来 $mysgin = sign($prestr,$sign_type); //把最终的字符串加密,获得签名结果 return $mysgin; } /** * 把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串 * @param $array 需要拼接的数组 * @param return 拼接完成以后的字符串 */ function create_linkstring($array) { $arg = ""; while (list ($key, $val) = each ($array)) { $arg.=$key."=".$val."&"; } $arg = substr($arg,0,count($arg)-2); //去掉最后一个&字符 return $arg; } /********************************************************************************/ /**除去数组中的空值和签名参数 * @param $parameter 加密参数组 * @param return 去掉空值与签名参数后的新加密参数组 */ function para_filter($parameter) { $para = array(); while (list ($key, $val) = each ($parameter)) { if($key == "sign" || $key == "sign_type" || $val == "")continue; else $para[$key] = $parameter[$key]; } return $para; } /********************************************************************************/ /**对数组排序 * @param $array 排序前的数组 * @param return 排序后的数组 */ function arg_sort($array) { ksort($array); reset($array); return $array; } /********************************************************************************/ /**加密字符串 * @param $prestr 需要加密的字符串 * @param return 加密结果 */ function sign($prestr,$sign_type) { $sign=''; if($sign_type == 'MD5') { $sign = md5($prestr); }elseif($sign_type =='DSA') { //DSA 签名方法待后续开发 die(L('dsa', 'pay')); }else { die(L('alipay_error','pay')); } return $sign; } // 日志消息,把支付宝返回的参数记录下来 function log_result($word) { $fp = fopen("log.txt","a"); flock($fp, LOCK_EX) ; fwrite($fp, L('execute_date', 'pay').":".strftime("%Y%m%d%H%M%S",time())."\n".$word."\n"); flock($fp, LOCK_UN); fclose($fp); } /**实现多种字符编码方式 * @param $input 需要编码的字符串 * @param $_output_charset 输出的编码格式 * @param $_input_charset 输入的编码格式 * @param return 编码后的字符串 */ function charset_encode($input,$_output_charset ,$_input_charset) { $output = ""; if(!isset($_output_charset) )$_output_charset = $_input_charset; if($_input_charset == $_output_charset || $input ==null ) { $output = $input; } elseif (function_exists("mb_convert_encoding")) { $output = mb_convert_encoding($input,$_output_charset,$_input_charset); } elseif(function_exists("iconv")) { $output = iconv($_input_charset,$_output_charset,$input); } else die("sorry, you have no libs support for charset change."); return $output; } /********************************************************************************/ /**实现多种字符解码方式 * @param $input 需要解码的字符串 * @param $_output_charset 输出的解码格式 * @param $_input_charset 输入的解码格式 * @param return 解码后的字符串 */ function charset_decode($input,$_input_charset ,$_output_charset) { $output = ""; if(!isset($_input_charset) )$_input_charset = $_input_charset ; if($_input_charset == $_output_charset || $input ==null ) { $output = $input; } elseif (function_exists("mb_convert_encoding")) { $output = mb_convert_encoding($input,$_output_charset,$_input_charset); } elseif(function_exists("iconv")) { $output = iconv($_input_charset,$_output_charset,$input); } else die("sorry, you have no libs support for charset changes."); return $output; } /*********************************************************************************/ /**用于防钓鱼,调用接口query_timestamp来获取时间戳的处理函数 注意:由于低版本的PHP配置环境不支持远程XML解析,因此必须服务器、本地电脑中装有高版本的PHP配置环境。建议本地调试时使用PHP开发软件 * @param $partner 合作身份者ID * @param return 时间戳字符串 */ function query_timestamp($partner) { $URL = "https://mapi.alipay.com/gateway.do?service=query_timestamp&partner=".$partner; $encrypt_key = ""; return $encrypt_key; } ?>
108wo
phpcms/modules/pay/functions/alipay.func.php
PHP
asf20
5,417
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); pc_base::load_sys_class('format', '', 0); pc_base::load_sys_class('form', '', 0); pc_base::load_app_func('global'); class payment extends admin { private $db, $account_db, $member_db; function __construct() { if (!module_exists(ROUTE_M)) showmessage(L('module_not_exists')); parent::__construct(); $this->db = pc_base::load_model('pay_payment_model'); $this->account_db = pc_base::load_model('pay_account_model'); $this->member_db = pc_base::load_model('member_model'); $this->modules_path = PC_PATH.'modules'.DIRECTORY_SEPARATOR.'pay'; pc_base::load_app_class('pay_method','','0'); $this->method = new pay_method($this->modules_path); } /** * 支付模块列表 */ public function init() { $infos = $this->method->get_list(); $show_dialog = true; include $this->admin_tpl('payment_list'); } /* * 增加支付模块 */ public function add() { if(isset($_POST['dosubmit'])) { $info = $infos = array(); $infos = $this->method->get_payment($_POST['pay_code']); $config = $infos['config']; foreach ($_POST['config_name'] as $key => $value) { $config[$value]['value'] = trim($_POST['config_value'][$key]); } $info['config'] = array2string($config); $info['name'] = $_POST['name']; $info['pay_name'] = $_POST['pay_name']; $info['pay_desc'] = $_POST['description']; $info['pay_id'] = $_POST['pay_id']; $info['pay_code'] = $_POST['pay_code']; $info['is_cod'] = $_POST['is_cod']; $info['is_online'] = $_POST['is_online']; $info['pay_fee'] = intval($_POST['pay_fee']); $info['pay_method'] = intval($_POST['pay_method']); $info['pay_order'] = intval($_POST['pay_order']); $info['enabled'] = '1'; $info['author'] = $infos['author']; $info['website'] = $infos['website']; $info['version'] = $infos['version']; $this->db->insert($info); if($this->db->insert_id()){ showmessage(L('operation_success'), '', '', 'add'); } } else { $infos = $this->method->get_payment($_GET['code']); extract($infos); $show_header = true; $show_validator = true; include $this->admin_tpl('payment_detail'); } } /* * 编辑支付模块 */ public function edit() { if(isset($_POST['dosubmit'])) { $infos = $this->method->get_payment($_POST['pay_code']); $config = $infos['config']; foreach ($_POST['config_name'] as $key => $value) { $config[$value]['value'] = trim($_POST['config_value'][$key]); } $info['config'] = array2string($config); $info['name'] = trim($_POST['name']); $info['pay_name'] = trim($_POST['pay_name']); $info['pay_desc'] = trim($_POST['description']); $info['pay_id'] = $_POST['pay_id']; $info['pay_code'] = trim($_POST['pay_code']); $info['pay_order'] = intval($_POST['pay_order']); $info['pay_method'] = intval($_POST['pay_method']); $info['pay_fee'] = (intval($_POST['pay_method'])==0) ? intval($_POST['pay_rate']) : intval($_POST['pay_fix']); $info['is_cod'] = trim($_POST['is_cod']); $info['is_online'] = trim($_POST['is_online']); $info['enabled'] = '1'; $info['author'] = $infos['author']; $info['website'] = $infos['website']; $info['version'] = $infos['version']; $infos = $this->db->update($info,array('pay_id'=>$info['pay_id'])); showmessage(L('edit').L('succ'), '', '', 'edit'); } else { $pay_id = intval($_GET['id']); $infos = $this->db->get_one(array('pay_id'=>$pay_id)); extract($infos); $config = string2array($config); $show_header = true; $show_validator = true; include $this->admin_tpl('payment_detail'); } } /** * 卸载支付模块 */ public function delete() { $pay_id = intval($_GET['id']); $this->db->delete(array('pay_id'=>$pay_id)); showmessage(L('delete_succ'),'?m=pay&c=payment'); } /** * 支付订单列表 */ public function pay_list() { $where = ''; if($_GET['dosubmit']){ extract($_GET['info']); if($trade_sn) $where = "AND `trade_sn` LIKE '%$trade_sn%' "; if($username) $where = "AND `username` LIKE '%$username%' "; if($start_addtime && $end_addtime) { $start = strtotime($start_addtime.' 00:00:00'); $end = strtotime($end_addtime.' 23:59:59'); $where .= "AND `addtime` >= '$start' AND `addtime` <= '$end'"; } if($status) $where .= "AND `status` LIKE '%$status%' "; if($where) $where = substr($where, 3); } $infos = array(); foreach(L('select') as $key=>$value) { $trade_status[$key] = $value; } $page = $_GET['page'] ? $_GET['page'] : '1'; $infos = $this->account_db->listinfo($where, $order = 'addtime DESC,id DESC', $page, $pagesize = 20); $pages = $this->account_db->pages; $number = count($infos); include $this->admin_tpl('pay_list'); } /** * 财务统计 * Enter description here ... */ public function pay_stat() { $where = ''; $infos = array(); if($_GET['dosubmit']){ extract($_GET['info']); if($username) $where = "AND `username` LIKE '%$username%' "; if($start_addtime && $end_addtime) { $start = strtotime($start_addtime.' 00:00:00'); $end = strtotime($end_addtime.' 23:59:59'); $where .= "AND `addtime` >= '$start' AND `addtime` <= '$end'"; } if($status) $where .= "AND `status` LIKE '%$status%' "; if($where) $where = substr($where, 3); $infos = $this->account_db->select($where); $num= count($infos); foreach ($infos as $_v) { if($_v['type'] == 1) { $amount_num++; $amount += $_v['money']; if($_v['status'] =='succ') {$amount_succ += $_v['money'];$amount_num_succ++;} } elseif ($_v['type'] == 2) { $point_num++; $point += $_v['money']; if($_v['status'] =='succ') {$point_succ += $_v['money'];$point_num_succ++;} } } } foreach(L('select') as $key=>$value) $trade_status[$key] = $value; $total_infos = $this->account_db->select(); $total_num= count($total_infos); foreach ($total_infos as $_v) { if($_v['type'] == 1) { $total_amount_num++; $total_amount += $_v['money']; if($_v['status'] =='succ') {$total_amount_succ += $_v['money'];$total_amount_num_succ++;} } elseif ($_v['type'] == 2) { $total_point_num++; $total_point += $_v['money']; if($_v['status'] =='succ') {$total_point_succ += $_v['money'];$total_point_num_succ++;} } } include $this->admin_tpl('pay_stat'); } /** * 支付打折 * Enter description here ... */ public function discount() { if(isset($_POST['dosubmit'])) { $discount = floatval($_POST['discount']); $id = intval($_POST['id']); $infos = $this->account_db->update(array('discount'=>$discount),array('id'=>$id)); showmessage(L('public_discount_succ'), '', '', 'discount'); } else { $show_header = true; $show_validator = true; $id = intval($_GET['id']); $infos = $this->account_db->get_one(array('id'=>$id)); extract($infos); include $this->admin_tpl('pay_discount'); } } /** * 修改财务 * Enter description here ... */ public function modify_deposit() { if(isset($_POST['dosubmit'])) { $username = isset($_POST['username']) && trim($_POST['username']) ? trim($_POST['username']) : showmessage(L('username').L('error')); $usernote = isset($_POST['usernote']) && trim($_POST['usernote']) ? addslashes(trim($_POST['usernote'])) : showmessage(L('usernote').L('error')); $userinfo = $this->get_useid($username); if($userinfo) { //如果增加金钱或点数,想pay_account 中记录数据 if($_POST['pay_unit']) { $value = floatval($_POST['unit']); $payment = L('admin_recharge'); $receipts = pc_base::load_app_class('receipts'); $func = $_POST['pay_type'] == '1' ? 'amount' :'point'; $receipts->$func($value, $userinfo['userid'] , $username, create_sn(), 'offline', $payment, param::get_cookie('admin_username'), $status = 'succ',$usernote); } else { $value = floatval($_POST['unit']); $msg = L('background_operation').$usernote; $spend = pc_base::load_app_class('spend'); $func = $_POST['pay_type'] == '1' ? 'amount' :'point'; $spend->$func($value,$msg,$userinfo['userid'],$username,param::get_cookie('userid'),param::get_cookie('admin_username')); } if(intval($_POST['sendemail'])) { pc_base::load_sys_func('mail'); $op = $_POST['pay_unit'] ? $value: '-'.$value; $op = $_POST['pay_type'] ? $op.L('yuan') : $op.L('point'); $msg = L('account_changes_notice_tips',array('username'=>$username,'time'=>date('Y-m-d H:i:s',SYS_TIME),'op'=>$op,'note'=>$usernote,'amount'=>$userinfo['amount'],'point'=>$userinfo['point'])); sendmail($userinfo['email'],L('send_account_changes_notice'),$msg); } showmessage(L('public_discount_succ'),HTTP_REFERER); } } else { $show_validator = true; include $this->admin_tpl('modify_deposit'); } } /* * 支付删除 */ public function pay_del() { $id = intval($_GET['id']); $this->account_db->delete(array('id'=>$id)); showmessage(L('delete_succ'),'?m=pay&c=payment&a=pay_list&menuid='.$_GET['menuid']); } /* * 支付取消 */ public function pay_cancel() { $id = intval($_GET['id']); $this->account_db->update(array('status'=>'cancel'),array('id'=>$id)); showmessage(L('state_change_succ'),HTTP_REFERER); } /* * 支付详情 */ public function public_pay_detail() { $id = intval($_GET['id']); $infos = $this->account_db->get_one(array('id'=>$id)); extract($infos); $show_header = true; include $this->admin_tpl('pay_detail'); } public function public_check() { $id = intval($_GET['id']); $infos = $this->account_db->get_one(array('id'=>$id)); $userinfo = $this->member_db->get_one(array('userid'=>$infos['userid'])); $amount = $userinfo['amount'] + $infos['money']; $this->account_db->update(array('status'=>'succ','adminnote'=>param::get_cookie('admin_username')),array('id'=>$id)); $this->member_db->update(array('amount'=>$amount),array('userid'=>$infos['userid'])); showmessage(L('check_passed'),'?m=pay&c=payment&a=pay_list'); } private function get_useid($username) { $username = trim($username); if ($result = $this->member_db->get_one(array('username'=>$username))){ return $result; } else { return false; } } /** * 检查用户名 * @param string $username 用户名 */ public function public_checkname_ajax() { $username = isset($_GET['username']) && trim($_GET['username']) ? trim($_GET['username']) : exit(0); if(CHARSET != 'utf-8') { $username = iconv('utf-8', CHARSET, $username); $username = addslashes($username); } $this->member_db = pc_base::load_model('member_model'); if ($r = $this->member_db->get_one(array('username'=>$username))){ exit(L('user_balance').$r['amount'].' '.L('point').' '.$r['point']); } else { exit('FALSE'); } } } ?>
108wo
phpcms/modules/pay/payment.php
PHP
asf20
11,227
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin'); ?> <div class="pad_10"> <div class="table-list"> <table width="100%" cellspacing="0"> <thead> <tr> <th width="80">Siteid</th> <th><?php echo L('dbsource_name')?></th> <th><?php echo L('server_address')?></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 align="center"><?php echo $v['name']?></td> <td align="center"><?php echo $v['host']?></td> <td align="center"><a href="javascript:edit(<?php echo $v['id']?>, '<?php echo htmlspecialchars(new_addslashes($v['name']))?>')"><?php echo L('edit')?></a> | <a href="?m=dbsource&c=dbsource_admin&a=del&id=<?php echo $v['id']?>" onclick="return confirm('<?php echo htmlspecialchars(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('edit_dbsource')?>《'+name+'》',id:'edit',iframe:'?m=dbsource&c=dbsource_admin&a=edit&id='+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/dbsource/templates/dbsource_list.tpl.php
PHP
asf20
1,676
<?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'})}}); $("#name").formValidator({onshow:"<?php echo L('input').L('name')?>",onfocus:"<?php echo L('input').L('name')?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('name')?>"}).ajaxValidator({type : "get",url : "",data :"m=dbsource&c=data&a=public_name",datatype : "html",async:'false',success : function(data){ if( data == "1" ){return true;}else{return false;}},buttons: $("#dosubmit"),onerror : "<?php echo L('name').L('exists')?>",onwait : "<?php echo L('connecting')?>"}); $("#cache").formValidator({onshow:"<?php echo L("enter_the_cache_input_will_not_be_cached")?>",onfocus:"<?php echo L("enter_the_cache_input_will_not_be_cached")?>",empty:true}).regexValidator({regexp:"num1",datatype:'enum',param:'i',onerror:"<?php echo L("cache_time_can_only_be_positive")?>"}); $("#num").formValidator({onshow:"<?php echo L('input').L("num")?>",onfocus:"<?php echo L('input').L("num")?>",empty:true}).regexValidator({regexp:"num1",datatype:'enum',param:'i',onerror:"<?php echo L('that_shows_only_positive_numbers')?>"}); }) //--> </script> <div class="pad-10"> <form action="?m=dbsource&c=data&a=add" method="post" id="myform"> <div> <fieldset> <legend><?php echo L('the_configuration_data_source')?></legend> <table width="100%" class="table_form"> <tr> <th width="80"><?php echo L('stdcall')?>:</th> <td class="y-bg"><?php echo form::radio(array('0'=>L('model_configuration'), '1'=>L('custom_sql')), $type ? $type : 0, 'name="type" onclick="location.href=\''.get_url().'&type=\'+this.value"')?></td> </tr> <?php if ($type==0) :?> <tr> <th><?php echo L('select_model')?>:</th> <td class="y-bg"><?php echo form::select($modules, $module, 'name="module" id="module" onchange="location.href=\''.get_url().'&module=\'+this.value"')?><script type="text/javascript">$(function(){$("#module").formValidator({onshow:"<?php echo L('please_select_model')?>",onfocus:"<?php echo L('please_select_model')?>"}).inputValidator({min:1, onerror:'<?php echo L('please_select_model')?>'});});</script></td> </tr> <?php if ($module):?> <tr> <th><?php echo L('selectingoperation')?>:</th> <td class="y-bg"><?php echo form::radio($html['action'], $action, 'name="action" onclick="location.href=\''.get_url().'&action=\'+this.value"')?></td> </tr> <?php endif;?> <?php if(isset($html[$action]) && is_array($html[$action]) && $action)foreach($html[$action] as $k=>$v):?> <tr> <th><?php echo $v['name']?>:</th> <td class="y-bg"><?php echo creat_form($k, $v)?></td> </tr> <?php endforeach;?> <?php else :?> <tr> <th valign="top"><?php echo L('custom_sql')?>:</th> <td class="y-bg"><textarea name="data" id="data" style="width:386px;height:178px;"></textarea><script type="text/javascript">$(function(){$("#data").formValidator({onshow:"<?php echo L('please_enter_a_sql')?>",onfocus:"<?php echo L('please_enter_a_sql')?>"}).inputValidator({min:1, onerror:'<?php echo L('please_enter_a_sql')?>'});});</script></td> </tr> <?php endif;?> </table> </fieldset> <div class="bk15"></div> <fieldset> <legend><?php echo L('vlan')?></legend> <table width="100%" class="table_form"> <tr> <th width="80"><?php echo L('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('output_mode')?>:</th> <td class="y-bg"><?php echo form::radio(array('1'=>'json', '2'=>'xml', '3'=>'js'), '1', 'name="dis_type" onclick="showcode(this.value)"')?></td> </tr> <tbody id="template_code" style="display:none"> <tr> <th valign="top"><?php echo L('template')?>:</th> <td class="y-bg"><textarea name="template" id="template" style="width:386px;height:178px;">{loop $data $k $v} <!-- <?php echo L('valgrind')?> --> {/loop}</textarea></td> </tr> </tbody> <tr> <th width="80"><?php echo L('buffer_time')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="cache" id="cache" size="30" /></td> </tr> <tr> <th width="80"><?php echo L('num')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="num" id="num" size="30" /></td> </tr> </table> </fieldset> <div class="bk15"></div> <input type="submit" class="dialog" id="dosubmit" name="dosubmit" value="" /> </div> </div> </form> <script type="text/javascript"> <!-- function showcode(obj) { if (obj==3){ $('#template_code').show(); } else { $('#template_code').hide(); } } //--> </script> </body> </html>
108wo
phpcms/modules/dbsource/templates/data_add.tpl.php
PHP
asf20
4,926
<?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_dbsource_name')?>",onfocus:"<?php echo L('input_dbsource_name')?>"}).inputValidator({min:1,onerror:"<?php echo L('input_dbsource_name')?>"}).regexValidator({regexp:"username",datatype:"enum",param:'i',onerror:"<?php echo L('data_source_of_the_letters_and_figures')?>"}).ajaxValidator({type : "get",url : "",data :"m=dbsource&c=dbsource_admin&a=public_name",datatype : "html",async:'false',success : function(data){ if( data == "1" ){return true;}else{return false;}},buttons: $("#dosubmit"),onerror : "<?php echo L('dbsource_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')?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('server_port')?>"}).regexValidator({regexp:"intege1",datatype:"enum",param:'i',onerror:"<?php echo L('server_ports_must_be_positive_integers')?>"}); $("#dbtablepre").formValidator({onshow:"<?php echo L('input').L('dbtablepre')?>",onfocus:"<?php echo L('tip_pre')?>"}); $("#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')?>"}); $("#dbname").formValidator({onshow:"<?php echo L('input').L('database')?>",onfocus:"<?php echo L('input').L('database')?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('database')?>"}); }) //--> </script> <div class="pad-10"> <form action="?m=dbsource&c=dbsource_admin&a=add" method="post" id="myform"> <div> <fieldset> <legend><?php echo L('configure_the_external_data_source')?></legend> <table width="100%" class="table_form"> <tr> <th width="80"><?php echo L('dbsource_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('server_address')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="host" id="host" size="30" /></td> </tr> <tr> <th><?php echo L('server_port')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="port" id="port" value="3306" 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('database')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="dbname" id="dbname" size="30"/></td> </tr> <tr> <th><?php echo L('dbtablepre');?>:</th> <td class="y-bg"><input type="text" class="input-text" name="dbtablepre" id="dbtablepre" size="30"/> </td> </tr> <tr> <th><?php echo L('charset')?>:</th> <td class="y-bg"><?php echo form::select(array('gbk'=>'GBK', 'utf8'=>'UTF-8', 'gb2312'=>'GB2312', 'latin1'=>'Latin1'), '', 'name="charset" id="charset"')?></td> </tr> <tr> <th></th> <td class="y-bg"><input type="button" class="button" value="<?php echo L('test_connections')?>" onclick="test_connect()" /></td> </tr> </table> </fieldset> <div class="bk15"></div> <input type="submit" class="dialog" id="dosubmit" name="dosubmit" value="" /> </div> </div> </form> <script type="text/javascript"> <!-- function test_connect() { $.get('?m=dbsource&c=dbsource_admin&a=public_test_mysql_connect', {host:$('#host').val(),username:$('#username').val(), password:$('#password').val(), port:$('#port').val()}, function(data){if(data==1){alert('<?php echo L('connect_success')?>')}else{alert('<?php echo L('connect_failed')?>')}}); } //--> </script> </body> </html>
108wo
phpcms/modules/dbsource/templates/dbsource_add.tpl.php
PHP
asf20
4,740
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin'); ?> <div class="pad_10"> <div class="table-list"> <form action="" method="get"> <input type="hidden" name="m" value="dbsource" /> <input type="hidden" name="c" value="data" /> <input type="hidden" name="a" value="del" /> <table width="100%" cellspacing="0"> <thead> <tr> <th width="80"><input type="checkbox" value="" id="check_box" onclick="selectall('id[]');"></th> <th><?php echo L('name')?></th> <th><?php echo L('output_mode')?></th> <th><?php echo L('stdcall')?></th> <th><?php echo L('data_call')?></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"><input type="checkbox" value="<?php echo $v['id']?>" name="id[]"></td> <td align="center"><?php echo $v['name']?></td> <td align="center"><?php switch($v['dis_type']){case 1:echo 'json';break;case 2:echo 'xml';break;case 3:echo 'js';break;}?></td> <td align="center"><?php switch($v['type']){case 0:echo L('model_configuration');break;case 1:echo L('custom_sql');break;}?></td> <td align="center"><input type="text" ondblclick="copy_text(this)" value="<?php if($v['dis_type']==3){ echo htmlspecialchars('<script type="text/javascript" src="'.APP_PATH.'index.php?m=dbsource&c=call&a=get&id='.$v['id'].'"></script>')?><?php } else { echo APP_PATH?>index.php?m=dbsource&c=call&a=get&id=<?php echo $v['id']?><?php }?>" size="30" /></td> <td align="center"><a href="javascript:edit(<?php echo $v['id']?>, '<?php echo htmlspecialchars(new_addslashes($v['name']))?>')"><?php echo L('edit')?></a> | <a href="?m=dbsource&c=data&a=del&id=<?php echo $v['id']?>" onclick="return confirm('<?php echo htmlspecialchars(new_addslashes(L('confirm', array('message'=>$v['name']))))?>')"><?php echo L('delete')?></a></td> </tr> <?php endforeach; endif; ?> </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('delete')?>" onclick="return confirm('<?php echo L('sure_deleted')?>')"/> </div> </from> </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('editing_data_sources_call')?>《'+name+'》',id:'edit',iframe:'?m=dbsource&c=data&a=edit&id='+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()}); } function copy_text(matter){ matter.select(); js1=matter.createTextRange(); js1.execCommand("Copy"); alert('<?php echo L('copy_code');?>'); } //--> </script> </body> </html>
108wo
phpcms/modules/dbsource/templates/data_list.tpl.php
PHP
asf20
3,022
<?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();})}}); $("#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({regexp:"intege1",datatype:"enum",param:'i',onerror:"<?php echo L('server_ports_must_be_positive_integers')?>"}); $("#dbtablepre").formValidator({onshow:"<?php echo L('input').L('dbtablepre')?>",onfocus:"<?php echo L('tip_pre')?>"}); $("#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')?>"}); $("#dbname").formValidator({onshow:"<?php echo L('input').L('database')?>",onfocus:"<?php echo L('input').L('database')?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('database')?>"}); }) //--> </script> <div class="pad-10"> <form action="?m=dbsource&c=dbsource_admin&a=edit&id=<?php echo $id?>" method="post" id="myform"> <div> <fieldset> <legend><?php echo L('configure_the_external_data_source')?></legend> <table width="100%" class="table_form"> <tr> <th width="80"><?php echo L('dbsource_name')?>:</th> <td class="y-bg"><?php echo $data['name']?></td> </tr> <tr> <th><?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><?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('database')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="dbname" id="dbname" size="30" value="<?php echo $data['dbname']?>" /></td> </tr> <tr> <th><?php echo L('dbtablepre');?>:</th> <td class="y-bg"><input type="text" class="input-text" name="dbtablepre" id="dbtablepre" value="<?php echo $data['dbtablepre']?>" size="30"/> </td> </tr> <tr> <th><?php echo L('charset')?>:</th> <td class="y-bg"><?php echo form::select(array('gbk'=>'GBK', 'utf8'=>'UTF-8', 'gb2312'=>'GB2312', 'latin1'=>'Latin1'), $data['charset'], 'name="charset" id="charset"')?></td> </tr> <tr> <th></th> <td class="y-bg"><input type="button" class="button" value="<?php echo L('test_connections')?>" onclick="test_connect()" /></td> </tr> </table> </fieldset> <div class="bk15"></div> <input type="submit" class="dialog" id="dosubmit" name="dosubmit" value="" /> </div> </div> </form> <script type="text/javascript"> <!-- function test_connect() { $.get('?m=dbsource&c=dbsource_admin&a=public_test_mysql_connect', {host:$('#host').val(),username:$('#username').val(), password:$('#password').val(), port:$('#port').val()}, function(data){if(data==1){alert('<?php echo L('connect_success')?>')}else{alert('<?php echo L('connect_failed')?>')}}); } //--> </script> </body> </html>
108wo
phpcms/modules/dbsource/templates/dbsource_edit.tpl.php
PHP
asf20
4,299
<?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'})}}); $("#name").formValidator({onshow:"<?php echo L('input').L('name')?>",onfocus:"<?php echo L('input').L('name')?>"}).inputValidator({min:1,onerror:"<?php echo L('input').L('name')?>"}).ajaxValidator({type : "get",url : "",data :"m=dbsource&c=data&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('name').L('exists')?>",onwait : "<?php echo L('connecting')?>"}).defaultPassed(); $("#cache").formValidator({onshow:"<?php echo L("enter_the_cache_input_will_not_be_cached")?>",onfocus:"<?php echo L("enter_the_cache_input_will_not_be_cached")?>",empty:true}).regexValidator({regexp:"num1",datatype:'enum',param:'i',onerror:"<?php echo L("cache_time_can_only_be_positive")?>"}); $("#num").formValidator({onshow:"<?php echo L('input').L("num")?>",onfocus:"<?php echo L('input').L("num")?>",empty:true}).regexValidator({regexp:"num1",datatype:'enum',param:'i',onerror:"<?php echo L('that_shows_only_positive_numbers')?>"}); }) //--> </script> <div class="pad-10"> <form action="?m=dbsource&c=data&a=edit&id=<?php echo $id?>" method="post" id="myform"> <div> <fieldset> <legend><?php echo L('the_configuration_data_source')?></legend> <table width="100%" class="table_form"> <tr> <th width="80"><?php echo L('stdcall')?>:</th> <td class="y-bg"><?php echo form::radio(array('0'=>L('model_configuration'), '1'=>L('custom_sql')), $type ? $type : 0, 'name="type" onclick="location.href=\''.get_url().'&type=\'+this.value"')?></td> </tr> <?php if ($type==0) :?> <tr> <th><?php echo L('select_model')?>:</th> <td class="y-bg"><?php echo form::select($modules, $module, 'name="module" id="module" onchange="location.href=\''.get_url().'&module=\'+this.value"')?><script type="text/javascript">$(function(){$("#module").formValidator({onshow:"<?php echo L('please_select_model')?>",onfocus:"<?php echo L('please_select_model')?>"}).inputValidator({min:1, onerror:'<?php echo L('please_select_model')?>'});});</script></td> </tr> <?php if ($module):?> <tr> <th><?php echo L('selectingoperation')?>:</th> <td class="y-bg"><?php echo form::radio($html['action'], $action, 'name="action" onclick="location.href=\''.get_url().'&action=\'+this.value"')?></td> </tr> <?php endif;?> <?php if(isset($html[$action]) && is_array($html[$action]) && $action)foreach($html[$action] as $k=>$v):?> <tr> <th><?php echo $v['name']?>:</th> <td class="y-bg"><?php echo creat_form($k, $v, $form_data[$k])?></td> </tr> <?php endforeach;?> <?php else :?> <tr> <th valign="top"><?php echo L('custom_sql')?>:</th> <td class="y-bg"><textarea name="data" id="data" style="width:386px;height:178px;"><?php if($edit_data['type']==1)echo $edit_data['data']?></textarea><script type="text/javascript">$(function(){$("#data").formValidator({onshow:"<?php echo L('please_enter_a_sql')?>",onfocus:"<?php echo L('please_enter_a_sql')?>"}).inputValidator({min:1, onerror:'<?php echo L('please_enter_a_sql')?>'});});</script></td> </tr> <?php endif;?> </table> </fieldset> <div class="bk15"></div> <fieldset> <legend><?php echo L('vlan')?></legend> <table width="100%" class="table_form"> <tr> <th width="80"><?php echo L('name')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="name" id="name" size="30" value="<?php echo htmlspecialchars($edit_data['name'])?>" /></td> </tr> <tr> <th><?php echo L('output_mode')?>:</th> <td class="y-bg"><?php echo form::radio(array('1'=>'json', '2'=>'xml', '3'=>'js'), $edit_data['dis_type'], 'name="dis_type" onclick="showcode(this.value)"')?></td> </tr> <tbody id="template_code" <?php if($edit_data['dis_type'] != 3) echo 'style="display:none"'?>> <tr> <th valign="top"><?php echo L('template')?>:</th> <td class="y-bg"><textarea name="template" id="template" style="width:386px;height:178px;"><?php if(!empty($edit_data['template'])) { echo $edit_data['template'];} else {echo '{loop $data $k $v} <!-- '.L('valgrind').' --> {/loop}';}?></textarea></td> </tr> </tbody> <tr> <th width="80"><?php echo L('buffer_time')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="cache" id="cache" size="30" value="<?php echo $edit_data['cache']?>" /></td> </tr> <tr> <th width="80"><?php echo L('num')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="num" id="num" size="30" value="<?php echo $edit_data['num']?>" /></td> </tr> </table> </fieldset> <div class="bk15"></div> <input type="submit" class="dialog" id="dosubmit" name="dosubmit" value="" /> </div> </div> </form> <script type="text/javascript"> <!-- function showcode(obj) { if (obj==3){ $('#template_code').show(); } else { $('#template_code').hide(); } } //--> </script> </body> </html>
108wo
phpcms/modules/dbsource/templates/data_edit.tpl.php
PHP
asf20
5,349
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin', 'admin', 0); class dbsource_admin extends admin { private $db; public function __construct() { $this->db = pc_base::load_model('dbsource_model'); parent::__construct(); pc_base::load_app_func('global'); } public function init() { $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1; $list = $this->db->listinfo(array('siteid'=>$this->get_siteid()), '', $page, 20); $pages = $this->db->pages; $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=dbsource&c=dbsource_admin&a=add\', title:\''.L('added_external_data_source').'\', 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('added_external_data_source')); include $this->admin_tpl('dbsource_list'); } public function add() { if (isset($_POST['dosubmit'])) { $name = isset($_POST['name']) && trim($_POST['name']) ? trim($_POST['name']) : showmessage(L('dbsource_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')); $dbname = isset($_POST['dbname']) && trim($_POST['dbname']) ? trim($_POST['dbname']) : showmessage(L('database').L('empty')); $dbtablepre = isset($_POST['dbtablepre']) && trim($_POST['dbtablepre']) ? trim($_POST['dbtablepre']) : ''; $charset = isset($_POST['charset']) && in_array(trim($_POST['charset']), array('gbk','utf8', 'gb2312', 'latin1')) ? trim($_POST['charset']) : showmessage(L('charset').L('illegal_parameters')); $siteid = $this->get_siteid(); if (!preg_match('/^\\w+$/i', $name)) { showmessage(L('data_source_of_the_letters_and_figures')); } //检察数据源名是否已经存在 if ($this->db->get_one(array('siteid'=>$siteid, 'name'=>$name), 'id')) { showmessage(L('dbsource_name').L('exists')); } if ($this->db->insert(array('siteid'=>$siteid, 'name'=>$name,'host'=>$host,'port'=>$port,'username'=>$username,'password'=>$password,'dbname'=>$dbname,'dbtablepre'=>$dbtablepre,'charset'=>$charset))) { dbsource_cache(); showmessage('', '', '', 'add'); } else { showmessage(L('operation_failure')); } } else { pc_base::load_sys_class('form', '', 0); $show_header = $show_validator = true; include $this->admin_tpl('dbsource_add'); } } public function edit() { $id = isset($_GET['id']) && intval($_GET['id']) ? intval($_GET['id']) : showmessage('ID'.L('empty')); $data = $this->db->get_one(array('id'=>$id)); if (!$data) { showmessage(L('notfound')); } if (isset($_POST['dosubmit'])) { $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')); $dbname = isset($_POST['dbname']) && trim($_POST['dbname']) ? trim($_POST['dbname']) : showmessage(L('database').L('empty')); $dbtablepre = isset($_POST['dbtablepre']) && trim($_POST['dbtablepre']) ? trim($_POST['dbtablepre']) : ''; $charset = isset($_POST['charset']) && in_array(trim($_POST['charset']), array('gbk','utf8', 'gb2312', 'latin1')) ? trim($_POST['charset']) : showmessage(L('charset').L('illegal_parameters')); $siteid = $this->get_siteid(); $sql = array('siteid'=>$siteid, 'host'=>$host,'port'=>$port,'username'=>$username,'password'=>$password,'dbname'=>$dbname, 'dbtablepre'=>$dbtablepre, 'charset'=>$charset); if ($this->db->update($sql, array('id'=>$id))) { dbsource_cache(); showmessage('', '', '', 'edit'); } else { showmessage(L('operation_failure')); } } else { pc_base::load_sys_class('form', '', 0); $show_header = $show_validator = true; include $this->admin_tpl('dbsource_edit'); } } public function del() { $id = isset($_GET['id']) && intval($_GET['id']) ? intval($_GET['id']) : ''; if ($this->db->get_one(array('id'=>$id))) { if ($this->db->delete(array('id'=>$id))) { dbsource_cache(); showmessage(L('operation_success'), '?m=dbsource&c=dbsource_admin&a=init'); } else { showmessage(L('operation_failure'), '?m=dbsource&c=dbsource_admin&a=init'); } } else { showmessage(L('notfound'), '?m=dbsource&c=dbsource_admin&a=init'); } } 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 public_test_mysql_connect() { $host = isset($_GET['host']) && trim($_GET['host']) ? trim($_GET['host']) : exit('0'); $password = isset($_GET['password']) && trim($_GET['password']) ? trim($_GET['password']) : 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'); if (@mysql_connect($host.':'.$port, $username, $password)) { exit('1'); } else { exit('0'); } } }
108wo
phpcms/modules/dbsource/dbsource_admin.php
PHP
asf20
6,482
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin', 'admin', 0); class data extends admin { private $db; public function __construct() { $this->db = pc_base::load_model('datacall_model'); parent::__construct(); } public function init() { $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=dbsource&c=data&a=add\', title:\''.L('adding_data_source_call').'\', 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('adding_data_source_call')); $page = isset($_POST['page']) && intval($_POST['page']) ? intval($_POST['page']) : 1; $list = $this->db->listinfo('','id desc', $page, 20); $pages = $this->db->pages; include $this->admin_tpl('data_list'); } public function add() { pc_base::load_app_func('global'); if (isset($_POST['dosubmit'])) { $name = isset($_POST['name']) && trim($_POST['name']) ? trim($_POST['name']) : showmessage(L('name').L('empty')); $dis_type = isset($_POST['dis_type']) && intval($_POST['dis_type']) ? intval($_POST['dis_type']) : 1; $cache = isset($_POST['cache']) && intval($_POST['cache']) ? intval($_POST['cache']) : 0; $num = isset($_POST['num']) && intval($_POST['num']) ? intval($_POST['num']) : 0; $type = isset($_POST['type']) && intval($_POST['type']) ? intval($_POST['type']) : 0; //检查名称是否已经存在 if ($this->db->get_one(array('name'=>$name))) { showmessage(L('name').L('exists')); } $sql = array(); if ($type == '1') { //自定义SQL $data = isset($_POST['data']) && trim($_POST['data']) ? trim($_POST['data']) : showmessage(L('custom_sql').L('empty')); $sql = array('data'=>$data); } else { //模型配置方式 $module = isset($_POST['module']) && trim($_POST['module']) ? trim($_POST['module']) : showmessage(L('please_select_model')); $action = isset($_POST['action']) && trim($_POST['action']) ? trim($_POST['action']) : showmessage(L('please_select_action')); $html = pc_tag_class($module); $data = array(); if (isset($html[$action]) && is_array($html[$action])) { foreach ($html[$action] as $key=>$val) { $val['validator']['reg_msg'] = $val['validator']['reg_msg'] ? $val['validator']['reg_msg'] : $val['name'].L('inputerror'); $$key = isset($_POST[$key]) && trim($_POST[$key]) ? trim($_POST[$key]) : ''; if (!empty($val['validator'])) { if (isset($val['validator']['min']) && strlen($$key) < $val['validator']['min']) { showmessage($val['name'].L('should').L('is_greater_than').$val['validator']['min'].L('lambda')); } if (isset($val['validator']['max']) && strlen($$key) > $val['validator']['max']) { showmessage($val['name'].L('should').L('less_than').$val['validator']['max'].L('lambda')); } if (!preg_match('/'.$val['validator']['reg'].'/'.$val['validator']['reg_param'], $$key)) { showmessage($val['name'].$val['validator']['reg_msg']); } } $data[$key] = $$key; } } $sql = array('data'=>array2string($data), 'module'=>$module, 'action'=>$action); } if ($dis_type == 3) { $sql['template'] = isset($_POST['template']) && trim($_POST['template']) ? trim($_POST['template']) : ''; } //初始化数据 $sql['name'] = $name; $sql['type'] = $type; $sql['dis_type'] = $dis_type; $sql['cache'] = $cache; $sql['num'] = $num; if ($id = $this->db->insert($sql,true)) { //当为JS时,输出模板文件 if ($dis_type == 3) { $tpl = pc_base::load_sys_class('template_cache'); $str = $tpl->template_parse($sql['template']); $filepath = CACHE_PATH.'caches_template'.DIRECTORY_SEPARATOR.'dbsource'.DIRECTORY_SEPARATOR; if(!is_dir($filepath)) { mkdir($filepath, 0777, true); } @file_put_contents($filepath.$id.'.php', $str); } showmessage('', '', '', 'add'); } else { showmessage(L('operation_failure')); } } else { pc_base::load_sys_class('form','',0); $modules = array_merge(array(''=>L('please_select')),pc_base::load_config('modules')); $show_header = $show_validator = true; $type = isset($_GET['type']) && intval($_GET['type']) ? intval($_GET['type']) : 0; $module = isset($_GET['module']) && trim($_GET['module']) ? trim($_GET['module']) : ''; $action = isset($_GET['action']) && trim($_GET['action']) ? trim($_GET['action']) : ''; if ($module) $html = pc_tag_class($module); pc_base::load_app_func('global','template'); include $this->admin_tpl('data_add'); } } public function edit() { $id = isset($_GET['id']) && intval($_GET['id']) ? intval($_GET['id']) : showmessage(L('illegal_parameters'), HTTP_REFERER); if (!$edit_data = $this->db->get_one(array('id'=>$id))) { showmessage(L('notfound')); } pc_base::load_app_func('global'); if (isset($_POST['dosubmit'])) { $name = isset($_POST['name']) && trim($_POST['name']) ? trim($_POST['name']) : showmessage(L('name').L('empty')); $dis_type = isset($_POST['dis_type']) && intval($_POST['dis_type']) ? intval($_POST['dis_type']) : 1; $cache = isset($_POST['cache']) && intval($_POST['cache']) ? intval($_POST['cache']) : 0; $num = isset($_POST['num']) && intval($_POST['num']) ? intval($_POST['num']) : 0; $type = isset($_POST['type']) && intval($_POST['type']) ? intval($_POST['type']) : 0; //检查名称是否已经存在 if ($edit_data['name'] != $name) { if ($this->db->get_one(array('name'=>$name), 'id')) { showmessage(L('name').L('exists')); } } $sql = array(); if ($type == '1') { //自定义SQL $data = isset($_POST['data']) && trim($_POST['data']) ? trim($_POST['data']) : showmessage(L('custom_sql').L('empty')); $sql = array('data'=>$data); } else { //模型配置方式 $module = isset($_POST['module']) && trim($_POST['module']) ? trim($_POST['module']) : showmessage(L('please_select_model')); $action = isset($_POST['action']) && trim($_POST['action']) ? trim($_POST['action']) : showmessage(L('please_select_action')); $html = pc_tag_class($module); $data = array(); if (isset($html[$action]) && is_array($html[$action])) { foreach ($html[$action] as $key=>$val) { $val['validator']['reg_msg'] = $val['validator']['reg_msg'] ? $val['validator']['reg_msg'] : $val['name'].L('inputerror'); $$key = isset($_POST[$key]) && trim($_POST[$key]) ? trim($_POST[$key]) : ''; if (!empty($val['validator'])) { if (isset($val['validator']['min']) && strlen($$key) < $val['validator']['min']) { showmessage($val['name'].L('should').L('is_greater_than').$val['validator']['min'].L('lambda')); } if (isset($val['validator']['max']) && strlen($$key) > $val['validator']['max']) { showmessage($val['name'].L('should').L('less_than').$val['validator']['max'].L('lambda')); } if (!preg_match('/'.$val['validator']['reg'].'/'.$val['validator']['reg_param'], $$key)) { showmessage($val['name'].$val['validator']['reg_msg']); } } $data[$key] = $$key; } } $sql = array('data'=>array2string($data), 'module'=>$module, 'action'=>$action); } if ($dis_type == 3) { $sql['template'] = isset($_POST['template']) && trim($_POST['template']) ? trim($_POST['template']) : ''; } //初始化数据 $sql['name'] = $name; $sql['type'] = $type; $sql['dis_type'] = $dis_type; $sql['cache'] = $cache; $sql['num'] = $num; if ($this->db->update($sql,array('id'=>$id))) { //当为JS时,输出模板文件 if ($dis_type == 3) { $tpl = pc_base::load_sys_class('template_cache'); $str = $tpl->template_parse($sql['template']); $filepath = CACHE_PATH.'caches_template'.DIRECTORY_SEPARATOR.'dbsource'.DIRECTORY_SEPARATOR; if(!is_dir($filepath)) { mkdir($filepath, 0777, true); } @file_put_contents($filepath.$id.'.php', $str); } showmessage('', '', '', 'edit'); } else { showmessage(L('operation_failure')); } } else { pc_base::load_sys_class('form','',0); $modules = array_merge(array(''=>L('please_select')),pc_base::load_config('modules')); $show_header = $show_validator = true; $type = isset($_GET['type']) ? intval($_GET['type']) : $edit_data['type']; $module = isset($_GET['module']) && trim($_GET['module']) ? trim($_GET['module']) : $edit_data['module']; $action = isset($_GET['action']) && trim($_GET['action']) ? trim($_GET['action']) : $edit_data['action']; if ($edit_data['type'] == 0) $form_data = string2array($edit_data['data']); if ($module) $html = pc_tag_class($module); pc_base::load_app_func('global','template'); include $this->admin_tpl('data_edit'); } } public function del() { $id = isset($_GET['id']) ? $_GET['id'] : ''; if (is_array($id)) { foreach ($id as $key => $v) { if (intval($v)) { $id[$key] = intval($v); } else { unset($id[$key]); } } $sql = implode('\',\'', $id); $this->db->delete("id in ('$sql')"); showmessage(L('operation_success'), HTTP_REFERER); } else { $id = intval($id); if(empty($id)) showmessage(L('illegal_parameters'), HTTP_REFERER); if ($this->db->delete(array('id'=>$id))) { showmessage(L('operation_success'), HTTP_REFERER); } else { showmessage(L('operation_failure'), 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'); } } }
108wo
phpcms/modules/dbsource/data.php
PHP
asf20
10,360
<?php defined('IN_PHPCMS') or exit('No permission resources.'); /** * 外部数据源缓存 */ function dbsource_cache() { $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'); } /** * 获取模型PC标签配置相信 * @param $module 模型名 */ function pc_tag_class ($module) { $filepath = PC_PATH.'modules'.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.'classes'.DIRECTORY_SEPARATOR.$module.'_tag.class.php'; if (file_exists($filepath)) { $pc_tag = pc_base::load_app_class($module.'_tag', $module); if (!method_exists($pc_tag, 'pc_tag')) { showmessage(L('the_module_will_not_support_the_operation')); } $html = $pc_tag->pc_tag(); } else { showmessage(L('the_module_will_not_support_the_operation'), HTTP_REFERER); } return $html; } /** * 返回模板地址。 * @param $id 数据源调用ID */ function template_url($id) { $filepath = CACHE_PATH.'caches_template'.DIRECTORY_SEPARATOR.'dbsource'.DIRECTORY_SEPARATOR.$id.'.php'; if (!file_exists($filepath)) { $datacall = pc_base::load_model('datacall_model'); $str = $datacall->get_one(array('id'=>$id), 'template'); $dir = dirname($filepath); if(!is_dir($dir)) { mkdir($dir, 0777, true); } $tpl = pc_base::load_sys_class('template_cache'); $str = $tpl->template_parse($str['template']); @file_put_contents($filepath, $str); } return $filepath; } ?>
108wo
phpcms/modules/dbsource/functions/global.func.php
PHP
asf20
1,849
<?php defined('IN_PHPCMS') or exit('No permission resources.'); class call { private $db; public function __construct() { $this->db = pc_base::load_model('datacall_model'); } public function get() { $id = isset($_GET['id']) && intval($_GET['id']) ? intval($_GET['id']) : exit(); if ($data = $this->db->get_one(array('id'=>$id))) { if (!$str = tpl_cache('dbsource_'.$id,$data['cache'])) { if ($data['type'] == 1) { //自定义SQL调用 $get_db = pc_base::load_model("get_model"); $sql = $data['data'].(!empty($data['num']) ? " LIMIT $data[num]" : ''); $r= $get_db->query($sql); while(($s = $get_db->fetch_next()) != false) { $str[] = $s; } } else { $filepath = PC_PATH.'modules'.DIRECTORY_SEPARATOR.$data['module'].DIRECTORY_SEPARATOR.'classes'.DIRECTORY_SEPARATOR.$data['module'].'_tag.class.php'; if (file_exists($filepath)) { $pc_tag = pc_base::load_app_class($data['module'].'_tag', $data['module']); if (!method_exists($pc_tag, $data['action'])) { exit(); } $sql = string2array($data['data']); $sql['action'] = $data['action']; $sql['limit'] = $data['num']; unset($data['num']); $str = $pc_tag->$data['action']($sql); } else { exit(); } } if ($data['cache']) setcache('dbsource_'.$id, $str, 'tpl_data'); } echo $this->_format($data['id'], $str, $data['dis_type']); } } private function _format($id, $data, $type) { switch($type) { case '1'://json if (CHARSET == 'gbk') { $data = array_iconv($data, 'gbk', 'utf-8'); } return json_encode($data); break; case '2'://xml $xml = pc_base::load_sys_class('xml'); return $xml->xml_serialize($data); break; case '3'://js pc_base::load_app_func('global'); ob_start(); include template_url($id); $html = ob_get_contents(); ob_clean(); return format_js($html); break; } } } ?>
108wo
phpcms/modules/dbsource/call.php
PHP
asf20
2,037
<?php defined('IN_PHPCMS') or exit('Access Denied'); defined('UNINSTALL') or exit('Access Denied'); ?>
108wo
phpcms/modules/formguide/uninstall/model.php
PHP
asf20
108
<?php defined('IN_PHPCMS') or exit('Access Denied'); defined('UNINSTALL') or exit('Access Denied'); $form_db = pc_base::load_model('sitemodel_model'); $form_field_db = pc_base::load_model('sitemodel_field_model'); $result = $form_db->select(array(), 'tablename'); if (is_array($result)) { foreach ($result as $r) { $tablename = 'form_'.$r['tablename']; $form_field_db->change_table($tablename); $form_field_db->query('DROP TABLE IF EXISTS `phpcms_'.$tablename.'`;'); } } ?>
108wo
phpcms/modules/formguide/uninstall/extention.inc.php
PHP
asf20
495
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); class formguide_info extends admin { private $db, $f_db, $tablename; public function __construct() { parent::__construct(); $this->db = pc_base::load_model('sitemodel_field_model'); $this->f_db = pc_base::load_model('sitemodel_model'); if (isset($_GET['formid']) && !empty($_GET['formid'])) { $formid = intval($_GET['formid']); $f_info = $this->f_db->get_one(array('modelid'=>$formid, 'siteid'=>$this->get_siteid()), 'tablename'); $this->tablename = 'form_'.$f_info['tablename']; $this->db->change_table($this->tablename); } } /** * 用户提交表单信息列表 */ public function init() { if (!isset($_GET['formid']) || empty($_GET['formid'])) { showmessage(L('illegal_operation'), HTTP_REFERER); } $formid = intval($_GET['formid']); if (!$this->tablename) { $f_info = $this->f_db->get_one(array('modelid'=>$formid, 'siteid'=>$this->get_siteid()), 'tablename'); $this->tablename = 'form_'.$f_info['tablename']; $this->db->change_table($this->tablename); } $page = max(intval($_GET['page']), 1); $r = $this->db->get_one(array(), "COUNT(dataid) sum"); $total = $r['sum']; $this->f_db->update(array('items'=>$total), array('modelid'=>$formid)); $pages = pages($total, $page, 20); $offset = ($page-1)*20; $datas = $this->db->select(array(), '*', $offset.', 20', '`dataid` DESC'); $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=formguide&c=formguide&a=add\', title:\''.L('formguide_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('formguide_add')); include $this->admin_tpl('formguide_info_list'); } /** * 查看 */ public function public_view() { if (!$this->tablename || !isset($_GET['did']) || empty($_GET['did'])) showmessage(L('illegal_operation'), HTTP_REFERER); $did = intval($_GET['did']); $formid = intval($_GET['formid']); $info = $this->db->get_one(array('dataid'=>$did)); pc_base::load_sys_class('form', '', ''); define('CACHE_MODEL_PATH',PHPCMS_PATH.'caches'.DIRECTORY_SEPARATOR.'caches_model'.DIRECTORY_SEPARATOR.'caches_data'.DIRECTORY_SEPARATOR); require CACHE_MODEL_PATH.'formguide_output.class.php'; $formguide_output = new formguide_output($formid); $forminfos_data = $formguide_output->get($info); $fields = $formguide_output->fields; include $this->admin_tpl('formguide_info_view'); } /** * 删除 */ public function public_delete() { $formid = intval($_GET['formid']); if (isset($_GET['did']) && !empty($_GET['did'])) { $did = intval($_GET['did']); $this->db->delete(array('dataid'=>$did)); $this->f_db->update(array('items'=>'-=1'), array('modelid'=>$formid)); showmessage(L('operation_success'), HTTP_REFERER); } else if(is_array($_POST['did']) && !empty($_POST['did'])) { foreach ($_POST['did'] as $did) { $did = intval($did); $this->db->delete(array('dataid'=>$did)); $this->f_db->update(array('items'=>'-=1'), array('modelid'=>$formid)); } showmessage(L('operation_success'), HTTP_REFERER); } else { showmessage(L('illegal_operation'), HTTP_REFERER); } } } ?>
108wo
phpcms/modules/formguide/formguide_info.php
PHP
asf20
3,489
<?php //模型原型存储路径 define('MODEL_PATH',PC_PATH.'modules'.DIRECTORY_SEPARATOR.'formguide'.DIRECTORY_SEPARATOR.'fields'.DIRECTORY_SEPARATOR); define('CACHE_MODEL_PATH',PHPCMS_PATH.'caches'.DIRECTORY_SEPARATOR.'caches_model'.DIRECTORY_SEPARATOR.'caches_data'.DIRECTORY_SEPARATOR); pc_base::load_app_class('admin','admin',0); pc_base::load_app_func('util'); class formguide_field extends admin { public function __construct() { parent::__construct(); $this->db = pc_base::load_model('sitemodel_field_model'); $this->model_db = pc_base::load_model('sitemodel_model'); $this->siteid = $this->get_siteid(); } public function init() { if (isset($_GET['formid']) && !empty($_GET['formid'])) { $formid = intval($_GET['formid']); $this->cache_field($formid); $datas = $this->db->select(array('modelid'=>$formid),'*',100,'listorder ASC'); $r = $this->model_db->get_one(array('modelid'=>$formid)); } else { $data = $datas = array(); $data = getcache('form_public_field_array', 'model'); if (is_array($data)) { foreach ($data as $_k => $_v) { $datas[$_k] = $_v['info']; } } } $show_header = $show_validator = $show_dialog = ''; require MODEL_PATH.'fields.inc.php'; include $this->admin_tpl('formguide_field_list'); } /** * 添加字段,当没有formid时为添加公用字段 */ public function add() { if(isset($_POST['dosubmit'])) { $field = $_POST['info']['field']; $minlength = $_POST['info']['minlength'] ? $_POST['info']['minlength'] : 0; $maxlength = $_POST['info']['maxlength'] ? $_POST['info']['maxlength'] : 0; $field_type = $_POST['info']['formtype']; //附加属性值 $_POST['info']['setting'] = array2string($_POST['setting']); $_POST['info']['siteid'] = $this->siteid; $_POST['info']['unsetgroupids'] = isset($_POST['unsetgroupids']) ? implode(',',$_POST['unsetgroupids']) : ''; $_POST['info']['unsetroleids'] = isset($_POST['unsetroleids']) ? implode(',',$_POST['unsetroleids']) : ''; require MODEL_PATH.$field_type.DIRECTORY_SEPARATOR.'config.inc.php'; if(isset($_POST['setting']['fieldtype'])) { $field_type = $_POST['setting']['fieldtype']; } if (isset($_POST['info']['modelid']) && !empty($_POST['info']['modelid'])) { $formid = intval($_POST['info']['modelid']); $forminfo = $this->model_db->get_one(array('modelid'=>$formid, 'siteid'=>$this->siteid), 'tablename'); $tablename = $this->db->db_tablepre.'form_'.$forminfo['tablename']; require MODEL_PATH.'add.sql.php'; $this->db->insert($_POST['info']); $this->cache_field($formid); } else { $unrunsql = 1; $tablename = 'formguide_table'; require MODEL_PATH.'add.sql.php'; $form_public_field_array = getcache('form_public_field_array', 'model'); if (array_key_exists($_POST['info']['field'], $form_public_field_array)) { showmessage(L('fields').L('already_exist'), HTTP_REFERER); } else { $form_public_field_array[$_POST['info']['field']] = array('info'=>$_POST['info'], 'sql'=>$sql); setcache('form_public_field_array', $form_public_field_array, 'model'); } } showmessage(L('add_success'),'?m=formguide&c=formguide_field&a=init&formid='.$formid); } else { $show_header = $show_validator = $show_dialog = ''; pc_base::load_sys_class('form','',0); require MODEL_PATH.'fields.inc.php'; $formid = intval($_GET['formid']); $f_datas = $this->db->select(array('modelid'=>$formid),'field,name',100,'listorder ASC'); $m_r = $this->model_db->get_one(array('modelid'=>$formid)); foreach($f_datas as $_k=>$_v) { $exists_field[] = $_v['field']; } $all_field = array(); foreach($fields as $_k=>$_v) { $all_field[$_k] = $_v; } $grouplist = array(); //会员组缓存 $group_cache = getcache('grouplist','member'); foreach($group_cache as $_key=>$_value) { $grouplist[$_key] = $_value['name']; } header("Cache-control: private"); include $this->admin_tpl('formguide_field_add'); } } public function edit() { if (isset($_POST['dosubmit'])) { $field = $_POST['info']['field']; $minlength = $_POST['info']['minlength'] ? $_POST['info']['minlength'] : 0; $maxlength = $_POST['info']['maxlength'] ? $_POST['info']['maxlength'] : 0; $field_type = $_POST['info']['formtype']; //附加属性值 $_POST['info']['setting'] = array2string($_POST['setting']); $_POST['info']['siteid'] = $this->siteid; $_POST['info']['unsetgroupids'] = isset($_POST['unsetgroupids']) ? implode(',',$_POST['unsetgroupids']) : ''; $_POST['info']['unsetroleids'] = isset($_POST['unsetroleids']) ? implode(',',$_POST['unsetroleids']) : ''; require MODEL_PATH.$field_type.DIRECTORY_SEPARATOR.'config.inc.php'; if(isset($_POST['setting']['fieldtype'])) { $field_type = $_POST['setting']['fieldtype']; } $oldfield = $_POST['oldfield']; if (isset($_POST['info']['modelid']) && !empty($_POST['info']['modelid'])) { $formid = intval($_POST['info']['modelid']); $forminfo = $this->model_db->get_one(array('modelid'=>$formid, 'siteid'=>$this->siteid), 'tablename'); $tablename = $this->db->db_tablepre.'form_'.$forminfo['tablename']; $fieldid = intval($_POST['fieldid']); require MODEL_PATH.'edit.sql.php'; $this->db->update($_POST['info'],array('fieldid'=>$fieldid,'siteid'=>$this->siteid)); } else { $unrunsql = 1; $tablename = 'formguide_table'; require MODEL_PATH.'add.sql.php'; $form_public_field_array = getcache('form_public_field_array', 'model'); if ($oldfield) { if ($form_public_field_array[$oldfield]['info']['listorder']) { $_POST['info']['listorder'] = $form_public_field_array[$oldfield]['info']['listorder']; } if ($oldfield == $_POST['info']['field']) { $form_public_field_array[$_POST['info']['field']] = array('info'=>$_POST['info'], 'sql'=>$sql); } else { if (array_key_exists($_POST['info']['field'], $form_public_field_array)) { showmessage(L('fields').L('already_exist'), HTTP_REFERER); } $new_form_field = $form_public_field_array; $form_public_field_array = array(); foreach ($new_form_field as $name => $v) { if ($name == $oldfield) { $form_public_field_array[$_POST['info']['field']] = array('info'=>$_POST['info'], 'sql'=>$sql); } else { $form_public_field_array[$name] = $v; } } } } setcache('form_public_field_array', $form_public_field_array, 'model'); } showmessage(L('update_success'),'?m=formguide&c=formguide_field&a=init&formid='.$formid); } else { if (isset($_GET['formid']) && !empty($_GET['formid'])) { pc_base::load_sys_class('form','',0); require MODEL_PATH.'fields.inc.php'; $formid = intval($_GET['formid']); $fieldid = intval($_GET['fieldid']); $m_r = $this->model_db->get_one(array('modelid'=>$formid)); $r = $this->db->get_one(array('fieldid'=>$fieldid)); extract($r); require MODEL_PATH.$formtype.DIRECTORY_SEPARATOR.'config.inc.php'; } else { if (!isset($_GET['field']) || empty($_GET['field'])) { showmessage(L('illegal_operation'), HTTP_REFERER); } $form_public_field_array = getcache('form_public_field_array', 'model'); if (!array_key_exists($_GET['field'], $form_public_field_array)) { showmessage(L('illegal_operation'), HTTP_REFERER); } extract($form_public_field_array[$_GET['field']]); extract($info); $setting = stripslashes($setting); $show_header = $show_validator = $show_dialog = ''; pc_base::load_sys_class('form','',0); require MODEL_PATH.'fields.inc.php'; } $setting = string2array($setting); ob_start(); include MODEL_PATH.$formtype.DIRECTORY_SEPARATOR.'field_edit_form.inc.php'; $form_data = ob_get_contents(); ob_end_clean(); //会员组缓存 $group_cache = getcache('grouplist','member'); foreach($group_cache as $_key=>$_value) { $grouplist[$_key] = $_value['name']; } header("Cache-control: private"); include $this->admin_tpl('formguide_field_edit'); } } /** * 禁用、开启字段 */ public function disabled() { $fieldid = intval($_GET['fieldid']); $disabled = $_GET['disabled'] ? 0 : 1; $this->db->update(array('disabled'=>$disabled),array('fieldid'=>$fieldid,'siteid'=>$this->siteid)); showmessage(L('operation_success'),HTTP_REFERER); } /** * 删除字段 */ public function delete() { if (isset($_GET['formid']) && !empty($_GET['formid']) && isset($_GET['fieldid']) && !empty($_GET['fieldid'])) { $formid = intval($_GET['formid']); $fieldid = intval($_GET['fieldid']); $r = $this->model_db->get_one(array('modelid'=>$formid), 'tablename'); $rs = $this->db->get_one(array('fieldid'=>$fieldid, 'siteid'=>$this->siteid), 'field'); $this->db->delete(array('fieldid'=>$fieldid, 'siteid'=>$this->siteid)); if ($r) { $field = $rs['field']; $tablename = $this->db->db_tablepre.'form_'.$r['tablename']; require MODEL_PATH.'delete.sql.php'; } } else { if (!isset($_GET['field']) || empty($_GET['field'])) showmessage(L('illegal_operation'), HTTP_REFERER); $field = $_GET['field']; $form_public_field_array = getcache('form_public_field_array', 'model'); if (array_key_exists($field, $form_public_field_array)) { unset($form_public_field_array[$field]); } setcache('form_public_field_array', $form_public_field_array, 'model'); } showmessage(L('update_success'), '?m=formguide&c=formguide_field&a=init&formid='.$formid); } /** * 排序 */ public function listorder() { if(isset($_POST['dosubmit'])) { if (isset($_GET['formid']) && !empty($_GET['formid'])) { foreach($_POST['listorders'] as $id => $listorder) { $this->db->update(array('listorder'=>$listorder),array('fieldid'=>$id)); } } else { $form_public_field_array = getcache('form_public_field_array', 'model'); asort($_POST['listorders']); $new_form_field = array(); foreach ($_POST['listorders'] as $id => $listorder) { $form_public_field_array[$id]['info']['listorder'] = $listorder; $new_form_field[$id] = $form_public_field_array[$id]; } unset($form_public_field_array); setcache('form_public_field_array', $new_form_field, 'model'); } showmessage(L('operation_success'),HTTP_REFERER); } else { showmessage(L('operation_failure')); } } /** * 检查字段是否存在 */ public function public_checkfield() { $field = strtolower($_GET['field']); $oldfield = strtolower($_GET['oldfield']); if($field==$oldfield) exit('1'); $modelid = intval($_GET['modelid']); if (in_array($field, array('dataid', 'userid', 'username', 'datetime', 'ip'))) { exit('0'); } if($modelid) { $forminfo = $this->model_db->get_one(array('modelid'=>$modelid), 'tablename'); $this->db->table_name = $this->db->db_tablepre.'form_'.$forminfo['tablename']; $fields = $this->db->get_fields(); } else { $fields = getcache('form_public_field_array', 'model'); } if(is_array($fields) && array_key_exists($field,$fields)) { exit('0'); } else { exit('1'); } } /** * 字段属性设置 */ public function public_field_setting() { $fieldtype = $_GET['fieldtype']; require MODEL_PATH.$fieldtype.DIRECTORY_SEPARATOR.'config.inc.php'; ob_start(); include MODEL_PATH.$fieldtype.DIRECTORY_SEPARATOR.'field_add_form.inc.php'; $data_setting = ob_get_contents(); //$data_setting = iconv('gbk','utf-8',$data_setting); ob_end_clean(); $settings = array('field_basic_table'=>$field_basic_table,'field_minlength'=>$field_minlength,'field_maxlength'=>$field_maxlength,'field_allow_search'=>$field_allow_search,'field_allow_fulltext'=>$field_allow_fulltext,'field_allow_isunique'=>$field_allow_isunique,'setting'=>$data_setting); echo json_encode($settings); return true; } /** * 更新指定表单向导的字段缓存 * * @param $formid 表单向导id * @param $disabled 字段状态 */ public function cache_field($formid = 0, $disabled = 0) { $field_array = array(); $fields = $this->db->select(array('modelid'=>$formid,'disabled'=>$disabled),'*',100,'listorder ASC'); foreach($fields as $_value) { $setting = string2array($_value['setting']); $_value = array_merge($_value,$setting); $field_array[$_value['field']] = $_value; } setcache('formguide_field_'.$formid,$field_array,'model'); return true; } } ?>
108wo
phpcms/modules/formguide/formguide_field.php
PHP
asf20
12,817
<?php defined('IN_ADMIN') or exit('No permission resources.'); $show_validator = $show_dialog = 1; include $this->admin_tpl('header','admin');?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({autotip:true,formid:"myform"}); $("#field").formValidator({onshow:"<?php echo L('input').L('fieldname')?>",onfocus:"<?php echo L('fieldname').L('between_1_to_20')?>"}).regexValidator({regexp:"^[a-zA-Z]{1}([a-zA-Z0-9]|[_]){0,19}$",onerror:"<?php echo L('fieldname_was_wrong');?>"}).inputValidator({min:1,max:20,onerror:"<?php echo L('fieldname').L('between_1_to_20')?>"}).ajaxValidator({ type : "get", url : "", data : "m=formguide&c=formguide_field&a=public_checkfield&formid=<?php echo $formid?>&oldfield=<?php echo $field;?>", datatype : "html", cached:false, getdata:{issystem:'issystem'}, async:'true', success : function(data){ if( data == "1" ) { return true; } else { return false; } }, buttons: $("#dosubmit"), onerror : "<?php echo L('fieldname').L('already_exist')?>", onwait : "<?php echo L('connecting_please_wait')?>" }).defaultPassed(); $("#formtype").formValidator({onshow:"<?php echo L('select_fieldtype');?>",onfocus:"<?php echo L('select_fieldtype');?>",oncorrect:"<?php echo L('input_right');?>",defaultvalue:""}).inputValidator({min:1,onerror: "<?php echo L('select_fieldtype');?>"}); $("#name").formValidator({onshow:"<?php echo L('input_nickname');?>",onfocus:"<?php echo L('nickname_empty');?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L('input_nickname');?>"}); }) //--> </script> <div class="pad_10"> <div class="subnav"> <h2 class="title-1 line-x f14 fb blue lh28"><?php echo L('model_manage');?>--<?php echo $m_r['name'].L('field_manage');?></h2> <div class="content-menu ib-a blue line-x"> <a href="javascript:;" class="on"><em><?php echo L('edit_field');?></em></a><span>|</span><a href="?m=formguide&c=formguide_field&a=init&formid=<?php echo $formid?>&menuid=<?php echo $_GET['menuid']?>"><em><?php echo L('manage_field');?></em></a><span>|</span></div> <div class="bk10"></div> </div> <form name="myform" id="myform" action="?m=formguide&c=formguide_field&a=edit" method="post"> <div class="common-form"> <table width="100%" class="table_form"> <tr> <th><strong><?php echo L('field_type');?></strong><br /></th> <td> <input type="hidden" name="info[formtype]" value="<?php echo $formtype;?>"> <?php echo form::select($fields,$formtype,'name="info[formtype]" id="formtype" onchange="javascript:field_setting(this.value);" disabled',L('select_fieldtype'));?> </td> </tr> <tr> <th width="25%"><font color="red">*</font> <strong><?php echo L('fieldname');?></strong><br /> <?php echo L('fieldname_tips');?> </th> <td><input type="text" name="info[field]" id="field" size="20" class="input-text" value="<?php echo $field?>" <?php if(in_array($field,$forbid_delete)) echo 'readonly';?>></td> </tr> <tr> <th><font color="red">*</font> <strong><?php echo L('field_nickname');?></strong><br /><?php echo L('nickname_tips');?></th> <td><input type="text" name="info[name]" id="name" size="30" class="input-text" value="<?php echo $name?>"></td> </tr> <tr> <th><strong><?php echo L('field_tip');?></strong><br /><?php echo L('field_tips');?></th> <td><textarea name="info[tips]" rows="2" cols="20" id="tips" style="height:40px; width:80%"><?php echo htmlspecialchars($tips);?></textarea></td> </tr> <tr> <th><strong><?php echo L('relation_parm');?></strong><br /><?php echo L('relation_parm_tips');?></th> <td><?php echo $form_data;?></td> </tr> <?php if(in_array($formtype,$att_css_js)) { ?> <tr> <th><strong><?php echo L('form_attr');?></strong><br /><?php echo L('form_attr_tips');?></th> <td><input type="text" name="info[formattribute]" size="50" class="input-text" value="<?php echo htmlspecialchars($formattribute);?>"></td> </tr> <tr> <th><strong><?php echo L('form_css_name');?></strong><br /><?php echo L('form_css_name_tips');?></th> <td><input type="text" name="info[css]" size="10" class="input-text" value="<?php echo htmlspecialchars($css);?>"></td> </tr> <?php } ?> <tr> <th><strong><?php echo L('string_size');?></strong><br /><?php echo L('string_size_tips');?></th> <td><?php echo L('minlength');?>:<input type="text" name="info[minlength]" id="field_minlength" value="<?php echo $minlength;?>" size="5" class="input-text"><?php echo L('maxlength');?>:<input type="text" name="info[maxlength]" id="field_maxlength" value="<?php echo $maxlength;?>" size="5" class="input-text"></td> </tr> <tr> <th><strong><?php echo L('data_preg');?></strong><br /><?php echo L('data_preg_tips');?></th> <td><input type="text" name="info[pattern]" id="pattern" value="<?php echo $pattern;?>" size="40" class="input-text"> <select name="pattern_select" onchange="javascript:$('#pattern').val(this.value)"> <option value=""><?php echo L('often_preg');?></option> <option value="/^[0-9.-]+$/"><?php echo L('figure');?></option> <option value="/^[0-9-]+$/"><?php echo L('integer');?></option> <option value="/^[a-z]+$/i"><?php echo L('letter');?></option> <option value="/^[0-9a-z]+$/i"><?php echo L('integer_letter');?></option> <option value="/^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/">E-mail</option> <option value="/^[0-9]{5,20}$/">QQ</option> <option value="/^http:\/\//"><?php echo L('hyperlink');?></option> <option value="/^(1)[0-9]{10}$/"><?php echo L('mobile_number');?></option> <option value="/^[0-9-]{6,13}$/"><?php echo L('tel_number');?></option> <option value="/^[0-9]{6}$/"><?php echo L('zip');?></option> </select> </td> </tr> <tr> <th><strong><?php echo L('data_passed_msg');?></strong></th> <td><input type="text" name="info[errortips]" value="<?php echo htmlspecialchars($errortips);?>" size="50" class="input-text"></td> </tr> <tr> <th><strong><?php echo L('disabled_groups_field');?></strong></th> <td><?php echo form::checkbox($grouplist,$unsetgroupids,'name="unsetgroupids[]" id="unsetgroupids"',0,'100');?></td> </tr> </table> <div class="bk15"></div> <input name="info[modelid]" type="hidden" value="<?php echo $formid?>"> <input name="fieldid" type="hidden" value="<?php echo $fieldid?>"> <input name="oldfield" type="hidden" value="<?php echo $field?>"> <div class="btn"><input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="button"></div> </form> </div> </body> </html>
108wo
phpcms/modules/formguide/templates/formguide_field_edit.tpl.php
PHP
asf20
6,774
<?php defined('IN_ADMIN') or exit('No permission resources.'); $show_dialog = $show_header = 1; include $this->admin_tpl('header', 'admin'); ?> <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> ';?> <?php echo admin::submenu($_GET['menuid'],$big_menu); ?><span>|</span><a href="javascript:window.top.art.dialog({id:'setting',iframe:'?m=formguide&c=formguide&a=setting', title:'<?php echo L('module_setting')?>', width:'540', height:'350'}, function(){var d = window.top.art.dialog({id:'setting'}).data.iframe;var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'setting'}).close()});void(0);"><em><?php echo L('module_setting')?></em></a> </div> </div> <div class="pad-lr-10"> <form name="myform" action="?m=formguide&c=formguide&a=listorder" method="post"> <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('formid[]');"></th> <th align="center"><?php echo L('name_items')?></th> <th width='100' align="center"><?php echo L('tablename')?></th> <th width='150' align="center"><?php echo L('introduction')?></th> <th width="140" align="center"><?php echo L('create_time')?></th> <th width="160" align="center"><?php echo L('call')?></th> <th width="220" align="center"><?php echo L('operations_manage')?></th> </tr> </thead> <tbody> <?php if(is_array($data)){ foreach($data as $form){ ?> <tr> <td align="center"> <input type="checkbox" name="formid[]" value="<?php echo $form['modelid']?>"> </td> <td><?php echo $form['name']?> [<a href="<?php echo APP_PATH?>index.php?m=formguide&c=index&a=show&formid=<?php echo $form['modelid']?>" target="_blank"><?php echo L('visit_front')?></a>] <?php if ($form['items']) {?>(<?php echo $form['items']?>)<?php }?></td> <td align="center"><?php echo $form['tablename']?></td> <td align="center"><?php echo $form['introduce']?></td> <td align="center"><?php echo date('Y-m-d H:i:s', $form['addtime'])?></td> <td align="center"><input type="text" value="<script language='javascript' src='{APP_PATH}index.php?m=formguide&c=index&a=show&formid=<?php echo $form['modelid']?>&action=js'></script>"></td> <td align="center"><a href="?m=formguide&c=formguide_info&a=init&formid=<?php echo $form['modelid']?>&menuid=<?php echo $_GET['menuid']?>"><?php echo L('info_list')?></a> | <a href="?m=formguide&c=formguide_field&a=add&formid=<?php echo $form['modelid']?>"><?php echo L('field_add')?></a> | <a href="?m=formguide&c=formguide_field&a=init&formid=<?php echo $form['modelid']?>"><?php echo L('field_manage')?></a> <br /><a href="?m=formguide&c=formguide&a=public_preview&formid=<?php echo $form['modelid']?>"><?php echo L('preview')?></a> | <a href="javascript:edit('<?php echo $form['modelid']?>', '<?php echo safe_replace($form['name'])?>');void(0);"><?php echo L('modify')?></a> | <a href="?m=formguide&c=formguide&a=disabled&formid=<?php echo $form['modelid']?>&val=<?php echo $form['disabled'] ? 0 : 1;?>"><?php if ($form['disabled']==0) { echo L('field_disabled'); } else { echo L('field_enabled'); }?></a> | <a href="?m=formguide&c=formguide&a=delete&formid=<?php echo $form['modelid']?>" onClick="return confirm('<?php echo L('confirm', array('message' => addslashes(htmlspecialchars($form['name']))))?>')"><?php echo L('del')?></a> | <a href="javascript:stat('<?php echo $form['modelid']?>', '<?php echo safe_replace($form['name'])?>');void(0);"><?php echo L('stat')?></a></td> </tr> <?php } } ?> </tbody> </table> <div class="btn"><label for="check_box"><?php echo L('selected_all')?>/<?php echo L('cancel')?></label> <input name="submit" type="submit" class="button" value="<?php echo L('remove_all_selected')?>" onClick="document.myform.action='?m=formguide&c=formguide&a=delete';return confirm('<?php echo L('affirm_delete')?>')">&nbsp;&nbsp;</div> </div> <div id="pages"><?php echo $this->db->pages;?></div> </form> </div> </body> </html> <script type="text/javascript"> function edit(id, title) { window.top.art.dialog({id:'edit'}).close(); window.top.art.dialog({title:'<?php echo L('edit_formguide')?>--'+title, id:'edit', iframe:'?m=formguide&c=formguide&a=edit&formid='+id ,width:'700px',height:'500px'}, 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 stat(id, title) { window.top.art.dialog({id:'stat'}).close(); window.top.art.dialog({title:'<?php echo L('stat_formguide')?>--'+title, id:'stat', iframe:'?m=formguide&c=formguide&a=stat&formid='+id ,width:'700px',height:'500px'}, function(){window.top.art.dialog({id:'edit'}).close()}); } </script>
108wo
phpcms/modules/formguide/templates/formguide_list.tpl.php
PHP
asf20
5,077
<?php defined('IN_ADMIN') or exit('No permission resources.'); $show_header = 1; include $this->admin_tpl('header', 'admin'); ?> <div class="pad-10"> <?php if(is_array($result)){ foreach($result as $v){ ?> <table width="100%" cellspacing="0" class="table-list"> <thead> <tr> <th align="left"><strong><?php echo $fields[$v['field']]['name']?></strong></th> <th width="10%" align="center"><?php echo L('stat_num')?></th> <th width='30%' align="center"><?php echo L('thumb_shi')?></th> </tr> </thead> <tbody> <?php $i = 1; $setting = string2array($v['setting']); $setting = $setting['options']; $options = explode("\n",$setting); if(is_array($options)){ foreach($options AS $_k=>$_v){ $_key = $_kv = $_v; if (strpos($_v,'|')!==false) { $xs = explode('|',$_v); $_key =$xs[0]; $_kv =$xs[1]; } ?> <tr> <td> <?php echo intval($_k+1).' 、 '.$_key;?> </td> <td align="center"><?php $number = 0; foreach ($datas AS $__k=>$__v) { if(trim($__v[$v['field']])==trim($_kv)) $number++; } echo $number; ?></td> <td align="center"> <?php if($total==0){ $per=0; }else{ $per=intval($number/$total*100); }?> <div class="vote_bar"> <div style="width:<?=$per?>%"><span><?php echo $per;?> %</span> </div> </div> </td> </tr> <?php $i++; } } ?> </tbody> </table> <div class="bk10"></div> <?php } } ?> <div class="bk10"></div> </div> </body> </html>
108wo
phpcms/modules/formguide/templates/formguide_stat.tpl.php
PHP
asf20
1,525
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin'); ?> <div class="pad-10"> <form method="post" action="?m=formguide&c=formguide&a=edit&formid=<?php echo $_GET['formid']?>" name="myform" id="myform"> <table class="table_form" width="100%" cellspacing="0"> <tbody> <tr> <th width="150"><strong><?php echo L('name')?>:</strong></th> <td><input name="info[name]" id="name" class="input-text" type="text" value="<?php echo htmlspecialchars($data['name'])?>" size="30" ></td> </tr> <tr> <th><strong><?php echo L('tablename')?>:</strong></th> <td><input name="info[tablename]" id="tablename" class="input-text" type="text" value="<?php echo $data['tablename']?>" readonly size="25" ></td> </tr> <tr> <th><strong><?php echo L('introduction')?>:</strong></th> <td><textarea name="info[description]" id="description" rows="6" cols="50"><?php echo $data['description']?></textarea></td> </tr> <tr> <th><strong><?php echo L('time_limit')?>:</strong></th> <td><input type="radio" name="setting[enabletime]" value="1" <?php if ($data['setting']['enabletime']) {?>checked<?php }?>> <?php echo L('enable')?> <input type="radio" name="setting[enabletime]" value="0" <?php if ($data['setting']['enabletime']==0) {?>checked<?php }?>> <?php echo L('unenable')?></td> </tr> <tr id="time_start" style="<?php if ($data['setting']['enabletime']==0) {?>display:none;<?php }?>"> <th><strong><?php echo L('start_time')?>:</strong></th> <td><?php echo form::date('setting[starttime]', date('Y-m-d', $data['setting']['starttime']))?></td> </tr> <tr id="time_end" style="<?php if ($data['setting']['enabletime']==0) {?>display:none;<?php }?>"> <th><strong><?php echo L('end_time')?>:</strong></th> <td><?php echo form::date('setting[endtime]', date('Y-m-d', $data['setting']['endtime']))?></td> </tr> <tr> <th><strong><?php echo L('allowed_send_mail')?>:</strong></th> <td><input name="setting[sendmail]" type="radio" value="1" <?php if ($data['setting']['sendmail']) {?>checked<?php }?>>&nbsp;<?php echo L('yes')?>&nbsp;&nbsp;<input name="setting[sendmail]" type="radio" value="0" <?php if ($data['setting']['sendmail']==0) {?>checked<?php }?>>&nbsp;<?php echo L('no')?></td> </tr> <tr id="mailaddress" style="<?php if ($data['setting']['sendmail']==0) {?>display:none;<?php }?>"> <th><strong><?php echo L('e-mail_address')?>:</strong></th> <td><input type="text" name="setting[mails]" id="mails" class="input-text" value="<?php echo $data['setting']['mails']?>" size="50"> <?php echo L('multiple_with_commas')?></td> </tr> <tr> <th><strong><?php echo L('allows_more_ip')?>:</strong></th> <td><input type='radio' name='setting[allowmultisubmit]' value='1' <?php if($data['setting']['allowmultisubmit'] == 1) {?>checked<?php }?>> <?php echo L('yes')?>&nbsp;&nbsp;&nbsp;&nbsp; <input type='radio' name='setting[allowmultisubmit]' value='0' <?php if($data['setting']['allowmultisubmit'] == 0) {?>checked<?php }?>> <?php echo L('no')?></td> </tr> <tr> <th><strong><?php echo L('allowunreg')?>:</strong></th> <td><input type='radio' name='setting[allowunreg]' value='1' <?php if($data['setting']['allowunreg'] == 1) {?>checked<?php }?>> <?php echo L('yes')?>&nbsp;&nbsp;&nbsp;&nbsp; <input type='radio' name='setting[allowunreg]' value='0' <?php if($data['setting']['allowunreg'] == 0) {?>checked<?php }?>> <?php echo L('no')?></td> </tr> <tr> <th><strong><?php echo L('optional_style')?>:</strong></th> <td> <?php echo form::select($template_list, $data['default_style'], 'name="info[default_style]" id="style" onchange="load_file_list(this.value)"', L('please_select'))?> </td> </tr> <tr> <th><strong><?php echo L('template_selection')?>:</strong></th> <td id="show_template"><script type="text/javascript">$.getJSON('?m=admin&c=category&a=public_tpl_file_list&style=<?php echo $data['default_style']?>&id=<?php echo $data['show_template']?>&module=formguide&templates=show&name=info&pc_hash='+pc_hash, function(data){$('#show_template').html(data.show_template);});</script></td> </tr> <tr> <th><strong>js调用使用的模板:</strong></th> <td id="show_js_template"><script type="text/javascript">$.getJSON('?m=admin&c=category&a=public_tpl_file_list&style=<?php echo $data['default_style']?>&id=<?php echo $data['js_template']?>&module=formguide&templates=show_js&name=info&pc_hash='+pc_hash, function(data){$('#show_js_template').html(data.show_js_template);});</script></td> </tr> </tbody> </table> <input type="submit" name="dosubmit" id="dosubmit" value=" <?php echo L('ok')?> " class="dialog">&nbsp;<input type="reset" class="dialog" value=" <?php echo L('clear')?> "> </form> </div> </body> </html> <script type="text/javascript"> function load_file_list(id) { if (id=='') return false; $.getJSON('?m=admin&c=category&a=public_tpl_file_list&style='+id+'&module=formguide&templates=show|show_js&name=info&pc_hash='+pc_hash, function(data){$('#show_template').html(data.show_template);$('#show_js_template').html(data.show_js_template);}); } $(document).ready(function(){ $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'220',height:'70'}, function(){this.close();$(obj).focus();})}}); $('#name').formValidator({onshow:"<?php echo L('input_form_title')?>",onfocus:"<?php echo L('title_min_3_chars')?>",oncorrect:"<?php echo L('right')?>"}).inputValidator({min:1,onerror:"<?php echo L('title_cannot_empty')?>"}).defaultPassed(); $('#tablename').formValidator({onshow:"<?php echo L('please_input_tallename')?>", onfocus:"<?php echo L('standard')?>", oncorrect:"<?php echo L('right')?>"}).regexValidator({regexp:"^[a-zA-Z]{1}([a-zA-Z0-9]|[_]){0,19}$",onerror:"<?php echo L('tablename_was_wrong');?>"}).inputValidator({min:1,onerror:"<?php echo L('tablename_no_empty')?>"}).ajaxValidator({ type : "get", url : "", data : "m=formguide&c=formguide&a=public_checktable&formid=<?php echo $_GET['formid']?>", datatype : "html", cached:false, getdata:{issystem:'issystem'}, async:'false', success : function(data){ if( data == "1" ){ return true; } else { return false; } }, buttons: $("#dosubmit"), onerror : "<?php echo L('tablename_existed')?>", onwait : "<?php echo L('connecting_please_wait')?>" }).defaultPassed(); $('#starttime').formValidator({onshow:"<?php echo L('select_stardate')?>",onfocus:"<?php echo L('select_stardate')?>",oncorrect:"<?php echo L('right_all')?>"}).defaultPassed(); $('#endtime').formValidator({onshow:"<?php echo L('select_downdate')?>",onfocus:"<?php echo L('select_downdate')?>",oncorrect:"<?php echo L('right_all')?>"}).defaultPassed(); $('#style').formValidator({onshow:"<?php echo L('select_style')?>",onfocus:"<?php echo L('select_style')?>",oncorrect:"<?php echo L('right')?>"}).inputValidator({min:1,onerror:"<?php echo L('select_style')?>"}).defaultPassed(); }); $("input:radio[name='setting[enabletime]']").click(function (){ if($("input:radio[name='setting[enabletime]'][checked]").val()==0) { $("#time_start").hide(); $("#time_end").hide(); } else if($("input:radio[name='setting[enabletime]'][checked]").val()==1) { $("#time_start").show(); $("#time_end").show(); } }); $("input:radio[name='setting[sendmail]']").click(function (){ if($("input:radio[name='setting[sendmail]'][checked]").val()==0) { $("#mailaddress").hide(); } else if($("input:radio[name='setting[sendmail]'][checked]").val()==1) { $("#mailaddress").show(); } }); </script>
108wo
phpcms/modules/formguide/templates/formguide_edit.tpl.php
PHP
asf20
7,745
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin'); ?> <script language="javascript" type="text/javascript" src="{JS_PATH}dialog.js"></script> <link href="<?php echo CSS_PATH?>table_form.css" rel="stylesheet" type="text/css" /> <link href="<?php echo CSS_PATH?>dialog.css" rel="stylesheet" type="text/css" /> <div class="subnav"> <h2 class="title-1 line-x f14 fb blue lh28"><?php echo $f_info['name']?>--<?php echo L('form_preview')?></h2> <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> ';?><a class="on" href="?m=formguide&c=formguide&a=init"><em><?php echo L('return_list')?></em></a></div> </div> <div class="pad-10"> <table class="table_form" width="100%" cellspacing="0"> <tbody> <?php if(is_array($forminfos_data)) { foreach($forminfos_data as $field=>$info) { if($info['isomnipotent']) continue; if($info['formtype']=='omnipotent') { foreach($forminfos_data as $_fm=>$_fm_value) { if($_fm_value['isomnipotent']) { $info['form'] = str_replace('{'.$_fm.'}',$_fm_value['form'],$info['form']); } } } ?> <tr> <th width="80"><?php if($info['star']){ ?> <font color="red">*</font><?php } ?> <?php echo $info['name']?> </th> <td><?php echo $info['form']?> <?php echo $info['tips']?></td> </tr> <?php } } ?> </tbody> </table> <input type="submit" class="button" name="dosubmit" id="dosubmit" value=" <?php echo L('ok')?> ">&nbsp;<input type="reset" class="button" value=" <?php echo L('clear')?> "> </div> </body> </html>
108wo
phpcms/modules/formguide/templates/formguide_preview.tpl.php
PHP
asf20
1,674
<?php defined('IN_ADMIN') or exit('No permission resources.'); $show_header = 1; include $this->admin_tpl('header', 'admin'); ?> <div class="pad-10"> <table width="100%" cellspacing="0" class="table-list"> <thead> <tr> <th width="15%" align="right"><?php echo L('selects')?></th> <th align="left"><?php echo L('values')?></th> </tr> </thead> <tbody> <?php if(is_array($forminfos_data)){ foreach($forminfos_data as $key => $form){ ?> <tr> <td><?php echo $fields[$key]['name']?>:</td> <td><?php echo $form?></td> </tr> <?php } } ?> </tbody> </table> </div> </body> </html>
108wo
phpcms/modules/formguide/templates/formguide_info_view.tpl.php
PHP
asf20
638
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin');?> <div class="subnav"> <h2 class="title-1 line-x f14 fb blue lh28"><?php echo L('formguide');?>--<?php if ($formid) echo $r['name']; else echo L('public')?><?php echo L('field_manage');?></h2> <div class="content-menu ib-a blue line-x"><a class="add fb" href="?m=formguide&c=formguide_field&a=add&formid=<?php echo $formid?>&menuid=<?php echo $_GET['menuid']?>"><em><?php echo L('add_field');?></em></a>  <a class="on" href="?m=formguide&c=formguide_field&a=init&formid=<?php echo $formid?>"><em><?php echo L('manage_field');?></em></a><?php if ($formid) {?><span>|</span><a href="?m=formguide&c=formguide&a=public_preview&formid=<?php echo $formid?>&menuid=<?php echo $_GET['menuid']?>"><em><?php echo L('priview_modelfield');?></em></a><?php }?> </div></div> <div class="pad-lr-10"> <form name="myform" action="?m=formguide&c=formguide_field&a=listorder&formid=<?php echo $formid?>" method="post"> <div class="table-list"> <table width="100%" cellspacing="0" > <thead> <tr> <th width="70"><?php echo L('listorder')?></th> <th width="90"><?php echo L('fieldname')?></th> <th width="100"><?php echo L('cnames');?></th> <th width="100"><?php echo L('type');?></th> <th width="50"><?php echo L('system');?></th> <th width="50"><?php echo L('must_input');?></th> <th width="50"><?php echo L('search');?></th> <th width="50"><?php echo L('listorder');?></th> <th width="50"><?php echo L('contribute');?></th> <th ><?php echo L('operations_manage');?></th> </tr> </thead> <tbody class="td-line"> <?php foreach($datas as $r) { $tablename = L($r['tablename']); ?> <tr> <td align='center' width='70'><input name='listorders[<?php echo $r['fieldid'] ? $r['fieldid'] : $r['field']?>]' type='text' size='3' value='<?php echo $r['listorder']?>' class='input-text-c'></td> <td width='90'><?php echo $r['field']?></td> <td width="100"><?php echo $r['name']?></td> <td width="100" align='center'><?php echo $r['formtype']?></td> <td width="50" align='center'><?php echo $r['issystem'] ? L('icon_unlock') : L('icon_locked')?></td> <td width="50" align='center'><?php echo $r['minlength'] ? L('icon_unlock') : L('icon_locked')?></td> <td width="50" align='center'><?php echo $r['issearch'] ? L('icon_unlock') : L('icon_locked')?></td> <td width="50" align='center'><?php echo $r['isorder'] ? L('icon_unlock') : L('icon_locked')?></td> <td width="50" align='center'><?php echo $r['isadd'] ? L('icon_unlock') : L('icon_locked')?></td> <td align='center'> <a href="?m=formguide&c=formguide_field&a=edit&formid=<?php echo $r['modelid']?>&fieldid=<?php echo $r['fieldid']?>&field=<?php echo $r['field']?>&menuid=<?php echo $_GET['menuid']?>"><?php echo L('edit');?></a> | <?php if ($formid) { if(!in_array($r['field'],$forbid_fields)) { ?> <a href="?m=formguide&c=formguide_field&a=disabled&disabled=<?php echo $r['disabled'];?>&modelid=<?php echo $r['modelid']?>&fieldid=<?php echo $r['fieldid']?>&fieldid=<?php echo $r['fieldid']?>&menuid=<?php echo $_GET['menuid']?>"><?php echo $r['disabled'] ? L('field_enabled') : L('field_disabled');?></a> <?php } else { ?><font color="#BEBEBE"> <?php echo L('field_disabled');?> </font><?php } ?>|<?php } if(!in_array($r['field'],$forbid_delete)) {?> <a href="javascript:confirmurl('?m=formguide&c=formguide_field&a=delete&formid=<?php echo $r['modelid']?>&fieldid=<?php echo $r['fieldid']?>&field=<?php echo $r['field']?>&menuid=<?php echo $_GET['menuid']?>','<?php echo L('confirm',array('message'=>$r['name']))?>')"><?php echo L('delete')?></a><?php } else {?><font color="#BEBEBE"> <?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></div> </form> </div> </body> </html>
108wo
phpcms/modules/formguide/templates/formguide_field_list.tpl.php
PHP
asf20
4,082
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin'); ?> <div class="pad-lr-10"> <form name="myform" action="?m=formguide&c=formguide_info&a=delete" method="post"> <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('did[]');"></th> <th align="center"><?php echo L('username')?></th> <th width='250' align="center"><?php echo L('userip')?></th> <th width='250' align="center"><?php echo L('times')?></th> <th width="250" align="center"><?php echo L('operation')?></th> </tr> </thead> <tbody> <?php if(is_array($datas)){ foreach($datas as $d){ ?> <tr> <td align="center"> <input type="checkbox" name="did[]" value="<?php echo $d['dataid']?>"> </td> <td><?php echo $d['username']?> </td> <td align="center"><?php echo $d['ip']?></td> <td align="center"><?php echo date('Y-m-d', $d['datetime'])?></td> <td align="center"><a href="javascript:check('<?php echo $formid?>', '<?php echo $d['dataid']?>', '<?php echo safe_replace($d['username'])?>');void(0);"><?php echo L('check')?></a> | <a href="?m=formguide&c=formguide_info&a=public_delete&formid=<?php echo $formid?>&did=<?php echo $d['dataid']?>" onClick="return confirm('<?php echo L('confirm', array('message' => L('delete')))?>')"><?php echo L('del')?></a></td> </tr> <?php } } ?> </tbody> </table> <div class="btn"><label for="check_box"><?php echo L('selected_all')?>/<?php echo L('cancel')?></label> <input name="submit" type="submit" class="button" value="<?php echo L('remove_all_selected')?>" onClick="document.myform.action='?m=formguide&c=formguide_info&a=public_delete&formid=<?php echo $formid?>';return confirm('<?php echo L('affirm_delete')?>')">&nbsp;&nbsp;</div> </div> <div id="pages"><?php echo $pages;?></div> </form> </div> </body> </html> <script type="text/javascript"> function check(id, did, title) { window.top.art.dialog({id:'check'}).close(); window.top.art.dialog({title:'<?php echo L('check')?>--'+title+'<?php echo L('submit_info')?>', id:'edit', iframe:'?m=formguide&c=formguide_info&a=public_view&formid='+id+'&did='+did ,width:'700px',height:'500px'}, function(){window.top.art.dialog({id:'check'}).close()}); } </script>
108wo
phpcms/modules/formguide/templates/formguide_info_list.tpl.php
PHP
asf20
2,434
<?php defined('IN_ADMIN') or exit('No permission resources.'); $show_validator = $show_dialog = 1; include $this->admin_tpl('header','admin');?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({autotip:true,formid:"myform"}); $("#field").formValidator({onshow:"<?php echo L('input').L('fieldname')?>",onfocus:"<?php echo L('fieldname').L('between_1_to_20')?>"}).regexValidator({regexp:"^[a-zA-Z]{1}([a-zA-Z0-9]|[_]){0,19}$",onerror:"<?php echo L('fieldname_was_wrong');?>"}).inputValidator({min:1,max:20,onerror:"<?php echo L('fieldname').L('between_1_to_20')?>"}).ajaxValidator({ type : "get", url : "", data : "m=formguide&c=formguide_field&a=public_checkfield&modelid=<?php echo $formid?>", datatype : "html", cached:false, getdata:{issystem:'issystem'}, async:'false', success : function(data){ if( data == "1" ){ return true; } else { return false; } }, buttons: $("#dosubmit"), onerror : "<?php echo L('fieldname').L('already_exist')?>", onwait : "<?php echo L('connecting_please_wait')?>" }); $("#formtype").formValidator({onshow:"<?php echo L('select_fieldtype');?>",onfocus:"<?php echo L('select_fieldtype');?>",oncorrect:"<?php echo L('input_right');?>",defaultvalue:""}).inputValidator({min:1,onerror: "<?php echo L('select_fieldtype');?>"}); $("#name").formValidator({onshow:"<?php echo L('input_nickname');?>",onfocus:"<?php echo L('nickname_empty');?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L('input_nickname');?>"}); }) //--> </script> <div class="pad_10"> <div class="subnav"> <h2 class="title-1 line-x f14 fb blue lh28"><?php echo L('formguide');?>--<?php echo $m_r['name'].L('field_manage'); ?></h2> <div class="content-menu ib-a blue line-x"><a class="add fb" href="?m=formguide&c=formguide_field&a=add&modelid=<?php echo $formid?>&menuid=<?php echo $_GET['menuid']?>"><em><?php echo L('add_field');?></em></a>  <?php if (isset($formid) && !empty($formid)) {?><a href="?m=formguide&c=formguide_field&a=init&modelid=<?php echo $formid?>&menuid=<?php echo $_GET['menuid']?>"><em><?php echo L('manage_field');?></em></a><?php } else {?><a href="?m=formguide&c=formguide_field&a=init&menuid=<?php echo $_GET['menuid']?>"><em><?php echo L('public_field_manage')?></em></a><?php }?></div> <div class="bk10"></div> </div> <form name="myform" id="myform" action="?m=formguide&c=formguide_field&a=add" method="post"> <div class="common-form"> <table width="100%" class="table_form contentWrap"> <tr> <th><strong><?php echo L('field_type');?></strong><br /></th> <td> <?php echo form::select($all_field,'','name="info[formtype]" id="formtype" onchange="javascript:field_setting(this.value);"',L('select_fieldtype'));?> </td> </tr> <tr> <th width="25%"><font color="red">*</font> <strong><?php echo L('fieldname');?></strong><br /> <?php echo L('fieldname_tips');?> </th> <td><input type="text" name="info[field]" id="field" size="20" class="input-text"></td> </tr> <tr> <th><font color="red">*</font> <strong><?php echo L('field_nickname');?></strong><br /><?php echo L('nickname_tips');?></th> <td><input type="text" name="info[name]" id="name" size="30" class="input-text"></td> </tr> <tr> <th><strong><?php echo L('field_tip');?></strong><br /><?php echo L('field_tips');?></th> <td><textarea name="info[tips]" rows="2" cols="20" id="tips" style="height:40px; width:80%"></textarea></td> </tr> <tr> <th><strong><?php echo L('relation_parm');?></strong><br /><?php echo L('relation_parm_tips');?></th> <td><div id="setting"></div></td> </tr> <tr id="formattribute"> <th><strong><?php echo L('form_attr');?></strong><br /><?php echo L('form_attr_tips');?></th> <td><input type="text" name="info[formattribute]" value="" size="50" class="input-text"></td> </tr> <tr id="css"> <th><strong><?php echo L('form_css_name');?></strong><br /><?php echo L('form_css_name_tips');?></th> <td><input type="text" name="info[css]" value="" size="10" class="input-text"></td> </tr> <tr> <th><strong><?php echo L('string_size');?></strong><br /><?php echo L('string_size_tips');?></th> <td><?php echo L('minlength');?>:<input type="text" name="info[minlength]" id="field_minlength" value="0" size="5" class="input-text"> <?php echo L('maxlength');?>:<input type="text" name="info[maxlength]" id="field_maxlength" value="" size="5" class="input-text"></td> </tr> <tr> <th><strong><?php echo L('data_preg');?></strong><br /><?php echo L('data_preg_tips');?></th> <td><input type="text" name="info[pattern]" id="pattern" value="" size="40" class="input-text"> <select name="pattern_select" onchange="javascript:$('#pattern').val(this.value)"> <option value=""><?php echo L('often_preg');?></option> <option value="/^[0-9.-]+$/"><?php echo L('figure');?></option> <option value="/^[0-9-]+$/"><?php echo L('integer');?></option> <option value="/^[a-z]+$/i"><?php echo L('letter');?></option> <option value="/^[0-9a-z]+$/i"><?php echo L('integer_letter');?></option> <option value="/^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/">E-mail</option> <option value="/^[0-9]{5,20}$/">QQ</option> <option value="/^http:\/\//"><?php echo L('hyperlink');?></option> <option value="/^(1)[0-9]{10}$/"><?php echo L('mobile_number');?></option> <option value="/^[0-9-]{6,13}$/"><?php echo L('tel_number');?></option> <option value="/^[0-9]{6}$/"><?php echo L('zip');?></option> </select> </td> </tr> <tr> <th><strong><?php echo L('data_passed_msg');?></strong></th> <td><input type="text" name="info[errortips]" value="" size="50" class="input-text"></td> </tr> <tr> <th><strong><?php echo L('disabled_groups_field');?></strong></th> <td><?php echo form::checkbox($grouplist,'','name="unsetgroupids[]" id="unsetgroupids"',0,'100');?></td> </tr> </table> </div> <div class="bk15"></div> <input name="info[modelid]" type="hidden" value="<?php echo $formid?>"> <div class="btn"><input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="button"></div> </form> <script type="text/javascript"> <!-- function field_setting(fieldtype) { $('#formattribute').css('display','none'); $('#css').css('display','none'); $.getJSON("?m=formguide&c=formguide_field&a=public_field_setting&fieldtype="+fieldtype, function(data){ if(data.field_allow_search=='1') { $('#field_allow_search0').attr("disabled",false); $('#field_allow_search1').attr("disabled",false); } else { $('#field_allow_search0').attr("checked",true); $('#field_allow_search0').attr("disabled",true); $('#field_allow_search1').attr("disabled",true); } if(data.field_allow_isunique=='1') { $('#field_allow_isunique0').attr("disabled",false); $('#field_allow_isunique1').attr("disabled",false); } else { $('#field_allow_isunique0').attr("checked",true); $('#field_allow_isunique0').attr("disabled",true); $('#field_allow_isunique1').attr("disabled",true); } $('#field_minlength').val(data.field_minlength); $('#field_maxlength').val(data.field_maxlength); $('#setting').html(data.setting); }); } //--> </script> </body> </html>
108wo
phpcms/modules/formguide/templates/formguide_field_add.tpl.php
PHP
asf20
7,487
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin'); ?> <div class="pad-10"> <form method="post" action="?m=formguide&c=formguide&a=add" name="myform" id="myform"> <table class="table_form" width="100%" cellspacing="0"> <tbody> <tr> <th width="150"><strong><?php echo L('name')?>:</strong></th> <td><input name="info[name]" id="name" class="input-text" type="text" size="30" ></td> </tr> <tr> <th><strong><?php echo L('tablename')?>:</strong></th> <td><input name="info[tablename]" id="tablename" class="input-text" type="text" size="25" ></td> </tr> <tr> <th><strong><?php echo L('introduction')?>:</strong></th> <td><textarea name="info[description]" id="description" rows="6" cols="50"></textarea></td> </tr> <tr> <th><strong><?php echo L('time_limit')?>:</strong></th> <td><input type="radio" name="setting[enabletime]" value="1"> <?php echo L('enable')?> <input type="radio" name="setting[enabletime]" value="0" checked> <?php echo L('unenable')?></td> </tr> <tr id="time_start" style="display:none;"> <th><strong><?php echo L('start_time')?>:</strong></th> <td><?php echo form::date('setting[starttime]', date('Y-m-d', SYS_TIME))?></td> </tr> <tr id="time_end" style="display:none;"> <th><strong><?php echo L('end_time')?>:</strong></th> <td><?php echo form::date('setting[endtime]')?></td> </tr> <tr> <th><strong><?php echo L('allowed_send_mail')?>:</strong></th> <td><input name="setting[sendmail]" type="radio" value="1" >&nbsp;<?php echo L('yes')?>&nbsp;&nbsp;<input name="setting[sendmail]" type="radio" value="0" checked>&nbsp;<?php echo L('no')?></td> </tr> <tr id="mailaddress" style="display:none;"> <th><strong><?php echo L('e-mail_address')?>:</strong></th> <td><input type="text" name="setting[mails]" id="mails" class="input-text" size="50"> <?php echo L('multiple_with_commas')?></td> </tr> <tr> <th><strong><?php echo L('allows_more_ip')?>:</strong></th> <td><input type='radio' name='setting[allowmultisubmit]' value='1' <?php if($this->M['allowmultisubmit'] == 1) {?>checked<?php }?>> <?php echo L('yes')?>&nbsp;&nbsp;&nbsp;&nbsp; <input type='radio' name='setting[allowmultisubmit]' value='0' <?php if($this->M['allowmultisubmit'] == 0) {?>checked<?php }?>> <?php echo L('no')?></td> </tr> <tr> <th><strong><?php echo L('allowunreg')?>:</strong></th> <td><input type='radio' name='setting[allowunreg]' value='1' <?php if($this->M['allowunreg'] == 1) {?>checked<?php }?>> <?php echo L('yes')?>&nbsp;&nbsp;&nbsp;&nbsp; <input type='radio' name='setting[allowunreg]' value='0' <?php if($this->M['allowunreg'] == 0) {?>checked<?php }?>> <?php echo L('no')?></td> </tr> <tr> <th><strong><?php echo L('optional_style')?>:</strong></th> <td> <?php echo form::select($template_list, $info['default_style'], 'name="info[default_style]" id="style" onchange="load_file_list(this.value)"', L('please_select'))?> </td> </tr> <tr> <th><strong><?php echo L('template_selection')?>:</strong></th> <td id="show_template"><script type="text/javascript">$.getJSON('?m=admin&c=category&a=public_tpl_file_list&style=<?php echo $info['default_style']?>&module=formguide&templates=show&name=info&pc_hash='+pc_hash, function(data){$('#show_template').html(data.show_template);});</script></td> </tr> <tr> <th><strong>js调用使用的模板:</strong></th> <td id="show_js_template"><script type="text/javascript">$.getJSON('?m=admin&c=category&a=public_tpl_file_list&style=<?php echo $info['default_style']?>&module=formguide&templates=show_js&name=info&pc_hash='+pc_hash, function(data){$('#show_js_template').html(data.show_js_template);});</script></td> </tr> </tbody> </table> <input type="submit" name="dosubmit" id="dosubmit" value=" <?php echo L('ok')?> " class="dialog">&nbsp;<input type="reset" class="dialog" value=" <?php echo L('clear')?> "> </form> </div> </body> </html> <script type="text/javascript"> function load_file_list(id) { if (id=='') return false; $.getJSON('?m=admin&c=category&a=public_tpl_file_list&style='+id+'&module=formguide&templates=show|show_js&name=info&pc_hash='+pc_hash, function(data){$('#show_template').html(data.show_template);$('#show_js_template').html(data.show_js_template);}); } $(document).ready(function(){ $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'220',height:'70'}, function(){this.close();$(obj).focus();})}}); $('#name').formValidator({onshow:"<?php echo L('input_form_title')?>",onfocus:"<?php echo L('title_min_3_chars')?>",oncorrect:"<?php echo L('right')?>"}).inputValidator({min:1,onerror:"<?php echo L('title_cannot_empty')?>"}); $('#tablename').formValidator({onshow:"<?php echo L('please_input_tallename')?>", onfocus:"<?php echo L('standard')?>", oncorrect:"<?php echo L('right')?>"}).regexValidator({regexp:"^[a-zA-Z]{1}([a-zA-Z0-9]|[_]){0,19}$",onerror:"<?php echo L('tablename_was_wrong');?>"}).inputValidator({min:1,onerror:"<?php echo L('tablename_no_empty')?>"}).ajaxValidator({ type : "get", url : "", data : "m=formguide&c=formguide&a=public_checktable", datatype : "html", cached:false, getdata:{issystem:'issystem'}, async:'false', success : function(data){ if( data == "1" ){ return true; } else { return false; } }, buttons: $("#dosubmit"), onerror : "<?php echo L('tablename_existed')?>", onwait : "<?php echo L('connecting_please_wait')?>" }); $('#starttime').formValidator({onshow:"<?php echo L('select_stardate')?>",onfocus:"<?php echo L('select_stardate')?>",oncorrect:"<?php echo L('right_all')?>"}); $('#endtime').formValidator({onshow:"<?php echo L('select_downdate')?>",onfocus:"<?php echo L('select_downdate')?>",oncorrect:"<?php echo L('right_all')?>"}); $('#style').formValidator({onshow:"<?php echo L('select_style')?>",onfocus:"<?php echo L('select_style')?>",oncorrect:"<?php echo L('right')?>"}).inputValidator({min:1,onerror:"<?php echo L('select_style')?>"}); }); $("input:radio[name='setting[enabletime]']").click(function (){ if($("input:radio[name='setting[enabletime]'][checked]").val()==0) { $("#time_start").hide(); $("#time_end").hide(); } else if($("input:radio[name='setting[enabletime]'][checked]").val()==1) { $("#time_start").show(); $("#time_end").show(); } }); $("input:radio[name='setting[sendmail]']").click(function (){ if($("input:radio[name='setting[sendmail]'][checked]").val()==0) { $("#mailaddress").hide(); } else if($("input:radio[name='setting[sendmail]'][checked]").val()==1) { $("#mailaddress").show(); } }); </script>
108wo
phpcms/modules/formguide/templates/formguide_add.tpl.php
PHP
asf20
6,835