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
<table cellpadding="2" cellspacing="1" width="98%"> <tr> <td width="100">文本框长度</td> <td><input type="text" name="setting[size]" size="10" class="input-text"></td> </tr> <tr> <td>默认值</td> <td><input type="text" name="setting[defaultvalue]" size="40" class="input-text"></td> </tr> <tr> <td>表单显示模式</td> <td><input type="radio" name="setting[show_type]" value="1" /> 图片模式 <input type="radio" name="setting[show_type]" value="0" checked/> 文本框模式</td> </tr> <tr> <td>允许上传的图片类型</td> <td><input type="text" name="setting[upload_allowext]" value="gif|jpg|jpeg|png|bmp" size="40" class="input-text"></td> </tr> <tr> <td>是否从已上传中选择</td> <td><input type="radio" name="setting[isselectimage]" value="1" checked> 是 <input type="radio" name="setting[isselectimage]" value="0"> 否</td> </tr> <tr> <td>图像大小</td> <td>宽 <input type="text" name="setting[images_width]" value="" size="3">px 高 <input type="text" name="setting[images_height]" value="" size="3">px</td> </tr> </table>
108wo
phpcms/modules/member/fields/image/field_add_form.inc.php
Hack
asf20
1,192
<?php defined('IN_PHPCMS') or exit('No permission resources.');?> <table cellpadding="2" cellspacing="1" width="98%"> <tr> <td width="100">文本框长度</td> <td><input type="text" name="setting[size]" value="<?php echo $setting['size'];?>" size="10" class="input-text"></td> </tr> <tr> <td>默认值</td> <td><input type="text" name="setting[defaultvalue]" value="<?php echo $setting['defaultvalue'];?>" size="40" class="input-text"></td> </tr> <tr> <td>表单显示模式</td> <td><input type="radio" name="setting[show_type]" value="1" <?php if($setting['show_type']) echo 'checked';?>/> 图片模式 <input type="radio" name="setting[show_type]" value="0" <?php if(!$setting['show_type']) echo 'checked';?>/> 文本框模式</td> </tr> <tr> <td>允许上传的图片大小</td> <td><input type="text" name="setting[upload_maxsize]" value="<?php echo $setting['upload_maxsize'];?>" size="5" class="input-text">KB 提示:1KB=1024Byte,1MB=1024KB *</td> </tr> <tr> <td>允许上传的图片类型</td> <td><input type="text" name="setting[upload_allowext]" value="<?php echo $setting['upload_allowext'];?>" size="40" class="input-text"></td> </tr> <tr> <td>是否从已上传中选择</td> <td><input type="radio" name="setting[isselectimage]" value="1" <?php if($setting['isselectimage']) echo 'checked';?>> 是 <input type="radio" name="setting[isselectimage]" value="0" <?php if(!$setting['isselectimage']) echo 'checked';?>> 否</td> </tr> <tr> <td>图像大小</td> <td>宽 <input type="text" name="setting[images_width]" value="<?php echo $setting['images_width'];?>" size="3">px 高 <input type="text" name="setting[images_height]" value="<?php echo $setting['images_height'];?>" size="3">px</td> </tr> </table>
108wo
phpcms/modules/member/fields/image/field_edit_form.inc.php
PHP
asf20
1,880
<?php class member_output { var $fields; var $data; function __construct($modelid,$catid = 0,$categorys = array()) { $this->modelid = $modelid; $this->catid = $catid; $this->categorys = $categorys; $this->fields = getcache('model_field_'.$modelid,'model'); } function get($data) { $this->data = $data; $this->id = $data['id']; $info = array(); foreach($this->fields as $field=>$v) { if(!isset($data[$field])) continue; $func = $v['formtype']; $value = $data[$field]; $result = method_exists($this, $func) ? $this->$func($field, $data[$field]) : $data[$field]; if($result !== false) $info[$field] = $result; } return $info; } }?>
108wo
phpcms/modules/member/fields/member_output.class.php
PHP
asf20
697
<?php if(!$maxlength) $maxlength = 255; $maxlength = min($maxlength, 255); $fieldtype = $issystem ? 'CHAR' : 'VARCHAR'; $sql = "ALTER TABLE `$tablename` CHANGE `$field` `$field` $fieldtype( $maxlength ) NOT NULL DEFAULT '$defaultvalue'"; $db->query($sql); ?>
108wo
phpcms/modules/member/fields/text/field_edit.inc.php
PHP
asf20
265
function text($field, $value, $fieldinfo) { extract($fieldinfo); $setting = string2array($setting); $size = $setting['size']; if(!$value) $value = $defaultvalue; $type = $ispassword ? 'password' : 'text'; $errortips = $this->fields[$field]['errortips']; $regexp = $pattern ? '.regexValidator({regexp:"'.substr($pattern,1,-1).'",onerror:"'.$errortips.'"})' : ''; if($errortips && $this->fields[$field]['isbase']) $this->formValidator .= '$("#'.$field.'").formValidator({onshow:"'.$errortips.'",onfocus:"'.$errortips.'"}).inputValidator({min:'.$minlength.',max:'.$maxlength.',onerror:"'.$errortips.'"})'.$regexp.';'; return '<input type="text" name="info['.$field.']" id="'.$field.'" size="'.$size.'" value="'.$value.'" class="input-text" '.$formattribute.' '.$css.'>'; }
108wo
phpcms/modules/member/fields/text/form.inc.php
PHP
asf20
801
<?php $db->query("ALTER TABLE `$tablename` DROP `$field`"); ?>
108wo
phpcms/modules/member/fields/text/field_delete.inc.php
PHP
asf20
65
<?php defined('IN_ADMIN') or exit('No permission resources.'); $field_type = 'varchar'; //字段数据库类型 $field_basic_table = 1; //是否允许作为主表字段 $field_allow_index = 1; //是否允许建立索引 $field_minlength = 1; //字符长度默认最小值 $field_maxlength = ''; //字符长度默认最大值 $field_allow_search = 1; //作为搜索条件 $field_allow_fulltext = 1; //作为全站搜索信息 $field_allow_isunique = 1; //是否允许值唯一 ?>
108wo
phpcms/modules/member/fields/text/config.inc.php
PHP
asf20
499
<table cellpadding="2" cellspacing="1" width="98%"> <tr> <td width="100">文本框长度</td> <td><input type="text" name="setting[size]" value="50" size="10" class="input-text"></td> </tr> <tr> <td>默认值</td> <td><input type="text" name="setting[defaultvalue]" value="" size="40" class="input-text"></td> </tr> <tr> <td>是否为密码框</td> <td><input type="radio" name="setting[ispassword]" value="1"> 是 <input type="radio" name="setting[ispassword]" value="0" checked> 否</td> </tr> </table>
108wo
phpcms/modules/member/fields/text/field_add_form.inc.php
Hack
asf20
571
<?php defined('IN_PHPCMS') or exit('No permission resources.');?> <table cellpadding="2" cellspacing="1" width="98%"> <tr> <td width="100">文本框长度</td> <td><input type="text" name="setting[size]" value="<?php echo $setting['size'];?>" size="10" class="input-text"></td> </tr> <tr> <td>默认值</td> <td><input type="text" name="setting[defaultvalue]" value="<?php echo $setting['defaultvalue'];?>" size="40" class="input-text"></td> </tr> <tr> <td>是否为密码框</td> <td><input type="radio" name="setting[ispassword]" value="1" <?php if($setting['ispassword']) echo 'checked';?>> 是 <input type="radio" name="setting[ispassword]" value="0" <?php if(!$setting['ispassword']) echo 'checked';?>> 否</td> </tr> </table>
108wo
phpcms/modules/member/fields/text/field_edit_form.inc.php
PHP
asf20
799
function box($field, $value, $fieldinfo) { $setting = string2array($fieldinfo['setting']); if($value=='') $value = $this->fields[$field]['defaultvalue']; $options = explode("\n",$this->fields[$field]['options']); foreach($options as $_k) { $v = explode("|",$_k); $k = trim($v[1]); $option[$k] = $v[0]; } $values = explode(',',$value); $value = array(); foreach($values as $_k) { if($_k != '') $value[] = $_k; } $value = implode(',',$value); switch($this->fields[$field]['boxtype']) { case 'radio': $string = form::radio($option,$value,"name='info[$field]'",$setting['width'],$field); break; case 'checkbox': $string = form::checkbox($option,$value,"name='info[$field][]'",1,$setting['width'],$field); break; case 'select': $string = form::select($option,$value,"name='info[$field]' id='$field'"); break; case 'multiple': $string = form::select($option,$value,"name='info[$field][]' id='$field' size=2 multiple='multiple' style='height:60px;'"); break; } return $string; }
108wo
phpcms/modules/member/fields/box/form.inc.php
PHP
asf20
1,091
<?php defined('IN_ADMIN') or exit('No permission resources.'); $field_type = 'int'; //字段数据库类型 $field_basic_table = 1; //是否允许作为主表字段 $field_allow_index = 1; //是否允许建立索引 $field_minlength = 0; //字符长度默认最小值 $field_maxlength = ''; //字符长度默认最大值 $field_allow_search = 1; //作为搜索条件 $field_allow_fulltext = 0; //作为全站搜索信息 $field_allow_isunique = 0; //是否允许值唯一 ?>
108wo
phpcms/modules/member/fields/box/config.inc.php
PHP
asf20
495
<table cellpadding="2" cellspacing="1" width="98%"> <tr> <td width="100">选项列表</td> <td><textarea name="setting[options]" rows="2" cols="20" id="options" style="height:100px;width:400px;">选项名称1|选项值1</textarea></td> </tr> <tr> <td>选项类型</td> <td> <input type="radio" name="setting[boxtype]" value="radio" checked onclick="$('#setcols').show();$('#setsize').hide();"/> 单选按钮 <input type="radio" name="setting[boxtype]" value="checkbox" onclick="$('#setcols').show();$('setsize').hide();"/> 复选框 <input type="radio" name="setting[boxtype]" value="select" onclick="$('#setcols').hide();$('setsize').show();" /> 下拉框 <input type="radio" name="setting[boxtype]" value="multiple" onclick="$('#setcols').hide();$('setsize').show();" /> 多选列表框 </td> </tr> <tr> <td>字段类型</td> <td> <select name="setting[fieldtype]" onchange="javascript:fieldtype_setting(this.value);"> <option value="varchar">字符 VARCHAR</option> <option value="tinyint">整数 TINYINT(3)</option> <option value="smallint">整数 SMALLINT(5)</option> <option value="mediumint">整数 MEDIUMINT(8)</option> <option value="int">整数 INT(10)</option> </select> <span id="minnumber" style="display:none"><input type="radio" name="setting[minnumber]" value="1" checked/> <font color='red'>正整数</font> <input type="radio" name="setting[minnumber]" value="-1" /> 整数</span> </td> </tr> <tbody id="setcols" style="display:"> <tr> <td>每列宽度</td> <td><input type="text" name="setting[width]" value="100" size="5" class="input-text"> px</td> </tr> </tbody> <tbody id="setsize" style="display:none"> <tr> <td>高度</td> <td><input type="text" name="setting[size]" value="1" size="5" class="input-text"> 行</td> </tr> </tbody> <tr> <td>默认值</td> <td><input type="text" name="setting[defaultvalue]" size="40" class="input-text"></td> </tr> <tr> <td>输出格式</td> <td> <input type="radio" name="setting[outputtype]" value="1" checked /> 输出选项值 <input type="radio" name="setting[outputtype]" value="0" /> 输出选项名称 </td> </tr> </table> <SCRIPT LANGUAGE="JavaScript"> <!-- function fieldtype_setting(obj) { if(obj!='varchar') { $('#minnumber').css('display',''); } else { $('#minnumber').css('display','none'); } } //--> </SCRIPT>
108wo
phpcms/modules/member/fields/box/field_add_form.inc.php
Hack
asf20
2,527
<?php defined('IN_PHPCMS') or exit('No permission resources.');?> <table cellpadding="2" cellspacing="1" width="98%"> <tr> <td width="100">选项列表</td> <td><textarea name="setting[options]" rows="2" cols="20" id="options" style="height:100px;width:200px;"><?php echo $setting['options'];?></textarea></td> </tr> <tr> <td>选项类型</td> <td> <input type="radio" name="setting[boxtype]" value="radio" <?php if($setting['boxtype']=='radio') echo 'checked';?> onclick="$('#setcols').show();$('#setsize').hide();"/> 单选按钮 <input type="radio" name="setting[boxtype]" value="checkbox" <?php if($setting['boxtype']=='checkbox') echo 'checked';?> onclick="$('#setcols').show();$('setsize').hide();"/> 复选框 <input type="radio" name="setting[boxtype]" value="select" <?php if($setting['boxtype']=='select') echo 'checked';?> onclick="$('#setcols').hide();$('setsize').show();" /> 下拉框 <input type="radio" name="setting[boxtype]" value="multiple" <?php if($setting['boxtype']=='multiple') echo 'checked';?> onclick="$('#setcols').hide();$('setsize').show();" /> 多选列表框 </td> </tr> <tr> <td>字段类型</td> <td> <select name="setting[fieldtype]" onchange="javascript:fieldtype_setting(this.value);"> <option value="varchar" <?php if($setting['fieldtype']=='varchar') echo 'selected';?>>字符 VARCHAR</option> <option value="tinyint" <?php if($setting['fieldtype']=='tinyint') echo 'selected';?>>整数 TINYINT(3)</option> <option value="smallint" <?php if($setting['fieldtype']=='smallint') echo 'selected';?>>整数 SMALLINT(5)</option> <option value="mediumint" <?php if($setting['fieldtype']=='mediumint') echo 'selected';?>>整数 MEDIUMINT(8)</option> <option value="int" <?php if($setting['fieldtype']=='int') echo 'selected';?>>整数 INT(10)</option> </select> <span id="minnumber" style="display:none"><input type="radio" name="setting[minnumber]" value="1" <?php if($setting['minnumber']==1) echo 'checked';?>/> <font color='red'>正整数</font> <input type="radio" name="setting[minnumber]" value="-1" <?php if($setting['minnumber']==-1) echo 'checked';?>/> 整数</span> </td> </tr> <tbody id="setcols" style="display:"> <tr> <td>每列宽度</td> <td><input type="text" name="setting[width]" value="<?php echo $setting['width'];?>" size="5" class="input-text"> px</td> </tr> </tbody> <tbody id="setsize" style="display:none"> <tr> <td>高度</td> <td><input type="text" name="setting[size]" value="<?php echo $setting['size'];?>" size="5" class="input-text"> 行</td> </tr> </tbody> <tr> <td>默认值</td> <td><input type="text" name="setting[defaultvalue]" size="40" class="input-text" value="<?php echo $setting['defaultvalue'];?>"></td> </tr> <tr> <td>输出格式</td> <td> <input type="radio" name="setting[outputtype]" value="1" <?php if($setting['outputtype']) echo 'checked';?> /> 输出选项值 <input type="radio" name="setting[outputtype]" value="0" <?php if(!$setting['outputtype']) echo 'checked';?> /> 输出选项名称 </td> </tr> </table> <SCRIPT LANGUAGE="JavaScript"> <!-- function fieldtype_setting(obj) { if(obj!='varchar') { $('#minnumber').css('display',''); } else { $('#minnumber').css('display','none'); } } //--> </SCRIPT>
108wo
phpcms/modules/member/fields/box/field_edit_form.inc.php
PHP
asf20
3,434
function box($field, $value) { extract(string2array($this->fields[$field]['setting'])); if($outputtype) { return $value; } else { $options = explode("\n",$this->fields[$field]['options']); foreach($options as $_k) { $v = explode("|",$_k); $k = trim($v[1]); $option[$k] = $v[0]; } $string = ''; switch($this->fields[$field]['boxtype']) { case 'radio': $string = $option[$value]; break; case 'checkbox': $value_arr = explode(',',$value); foreach($value_arr as $_v) { if($_v) $string .= $option[$_v].' 、'; } break; case 'select': $string = $option[$value]; break; case 'multiple': $value_arr = explode(',',$value); foreach($value_arr as $_v) { if($_v) $string .= $option[$_v].' 、'; } break; } return $string; } }
108wo
phpcms/modules/member/fields/box/output.inc.php
PHP
asf20
885
function box($field, $value) { if($this->fields[$field]['boxtype'] == 'checkbox') { if(!is_array($value) || empty($value)) return false; array_shift($value); $value = ','.implode(',', $value).','; return $value; } elseif($this->fields[$field]['boxtype'] == 'multiple') { if(is_array($value) && count($value)>1) { $value = ','.implode(',', $value).','; return $value; } } else { return $value; } }
108wo
phpcms/modules/member/fields/box/input.inc.php
PHP
asf20
451
<?php defined('IN_ADMIN') or exit('No permission resources.'); $this->db->query("ALTER TABLE `$tablename` DROP `$field`"); ?>
108wo
phpcms/modules/member/fields/delete.sql.php
PHP
asf20
130
<?php defined('IN_ADMIN') or exit('No permission resources.'); $defaultvalue = isset($_POST['setting']['defaultvalue']) ? $_POST['setting']['defaultvalue'] : ''; $minnumber = isset($_POST['setting']['minnumber']) ? $_POST['setting']['minnumber'] : 1; $decimaldigits = isset($_POST['setting']['decimaldigits']) ? $_POST['setting']['decimaldigits'] : ''; switch($field_type) { case 'varchar': if(!$maxlength) $maxlength = 255; $maxlength = min($maxlength, 255); $fieldtype = isset($issystem) ? 'CHAR' : 'VARCHAR'; $sql = "ALTER TABLE `$tablename` CHANGE `$oldfield` `$field` $fieldtype( $maxlength ) NOT NULL DEFAULT '$defaultvalue'"; $this->db->query($sql); break; case 'tinyint': $this->db->query("ALTER TABLE `$tablename` CHANGE `$oldfield` `$field` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0'"); break; case 'number': $minnumber = intval($minnumber); $defaultvalue = $decimaldigits == 0 ? intval($defaultvalue) : floatval($defaultvalue); $sql = "ALTER TABLE `$tablename` CHANGE `$oldfield` `$field` ".($decimaldigits == 0 ? 'INT' : 'FLOAT')." ".($minnumber >= 0 ? 'UNSIGNED' : '')." NOT NULL DEFAULT '$defaultvalue'"; $this->db->query($sql); break; case 'smallint': $minnumber = intval($minnumber); $this->db->query("ALTER TABLE `$tablename` CHANGE `$oldfield` `$field` SMALLINT ".($minnumber >= 0 ? 'UNSIGNED' : '')." NOT NULL"); break; case 'int': $minnumber = intval($minnumber); $defaultvalue = intval($defaultvalue); $sql = "ALTER TABLE `$tablename` CHANGE `$oldfield` `$field` INT ".($minnumber >= 0 ? 'UNSIGNED' : '')." NOT NULL DEFAULT '$defaultvalue'"; $this->db->query($sql); break; case 'mediumtext': $this->db->query("ALTER TABLE `$tablename` CHANGE `$oldfield` `$field` MEDIUMTEXT NOT NULL"); break; case 'text': $this->db->query("ALTER TABLE `$tablename` CHANGE `$oldfield` `$field` TEXT NOT NULL"); break; case 'date': $this->db->query("ALTER TABLE `$tablename` CHANGE `$oldfield` `$field` DATE NULL"); break; case 'datetime': $this->db->query("ALTER TABLE `$tablename` CHANGE `$oldfield` `$field` DATETIME NULL"); break; case 'timestamp': $this->db->query("ALTER TABLE `$tablename` CHANGE `$oldfield` `$field` TIMESTAMP NOT NULL"); break; //特殊自定义字段 case 'pages': break; case 'readpoint': $defaultvalue = intval($defaultvalue); $this->db->query("ALTER TABLE `$tablename` CHANGE `$oldfield` `readpoint` smallint(5) unsigned NOT NULL default '$defaultvalue'"); break; } ?>
108wo
phpcms/modules/member/fields/edit.sql.php
PHP
asf20
2,555
<?php class member_update { var $modelid; var $fields; var $data; function __construct($modelid) { $this->db = pc_base::load_model('sitemodel_field_model'); $this->db_pre = $this->db->db_tablepre; $this->modelid = $modelid; $this->fields = getcache('model_field_'.$modelid,'model'); } }?>
108wo
phpcms/modules/member/fields/member_update.class.php
PHP
asf20
320
function datetime($field, $value, $fieldinfo) { extract(string2array($fieldinfo['setting'])); $isdatetime = 0; if($fieldtype=='int') { if(!$value) $value = SYS_TIME; $format_txt = $format == 'm-d' ? 'm-d' : $format; $value = date($format_txt,$value); $isdatetime = strlen($format) > 6 ? 1 : 0; } elseif($fieldtype=='datetime') { $isdatetime = 1; } return form::date("info[$field]",$value,$isdatetime,1); }
108wo
phpcms/modules/member/fields/datetime/form.inc.php
PHP
asf20
448
<?php defined('IN_ADMIN') or exit('No permission resources.'); $field_type = 'int'; //字段数据库类型 $field_basic_table = 1; //是否允许作为主表字段 $field_allow_index = 1; //是否允许建立索引 $field_minlength = 1; //字符长度默认最小值 $field_maxlength = ''; //字符长度默认最大值 $field_allow_search = 1; //作为搜索条件 $field_allow_fulltext = 0; //作为全站搜索信息 $field_allow_isunique = 0; //是否允许值唯一 ?>
108wo
phpcms/modules/member/fields/datetime/config.inc.php
PHP
asf20
495
<table cellpadding="2" cellspacing="1" bgcolor="#ffffff"> <tr> <td><strong>时间格式:</strong></td> <td> <input type="radio" name="setting[fieldtype]" value="date" checked>日期(<?=date('Y-m-d')?>)<br /> <input type="radio" name="setting[fieldtype]" value="datetime">日期+时间(<?=date('Y-m-d H:i:s')?>)<br /> <input type="radio" name="setting[fieldtype]" value="int">整数 显示格式: <select name="setting[format]"> <option value="Y-m-d H:i:s"><?=date('Y-m-d H:i:s')?></option> <option value="Y-m-d H:i"><?=date('Y-m-d H:i')?></option> <option value="Y-m-d"><?=date('Y-m-d')?></option> <option value="m-d"><?=date('m-d')?></option> </select> </td> </tr> <tr> <td><strong>默认值:</strong></td> <td> <input type="radio" name="setting[defaulttype]" value="0" checked/>无<br /> </td> </tr> </table>
108wo
phpcms/modules/member/fields/datetime/field_add_form.inc.php
PHP
asf20
916
<?php defined('IN_PHPCMS') or exit('No permission resources.');?> <table cellpadding="2" cellspacing="1" bgcolor="#ffffff"> <tr> <td><strong>时间格式:</strong></td> <td> <input type="radio" name="setting[fieldtype]" value="date" <?php if($setting['fieldtype']=='date') echo 'checked';?>>日期(<?=date('Y-m-d')?>)<br /> <input type="radio" name="setting[fieldtype]" value="datetime" <?php if($setting['fieldtype']=='datetime') echo 'checked';?>>日期+时间(<?=date('Y-m-d H:i:s')?>)<br /> <input type="radio" name="setting[fieldtype]" value="int" <?php if($setting['fieldtype']=='int') echo 'checked';?>>整数 显示格式: <select name="setting[format]"> <option value="Y-m-d H:i:s" <?php if($setting['format']=='Y-m-d H:i:s') echo 'selected';?>><?=date('Y-m-d H:i:s')?></option> <option value="Y-m-d H:i" <?php if($setting['format']=='Y-m-d H:i') echo 'selected';?>><?=date('Y-m-d H:i')?></option> <option value="Y-m-d" <?php if($setting['format']=='Y-m-d') echo 'selected';?>><?=date('Y-m-d')?></option> <option value="m-d" <?php if($setting['format']=='m-d') echo 'selected';?>><?=date('m-d')?></option> </select> </td> </tr> <tr> <td><strong>默认值:</strong></td> <td> <input type="radio" name="setting[defaulttype]" value="0" checked/>无<br /> </td> </tr> </table>
108wo
phpcms/modules/member/fields/datetime/field_edit_form.inc.php
PHP
asf20
1,388
function datetime($field, $value) { $setting = string2array($this->fields[$field]['setting']); extract($setting); if($fieldtype=='date') { $format_txt = 'Y-m-d'; } elseif($fieldtype=='datetime') { $format_txt = 'Y-m-d H:i:s'; } else { $format_txt = $format; } if(strlen($format_txt)<6) { $isdatetime = 0; } else { $isdatetime = 1; } if(!$value) $value = SYS_TIME; $value = date($format_txt,$value); return $value; }
108wo
phpcms/modules/member/fields/datetime/output.inc.php
PHP
asf20
476
function datetime($field, $value) { $setting = string2array($this->fields[$field]['setting']); if($setting['fieldtype']=='int') { $value = strtotime($value); } return $value; }
108wo
phpcms/modules/member/fields/datetime/input.inc.php
PHP
asf20
197
<?php /** * 管理员后台会员组操作类 */ defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin', 'admin', 0); class member_group extends admin { private $db; function __construct() { parent::__construct(); $this->db = pc_base::load_model('member_group_model'); } /** * 会员组首页 */ function init() { include $this->admin_tpl('member_init'); } /** * 会员组列表 */ function manage() { $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $member_group_list = $this->db->listinfo('', 'sort ASC', $page, 15); $this->member_db = pc_base::load_model('member_model'); //TODO 此处循环中执行sql,会严重影响效率,稍后考虑在memebr_group表中加入会员数字段和统计会员总数功能解决。 foreach ($member_group_list as $k=>$v) { $membernum = $this->member_db->count(array('groupid'=>$v['groupid'])); $member_group_list[$k]['membernum'] = $membernum; } $pages = $this->db->pages; $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=member&c=member_group&a=add\', title:\''.L('member_group_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('member_group_add')); include $this->admin_tpl('member_group_list'); } /** * 添加会员组 */ function add() { if(isset($_POST['dosubmit'])) { $info = array(); if(!$this->_checkname($_POST['info']['name'])){ showmessage('会员组名称已经存在'); } $info = $_POST['info']; $info['allowpost'] = $info['allowpost'] ? 1 : 0; $info['allowupgrade'] = $info['allowupgrade'] ? 1 : 0; $info['allowpostverify'] = $info['allowpostverify'] ? 1 : 0; $info['allowsendmessage'] = $info['allowsendmessage'] ? 1 : 0; $info['allowattachment'] = $info['allowattachment'] ? 1 : 0; $info['allowsearch'] = $info['allowsearch'] ? 1 : 0; $info['allowvisit'] = $info['allowvisit'] ? 1 : 0; $this->db->insert($info); if($this->db->insert_id()){ $this->_updatecache(); showmessage(L('operation_success'),'?m=member&c=member_group&a=manage', '', 'add'); } } else { $show_header = $show_scroll = true; include $this->admin_tpl('member_group_add'); } } /** * 修改会员组 */ function edit() { if(isset($_POST['dosubmit'])) { $info = array(); $info = $_POST['info']; $info['allowpost'] = isset($info['allowpost']) ? 1 : 0; $info['allowupgrade'] = isset($info['allowupgrade']) ? 1 : 0; $info['allowpostverify'] = isset($info['allowpostverify']) ? 1 : 0; $info['allowsendmessage'] = isset($info['allowsendmessage']) ? 1 : 0; $info['allowattachment'] = isset($info['allowattachment']) ? 1 : 0; $info['allowsearch'] = isset($info['allowsearch']) ? 1 : 0; $info['allowvisit'] = isset($info['allowvisit']) ? 1 : 0; $this->db->update($info, array('groupid'=>$info['groupid'])); $this->_updatecache(); showmessage(L('operation_success'), '?m=member&c=member_group&a=manage', '', 'edit'); } else { $show_header = $show_scroll = true; $groupid = isset($_GET['groupid']) ? $_GET['groupid'] : showmessage(L('illegal_parameters'), HTTP_REFERER); $groupinfo = $this->db->get_one(array('groupid'=>$groupid)); include $this->admin_tpl('member_group_edit'); } } /** * 排序会员组 */ function sort() { if(isset($_POST['sort'])) { foreach($_POST['sort'] as $k=>$v) { $this->db->update(array('sort'=>$v), array('groupid'=>$k)); } $this->_updatecache(); showmessage(L('operation_success'), HTTP_REFERER); } else { showmessage(L('operation_failure'), HTTP_REFERER); } } /** * 删除会员组 */ function delete() { $groupidarr = isset($_POST['groupid']) ? $_POST['groupid'] : showmessage(L('illegal_parameters'), HTTP_REFERER); $where = to_sqls($groupidarr, '', 'groupid'); if ($this->db->delete($where)) { $this->_updatecache(); showmessage(L('operation_success'), HTTP_REFERER); } else { showmessage(L('operation_failure'), HTTP_REFERER); } } /** * 检查用户名是否合法 * @param string $name */ private function _checkname($name = NULL) { if(empty($name)) return false; if ($this->db->get_one(array('name'=>$name),'groupid')){ return false; } return true; } /** * 更新会员组列表缓存 */ private function _updatecache() { $grouplist = $this->db->listinfo('', '', 1, 1000, 'groupid'); setcache('grouplist', $grouplist); } public function public_checkname_ajax() { $name = isset($_GET['name']) && trim($_GET['name']) ? trim($_GET['name']) : exit(0); $name = iconv('utf-8', CHARSET, $name); if ($this->db->get_one(array('name'=>$name),'groupid')){ exit('0'); } else { exit('1'); } } } ?>
108wo
phpcms/modules/member/member_group.php
PHP
asf20
5,143
<?php /** * 管理员后台会员审核操作类 */ defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin', 'admin', 0); pc_base::load_sys_class('format', '', 0); class member_verify extends admin { private $db, $member_db; function __construct() { parent::__construct(); $this->db = pc_base::load_model('member_verify_model'); $this->_init_phpsso(); } /** * defalut */ function init() { include $this->admin_tpl('member_init'); } /** * member list */ function manage() { $status = !empty($_GET['s']) ? $_GET['s'] : 0; $where = array('status'=>$status); $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $memberlist = $this->db->listinfo($where, 'regdate DESC', $page, 10); $pages = $this->db->pages; $member_model = getcache('member_model', 'commons'); include $this->admin_tpl('member_verify'); } function modelinfo() { $userid = !empty($_GET['userid']) ? intval($_GET['userid']) : showmessage(L('illegal_parameters'), HTTP_REFERER); $modelid = !empty($_GET['modelid']) ? intval($_GET['modelid']) : showmessage(L('illegal_parameters'), HTTP_REFERER); $memberinfo = $this->db->get_one(array('userid'=>$userid)); //模型字段名称 $this->member_field_db = pc_base::load_model('sitemodel_field_model'); $model_fieldinfo = $this->member_field_db->select(array('modelid'=>$modelid), "*", 100); //用户模型字段信息 $member_fieldinfo = string2array($memberinfo['modelinfo']); //交换数组key值 foreach($model_fieldinfo as $v) { if(array_key_exists($v['field'], $member_fieldinfo)) { $tmp = $member_fieldinfo[$v['field']]; unset($member_fieldinfo[$v['field']]); $member_fieldinfo[$v['name']] = $tmp; unset($tmp); } } include $this->admin_tpl('member_verify_modelinfo'); } /** * pass member */ function pass() { if (isset($_POST['userid'])) { $this->member_db = pc_base::load_model('member_model'); $uidarr = isset($_POST['userid']) ? $_POST['userid'] : showmessage(L('illegal_parameters'), HTTP_REFERER); $where = to_sqls($uidarr, '', 'userid'); $userarr = $this->db->listinfo($where); $success_uids = $info = array(); foreach($userarr as $v) { $status = $this->client->ps_member_register($v['username'], $v['password'], $v['email'], $v['regip'], $v['encrypt']); if ($status > 0) { $info['phpssouid'] = $status; $info['password'] = password($v['password'], $v['encrypt']); $info['regdate'] = $info['lastdate'] = $v['regdate']; $info['username'] = $v['username']; $info['nickname'] = $v['nickname']; $info['email'] = $v['email']; $info['regip'] = $v['regip']; $info['point'] = $v['point']; $info['groupid'] = $this->_get_usergroup_bypoint($v['point']); $info['amount'] = $v['amount']; $info['encrypt'] = $v['encrypt']; $info['modelid'] = $v['modelid'] ? $v['modelid'] : 10; $userid = $this->member_db->insert($info, 1); if($v['modelinfo']) { //如果数据模型不为空 //插入会员模型数据 $user_model_info = string2array($v['modelinfo']); $user_model_info['userid'] = $userid; $this->member_db->set_model($info['modelid']); $this->member_db->insert($user_model_info); } if($userid) { $success_uids[] = $v['userid']; } } } $where = to_sqls($success_uids, '', 'userid'); $this->db->update(array('status'=>1, 'message'=>$_POST['message']), $where); //phpsso注册失败的用户状态直接置为审核期间phpsso已注册该会员 $fail_uids = array_diff($uidarr, $success_uids); if (!empty($fail_uids)) { $where = to_sqls($fail_uids, '', 'userid'); $this->db->update(array('status'=>5, 'message'=>$_POST['message']), $where); } //发送 email通知 if($_POST['sendemail']) { $memberinfo = $this->db->select($where); pc_base::load_sys_func('mail'); foreach ($memberinfo as $v) { sendmail($v['email'], L('reg_pass'), $_POST['message']); } } showmessage(L('pass').L('operation_success'), HTTP_REFERER); } else { showmessage(L('operation_failure'), HTTP_REFERER); } } /** * delete member */ function delete() { if(isset($_POST['userid'])) { $uidarr = isset($_POST['userid']) ? $_POST['userid'] : showmessage(L('illegal_parameters'), HTTP_REFERER); $message = stripslashes($_POST['message']); $where = to_sqls($uidarr, '', 'userid'); $this->db->delete($where); showmessage(L('delete').L('operation_success'), HTTP_REFERER); } else { showmessage(L('operation_failure'), HTTP_REFERER); } } /** * reject member */ function reject() { if(isset($_POST['userid'])) { $uidarr = isset($_POST['userid']) ? $_POST['userid'] : showmessage(L('illegal_parameters'), HTTP_REFERER); $where = to_sqls($uidarr, '', 'userid'); $res = $this->db->update(array('status'=>4, 'message'=>$_POST['message']), $where); //发送 email通知 if($res) { if($_POST['sendemail']) { $memberinfo = $this->db->select($where); pc_base::load_sys_func('mail'); foreach ($memberinfo as $v) { sendmail($v['email'], L('reg_reject'), $_POST['message']); } } } showmessage(L('reject').L('operation_success'), HTTP_REFERER); } else { showmessage(L('operation_failure'), HTTP_REFERER); } } /** * ignore member */ function ignore() { if(isset($_POST['userid'])) { $uidarr = isset($_POST['userid']) ? $_POST['userid'] : showmessage(L('illegal_parameters'), HTTP_REFERER); $where = to_sqls($uidarr, '', 'userid'); $res = $this->db->update(array('status'=>2, 'message'=>$_POST['message']), $where); //发送 email通知 if($res) { if($_POST['sendemail']) { $memberinfo = $this->db->select($where); pc_base::load_sys_func('mail'); foreach ($memberinfo as $v) { sendmail($v['email'], L('reg_ignore'), $_POST['message']); } } } showmessage(L('ignore').L('operation_success'), HTTP_REFERER); } else { showmessage(L('operation_failure'), HTTP_REFERER); } } /* * change password */ function _edit_password($userid, $password){ $userid = intval($userid); if($userid < 1) return false; if(!is_password($password)) { showmessage(L('password_format_incorrect')); return false; } $passwordinfo = password($password); return $this->db->update($passwordinfo,array('userid'=>$userid)); } private function _checkuserinfo($data, $is_edit=0) { if(!is_array($data)){ showmessage(L('need_more_param'));return false; } elseif (!is_username($data['username']) && !$is_edit){ showmessage(L('username_format_incorrect'));return false; } elseif (!isset($data['userid']) && $is_edit) { showmessage(L('username_format_incorrect'));return false; } elseif (empty($data['email']) || !is_email($data['email'])){ showmessage(L('email_format_incorrect'));return false; } return $data; } private function _checkpasswd($password){ if (!is_password($password)){ return false; } return true; } private function _checkname($username) { $username = trim($username); if ($this->db->get_one(array('username'=>$username))){ return false; } return true; } /** *根据积分算出用户组 * @param $point int 积分数 */ private function _get_usergroup_bypoint($point=0) { $groupid = 2; if(empty($point)) { $member_setting = getcache('member_setting'); $point = $member_setting['defualtpoint'] ? $member_setting['defualtpoint'] : 0; } $grouplist = getcache('grouplist'); foreach ($grouplist as $k=>$v) { $grouppointlist[$k] = $v['point']; } arsort($grouppointlist); //如果超出用户组积分设置则为积分最高的用户组 if($point > max($grouppointlist)) { $groupid = key($grouppointlist); } else { foreach ($grouppointlist as $k=>$v) { if($point >= $v) { $groupid = $tmp_k; break; } $tmp_k = $k; } } return $groupid; } /** * 初始化phpsso * about phpsso, include client and client configure * @return string phpsso_api_url phpsso地址 */ private function _init_phpsso() { pc_base::load_app_class('client', '', 0); define('APPID', pc_base::load_config('system', 'phpsso_appid')); $phpsso_api_url = pc_base::load_config('system', 'phpsso_api_url'); $phpsso_auth_key = pc_base::load_config('system', 'phpsso_auth_key'); $this->client = new client($phpsso_api_url, $phpsso_auth_key); return $phpsso_api_url; } /** * check uername status */ public function checkname_ajax() { $username = isset($_GET['username']) && trim($_GET['username']) ? trim($_GET['username']) : exit(0); $username = iconv('utf-8', CHARSET, $username); $status = $this->client->ps_checkname($username); if($status == -4) { //deny_register exit('0'); } $status = $this->client->ps_get_member_info($username, 2); if (is_array($status)) { exit('0'); } else { exit('1'); } } /** * check email status */ public function checkemail_ajax() { $email = isset($_GET['email']) && trim($_GET['email']) ? trim($_GET['email']) : exit(0); $status = $this->client->ps_checkemail($email); if($status == -5) { //deny_register exit('0'); } $status = $this->client->ps_get_member_info($email, 3); if(isset($_GET['phpssouid']) && isset($status['uid'])) { if ($status['uid'] == intval($_GET['phpssouid'])) { exit('1'); } } if (is_array($status)) { exit('0'); } else { exit('1'); } } } ?>
108wo
phpcms/modules/member/member_verify.php
PHP
asf20
9,889
<?php /** * 管理员后台会员操作类 */ defined('IN_PHPCMS') or exit('No permission resources.'); //模型缓存路径 define('CACHE_MODEL_PATH',CACHE_PATH.'caches_model'.DIRECTORY_SEPARATOR.'caches_data'.DIRECTORY_SEPARATOR); 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('util', 'content'); class MY_member extends admin { private $db, $verify_db; function __construct() { parent::__construct(); $this->db = pc_base::load_model('member_model'); $this->_init_phpsso(); } /** * defalut */ function init() { $show_header = $show_scroll = true; pc_base::load_sys_class('form', '', 0); $this->verify_db = pc_base::load_model('member_verify_model'); //搜索框 $keyword = isset($_GET['keyword']) ? $_GET['keyword'] : ''; $type = isset($_GET['type']) ? $_GET['type'] : ''; $groupid = isset($_GET['groupid']) ? $_GET['groupid'] : ''; $start_time = isset($_GET['start_time']) ? $_GET['start_time'] : date('Y-m-d', SYS_TIME-date('t', SYS_TIME)*86400); $end_time = isset($_GET['end_time']) ? $_GET['end_time'] : date('Y-m-d', SYS_TIME); $grouplist = getcache('grouplist'); foreach($grouplist as $k=>$v) { $grouplist[$k] = $v['name']; } $memberinfo['totalnum'] = $this->db->count(); $memberinfo['vipnum'] = $this->db->count(array('vip'=>1)); $memberinfo['verifynum'] = $this->verify_db->count(array('status'=>0)); $todaytime = strtotime(date('Y-m-d', SYS_TIME)); $memberinfo['today_member'] = $this->db->count("`regdate` > '$todaytime'"); include $this->admin_tpl('member_init'); } /** * 会员搜索 */ function search() { //搜索框 $keyword = isset($_GET['keyword']) ? $_GET['keyword'] : ''; $type = isset($_GET['type']) ? $_GET['type'] : ''; $groupid = isset($_GET['groupid']) ? $_GET['groupid'] : ''; $modelid = isset($_GET['modelid']) ? $_GET['modelid'] : ''; //站点信息 $sitelistarr = getcache('sitelist', 'commons'); $siteid = isset($_GET['siteid']) ? intval($_GET['siteid']) : '0'; foreach ($sitelistarr as $k=>$v) { $sitelist[$k] = $v['name']; } $status = isset($_GET['status']) ? $_GET['status'] : ''; $amount_from = isset($_GET['amount_from']) ? $_GET['amount_from'] : ''; $amount_to = isset($_GET['amount_to']) ? $_GET['amount_to'] : ''; $point_from = isset($_GET['point_from']) ? $_GET['point_from'] : ''; $point_to = isset($_GET['point_to']) ? $_GET['point_to'] : ''; $start_time = isset($_GET['start_time']) ? $_GET['start_time'] : ''; $end_time = isset($_GET['end_time']) ? $_GET['end_time'] : date('Y-m-d', SYS_TIME); $grouplist = getcache('grouplist'); foreach($grouplist as $k=>$v) { $grouplist[$k] = $v['name']; } //会员所属模型 $modellistarr = getcache('member_model', 'commons'); foreach ($modellistarr as $k=>$v) { $modellist[$k] = $v['name']; } if (isset($_GET['search'])) { //默认选取一个月内的用户,防止用户量过大给数据造成灾难 $where_start_time = strtotime($start_time) ? strtotime($start_time) : 0; $where_end_time = strtotime($end_time) + 86400; //开始时间大于结束时间,置换变量 if($where_start_time > $where_end_time) { $tmp = $where_start_time; $where_start_time = $where_end_time; $where_end_time = $tmp; $tmptime = $start_time; $start_time = $end_time; $end_time = $tmptime; unset($tmp, $tmptime); } $where = ''; //如果是超级管理员角色,显示所有用户,否则显示当前站点用户 if($_SESSION['roleid'] == 1) { if(!empty($siteid)) { $where .= "`siteid` = '$siteid' AND "; } } else { $siteid = get_siteid(); $where .= "`siteid` = '$siteid' AND "; } if($status) { $islock = $status == 1 ? 1 : 0; $where .= "`islock` = '$islock' AND "; } if($groupid) { $where .= "`groupid` = '$groupid' AND "; } if($modelid) { $where .= "`modelid` = '$modelid' AND "; } $where .= "`regdate` BETWEEN '$where_start_time' AND '$where_end_time' AND "; //资金范围 if($amount_from) { if($amount_to) { if($amount_from > $amount_to) { $tmp = $amount_from; $amount_from = $amount_to; $amount_to = $tmp; unset($tmp); } $where .= "`amount` BETWEEN '$amount_from' AND '$amount_to' AND "; } else { $where .= "`amount` > '$amount_from' AND "; } } //点数范围 if($point_from) { if($point_to) { if($point_from > $point_to) { $tmp = $amount_from; $point_from = $point_to; $point_to = $tmp; unset($tmp); } $where .= "`point` BETWEEN '$point_from' AND '$point_to' AND "; } else { $where .= "`point` > '$point_from' AND "; } } if($keyword) { if ($type == '1') { $where .= "`username` LIKE '%$keyword%'"; } elseif($type == '2') { $where .= "`userid` = '$keyword'"; } elseif($type == '3') { $where .= "`email` like '%$keyword%'"; } elseif($type == '4') { $where .= "`regip` = '$keyword'"; } elseif($type == '5') { $where .= "`nickname` LIKE '%$keyword%'"; } else { $where .= "`username` like '%$keyword%'"; } } else { $where .= '1'; } } else { $where = ''; } $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $memberlist = $this->db->listinfo($where, 'userid DESC', $page, 15); $pages = $this->db->pages; $big_menu = array('?m=member&c=member&a=manage&menuid=72', L('member_research')); include $this->admin_tpl('member_list'); } /** * member list */ function manage() { $sitelistarr = getcache('sitelist', 'commons'); foreach ($sitelistarr as $k=>$v) { $sitelist[$k] = $v['name']; } $groupid = isset($_GET['groupid']) ? intval($_GET['groupid']) : ''; $page = isset($_GET['page']) ? intval($_GET['page']) : 1; //如果是超级管理员角色,显示所有用户,否则显示当前站点用户 if($_SESSION['roleid'] == 1) { $where = ''; } else { $siteid = get_siteid(); $where .= "`siteid` = '$siteid'"; } $memberlist_arr = $this->db->listinfo($where, 'userid DESC', $page, 15); $pages = $this->db->pages; //搜索框 $keyword = isset($_GET['keyword']) ? $_GET['keyword'] : ''; $type = isset($_GET['type']) ? $_GET['type'] : ''; $start_time = isset($_GET['start_time']) ? $_GET['start_time'] : ''; $end_time = isset($_GET['end_time']) ? $_GET['end_time'] : date('Y-m-d', SYS_TIME); $grouplist = getcache('grouplist'); foreach($grouplist as $k=>$v) { $grouplist[$k] = $v['name']; } //会员所属模型 $modellistarr = getcache('member_model', 'commons'); foreach ($modellistarr as $k=>$v) { $modellist[$k] = $v['name']; } //查询会员头像 foreach($memberlist_arr as $k=>$v) { $memberlist[$k] = $v; $memberlist[$k]['avatar'] = get_memberavatar($v['phpssouid']); } $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=member&c=member&a=add\', title:\''.L('member_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('member_add')); include $this->admin_tpl('member_list'); } /** * add member */ function add() { header("Cache-control: private"); if(isset($_POST['dosubmit'])) { $info = array(); if(!$this->_checkname($_POST['info']['username'])){ showmessage(L('member_exist')); } $info = $this->_checkuserinfo($_POST['info']); if(!$this->_checkpasswd($info['password'])){ showmessage(L('password_format_incorrect')); } $info['regip'] = ip(); $info['overduedate'] = strtotime($info['overduedate']); //eddy 开发商上传权限 start $info['doupload'] = $_POST['info']['doupload'] ? 1 : 0; //eddy 开发商上传权限 end $status = $this->client->ps_member_register($info['username'], $info['password'], $info['email'], $info['regip']); if($status > 0) { unset($info[pwdconfirm]); $info['phpssouid'] = $status; //取phpsso密码随机数 $memberinfo = $this->client->ps_get_member_info($status); $memberinfo = unserialize($memberinfo); $info['encrypt'] = $memberinfo['random']; $info['password'] = password($info['password'], $info['encrypt']); $info['regdate'] = $info['lastdate'] = SYS_TIME; $info['uniqid'] = uniqid(true); //eddy 唯一邀请码 $this->db->insert($info); if($this->db->insert_id()){ showmessage(L('operation_success'),'?m=member&c=member&a=add', '', 'add'); } } elseif($status == -4) { showmessage(L('username_deny'), HTTP_REFERER); } elseif($status == -5) { showmessage(L('email_deny'), HTTP_REFERER); } else { showmessage(L('operation_failure'), HTTP_REFERER); } } else { $show_header = $show_scroll = true; $siteid = get_siteid(); //会员组缓存 $group_cache = getcache('grouplist', 'member'); foreach($group_cache as $_key=>$_value) { $grouplist[$_key] = $_value['name']; } //会员模型缓存 $member_model_cache = getcache('member_model', 'commons'); foreach($member_model_cache as $_key=>$_value) { if($siteid == $_value['siteid']) { $modellist[$_key] = $_value['name']; } } include $this->admin_tpl('member_add'); } } /** * edit member */ function edit() { if(isset($_POST['dosubmit'])) { $memberinfo = $info = array(); $basicinfo['userid'] = $_POST['info']['userid']; $basicinfo['username'] = $_POST['info']['username']; $basicinfo['nickname'] = $_POST['info']['nickname']; $basicinfo['email'] = $_POST['info']['email']; $basicinfo['point'] = $_POST['info']['point']; $basicinfo['password'] = $_POST['info']['password']; $basicinfo['groupid'] = $_POST['info']['groupid']; $basicinfo['modelid'] = $_POST['info']['modelid']; $basicinfo['vip'] = $_POST['info']['vip']; $basicinfo['overduedate'] = strtotime($_POST['info']['overduedate']); //eddy 开发商上传权限 start $basicinfo['doupload'] = $_POST['info']['doupload'] ? 1 : 0; //eddy 开发商上传权限 end //会员基本信息 $info = $this->_checkuserinfo($basicinfo, 1); //会员模型信息 //$modelinfo = array_diff($_POST['info'], $info); $modelinfo = array_diff_key($_POST['info'], $info); //上一句有BUG eddy //过滤vip过期时间 unset($modelinfo['overduedate']); unset($modelinfo['pwdconfirm']); $userid = $info['userid']; //如果是超级管理员角色,显示所有用户,否则显示当前站点用户 if($_SESSION['roleid'] == 1) { $where = array('userid'=>$userid); } else { $siteid = get_siteid(); $where = array('userid'=>$userid, 'siteid'=>$siteid); } $userinfo = $this->db->get_one($where); if(empty($userinfo)) { showmessage(L('user_not_exist').L('or').L('no_permission'), HTTP_REFERER); } //删除用户头像 if(!empty($_POST['delavatar'])) { $this->client->ps_deleteavatar($userinfo['phpssouid']); } $status = $this->client->ps_member_edit($info['username'], $info['email'], '', $info['password'], $userinfo['phpssouid'], $userinfo['encrypt']); if($status >= 0) { unset($info['userid']); unset($info['username']); //如果密码不为空,修改用户密码。 if(isset($info['password']) && !empty($info['password'])) { $info['password'] = password($info['password'], $userinfo['encrypt']); } else { unset($info['password']); } $this->db->update($info, array('userid'=>$userid)); require_once CACHE_MODEL_PATH.'member_input.class.php'; require_once CACHE_MODEL_PATH.'member_update.class.php'; $member_input = new member_input($basicinfo['modelid']); $modelinfo = $member_input->get($modelinfo); //更新模型表,方法更新了$this->table $this->db->set_model($info['modelid']); $userinfo = $this->db->get_one(array('userid'=>$userid)); if($userinfo) { $this->db->update($modelinfo, array('userid'=>$userid)); } else { $modelinfo['userid'] = $userid; $this->db->insert($modelinfo); } showmessage(L('operation_success'), '?m=member&c=member&a=manage', '', 'edit'); } else { showmessage(L('operation_failure'), HTTP_REFERER); } } else { $show_header = $show_scroll = true; $siteid = get_siteid(); $userid = isset($_GET['userid']) ? $_GET['userid'] : showmessage(L('illegal_parameters'), HTTP_REFERER); //会员组缓存 $group_cache = getcache('grouplist', 'member'); foreach($group_cache as $_key=>$_value) { $grouplist[$_key] = $_value['name']; } //会员模型缓存 $member_model_cache = getcache('member_model', 'commons'); foreach($member_model_cache as $_key=>$_value) { if($siteid == $_value['siteid']) { $modellist[$_key] = $_value['name']; } } //如果是超级管理员角色,显示所有用户,否则显示当前站点用户 if($_SESSION['roleid'] == 1) { $where = array('userid'=>$userid); } else { $where = array('userid'=>$userid, 'siteid'=>$siteid); } $memberinfo = $this->db->get_one($where); if(empty($memberinfo)) { showmessage(L('user_not_exist').L('or').L('no_permission'), HTTP_REFERER); } $memberinfo['avatar'] = get_memberavatar($memberinfo['phpssouid'], '', 90); $modelid = isset($_GET['modelid']) ? $_GET['modelid'] : $memberinfo['modelid']; //获取会员模型表单 require CACHE_MODEL_PATH.'member_form.class.php'; $member_form = new member_form($modelid); $form_overdudate = form::date('info[overduedate]', date('Y-m-d H:i:s',$memberinfo['overduedate']), 1); $this->db->set_model($modelid); $membermodelinfo = $this->db->get_one(array('userid'=>$userid)); $forminfos = $forminfos_arr = $member_form->get($membermodelinfo); //万能字段过滤 foreach($forminfos as $field=>$info) { if($info['isomnipotent']) { unset($forminfos[$field]); } else { if($info['formtype']=='omnipotent') { foreach($forminfos_arr as $_fm=>$_fm_value) { if($_fm_value['isomnipotent']) { $info['form'] = str_replace('{'.$_fm.'}',$_fm_value['form'], $info['form']); } } $forminfos[$field]['form'] = $info['form']; } } } $show_dialog = 1; include $this->admin_tpl('member_edit'); } } /** * delete member */ function delete() { $uidarr = isset($_POST['userid']) ? $_POST['userid'] : showmessage(L('illegal_parameters'), HTTP_REFERER); $where = to_sqls($uidarr, '', 'userid'); $phpsso_userinfo = $this->db->listinfo($where); $phpssouidarr = array(); if(is_array($phpsso_userinfo)) { foreach($phpsso_userinfo as $v) { if(!empty($v['phpssouid'])) { $phpssouidarr[] = $v['phpssouid']; } } } //查询用户信息 $userinfo_arr = $this->db->select($where, "userid, modelid"); $userinfo = array(); if(is_array($userinfo_arr)) { foreach($userinfo_arr as $v) { $userinfo[$v['userid']] = $v['modelid']; } } //delete phpsso member first if(!empty($phpssouidarr)) { $status = $this->client->ps_delete_member($phpssouidarr, 1); if($status > 0) { if ($this->db->delete($where)) { //删除用户模型用户资料 foreach($uidarr as $v) { if(!empty($userinfo[$v])) { $this->db->set_model($userinfo[$v]); $this->db->delete(array('userid'=>$v)); } } showmessage(L('operation_success'), HTTP_REFERER); } else { showmessage(L('operation_failure'), HTTP_REFERER); } } else { showmessage(L('operation_failure'), HTTP_REFERER); } } else { if ($this->db->delete($where)) { showmessage(L('operation_success'), HTTP_REFERER); } else { showmessage(L('operation_failure'), HTTP_REFERER); } } } /** * lock member */ function lock() { if(isset($_POST['userid'])) { $uidarr = isset($_POST['userid']) ? $_POST['userid'] : showmessage(L('illegal_parameters'), HTTP_REFERER); $where = to_sqls($uidarr, '', 'userid'); $this->db->update(array('islock'=>1), $where); showmessage(L('member_lock').L('operation_success'), HTTP_REFERER); } else { showmessage(L('operation_failure'), HTTP_REFERER); } } /** * unlock member */ function unlock() { if(isset($_POST['userid'])) { $uidarr = isset($_POST['userid']) ? $_POST['userid'] : showmessage(L('illegal_parameters'), HTTP_REFERER); $where = to_sqls($uidarr, '', 'userid'); $this->db->update(array('islock'=>0), $where); showmessage(L('member_unlock').L('operation_success'), HTTP_REFERER); } else { showmessage(L('operation_failure'), HTTP_REFERER); } } /** * move member */ function move() { if(isset($_POST['dosubmit'])) { $uidarr = isset($_POST['userid']) ? $_POST['userid'] : showmessage(L('illegal_parameters'), HTTP_REFERER); $groupid = isset($_POST['groupid']) && !empty($_POST['groupid']) ? $_POST['groupid'] : showmessage(L('illegal_parameters'), HTTP_REFERER); $where = to_sqls($uidarr, '', 'userid'); $this->db->update(array('groupid'=>$groupid), $where); showmessage(L('member_move').L('operation_success'), HTTP_REFERER, '', 'move'); } else { $show_header = $show_scroll = true; $grouplist = getcache('grouplist'); foreach($grouplist as $k=>$v) { $grouplist[$k] = $v['name']; } $ids = isset($_GET['ids']) ? explode(',', $_GET['ids']): showmessage(L('illegal_parameters'), HTTP_REFERER); array_pop($ids); if(!empty($ids)) { $where = to_sqls($ids, '', 'userid'); $userarr = $this->db->listinfo($where); } else { showmessage(L('illegal_parameters'), HTTP_REFERER, '', 'move'); } include $this->admin_tpl('member_move'); } } function memberinfo() { $show_header = false; $userid = !empty($_GET['userid']) ? intval($_GET['userid']) : ''; $username = !empty($_GET['username']) ? trim($_GET['username']) : ''; if(!empty($userid)) { $memberinfo = $this->db->get_one(array('userid'=>$userid)); } elseif(!empty($username)) { $memberinfo = $this->db->get_one(array('username'=>$username)); } else { showmessage(L('illegal_parameters'), HTTP_REFERER); } if(empty($memberinfo)) { showmessage(L('user').L('not_exists'), HTTP_REFERER); } $memberinfo['avatar'] = get_memberavatar($memberinfo['phpssouid'], '', 90); $grouplist = getcache('grouplist'); //会员模型缓存 $modellist = getcache('member_model', 'commons'); $modelid = !empty($_GET['modelid']) ? intval($_GET['modelid']) : $memberinfo['modelid']; //站群缓存 $sitelist =getcache('sitelist', 'commons'); $this->db->set_model($modelid); $member_modelinfo = $this->db->get_one(array('userid'=>$userid)); //模型字段名称 $model_fieldinfo = getcache('model_field_'.$modelid, 'model'); //图片字段显示图片 foreach($model_fieldinfo as $k=>$v) { if($v['formtype'] == 'image') { $member_modelinfo[$k] = "<a href='.$member_modelinfo[$k].' target='_blank'><img src='.$member_modelinfo[$k].' height='40' widht='40' onerror=\"this.src='$phpsso_api_url/statics/images/member/nophoto.gif'\"></a>"; } elseif($v['formtype'] == 'images') { $tmp = string2array($member_modelinfo[$k]); $member_modelinfo[$k] = ''; if(is_array($tmp)) { foreach ($tmp as $tv) { $member_modelinfo[$k] .= " <a href='$tv[url]' target='_blank'><img src='$tv[url]' height='40' widht='40' onerror=\"this.src='$phpsso_api_url/statics/images/member/nophoto.gif'\"></a>"; } unset($tmp); } } elseif($v['formtype'] == 'box') { //box字段,获取字段名称和值的数组 $tmp = explode("\n",$v['options']); if(is_array($tmp)) { foreach($tmp as $boxv) { $box_tmp_arr = explode('|', trim($boxv)); if(is_array($box_tmp_arr) && isset($box_tmp_arr[1]) && isset($box_tmp_arr[0])) { $box_tmp[$box_tmp_arr[1]] = $box_tmp_arr[0]; $tmp_key = intval($member_modelinfo[$k]); } } } if(isset($box_tmp[$tmp_key])) { $member_modelinfo[$k] = $box_tmp[$tmp_key]; } else { $member_modelinfo[$k] = $member_modelinfo_arr[$k]; } unset($tmp, $tmp_key, $box_tmp, $box_tmp_arr); } elseif($v['formtype'] == 'linkage') { //如果为联动菜单 $tmp = string2array($v['setting']); $tmpid = $tmp['linageid']; $linkagelist = getcache($tmpid, 'linkage'); $fullname = $this->_get_linkage_fullname($member_modelinfo[$k], $linkagelist); $member_modelinfo[$v['name']] = substr($fullname, 0, -1); unset($tmp, $tmpid, $linkagelist, $fullname); } else { $member_modelinfo[$k] = $member_modelinfo[$k]; } } $member_fieldinfo = array(); //交换数组key值 foreach($model_fieldinfo as $v) { if(!empty($member_modelinfo) && array_key_exists($v['field'], $member_modelinfo)) { $tmp = $member_modelinfo[$v['field']]; unset($member_modelinfo[$v['field']]); $member_fieldinfo[$v['name']] = $tmp; unset($tmp); } else { $member_fieldinfo[$v['name']] = ''; } } include $this->admin_tpl('member_moreinfo'); } /* * 通过linkageid获取名字路径 */ private function _get_linkage_fullname($linkageid, $linkagelist) { $fullname = ''; if($linkagelist['data'][$linkageid]['parentid'] != 0) { $fullname = $this->_get_linkage_fullname($linkagelist['data'][$linkageid]['parentid'], $linkagelist); } //所在地区名称 $return = $fullname.$linkagelist['data'][$linkageid]['name'].'>'; return $return; } private function _checkuserinfo($data, $is_edit=0) { //eddy start /**if(!is_array($data)){ showmessage(L('need_more_param'));return false; } elseif (!is_username($data['username']) && !$is_edit){ showmessage(L('username_format_incorrect'));return false; } elseif (!isset($data['userid']) && $is_edit) { showmessage(L('username_format_incorrect'));return false; } elseif (empty($data['email']) || !is_email($data['email'])){ showmessage(L('email_format_incorrect'));return false; }*/ if(!is_array($data)){ showmessage(L('need_more_param'));return false; } elseif (!isset($data['userid']) && $is_edit) { showmessage(L('username_format_incorrect'));return false; } elseif (empty($data['email']) || !is_email($data['email'])){ showmessage(L('email_format_incorrect'));return false; } //eddy end return $data; } private function _checkpasswd($password){ if (!is_password($password)){ return false; } return true; } private function _checkname($username) { $username = trim($username); if ($this->db->get_one(array('username'=>$username))){ return false; } return true; } /** * 初始化phpsso * about phpsso, include client and client configure * @return string phpsso_api_url phpsso地址 */ private function _init_phpsso() { pc_base::load_app_class('client', '', 0); define('APPID', pc_base::load_config('system', 'phpsso_appid')); $phpsso_api_url = pc_base::load_config('system', 'phpsso_api_url'); $phpsso_auth_key = pc_base::load_config('system', 'phpsso_auth_key'); $this->client = new client($phpsso_api_url, $phpsso_auth_key); return $phpsso_api_url; } /** * 检查用户名 * @param string $username 用户名 * @return $status {-4:用户名禁止注册;-1:用户名已经存在 ;1:成功} */ 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); } $status = $this->client->ps_checkname($username); if($status == -4 || $status == -1) { exit('0'); } else { exit('1'); } } /** * 检查邮箱 * @param string $email * @return $status {-1:email已经存在 ;-5:邮箱禁止注册;1:成功} */ public function public_checkemail_ajax() { $email = isset($_GET['email']) && trim($_GET['email']) ? trim($_GET['email']) : exit(0); $status = $this->client->ps_checkemail($email); if($status == -5) { //禁止注册 exit('0'); } elseif($status == -1) { //用户名已存在,但是修改用户的时候需要判断邮箱是否是当前用户的 if(isset($_GET['phpssouid'])) { //修改用户传入phpssouid $status = $this->client->ps_get_member_info($email, 3); if($status) { $status = unserialize($status); //接口返回序列化,进行判断 if (isset($status['uid']) && $status['uid'] == intval($_GET['phpssouid'])) { exit('1'); } else { exit('0'); } } else { exit('0'); } } else { exit('0'); } } else { exit('1'); } } } ?>
108wo
phpcms/modules/member/MY_member.php
PHP
asf20
25,724
<?php /** * 会员前台投稿操作类 */ defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('foreground'); pc_base::load_sys_class('format', '', 0); pc_base::load_sys_class('form', '', 0); class content extends foreground { private $times_db; function __construct() { parent::__construct(); } public function publish() { $memberinfo = $this->memberinfo; $grouplist = getcache('grouplist'); //判断会员组是否允许投稿 if(!$grouplist[$memberinfo['groupid']]['allowpost']) { showmessage(L('member_group').L('publish_deny'), HTTP_REFERER); } //判断每日投稿数 $this->content_check_db = pc_base::load_model('content_check_model'); $todaytime = strtotime(date('y-m-d',SYS_TIME)); $_username = $this->memberinfo['username']; $allowpostnum = $this->content_check_db->count("`inputtime` > $todaytime AND `username`='$_username'"); if($grouplist[$memberinfo['groupid']]['allowpostnum'] > 0 && $allowpostnum >= $grouplist[$memberinfo['groupid']]['allowpostnum']) { showmessage(L('allowpostnum_deny').$grouplist[$memberinfo['groupid']]['allowpostnum'], HTTP_REFERER); } $siteids = getcache('category_content', 'commons'); header("Cache-control: private"); if(isset($_POST['dosubmit'])) { $catid = intval($_POST['info']['catid']); $siteid = $siteids[$catid]; $CATEGORYS = getcache('category_content_'.$siteid, 'commons'); $category = $CATEGORYS[$catid]; $modelid = $category['modelid']; if(!$modelid) showmessage(L('illegal_parameters'), HTTP_REFERER); $this->content_db = pc_base::load_model('content_model'); $this->content_db->set_model($modelid); $table_name = $this->content_db->table_name; $fields_sys = $this->content_db->get_fields(); $this->content_db->table_name = $table_name.'_data'; $fields_attr = $this->content_db->get_fields(); $fields = array_merge($fields_sys,$fields_attr); $fields = array_keys($fields); $info = array(); foreach($_POST['info'] as $_k=>$_v) { if(in_array($_k, $fields)) $info[$_k] = $_v; } $post_fields = array_keys($_POST['info']); $post_fields = array_intersect_assoc($fields,$post_fields); $setting = string2array($category['setting']); if($setting['presentpoint'] < 0 && $memberinfo['point'] < abs($setting['presentpoint'])) showmessage(L('points_less_than',array('point'=>$memberinfo['point'],'need_point'=>abs($setting['presentpoint']))),APP_PATH.'index.php?m=pay&c=deposit&a=pay&exchange=point',3000); //判断会员组投稿是否需要审核 if($grouplist[$memberinfo['groupid']]['allowpostverify'] || !$setting['workflowid']) { $info['status'] = 99; } else { $info['status'] = 1; } $info['username'] = $memberinfo['username']; $this->content_db->siteid = $siteid; $id = $this->content_db->add_content($info); //检查投稿奖励或扣除积分 if ($info['status']==99) { $flag = $catid.'_'.$id; if($setting['presentpoint']>0) { pc_base::load_app_class('receipts','pay',0); receipts::point($setting['presentpoint'],$memberinfo['userid'], $memberinfo['username'], $flag,'selfincome',L('contribute_add_point'),$memberinfo['username']); } else { pc_base::load_app_class('spend','pay',0); spend::point($setting['presentpoint'], L('contribute_del_point'), $memberinfo['userid'], $memberinfo['username'], '', '', $flag); } } //缓存结果 $model_cache = getcache('model','commons'); $infos = array(); foreach ($model_cache as $modelid=>$model) { if($model['siteid']==$siteid) { $datas = array(); $this->content_db->set_model($modelid); $datas = $this->content_db->select(array('username'=>$memberinfo['username'],'sysadd'=>0),'id,catid,title,url,username,sysadd,inputtime,status',100,'id DESC'); if($datas) $infos = array_merge($infos,$datas); } } setcache('member_'.$memberinfo['userid'].'_'.$siteid, $infos,'content'); //缓存结果 END if($info['status']==99) { showmessage(L('contributors_success'), APP_PATH.'index.php?m=member&c=content&a=published'); } else { showmessage(L('contributors_checked'), APP_PATH.'index.php?m=member&c=content&a=published'); } } else { $show_header = $show_dialog = $show_validator = ''; $temp_language = L('news','','content'); $sitelist = getcache('sitelist','commons'); if(!isset($_GET['siteid']) && count($sitelist)>1) { include template('member', 'content_publish_select_model'); exit; } //设置cookie 在附件添加处调用 param::set_cookie('module', 'content'); $siteid = intval($_GET['siteid']); if(!$siteid) $siteid = 1; $CATEGORYS = getcache('category_content_'.$siteid, 'commons'); $priv_db = pc_base::load_model('category_priv_model'); //加载栏目权限表数据模型 foreach ($CATEGORYS as $catid=>$cat) { if($cat['siteid']==$siteid && $cat['child']==0 && $cat['type']==0 && $priv_db->get_one(array('catid'=>$catid, 'roleid'=>$memberinfo['groupid'], 'is_admin'=>0, 'action'=>'add'))) break; } $catid = $_GET['catid'] ? intval($_GET['catid']) : $catid; if (!$catid) showmessage(L('category').L('publish_deny'), APP_PATH.'index.php?m=member'); //判断本栏目是否允许投稿 if (!$priv_db->get_one(array('catid'=>$catid, 'roleid'=>$memberinfo['groupid'], 'is_admin'=>0, 'action'=>'add'))) showmessage(L('category').L('publish_deny'), APP_PATH.'index.php?m=member'); $category = $CATEGORYS[$catid]; if($category['siteid']!=$siteid) showmessage(L('site_no_category'),'?m=member&c=content&a=publish'); $setting = string2array($category['setting']); if($setting['presentpoint'] < 0 && $memberinfo['point'] < abs($setting['presentpoint'])) showmessage(L('points_less_than',array('point'=>$memberinfo['point'],'need_point'=>abs($setting['presentpoint']))),APP_PATH.'index.php?m=pay&c=deposit&a=pay&exchange=point',3000); if($category['type']!=0) showmessage(L('illegal_operation')); $modelid = $category['modelid']; require CACHE_MODEL_PATH.'content_form.class.php'; $content_form = new content_form($modelid, $catid, $CATEGORYS); $forminfos_data = $content_form->get(); $forminfos = array(); foreach($forminfos_data as $_fk=>$_fv) { if($_fv['isomnipotent']) continue; if($_fv['formtype']=='omnipotent') { foreach($forminfos_data as $_fm=>$_fm_value) { if($_fm_value['isomnipotent']) { $_fv['form'] = str_replace('{'.$_fm.'}',$_fm_value['form'],$_fv['form']); } } } $forminfos[$_fk] = $_fv; } $formValidator = $content_form->formValidator; //去掉栏目id unset($forminfos['catid']); $workflowid = $setting['workflowid']; header("Cache-control: private"); include template('member', 'content_publish'); } } public function published() { $memberinfo = $this->memberinfo; $sitelist = getcache('sitelist','commons'); if(!isset($_GET['siteid']) && count($sitelist)>1) { include template('member', 'content_publish_select_model'); exit; } $_username = $this->memberinfo['username']; $_userid = $this->memberinfo['userid']; $siteid = intval($_GET['siteid']); if(!$siteid) $siteid = 1; $CATEGORYS = getcache('category_content_'.$siteid, 'commons'); $siteurl = siteurl($siteid); $pagesize = 20; $page = max(intval($_GET['page']),1); $workflows = getcache('workflow_'.$siteid,'commons'); $this->content_check_db = pc_base::load_model('content_check_model'); $infos = $this->content_check_db->listinfo(array('username'=>$_username, 'siteid'=>$siteid),'inputtime DESC',$page); $datas = array(); foreach($infos as $_v) { $arr_checkid = explode('-',$_v['checkid']); $_v['id'] = $arr_checkid[1]; $_v['modelid'] = $arr_checkid[2]; $_v['url'] = $_v['status']==99 ? go($_v['catid'],$_v['id']) : APP_PATH.'index.php?m=content&c=index&a=show&catid='.$_v['catid'].'&id='.$_v['id']; if(!isset($setting[$_v['catid']])) $setting[$_v['catid']] = string2array($CATEGORYS[$_v['catid']]['setting']); $workflowid = $setting[$_v['catid']]['workflowid']; $_v['flag'] = $workflows[$workflowid]['flag']; $datas[] = $_v; } $pages = $this->content_check_db->pages; include template('member', 'content_published'); } /** * 编辑内容 */ public function edit() { $_username = $this->memberinfo['username']; if(isset($_POST['dosubmit'])) { $catid = $_POST['info']['catid'] = intval($_POST['info']['catid']); $siteids = getcache('category_content', 'commons'); $siteid = $siteids[$catid]; $CATEGORYS = getcache('category_content_'.$siteid, 'commons'); $category = $CATEGORYS[$catid]; if($category['type']==0) { $id = intval($_POST['id']); $catid = $_POST['info']['catid'] = intval($_POST['info']['catid']); $this->content_db = pc_base::load_model('content_model'); $modelid = $category['modelid']; $this->content_db->set_model($modelid); //判断会员组投稿是否需要审核 $memberinfo = $this->memberinfo; $grouplist = getcache('grouplist'); $setting = string2array($category['setting']); if(!$grouplist[$memberinfo['groupid']]['allowpostverify'] || $setting['workflowid']) { $_POST['info']['status'] = 1; } //echo $_POST['info']['status'];exit; $this->content_db->edit_content($_POST['info'],$id); $forward = $_POST['forward']; showmessage(L('update_success'),$forward); } } else { $show_header = $show_dialog = $show_validator = ''; $temp_language = L('news','','content'); //设置cookie 在附件添加处调用 param::set_cookie('module', 'content'); $id = intval($_GET['id']); if(isset($_GET['catid']) && $_GET['catid']) { $catid = $_GET['catid'] = intval($_GET['catid']); param::set_cookie('catid', $catid); $siteids = getcache('category_content', 'commons'); $siteid = $siteids[$catid]; $CATEGORYS = getcache('category_content_'.$siteid, 'commons'); $category = $CATEGORYS[$catid]; if($category['type']==0) { $modelid = $category['modelid']; $this->model = getcache('model', 'commons'); $this->content_db = pc_base::load_model('content_model'); $this->content_db->set_model($modelid); $this->content_db->table_name = $this->content_db->db_tablepre.$this->model[$modelid]['tablename']; $r = $this->content_db->get_one(array('id'=>$id,'username'=>$_username,'sysadd'=>0)); if(!$r) showmessage(L('illegal_operation')); if($r['status']==99) showmessage(L('has_been_verified')); $this->content_db->table_name = $this->content_db->table_name.'_data'; $r2 = $this->content_db->get_one(array('id'=>$id)); $data = array_merge($r,$r2); require CACHE_MODEL_PATH.'content_form.class.php'; $content_form = new content_form($modelid,$catid,$CATEGORYS); $forminfos_data = $content_form->get($data); $forminfos = array(); foreach($forminfos_data as $_fk=>$_fv) { if($_fv['isomnipotent']) continue; if($_fv['formtype']=='omnipotent') { foreach($forminfos_data as $_fm=>$_fm_value) { if($_fm_value['isomnipotent']) { $_fv['form'] = str_replace('{'.$_fm.'}',$_fm_value['form'],$_fv['form']); } } } $forminfos[$_fk] = $_fv; } $formValidator = $content_form->formValidator; include template('member', 'content_publish'); } } header("Cache-control: private"); } } public function info_publish() { $memberinfo = $this->memberinfo; $grouplist = getcache('grouplist'); $SEO['title'] = L('info_publish','','info'); //判断会员组是否允许投稿 if(!$grouplist[$memberinfo['groupid']]['allowpost']) { showmessage(L('member_group').L('publish_deny'), HTTP_REFERER); } //判断每日投稿数 $this->content_check_db = pc_base::load_model('content_check_model'); $todaytime = strtotime(date('y-m-d',SYS_TIME)); $_username = $memberinfo['username']; $allowpostnum = $this->content_check_db->count("`inputtime` > $todaytime AND `username`='$_username'"); if($grouplist[$memberinfo['groupid']]['allowpostnum'] > 0 && $allowpostnum >= $grouplist[$memberinfo['groupid']]['allowpostnum']) { showmessage(L('allowpostnum_deny').$grouplist[$memberinfo['groupid']]['allowpostnum'], HTTP_REFERER); } $siteids = getcache('category_content', 'commons'); header("Cache-control: private"); if(isset($_POST['dosubmit'])) { $catid = intval($_POST['info']['catid']); $siteid = $siteids[$catid]; $CATEGORYS = getcache('category_content_'.$siteid, 'commons'); $category = $CATEGORYS[$catid]; $modelid = $category['modelid']; if(!$modelid) showmessage(L('illegal_parameters'), HTTP_REFERER); $this->content_db = pc_base::load_model('content_model'); $this->content_db->set_model($modelid); $table_name = $this->content_db->table_name; $fields_sys = $this->content_db->get_fields(); $this->content_db->table_name = $table_name.'_data'; $fields_attr = $this->content_db->get_fields(); $fields = array_merge($fields_sys,$fields_attr); $fields = array_keys($fields); $info = array(); foreach($_POST['info'] as $_k=>$_v) { if(in_array($_k, $fields)) $info[$_k] = $_v; } $post_fields = array_keys($_POST['info']); $post_fields = array_intersect_assoc($fields,$post_fields); $setting = string2array($category['setting']); if($setting['presentpoint'] < 0 && $memberinfo['point'] < abs($setting['presentpoint'])) showmessage(L('points_less_than',array('point'=>$memberinfo['point'],'need_point'=>abs($setting['presentpoint']))),APP_PATH.'index.php?m=pay&c=deposit&a=pay&exchange=point',3000); //判断会员组投稿是否需要审核 if($grouplist[$memberinfo['groupid']]['allowpostverify'] || !$setting['workflowid']) { $info['status'] = 99; } else { $info['status'] = 1; } $info['username'] = $memberinfo['username']; $this->content_db->siteid = $siteid; $id = $this->content_db->add_content($info); //检查投稿奖励或扣除积分 $flag = $catid.'_'.$id; if($setting['presentpoint']>0) { pc_base::load_app_class('receipts','pay',0); receipts::point($setting['presentpoint'],$memberinfo['userid'], $memberinfo['username'], $flag,'selfincome',L('contribute_add_point'),$memberinfo['username']); } else { pc_base::load_app_class('spend','pay',0); spend::point($setting['presentpoint'], L('contribute_del_point'), $memberinfo['userid'], $memberinfo['username'], '', '', $flag); } //缓存结果 $model_cache = getcache('model','commons'); $infos = array(); foreach ($model_cache as $modelid=>$model) { if($model['siteid']==$siteid) { $datas = array(); $this->content_db->set_model($modelid); $datas = $this->content_db->select(array('username'=>$memberinfo['username'],'sysadd'=>0),'id,catid,title,url,username,sysadd,inputtime,status',100,'id DESC'); } } setcache('member_'.$memberinfo['userid'].'_'.$siteid, $infos,'content'); //缓存结果 END if($info['status']==99) { showmessage(L('contributors_success'), APP_PATH.'index.php?m=member&c=content&a=info_top&id='.$id.'&catid='.$catid.'&msg=1'); } else { showmessage(L('contributors_checked'), APP_PATH.'index.php?m=member&c=content&a=info_top&id='.$id.'&catid='.$catid.'&msg=1'); } } else { $show_header = $show_dialog = $show_validator = ''; $step = $step_1 = $step_2 = $step_3 = $step_4; $temp_language = L('news','','content'); $sitelist = getcache('sitelist','commons'); /* if(!isset($_GET['siteid']) && count($sitelist)>1) { include template('member', 'content_publish_select_model'); exit; } */ //设置cookie 在附件添加处调用 param::set_cookie('module', 'content'); $siteid = intval($_GET['siteid']); //获取信息模型类别、区域、城市信息 $info_linkageid = getinfocache('info_linkageid'); $cityid = getcity(trim($_GET['city']),'linkageid'); $cityname = getcity(trim($_GET['city']),'name'); $citypinyin = getcity(trim($_GET['city']),'pinyin'); $zone = intval($_GET['zone']); $zone_name = get_linkage($zone, $info_linkageid, '', 0); if(!$siteid) $siteid = 1; $CATEGORYS = getcache('category_content_'.$siteid, 'commons'); $priv_db = pc_base::load_model('category_priv_model'); //加载栏目权限表数据模型 foreach ($CATEGORYS as $catid=>$cat) { if($cat['siteid']==$siteid && $cat['child']==0 && $cat['type']==0 && $priv_db->get_one(array('catid'=>$catid, 'roleid'=>$memberinfo['groupid'], 'is_admin'=>0, 'action'=>'add'))) break; } $catid = $_GET['catid'] ? intval($_GET['catid']) : $catid; if (!$catid) showmessage(L('category').L('publish_deny'), APP_PATH.'index.php?m=member'); //判断本栏目是否允许投稿 if (!$priv_db->get_one(array('catid'=>$catid, 'roleid'=>$memberinfo['groupid'], 'is_admin'=>0, 'action'=>'add'))) showmessage(L('category').L('publish_deny'), APP_PATH.'index.php?m=member'); $category = $CATEGORYS[$catid]; if($category['siteid']!=$siteid) showmessage(L('site_no_category'),'?m=member&c=content&a=info_publish'); $setting = string2array($category['setting']); if($zone == 0 && !isset($_GET['catid'])) { $step = 1; include template('member', 'info_content_publish_select'); exit; } elseif($zone == 0 && $category['child']) { $step = 2; $step_1 = '<a href="'.APP_PATH.'index.php?m=member&c=content&a=info_publish&siteid='.$siteid.'&city='.$citypinyin.'">'.$category['catname'].'</a>'; include template('member', 'info_content_publish_select'); exit; } elseif($zone == 0 && isset($_GET['catid'])) { $step = 3; $step_1 = '<a href="'.APP_PATH.'index.php?m=member&c=content&a=info_publish&siteid='.$siteid.'">'.$CATEGORYS[$category['parentid']]['catname'].'</a>'; $step_2 = '<a href="'.APP_PATH.'index.php?m=member&c=content&a=info_publish&siteid='.$siteid.'&city='.$citypinyin.'&catid='.$category['parentid'].'">'.$category['catname'].'</a>'; $zone_arrchild = show_linkage($info_linkageid,$cityid,$cityid); include template('member', 'info_content_publish_select'); exit; } elseif($zone !== 0 && get_linkage_level($info_linkageid,$zone,'child') && !$_GET['jumpstep']) { $step = 4; $step_1 = '<a href="'.APP_PATH.'index.php?m=member&c=content&a=info_publish&siteid='.$siteid.'&city='.$citypinyin.'">'.$CATEGORYS[$category['parentid']]['catname'].'</a>'; $step_2 = '<a href="'.APP_PATH.'index.php?m=member&c=content&a=info_publish&siteid='.$siteid.'&city='.$citypinyin.'&catid='.$category['parentid'].'">'.$category['catname'].'</a>'; $step_3 = '<a href="'.APP_PATH.'index.php?m=member&c=content&a=info_publish&siteid='.$siteid.'&city='.$citypinyin.'&catid='.$catid.'">'.$zone_name.'</a>'; $zone_arrchild = get_linkage_level($info_linkageid,$zone,'arrchildinfo'); include template('member', 'info_content_publish_select'); exit; } if($setting['presentpoint'] < 0 && $memberinfo['point'] < abs($setting['presentpoint'])) showmessage(L('points_less_than',array('point'=>$memberinfo['point'],'need_point'=>abs($setting['presentpoint']))),APP_PATH.'index.php?m=pay&c=deposit&a=pay&exchange=point',3000); if($category['type']!=0) showmessage(L('illegal_operation')); $modelid = $category['modelid']; require CACHE_MODEL_PATH.'content_form.class.php'; $content_form = new content_form($modelid, $catid, $CATEGORYS); $data = array('zone'=>$zone,'city'=>$cityid); $forminfos_data = $content_form->get($data); $forminfos = array(); foreach($forminfos_data as $_fk=>$_fv) { if($_fv['isomnipotent']) continue; if($_fv['formtype']=='omnipotent') { foreach($forminfos_data as $_fm=>$_fm_value) { if($_fm_value['isomnipotent']) { $_fv['form'] = str_replace('{'.$_fm.'}',$_fm_value['form'],$_fv['form']); } } } $forminfos[$_fk] = $_fv; } $formValidator = $content_form->formValidator; //去掉栏目id unset($forminfos['catid']); $workflowid = $setting['workflowid']; header("Cache-control: private"); include template('member', 'info_content_publish'); } } function info_top() { $exist_posids = array(); $memberinfo = $this->memberinfo; $_username = $this->memberinfo['username']; $id = intval($_GET['id']); $catid = $_GET['catid']; $pos_data = pc_base::load_model('position_data_model'); if(!$id || !$catid) showmessage(L('illegal_parameters'), HTTP_REFERER); if(isset($catid) && $catid) { $siteids = getcache('category_content', 'commons'); $siteid = $siteids[$catid]; $CATEGORYS = getcache('category_content_'.$siteid, 'commons'); $category = $CATEGORYS[$catid]; if($category['type']==0) { $modelid = $category['modelid']; $this->model = getcache('model', 'commons'); $this->content_db = pc_base::load_model('content_model'); $this->content_db->set_model($modelid); $this->content_db->table_name = $this->content_db->db_tablepre.$this->model[$modelid]['tablename']; $r = $this->content_db->get_one(array('id'=>$id,'username'=>$_username,'sysadd'=>0)); if(!$r) showmessage(L('illegal_operation')); //再次重新赋值,以数据库为准 $catid = $CATEGORYS[$r['catid']]['catid']; $modelid = $CATEGORYS[$catid]['modelid']; require_once CACHE_MODEL_PATH.'content_output.class.php'; $content_output = new content_output($modelid,$catid,$CATEGORYS); $data = $content_output->get($r); extract($data); } } //置顶推荐位数组 $infos = getcache('info_setting','commons'); $toptype_posid = array('1'=>$infos['top_city_posid'], '2'=>$infos['top_zone_posid'], '3'=>$infos['top_district_posid'], ); foreach($toptype_posid as $_k => $_v) { if($pos_data->get_one(array('id'=>$id,'catid'=>$catid,'posid'=>$_v))) { $exist_posids[$_k] = 1; } } include template('member', 'info_top'); } function info_top_cost() { $amount = $msg = ''; $memberinfo = $this->memberinfo; $_username = $this->memberinfo['username']; $_userid = $this->memberinfo['userid']; $infos = getcache('info_setting','commons'); $toptype_arr = array(1,2,3); //置顶积分数组 $toptype_price = array('1'=>$infos['top_city'], '2'=>$infos['top_zone'], '3'=>$infos['top_district'], ); //置顶推荐位数组 $toptype_posid = array('1'=>$infos['top_city_posid'], '2'=>$infos['top_zone_posid'], '3'=>$infos['top_district_posid'], ); if(isset($_POST['dosubmit'])) { $posids = array(); $push_api = pc_base::load_app_class('push_api','admin'); $pos_data = pc_base::load_model('position_data_model'); $catid = intval($_POST['catid']); $id = intval($_POST['id']); $flag = $catid.'_'.$id; $toptime = intval($_POST['toptime']); if($toptime == 0 || empty($_POST['toptype'])) showmessage(L('info_top_not_setting_toptime')); //计算置顶扣费积分,时间 if(is_array($_POST['toptype']) && !empty($_POST['toptype'])) { foreach($_POST['toptype'] as $r) { if(is_numeric($r) && in_array($r, $toptype_arr)) { $posids[] = $toptype_posid[$r]; $amount += $toptype_price[$r]; $msg .= $r.'-'; } } } //应付总积分 $amount = $amount * $toptime; //扣除置顶点数 pc_base::load_app_class('spend','pay',0); $pay_status = spend::point($amount, L('info_top').$msg, $_userid, $_username, '', '', $flag); if($pay_status == false) { $msg = spend::get_msg(); showmessage($msg); } //置顶过期时间 //TODO $expiration = SYS_TIME + $toptime * 3600; //获取置顶文章信息内容 if(isset($catid) && $catid) { $siteids = getcache('category_content', 'commons'); $siteid = $siteids[$catid]; $CATEGORYS = getcache('category_content_'.$siteid, 'commons'); $category = $CATEGORYS[$catid]; if($category['type']==0) { $modelid = $category['modelid']; $this->model = getcache('model', 'commons'); $this->content_db = pc_base::load_model('content_model'); $this->content_db->set_model($modelid); $this->content_db->table_name = $this->content_db->db_tablepre.$this->model[$modelid]['tablename']; $r = $this->content_db->get_one(array('id'=>$id,'username'=>$_username,'sysadd'=>0)); } } if(!$r) showmessage(L('illegal_operation')); $push_api->position_update($id, $modelid, $catid, $posids, $r, $expiration, 1); $refer = $_POST['msg'] ? $r['url'] : ''; if($_POST['msg']) showmessage(L('ding_success'),$refer); else showmessage(L('ding_success'), '', '', 'top'); } else { $toptype = trim($_POST['toptype']); $toptime = trim($_POST['toptime']); $types = explode('_', $toptype); if(is_array($types) && !empty($types)) { foreach($types as $r) { if(is_numeric($r) && in_array($r, $toptype_arr)) { $amount += $toptype_price[$r]; } } } $amount = $amount * $toptime; echo $amount; } } /** * 初始化phpsso * about phpsso, include client and client configure * @return string phpsso_api_url phpsso地址 */ private function _init_phpsso() { pc_base::load_app_class('client', '', 0); define('APPID', pc_base::load_config('system', 'phpsso_appid')); $phpsso_api_url = pc_base::load_config('system', 'phpsso_api_url'); $phpsso_auth_key = pc_base::load_config('system', 'phpsso_auth_key'); $this->client = new client($phpsso_api_url, $phpsso_auth_key); return $phpsso_api_url; } } ?>
108wo
phpcms/modules/member/content.php
PHP
asf20
26,223
<?php ?>
108wo
phpcms/modules/member/functions/global.func.php
PHP
asf20
15
<?php /** * 管理员后台会员模型字段操作类 */ defined('IN_PHPCMS') or exit('No permission resources.'); //模型原型存储路径 define('MODEL_PATH',PC_PATH.'modules'.DIRECTORY_SEPARATOR.'member'.DIRECTORY_SEPARATOR.'fields'.DIRECTORY_SEPARATOR); define('CACHE_MODEL_PATH',CACHE_PATH.'caches_model'.DIRECTORY_SEPARATOR.'caches_data'.DIRECTORY_SEPARATOR); pc_base::load_app_class('admin', 'admin', 0); pc_base::load_app_func('util'); class member_modelfield extends admin { function __construct() { parent::__construct(); $this->db = pc_base::load_model('sitemodel_field_model'); $this->model_db = pc_base::load_model('sitemodel_model'); } public function manage() { $modelid = $_GET['modelid']; $datas = $this->cache_field($modelid); $modelinfo = $this->model_db->get_one(array('modelid'=>$modelid)); $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=member&c=member_modelfield&a=add&modelid='.$modelinfo['modelid'].'\', title:\''.L('member_modelfield_add').' '.L('model_name').':'.$modelinfo['name'].'\', 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('member_modelfield_add')); include $this->admin_tpl('member_modelfield_list'); } public function add() { if(isset($_POST['dosubmit'])) { $model_cache = getcache('member_model', 'commons'); $modelid = $_POST['info']['modelid'] = intval($_POST['info']['modelid']); $model_table = $model_cache[$modelid]['tablename']; $tablename = $this->db->db_tablepre.$model_table; $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']; require MODEL_PATH.$field_type.DIRECTORY_SEPARATOR.'config.inc.php'; if(isset($_POST['setting']['fieldtype'])) { $field_type = $_POST['setting']['fieldtype']; } require MODEL_PATH.'add.sql.php'; //附加属性值 $_POST['info']['setting'] = array2string($_POST['setting']); $_POST['info']['unsetgroupids'] = isset($_POST['unsetgroupids']) ? implode(',',$_POST['unsetgroupids']) : ''; $_POST['info']['unsetroleids'] = isset($_POST['unsetroleids']) ? implode(',',$_POST['unsetroleids']) : ''; $this->db->insert($_POST['info']); $this->cache_field($modelid); showmessage(L('operation_success'), '?m=member&c=member_model&a=manage', '', 'add'); } else { $show_header = $show_validator= $show_dialog =''; pc_base::load_sys_class('form', '', 0); require MODEL_PATH.'fields.inc.php'; $modelid = $_GET['modelid']; //角色缓存 $roles = getcache('role','commons'); //会员组缓存 $group_cache = getcache('grouplist','member'); foreach($group_cache as $_key=>$_value) { $grouplist[$_key] = $_value['name']; } header("Cache-control: private"); include $this->admin_tpl('member_modelfield_add'); } } /** * 修改 */ public function edit() { if(isset($_POST['dosubmit'])) { $model_cache = getcache('member_model','commons'); $modelid = $_POST['info']['modelid'] = intval($_POST['info']['modelid']); $model_table = $model_cache[$modelid]['tablename']; $tablename = $this->db->db_tablepre.$model_table; $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']; require MODEL_PATH.$field_type.DIRECTORY_SEPARATOR.'config.inc.php'; if(isset($_POST['setting']['fieldtype'])) { $field_type = $_POST['setting']['fieldtype']; } $oldfield = $_POST['oldfield']; require MODEL_PATH.'edit.sql.php'; //附加属性值 $_POST['info']['setting'] = array2string($_POST['setting']); $fieldid = intval($_POST['fieldid']); $_POST['info']['unsetgroupids'] = isset($_POST['unsetgroupids']) ? implode(',',$_POST['unsetgroupids']) : ''; $_POST['info']['unsetroleids'] = isset($_POST['unsetroleids']) ? implode(',',$_POST['unsetroleids']) : ''; $this->db->update($_POST['info'],array('fieldid'=>$fieldid)); $this->cache_field($modelid); //更新模型缓存 pc_base::load_app_class('member_cache','',''); member_cache::update_cache_model(); showmessage(L('operation_success'), HTTP_REFERER, '', 'edit'); } else { $show_header = $show_validator= $show_dialog =''; pc_base::load_sys_class('form','',0); require MODEL_PATH.'fields.inc.php'; $modelid = intval($_GET['modelid']); $fieldid = intval($_GET['fieldid']); $r = $this->db->get_one(array('fieldid'=>$fieldid)); extract($r); $setting = string2array($setting); ob_start(); include MODEL_PATH.$formtype.DIRECTORY_SEPARATOR.'field_edit_form.inc.php'; $form_data = ob_get_contents(); ob_end_clean(); //角色缓存 $roles = getcache('role','commons'); $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('member_modelfield_edit'); } } public function delete() { $fieldid = intval($_GET['fieldid']); $r = $this->db->get_one(array('fieldid'=>$fieldid)); //删除模型字段 $this->db->delete(array('fieldid'=>$fieldid)); //删除表字段 $model_cache = getcache('member_model', 'commons'); $model_table = $model_cache[$r['modelid']]['tablename']; $this->db->drop_field($model_table, $r['field']); showmessage(L('operation_success'), HTTP_REFERER); } /** * 禁用字段 */ public function disable() { $fieldid = intval($_GET['fieldid']); $disabled = intval($_GET['disabled']); $this->db->update(array('disabled'=>$disabled), array('fieldid'=>$fieldid)); showmessage(L('operation_success'), HTTP_REFERER); } /** * 排序 */ public function sort() { if(isset($_POST['listorders'])) { foreach($_POST['listorders'] as $id => $listorder) { $this->db->update(array('listorder'=>$listorder),array('fieldid'=>$id)); } showmessage(L('operation_success')); } 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']); $model_cache = getcache('member_model','commons'); $tablename = $model_cache[$modelid]['tablename']; $this->db->table_name = $this->db->db_tablepre.$tablename; $fields = $this->db->get_fields(); if(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(); 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 $modelid 模型id */ public function cache_field($modelid = 0) { $field_array = array(); $fields = $this->db->select(array('modelid'=>$modelid),'*',100,'listorder ASC'); foreach($fields as $_value) { $setting = string2array($_value['setting']); $_value = array_merge($_value,$setting); $field_array[$_value['field']] = $_value; } setcache('model_field_'.$modelid,$field_array,'model'); return $field_array; } /** * 预览模型 */ public function public_priview() { pc_base::load_sys_class('form','',0); $show_header = ''; $modelid = intval($_GET['modelid']); require CACHE_MODEL_PATH.'content_form.class.php'; $content_form = new content_form($modelid); $forminfos = $content_form->get(); include $this->admin_tpl('sitemodel_priview'); } } ?>
108wo
phpcms/modules/member/member_modelfield.php
PHP
asf20
8,791
<?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/myhelp/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/myhelp/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/myhelp/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/myhelp/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/myhelp/templates/brand_manage.tpl.php
PHP
asf20
5,106
<?php defined('IN_PHPCMS') or exit('Access Denied'); defined('INSTALL') or exit('Access Denied'); $menu_db->insert(array('name'=>'myhelp', 'parentid'=>29, 'm'=>'myhelp', 'c'=>'myhelp', 'a'=>'init', 'data'=>'', 'listorder'=>0, 'display'=>'1'), true); ?>
108wo
phpcms/modules/myhelp/extention.inc.php
PHP
asf20
256
<?php /** * 前台求助信息管理 */ defined('IN_PHPCMS') or exit('No permission resources.'); class index{ private $db; public $siteid; /** * 初始化 * Enter description here ... */ function __construct() { $this->db = pc_base::load_model('myhelp_model'); $this->_userid = param::get_cookie('_userid'); $this->siteid = get_siteid(); } public function init() { if (isset($_GET['id']) && intval($_GET['id'])) { $id = intval($_GET['id']); $this->db->update('`hits`=`hits`+1', array('id'=>$id)); $myhelp = $this->db->get_one(array('id'=>$id)); } $productid = intval($_GET['productid']); $content_db = pc_base::load_model('content_model'); $content_db->set_model(13); $product = $content_db->get_one(array('id'=>$productid)); if ($product) { $myhelp_list = $this->db->select(array('productid'=>$productid), 'title,username,modelid,hits,inputtime', '20', 'inputtime DESC'); } else { showmessage('抱歉,您的请求错误!', APP_PATH.'/index.php'); } $catid = TOP_PRODUCT_CATID; include template('myhelp','index'); } /** * 添加 */ public function add() { $productid = intval($_POST['id']); $title = new_addslashes($_POST['myhelp_title']); $content_db = pc_base::load_model('content_model'); $content_db->set_model(13); $product = $content_db->get_one(array('id'=>$productid), 'id,title'); $member_db = pc_base::load_model('member_model'); $member = $member_db->get_one(array('userid'=>$this->_userid), 'userid,username,modelid'); if ($product && $member) { $data = array( 'productid' => $product['id'], 'product_title' => $product['title'], 'title' => $title, 'userid' => $member['userid'], 'modelid' => $member['modelid'], 'username' => $member['username'], 'inputtime' => SYS_TIME ); $data['id'] = $this->db->insert($data, true); $data['inputtime'] = date('m-d', $data['inputtime']); //修改产品表最新求助信息创建时间,用于会员中心排序 $content_db->update(array('myhelp_inputtime'=>date('Y-m-d H:i:s', SYS_TIME)), array('id'=>$product['id'])); echo json_encode($data); exit; } } }
108wo
phpcms/modules/myhelp/index.php
PHP
asf20
2,178
<?php /** * 后台求助信息管理 */ defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); class myhelp extends admin { private $db; public $siteid; function __construct() { parent::__construct(); $this->db = pc_base::load_model('myhelp_model'); $this->siteid = $this->get_siteid(); } }
108wo
phpcms/modules/myhelp/myhelp.php
PHP
asf20
350
<?php defined('IN_PHPCMS') or exit('Access Denied'); defined('INSTALL') or exit('Access Denied'); return array('myhelp'); ?>
108wo
phpcms/modules/myhelp/install/model.php
PHP
asf20
130
<?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/myhelp/install/config.inc.php
PHP
asf20
266
<?php defined('IN_PHPCMS') or exit('No permission resources.'); //模型缓存路径 define('CACHE_MODEL_PATH',CACHE_PATH.'caches_model'.DIRECTORY_SEPARATOR.'caches_data'.DIRECTORY_SEPARATOR); pc_base::load_app_func('util','content'); class search { private $db; function __construct() { $this->db = pc_base::load_model('content_model'); } /** * 按照模型搜索 */ public function init() { $grouplist = getcache('grouplist','member'); $_groupid = param::get_cookie('_groupid'); if(!$_groupid) $_groupid = 8; if(!$grouplist[$_groupid]['allowsearch']) { if ($_groupid==8) showmessage(L('guest_not_allowsearch')); else showmessage(''); } if(!isset($_GET['catid'])) showmessage(L('missing_part_parameters')); $catid = intval($_GET['catid']); $siteids = getcache('category_content','commons'); $siteid = $siteids[$catid]; $this->categorys = getcache('category_content_'.$siteid,'commons'); if(!isset($this->categorys[$catid])) showmessage(L('missing_part_parameters')); if(isset($_GET['info']['catid']) && $_GET['info']['catid']) { $catid = intval($_GET['info']['catid']); } else { $_GET['info']['catid'] = 0; } $modelid = $this->categorys[$catid]['modelid']; $modelid = intval($modelid); if(!$modelid) showmessage(L('illegal_parameters')); //搜索间隔 $minrefreshtime = getcache('common','commons'); $minrefreshtime = intval($minrefreshtime['minrefreshtime']); $minrefreshtime = $minrefreshtime ? $minrefreshtime : 5; if(param::get_cookie('search_cookie') && param::get_cookie('search_cookie')>SYS_TIME-2) { showmessage(L('search_minrefreshtime',array('min'=>$minrefreshtime)),'index.php?m=content&c=search&catid='.$catid,$minrefreshtime*1280); } else { param::set_cookie('search_cookie',SYS_TIME+2); } //搜索间隔 $CATEGORYS = $this->categorys; //产生表单 pc_base::load_sys_class('form','',0); $fields = getcache('model_field_'.$modelid,'model'); $forminfos = array(); foreach ($fields as $field=>$r) { if($r['issearch']) { if($r['formtype']=='catid') { $r['form'] = form::select_category('',$_GET['info']['catid'],'name="info[catid]"',L('please_select_category'),$modelid,0,1); } elseif($r['formtype']=='number') { $r['form'] = "<input type='text' name='{$field}_start' id='{$field}_start' value='' size=5 class='input-text'/> - <input type='text' name='{$field}_end' id='{$field}_start' value='' size=5 class='input-text'/>"; } elseif($r['formtype']=='datetime') { $r['form'] = form::date("info[$field]"); } elseif($r['formtype']=='box') { $options = explode("\n",$r['options']); foreach($options as $_k) { $v = explode("|",$_k); $option[$v[1]] = $v[0]; } switch($r['boxtype']) { case 'radio': $string = form::radio($option,$value,"name='info[$field]' id='$field'"); break; case 'checkbox': $string = form::radio($option,$value,"name='info[$field]' id='$field'"); break; case 'select': $string = form::select($option,$value,"name='info[$field]' id='$field'"); break; case 'multiple': $string = form::select($option,$value,"name='info[$field]' id='$field'"); break; } $r['form'] = $string; } elseif($r['formtype']=='typeid') { $types = getcache('type_content','commons'); $types_array = array(L('no_limit')); foreach ($types as $_k=>$_v) { if($modelid == $_v['modelid']) $types_array[$_k] = $_v['name']; } $r['form'] = form::select($types_array,0,"name='info[$field]' id='$field'"); } elseif($r['formtype']=='linkage') { $setting = string2array($r['setting']); $value = $_GET['info'][$field]; $r['form'] = menu_linkage($setting['linkageid'],$field,$value); } elseif(in_array($r['formtype'], array('text','keyword','textarea','editor','title','author','omnipotent'))) { $value = safe_replace($_GET['info'][$field]); $r['form'] = "<input type='text' name='info[$field]' id='$field' value='".$value."' class='input-text search-text'/>"; } else { continue; } $forminfos[$field] = $r; } } //----------- if(isset($_GET['dosubmit'])) { $siteid = $this->categorys[$catid]['siteid']; $siteurl = siteurl($siteid); $this->db->set_model($modelid); $tablename = $this->db->table_name; $page = max(intval($_GET['page']), 1); $sql = "SELECT * FROM `{$tablename}` a,`{$tablename}_data` b WHERE a.id=b.id AND a.status=99"; $sql_count = "SELECT COUNT(*) AS num FROM `{$tablename}` a,`{$tablename}_data` b WHERE a.id=b.id AND a.status=99"; //构造搜索SQL $where = ''; foreach ($fields as $field=>$r) { if($r['issearch']) { $table_nickname = $r['issystem'] ? 'a' : 'b'; if($r['formtype']=='catid') { if($_GET['info']['catid']) $where .= " AND {$table_nickname}.catid='$catid'"; } elseif($r['formtype']=='number') { $start = "{$field}_start"; $end = "{$field}_end"; if($_GET[$start]) { $start = intval($_GET[$start]); $where .= " AND {$table_nickname}.{$field}>'$start'"; } if($_GET[$end]) { $end = intval($_GET[$end]); $where .= " AND {$table_nickname}.{$field}<'$end'"; } } elseif($r['formtype']=='datetime') { if($_GET['info'][$field]) { $start = strtotime($_GET['info'][$field]); if($start) $where .= " AND {$table_nickname}.{$field}>'$start'"; } } elseif($r['formtype']=='box') { if($_GET['info'][$field]) { $field_value = safe_replace($_GET['info'][$field]); switch($r['boxtype']) { case 'radio': $where .= " AND {$table_nickname}.`$field`='$field_value'"; break; case 'checkbox': $where .= " AND {$table_nickname}.`$field` LIKE '%,$field_value,%'"; break; case 'select': $where .= " AND {$table_nickname}.`$field`='$field_value'"; break; case 'multiple': $where .= " AND {$table_nickname}.`$field` LIKE '%,$field_value,%'"; break; } } } elseif($r['formtype']=='typeid') { if($_GET['info'][$field]) { $typeid = intval($_GET['info'][$field]); $where .= " AND {$table_nickname}.`$field`='$typeid'"; } } elseif($r['formtype']=='linkage') { if($_GET['info'][$field]) { $linkage = intval($_GET['info'][$field]); $where .= " AND {$table_nickname}.`$field`='$linkage'"; } } elseif(in_array($r['formtype'], array('text','keyword','textarea','editor','title','author','omnipotent'))) { if($_GET['info'][$field]) { $keywords = safe_replace($_GET['info'][$field]); $where .= " AND {$table_nickname}.`$field` LIKE '%$keywords%'"; } } else { continue; } } } //----------- if($where=='') showmessage(L('please_enter_content_to_search')); $pagesize = 20; $offset = intval($pagesize*($page-1)); $sql_count .= $where; $this->db->query($sql_count); $total = $this->db->fetch_array(); $total = $total[0]['num']; if($total!=0) { $sql .= $where; $order = ''; $order = $_GET['orderby']=='a.id DESC' ? 'a.id DESC' : 'a.id ASC'; $sql .= ' ORDER BY '.$order; $sql .= " LIMIT $offset,$pagesize"; $this->db->query($sql); $datas = $this->db->fetch_array(); $pages = pages($total, $page, $pagesize); } else { $datas = array(); $pages = ''; } } $SEO = seo($siteid, $catid, $keywords); include template('content','search'); } } ?>
108wo
phpcms/modules/content/search.php
PHP
asf20
7,766
<?php defined('IN_PHPCMS') or exit('No permission resources.'); //模型原型存储路径 define('MODEL_PATH',PC_PATH.'modules'.DIRECTORY_SEPARATOR.'content'.DIRECTORY_SEPARATOR.'fields'.DIRECTORY_SEPARATOR); //模型缓存路径 define('CACHE_MODEL_PATH',CACHE_PATH.'caches_model'.DIRECTORY_SEPARATOR.'caches_data'.DIRECTORY_SEPARATOR); pc_base::load_app_class('admin','admin',0); class sitemodel extends admin { private $db; public $siteid; function __construct() { parent::__construct(); $this->db = pc_base::load_model('sitemodel_model'); $this->siteid = $this->get_siteid(); if(!$this->siteid) $this->siteid = 1; } public function init() { $categorys = getcache('category_content_'.$this->siteid,'commons'); $datas = $this->db->listinfo(array('siteid'=>$this->siteid,'type'=>0),'',$_GET['page'],30); //模型文章数array('模型id'=>数量); $items = array(); foreach ($datas as $k=>$r) { foreach ($categorys as $catid=>$cat) { if(intval($cat['modelid']) == intval($r['modelid'])) { $items[$r['modelid']] += intval($cat['items']); } else { $items[$r['modelid']] += 0; } } $datas[$k]['items'] = $items[$r['modelid']]; } $pages = $this->db->pages; $this->public_cache(); $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=content&c=sitemodel&a=add\', title:\''.L('add_model').'\', width:\'580\', height:\'420\', lock:true}, function(){var d = window.top.art.dialog({id:\'add\'}).data.iframe;var form = d.document.getElementById(\'dosubmit\');form.click();return false;}, function(){window.top.art.dialog({id:\'add\'}).close()});void(0);', L('add_model')); include $this->admin_tpl('sitemodel_manage'); } public function add() { if(isset($_POST['dosubmit'])) { $_POST['info']['siteid'] = $this->siteid; $_POST['info']['category_template'] = $_POST['setting']['category_template']; $_POST['info']['list_template'] = $_POST['setting']['list_template']; $_POST['info']['show_template'] = $_POST['setting']['show_template']; $modelid = $this->db->insert($_POST['info'],1); $model_sql = file_get_contents(MODEL_PATH.'model.sql'); $tablepre = $this->db->db_tablepre; $tablename = $_POST['info']['tablename']; $model_sql = str_replace('$basic_table', $tablepre.$tablename, $model_sql); $model_sql = str_replace('$table_data',$tablepre.$tablename.'_data', $model_sql); $model_sql = str_replace('$table_model_field',$tablepre.'model_field', $model_sql); $model_sql = str_replace('$modelid',$modelid,$model_sql); $model_sql = str_replace('$siteid',$this->siteid,$model_sql); $this->db->sql_execute($model_sql); $this->cache_field($modelid); //调用全站搜索类别接口 $this->type_db = pc_base::load_model('type_model'); $this->type_db->insert(array('name'=>$_POST['info']['name'],'module'=>'search','modelid'=>$modelid,'siteid'=>$this->siteid)); $cache_api = pc_base::load_app_class('cache_api','admin'); $cache_api->cache('type'); $cache_api->search_type(); showmessage(L('add_success'), '', '', 'add'); } else { pc_base::load_sys_class('form','',0); $show_header = $show_validator = ''; $style_list = template_list($this->siteid, 0); foreach ($style_list as $k=>$v) { $style_list[$v['dirname']] = $v['name'] ? $v['name'] : $v['dirname']; unset($style_list[$k]); } include $this->admin_tpl('sitemodel_add'); } } public function edit() { if(isset($_POST['dosubmit'])) { $modelid = intval($_POST['modelid']); $_POST['info']['category_template'] = $_POST['setting']['category_template']; $_POST['info']['list_template'] = $_POST['setting']['list_template']; $_POST['info']['show_template'] = $_POST['setting']['show_template']; $this->db->update($_POST['info'],array('modelid'=>$modelid,'siteid'=>$this->siteid)); showmessage(L('update_success'), '', '', 'edit'); } else { pc_base::load_sys_class('form','',0); $show_header = $show_validator = ''; $style_list = template_list($this->siteid, 0); foreach ($style_list as $k=>$v) { $style_list[$v['dirname']] = $v['name'] ? $v['name'] : $v['dirname']; unset($style_list[$k]); } $modelid = intval($_GET['modelid']); $r = $this->db->get_one(array('modelid'=>$modelid)); extract($r); include $this->admin_tpl('sitemodel_edit'); } } public function delete() { $this->sitemodel_field_db = pc_base::load_model('sitemodel_field_model'); $modelid = intval($_GET['modelid']); $model_cache = getcache('model','commons'); $model_table = $model_cache[$modelid]['tablename']; $this->sitemodel_field_db->delete(array('modelid'=>$modelid,'siteid'=>$this->siteid)); $this->db->drop_table($model_table); $this->db->drop_table($model_table.'_data'); $this->db->delete(array('modelid'=>$modelid,'siteid'=>$this->siteid)); //删除全站搜索接口数据 $this->type_db = pc_base::load_model('type_model'); $this->type_db->delete(array('module'=>'search','modelid'=>$modelid,'siteid'=>$this->siteid)); $cache_api = pc_base::load_app_class('cache_api','admin'); $cache_api->cache('type'); $cache_api->search_type(); exit('1'); } public function disabled() { $modelid = intval($_GET['modelid']); $r = $this->db->get_one(array('modelid'=>$modelid,'siteid'=>$this->siteid)); $status = $r['disabled'] == '1' ? '0' : '1'; $this->db->update(array('disabled'=>$status),array('modelid'=>$modelid,'siteid'=>$this->siteid)); showmessage(L('update_success'), HTTP_REFERER); } /** * 更新模型缓存 */ public function public_cache() { require MODEL_PATH.'fields.inc.php'; //更新内容模型类:表单生成、入库、更新、输出 $classtypes = array('form','input','update','output'); foreach($classtypes as $classtype) { $cache_data = file_get_contents(MODEL_PATH.'content_'.$classtype.'.class.php'); $cache_data = str_replace('}?>','',$cache_data); foreach($fields as $field=>$fieldvalue) { if(file_exists(MODEL_PATH.$field.DIRECTORY_SEPARATOR.$classtype.'.inc.php')) { $cache_data .= file_get_contents(MODEL_PATH.$field.DIRECTORY_SEPARATOR.$classtype.'.inc.php'); } } $cache_data .= "\r\n } \r\n?>"; file_put_contents(CACHE_MODEL_PATH.'content_'.$classtype.'.class.php',$cache_data); @chmod(CACHE_MODEL_PATH.'content_'.$classtype.'.class.php',0777); } //更新模型数据缓存 $model_array = array(); $datas = $this->db->select(array('type'=>0)); foreach ($datas as $r) { if(!$r['disabled']) $model_array[$r['modelid']] = $r; } setcache('model', $model_array, 'commons'); return true; } /** * 导出模型 */ function export() { $modelid = isset($_GET['modelid']) ? $_GET['modelid'] : showmessage(L('illegal_parameters'), HTTP_REFERER); $modelarr = getcache('model', 'commons'); //定义系统字段排除 //$system_field = array('id','title','style','catid','url','listorder','status','userid','username','inputtime','updatetime','pages','readpoint','template','groupids_view','posids','content','keywords','description','thumb','typeid','relation','islink','allow_comment'); $this->sitemodel_field_db = pc_base::load_model('sitemodel_field_model'); $modelinfo = $this->sitemodel_field_db->select(array('modelid'=>$modelid)); foreach($modelinfo as $k=>$v) { //if(in_array($v['field'],$system_field)) continue; $modelinfoarr[$k] = $v; $modelinfoarr[$k]['setting'] = string2array($v['setting']); } $res = var_export($modelinfoarr, TRUE); header('Content-Disposition: attachment; filename="'.$modelarr[$modelid]['tablename'].'.model"'); echo $res;exit; } /** * 导入模型 */ function import(){ if(isset($_POST['dosubmit'])) { $info = array(); $info['name'] = $_POST['info']['modelname']; //主表表名 $basic_table = $info['tablename'] = $_POST['info']['tablename']; //从表表名 $table_data = $basic_table.'_data'; $info['description'] = $_POST['info']['description']; $info['type'] = 0; $info['siteid'] = $this->siteid; $info['default_style'] = $_POST['default_style']; $info['category_template'] = $_POST['setting']['category_template']; $info['list_template'] = $_POST['setting']['list_template']; $info['show_template'] = $_POST['setting']['show_template']; if(!empty($_FILES['model_import']['tmp_name'])) { $model_import = @file_get_contents($_FILES['model_import']['tmp_name']); if(!empty($model_import)) { $model_import_data = string2array($model_import); } } $is_exists = $this->db->table_exists($basic_table); if($is_exists) showmessage(L('operation_failure'),'?m=content&c=sitemodel&a=init'); $modelid = $this->db->insert($info, 1); if($modelid){ $tablepre = $this->db->db_tablepre; //建立数据表 $model_sql = file_get_contents(MODEL_PATH.'model.sql'); $model_sql = str_replace('$basic_table', $tablepre.$basic_table, $model_sql); $model_sql = str_replace('$table_data',$tablepre.$table_data, $model_sql); $model_sql = str_replace('$table_model_field',$tablepre.'model_field', $model_sql); $model_sql = str_replace('$modelid',$modelid,$model_sql); $model_sql = str_replace('$siteid',$this->siteid,$model_sql); $this->db->sql_execute($model_sql); if(!empty($model_import_data)) { $this->sitemodel_field_db = pc_base::load_model('sitemodel_field_model'); $system_field = array('title','style','catid','url','listorder','status','userid','username','inputtime','updatetime','pages','readpoint','template','groupids_view','posids','content','keywords','description','thumb','typeid','relation','islink','allow_comment'); foreach($model_import_data as $v) { $field = $v['field']; if(in_array($field,$system_field)) { $v['siteid'] = $this->siteid; unset($v['fieldid'],$v['modelid'],$v['field']); $v = new_addslashes($v); $v['setting'] = array2string($v['setting']); $this->sitemodel_field_db->update($v,array('modelid'=>$modelid,'field'=>$field)); } else { $tablename = $v['issystem'] ? $tablepre.$basic_table : $tablepre.$table_data; //重组模型表字段属性 $minlength = $v['minlength'] ? $v['minlength'] : 0; $maxlength = $v['maxlength'] ? $v['maxlength'] : 0; $field_type = $v['formtype']; require MODEL_PATH.$field_type.DIRECTORY_SEPARATOR.'config.inc.php'; if(isset($v['setting']['fieldtype'])) { $field_type = $v['setting']['fieldtype']; } require MODEL_PATH.'add.sql.php'; $v['tips'] = addslashes($v['tips']); $v['setting'] = array2string($v['setting']); $v['modelid'] = $modelid; $v['siteid'] = $this->siteid; unset($v['fieldid']); $this->sitemodel_field_db->insert($v); } } } $this->public_cache(); showmessage(L('operation_success'),'?m=content&c=sitemodel&a=init'); } } else { pc_base::load_sys_class('form','',0); $show_validator = ''; $style_list = template_list($this->siteid, 0); foreach ($style_list as $k=>$v) { $style_list[$v['dirname']] = $v['name'] ? $v['name'] : $v['dirname']; unset($style_list[$k]); } $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=content&c=sitemodel&a=add\', title:\''.L('add_model').'\', width:\'580\', 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);', L('add_model')); include $this->admin_tpl('sitemodel_import'); } } /** * 检查表是否存在 */ public function public_check_tablename() { $r = $this->db->table_exists(strip_tags($_GET['tablename'])); if(!$r) echo '1'; } /** * 更新指定模型字段缓存 * * @param $modelid 模型id */ public function cache_field($modelid = 0) { $this->field_db = pc_base::load_model('sitemodel_field_model'); $field_array = array(); $fields = $this->field_db->select(array('modelid'=>$modelid,'disabled'=>$disabled),'*',100,'listorder ASC'); foreach($fields as $_value) { $setting = string2array($_value['setting']); $_value = array_merge($_value,$setting); $field_array[$_value['field']] = $_value; } setcache('model_field_'.$modelid,$field_array,'model'); return true; } } ?>
108wo
phpcms/modules/content/sitemodel.php
PHP
asf20
12,706
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); pc_base::load_sys_class('form','',0); class create_html extends admin { private $db; public $siteid,$categorys; public function __construct() { parent::__construct(); $this->db = pc_base::load_model('content_model'); $this->siteid = $this->get_siteid(); $this->categorys = getcache('category_content_'.$this->siteid,'commons'); foreach($_GET as $k=>$v) { $_POST[$k] = $v; } } public function update_urls() { if(isset($_POST['dosubmit'])) { extract($_POST,EXTR_SKIP); $this->url = pc_base::load_app_class('url'); $modelid = intval($_POST['modelid']); if($modelid) { //设置模型数据表名 $this->db->set_model($modelid); $table_name = $this->db->table_name; if($type == 'lastinput') { $offset = 0; } else { $page = max(intval($page), 1); $offset = $pagesize*($page-1); } $where = ' WHERE status=99 '; $order = 'ASC'; if(!isset($first) && is_array($catids) && $catids[0] > 0) { setcache('url_show_'.$_SESSION['userid'], $catids,'content'); $catids = implode(',',$catids); $where .= " AND catid IN($catids) "; $first = 1; } elseif($first) { $catids = getcache('url_show_'.$_SESSION['userid'],'content'); $catids = implode(',',$catids); $where .= " AND catid IN($catids) "; } else { $first = 0; } if($type == 'lastinput' && $number) { $offset = 0; $pagesize = $number; $order = 'DESC'; } elseif($type == 'date') { if($fromdate) { $fromtime = strtotime($fromdate.' 00:00:00'); $where .= " AND `inputtime`>=$fromtime "; } if($todate) { $totime = strtotime($todate.' 23:59:59'); $where .= " AND `inputtime`<=$totime "; } } elseif($type == 'id') { $fromid = intval($fromid); $toid = intval($toid); if($fromid) $where .= " AND `id`>=$fromid "; if($toid) $where .= " AND `id`<=$toid "; } if(!isset($total) && $type != 'lastinput') { $rs = $this->db->query("SELECT COUNT(*) AS `count` FROM `$table_name` $where"); $result = $this->db->fetch_array($rs); $total = $result[0]['count']; $pages = ceil($total/$pagesize); $start = 1; } $rs = $this->db->query("SELECT * FROM `$table_name` $where ORDER BY `id` $order LIMIT $offset,$pagesize"); $data = $this->db->fetch_array($rs); foreach($data as $r) { if($r['islink'] || $r['upgrade']) continue; //更新URL链接 $this->urls($r['id'], $r['catid'], $r['inputtime'], $r['prefix']); } if($pages > $page) { $page++; $http_url = get_url(); $creatednum = $offset + count($data); $percent = round($creatednum/$total, 2)*100; $message = L('need_update_items',array('total'=>$total,'creatednum'=>$creatednum,'percent'=>$percent)); $forward = $start ? "?m=content&c=create_html&a=update_urls&type=$type&dosubmit=1&first=$first&fromid=$fromid&toid=$toid&fromdate=$fromdate&todate=$todate&pagesize=$pagesize&page=$page&pages=$pages&total=$total&modelid=$modelid" : preg_replace("/&page=([0-9]+)&pages=([0-9]+)&total=([0-9]+)/", "&page=$page&pages=$pages&total=$total", $http_url); } else { delcache('url_show_'.$_SESSION['userid'],'content'); $message = L('create_update_success'); $forward = '?m=content&c=create_html&a=update_urls'; } showmessage($message,$forward,200); } else { //当没有选择模型时,需要按照栏目来更新 if(!isset($set_catid)) { if($catids[0] != 0) { $update_url_catids = $catids; } else { foreach($this->categorys as $catid=>$cat) { if($cat['child'] || $cat['siteid'] != $this->siteid || $cat['type']!=0) continue; $update_url_catids[] = $catid; } } setcache('update_url_catid'.'-'.$this->siteid.'-'.$_SESSION['userid'],$update_url_catids,'content'); $message = L('start_update_urls'); $forward = "?m=content&c=create_html&a=update_urls&set_catid=1&pagesize=$pagesize&dosubmit=1"; showmessage($message,$forward,200); } $catid_arr = getcache('update_url_catid'.'-'.$this->siteid.'-'.$_SESSION['userid'],'content'); $autoid = $autoid ? intval($autoid) : 0; if(!isset($catid_arr[$autoid])) showmessage(L('create_update_success'),'?m=content&c=create_html&a=update_urls',200); $catid = $catid_arr[$autoid]; $modelid = $this->categorys[$catid]['modelid']; //设置模型数据表名 $this->db->set_model($modelid); $table_name = $this->db->table_name; $page = max(intval($page), 1); $offset = $pagesize*($page-1); $where = " WHERE status=99 AND catid='$catid'"; $order = 'ASC'; if(!isset($total)) { $rs = $this->db->query("SELECT COUNT(*) AS `count` FROM `$table_name` $where"); $result = $this->db->fetch_array($rs); $total = $result[0]['count']; $pages = ceil($total/$pagesize); $start = 1; } $rs = $this->db->query("SELECT * FROM `$table_name` $where ORDER BY `id` $order LIMIT $offset,$pagesize"); $data = $this->db->fetch_array($rs); foreach($data as $r) { if($r['islink'] || $r['upgrade']) continue; //更新URL链接 $this->urls($r['id'], $r['catid'], $r['inputtime'], $r['prefix']); } if($pages > $page) { $page++; $http_url = get_url(); $creatednum = $offset + count($data); $percent = round($creatednum/$total, 2)*100; $message = '【'.$this->categorys[$catid]['catname'].'】 '.L('have_update_items',array('total'=>$total,'creatednum'=>$creatednum,'percent'=>$percent)); $forward = $start ? "?m=content&c=create_html&a=update_urls&type=$type&dosubmit=1&first=$first&fromid=$fromid&toid=$toid&fromdate=$fromdate&todate=$todate&pagesize=$pagesize&page=$page&pages=$pages&total=$total&autoid=$autoid&set_catid=1" : preg_replace("/&page=([0-9]+)&pages=([0-9]+)&total=([0-9]+)/", "&page=$page&pages=$pages&total=$total", $http_url); } else { $autoid++; $message = L('updating').$this->categorys[$catid]['catname']." ..."; $forward = "?m=content&c=create_html&a=update_urls&set_catid=1&pagesize=$pagesize&dosubmit=1&autoid=$autoid"; } showmessage($message,$forward,200); } } else { $show_header = $show_dialog = ''; $admin_username = param::get_cookie('admin_username'); $modelid = isset($_GET['modelid']) ? intval($_GET['modelid']) : 0; $tree = pc_base::load_sys_class('tree'); $tree->icon = array('&nbsp;&nbsp;&nbsp;│ ','&nbsp;&nbsp;&nbsp;├─ ','&nbsp;&nbsp;&nbsp;└─ '); $tree->nbsp = '&nbsp;&nbsp;&nbsp;'; $categorys = array(); if(!empty($this->categorys)) { foreach($this->categorys as $catid=>$r) { if($this->siteid != $r['siteid'] || ($r['type']!=0 && $r['child']==0)) continue; if($modelid && $modelid != $r['modelid']) continue; $r['disabled'] = $r['child'] ? 'disabled' : ''; $categorys[$catid] = $r; } } $str = "<option value='\$catid' \$selected \$disabled>\$spacer \$catname</option>"; $tree->init($categorys); $string .= $tree->get_tree(0, $str); include $this->admin_tpl('update_urls'); } } private function urls($id, $catid= 0, $inputtime = 0, $prefix = ''){ $urls = $this->url->show($id, 0, $catid, $inputtime, $prefix,'','edit'); //更新到数据库 $url = $urls[0]; $this->db->update(array('url'=>$url),array('id'=>$id)); //echo $id; echo "|"; return $urls; } /** * 生成内容页 */ public function show() { if(isset($_POST['dosubmit'])) { extract($_POST,EXTR_SKIP); $this->html = pc_base::load_app_class('html'); $modelid = intval($_POST['modelid']); if($modelid) { //设置模型数据表名 $this->db->set_model($modelid); $table_name = $this->db->table_name; if($type == 'lastinput') { $offset = 0; } else { $page = max(intval($page), 1); $offset = $pagesize*($page-1); } $where = ' WHERE status=99 '; $order = 'ASC'; if(!isset($first) && is_array($catids) && $catids[0] > 0) { setcache('html_show_'.$_SESSION['userid'], $catids,'content'); $catids = implode(',',$catids); $where .= " AND catid IN($catids) "; $first = 1; } elseif(count($catids)==1 && $catids[0] == 0) { $catids = array(); foreach($this->categorys as $catid=>$cat) { if($cat['child'] || $cat['siteid'] != $this->siteid || $cat['type']!=0) continue; $setting = string2array($cat['setting']); if(!$setting['content_ishtml']) continue; $catids[] = $catid; } print_r($catids); setcache('html_show_'.$_SESSION['userid'], $catids,'content'); $catids = implode(',',$catids); $where .= " AND catid IN($catids) "; $first = 1; } elseif($first) { $catids = getcache('html_show_'.$_SESSION['userid'],'content'); $catids = implode(',',$catids); $where .= " AND catid IN($catids) "; } else { $first = 0; } if(count($catids)==1 && $catids[0]==0) { $message = L('create_update_success'); $forward = '?m=content&c=create_html&a=show'; showmessage($message,$forward); } if($type == 'lastinput' && $number) { $offset = 0; $pagesize = $number; $order = 'DESC'; } elseif($type == 'date') { if($fromdate) { $fromtime = strtotime($fromdate.' 00:00:00'); $where .= " AND `inputtime`>=$fromtime "; } if($todate) { $totime = strtotime($todate.' 23:59:59'); $where .= " AND `inputtime`<=$totime "; } } elseif($type == 'id') { $fromid = intval($fromid); $toid = intval($toid); if($fromid) $where .= " AND `id`>=$fromid "; if($toid) $where .= " AND `id`<=$toid "; } if(!isset($total) && $type != 'lastinput') { $rs = $this->db->query("SELECT COUNT(*) AS `count` FROM `$table_name` $where"); $result = $this->db->fetch_array($rs); $total = $result[0]['count']; $pages = ceil($total/$pagesize); $start = 1; } $rs = $this->db->query("SELECT * FROM `$table_name` $where ORDER BY `id` $order LIMIT $offset,$pagesize"); $data = $this->db->fetch_array($rs); $tablename = $this->db->table_name.'_data'; $this->url = pc_base::load_app_class('url'); foreach($data as $r) { if($r['islink']) continue; $this->db->table_name = $tablename; $r2 = $this->db->get_one(array('id'=>$r['id'])); if($r) $r = array_merge($r,$r2); if($r['upgrade']) { $urls[1] = $r['url']; } else { $urls = $this->url->show($r['id'], '', $r['catid'],$r['inputtime']); } $this->html->show($urls[1],$r,0,'edit',$r['upgrade']); } if($pages > $page) { $page++; $http_url = get_url(); $creatednum = $offset + count($data); $percent = round($creatednum/$total, 2)*100; $message = L('need_update_items',array('total'=>$total,'creatednum'=>$creatednum,'percent'=>$percent)); $forward = $start ? "?m=content&c=create_html&a=show&type=$type&dosubmit=1&first=$first&fromid=$fromid&toid=$toid&fromdate=$fromdate&todate=$todate&pagesize=$pagesize&page=$page&pages=$pages&total=$total&modelid=$modelid" : preg_replace("/&page=([0-9]+)&pages=([0-9]+)&total=([0-9]+)/", "&page=$page&pages=$pages&total=$total", $http_url); } else { delcache('html_show_'.$_SESSION['userid'],'content'); $message = L('create_update_success'); $forward = '?m=content&c=create_html&a=show'; } showmessage($message,$forward,200); } else { //当没有选择模型时,需要按照栏目来更新 if(!isset($set_catid)) { if($catids[0] != 0) { $update_url_catids = $catids; } else { foreach($this->categorys as $catid=>$cat) { if($cat['child'] || $cat['siteid'] != $this->siteid || $cat['type']!=0) continue; $setting = string2array($cat['setting']); if(!$setting['content_ishtml']) continue; $update_url_catids[] = $catid; } } setcache('update_html_catid'.'-'.$this->siteid.'-'.$_SESSION['userid'],$update_url_catids,'content'); $message = L('start_update'); $forward = "?m=content&c=create_html&a=show&set_catid=1&pagesize=$pagesize&dosubmit=1"; showmessage($message,$forward,200); } if(count($catids)==1 && $catids[0]==0) { $message = L('create_update_success'); $forward = '?m=content&c=create_html&a=show'; showmessage($message,$forward,200); } $catid_arr = getcache('update_html_catid'.'-'.$this->siteid.'-'.$_SESSION['userid'],'content'); $autoid = $autoid ? intval($autoid) : 0; if(!isset($catid_arr[$autoid])) showmessage(L('create_update_success'),'?m=content&c=create_html&a=show',200); $catid = $catid_arr[$autoid]; $modelid = $this->categorys[$catid]['modelid']; //设置模型数据表名 $this->db->set_model($modelid); $table_name = $this->db->table_name; $page = max(intval($page), 1); $offset = $pagesize*($page-1); $where = " WHERE status=99 AND catid='$catid'"; $order = 'ASC'; if(!isset($total)) { $rs = $this->db->query("SELECT COUNT(*) AS `count` FROM `$table_name` $where"); $result = $this->db->fetch_array($rs); $total = $result[0]['count']; $pages = ceil($total/$pagesize); $start = 1; } $rs = $this->db->query("SELECT * FROM `$table_name` $where ORDER BY `id` $order LIMIT $offset,$pagesize"); $data = $this->db->fetch_array($rs); $tablename = $this->db->table_name.'_data'; $this->url = pc_base::load_app_class('url'); foreach($data as $r) { if($r['islink']) continue; //写入文件 $this->db->table_name = $tablename; $r2 = $this->db->get_one(array('id'=>$r['id'])); if($r2) $r = array_merge($r,$r2); if($r['upgrade']) { $urls[1] = $r['url']; } else { $urls = $this->url->show($r['id'], '', $r['catid'],$r['inputtime']); } $this->html->show($urls[1],$r,0,'edit',$r['upgrade']); } if($pages > $page) { $page++; $http_url = get_url(); $creatednum = $offset + count($data); $percent = round($creatednum/$total, 2)*100; $message = '【'.$this->categorys[$catid]['catname'].'】 '.L('have_update_items',array('total'=>$total,'creatednum'=>$creatednum,'percent'=>$percent)); $forward = $start ? "?m=content&c=create_html&a=show&type=$type&dosubmit=1&first=$first&fromid=$fromid&toid=$toid&fromdate=$fromdate&todate=$todate&pagesize=$pagesize&page=$page&pages=$pages&total=$total&autoid=$autoid&set_catid=1" : preg_replace("/&page=([0-9]+)&pages=([0-9]+)&total=([0-9]+)/", "&page=$page&pages=$pages&total=$total", $http_url); } else { $autoid++; $message = L('start_update').$this->categorys[$catid]['catname']." ..."; $forward = "?m=content&c=create_html&a=show&set_catid=1&pagesize=$pagesize&dosubmit=1&autoid=$autoid"; } showmessage($message,$forward,200); } } else { $show_header = $show_dialog = ''; $admin_username = param::get_cookie('admin_username'); $modelid = isset($_GET['modelid']) ? intval($_GET['modelid']) : 0; $tree = pc_base::load_sys_class('tree'); $tree->icon = array('&nbsp;&nbsp;&nbsp;│ ','&nbsp;&nbsp;&nbsp;├─ ','&nbsp;&nbsp;&nbsp;└─ '); $tree->nbsp = '&nbsp;&nbsp;&nbsp;'; $categorys = array(); if(!empty($this->categorys)) { foreach($this->categorys as $catid=>$r) { if($this->siteid != $r['siteid'] || ($r['type']!=0 && $r['child']==0)) continue; if($modelid && $modelid != $r['modelid']) continue; if($r['child']==0) { $setting = string2array($r['setting']); if(!$setting['content_ishtml']) continue; } $r['disabled'] = $r['child'] ? 'disabled' : ''; $categorys[$catid] = $r; } } $str = "<option value='\$catid' \$selected \$disabled>\$spacer \$catname</option>"; $tree->init($categorys); $string .= $tree->get_tree(0, $str); include $this->admin_tpl('create_html_show'); } } /** * 生成栏目页 */ public function category() { if(isset($_POST['dosubmit'])) { extract($_POST,EXTR_SKIP); $this->html = pc_base::load_app_class('html'); $referer = isset($referer) ? urlencode($referer) : ''; $modelid = intval($_POST['modelid']); if(!isset($set_catid)) { if($catids[0] != 0) { $update_url_catids = $catids; } else { foreach($this->categorys as $catid=>$cat) { if($cat['siteid'] != $this->siteid || $cat['type']==2 || !$cat['ishtml']) continue; if($modelid && ($modelid != $cat['modelid'])) continue; $update_url_catids[] = $catid; } } setcache('update_html_catid'.'-'.$this->siteid.'-'.$_SESSION['userid'],$update_url_catids,'content'); $message = L('start_update_category'); $forward = "?m=content&c=create_html&a=category&set_catid=1&pagesize=$pagesize&dosubmit=1&modelid=$modelid&referer=$referer"; showmessage($message,$forward); } $catid_arr = getcache('update_html_catid'.'-'.$this->siteid.'-'.$_SESSION['userid'],'content'); $autoid = $autoid ? intval($autoid) : 0; if(!isset($catid_arr[$autoid])) { if(!empty($referer) && $this->categorys[$catid_arr[0]]['type']!=1) { showmessage(L('create_update_success'),'?m=content&c=content&a=init&catid='.$catid_arr[0],200); } else { showmessage(L('create_update_success'),'?m=content&c=create_html&a=category',200); } } $catid = $catid_arr[$autoid]; $page = $page ? $page : 1; $j = 1; do { $this->html->category($catid,$page); $page++; $j++; $total_number = isset($total_number) ? $total_number : PAGES; } while ($j <= $total_number && $j < $pagesize); if($page <= $total_number) { $endpage = intval($page+$pagesize); $message = L('updating').$this->categorys[$catid]['catname'].L('start_to_end_id',array('page'=>$page,'endpage'=>$endpage)); $forward = "?m=content&c=create_html&a=category&set_catid=1&pagesize=$pagesize&dosubmit=1&autoid=$autoid&page=$page&total_number=$total_number&modelid=$modelid&referer=$referer"; } else { $autoid++; $message = $this->categorys[$catid]['catname'].L('create_update_success'); $forward = "?m=content&c=create_html&a=category&set_catid=1&pagesize=$pagesize&dosubmit=1&autoid=$autoid&modelid=$modelid&referer=$referer"; } showmessage($message,$forward,200); } else { $show_header = $show_dialog = ''; $admin_username = param::get_cookie('admin_username'); $modelid = isset($_GET['modelid']) ? intval($_GET['modelid']) : 0; $tree = pc_base::load_sys_class('tree'); $tree->icon = array('&nbsp;&nbsp;&nbsp;│ ','&nbsp;&nbsp;&nbsp;├─ ','&nbsp;&nbsp;&nbsp;└─ '); $tree->nbsp = '&nbsp;&nbsp;&nbsp;'; $categorys = array(); if(!empty($this->categorys)) { foreach($this->categorys as $catid=>$r) { if($this->siteid != $r['siteid'] || ($r['type']==2 && $r['child']==0)) continue; if($modelid && $modelid != $r['modelid']) continue; if($r['child']==0) { if(!$r['ishtml']) continue; } $categorys[$catid] = $r; } } $str = "<option value='\$catid' \$selected>\$spacer \$catname</option>"; $tree->init($categorys); $string .= $tree->get_tree(0, $str); include $this->admin_tpl('create_html_category'); } } //生成首页 public function public_index() { $this->html = pc_base::load_app_class('html'); $size = $this->html->index(); showmessage(L('index_create_finish',array('size'=>sizecount($size)))); } /** * 批量生成内容页 */ public function batch_show() { if(isset($_POST['dosubmit'])) { $catid = intval($_GET['catid']); if(!$catid) showmessage(L('missing_part_parameters')); $modelid = $this->categorys[$catid]['modelid']; $setting = string2array($this->categorys[$catid]['setting']); $content_ishtml = $setting['content_ishtml']; if($content_ishtml) { $this->url = pc_base::load_app_class('url'); $this->db->set_model($modelid); if(empty($_POST['ids'])) showmessage(L('you_do_not_check')); $this->html = pc_base::load_app_class('html'); $ids = implode(',', $_POST['ids']); $rs = $this->db->select("catid='$catid' AND id IN ($ids)"); $tablename = $this->db->table_name.'_data'; foreach($rs as $r) { if($r['islink']) continue; $this->db->table_name = $tablename; $r2 = $this->db->get_one(array('id'=>$r['id'])); if($r2) $r = array_merge($r,$r2); //判断是否为升级或转换过来的数据 if(!$r['upgrade']) { $urls = $this->url->show($r['id'], '', $r['catid'],$r['inputtime']); } else { $urls[1] = $r['url']; } $this->html->show($urls[1],$r,0,'edit',$r['upgrade']); } showmessage(L('operation_success'),HTTP_REFERER); } } } } ?>
108wo
phpcms/modules/content/create_html.php
PHP
asf20
21,333
<?php defined('IN_ADMIN') or exit('No permission resources.');$addbg=1; include $this->admin_tpl('header','admin');?> <script type="text/javascript"> <!-- var charset = '<?php echo CHARSET;?>'; var uploadurl = '<?php echo pc_base::load_config('system','upload_url')?>'; //--> </script> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>content_addtop.js"></script> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>colorpicker.js"></script> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>hotkeys.js"></script> <script type="text/javascript">var catid=<?php echo $catid;?></script> <div class="addContent"> <div class="crumbs"><?php echo L('priview_model_position');?><?php echo $r['name'];?></div> <div class="col-right"> <div class="col-1"> <div class="content pad-6"> <?php if(is_array($forminfos['senior'])) { foreach($forminfos['senior'] as $field=>$info) { if($info['isomnipotent']) continue; if($info['formtype']=='omnipotent') { foreach($forminfos['base'] as $_fm=>$_fm_value) { if($_fm_value['isomnipotent']) { $info['form'] = str_replace('{'.$_fm.'}',$_fm_value['form'],$info['form']); } } foreach($forminfos['senior'] as $_fm=>$_fm_value) { if($_fm_value['isomnipotent']) { $info['form'] = str_replace('{'.$_fm.'}',$_fm_value['form'],$info['form']); } } } ?> <h6><?php if($info['star']){ ?> <font color="red">*</font><?php } ?> <?php echo $info['name']?></h6> <?php echo $info['form']?><?php echo $info['tips']?> <?php } } ?> <?php if($_SESSION['roleid']==1) {?> <h6><?php echo L('c_status');?></h6> <span class="ib" style="width:90px"><label><input type="radio" name="status" value="99" checked/> <?php echo L('c_publish');?> </label></span> <?php if($workflowid) { ?><label><input type="radio" name="status" value="1" > <?php echo L('c_check');?> </label><?php }?> <?php }?> </div> </div> </div> <div class="col-auto"> <div class="col-1"> <div class="content pad-6"> <table width="100%" cellspacing="0" class="table_form"> <tbody> <?php if(is_array($forminfos['base'])) { foreach($forminfos['base'] as $field=>$info) { if($info['isomnipotent']) continue; if($info['formtype']=='omnipotent') { foreach($forminfos['base'] as $_fm=>$_fm_value) { if($_fm_value['isomnipotent']) { $info['form'] = str_replace('{'.$_fm.'}',$_fm_value['form'],$info['form']); } } foreach($forminfos['senior'] 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> </div> </div> </div> </div> </div> <div class="fixed-bottom"> <div class="fixed-but text-c"> <div class="button"><input value="<?php echo L('save_close');?>" type="submit" name="dosubmit" class="cu" style="width:145px;"></div> <div class="button"><input value="<?php echo L('save_continue');?>" type="submit" name="dosubmit_continue" class="cu" style="width:130px;" title="Alt+X"></div> <div class="button"><input value="<?php echo L('c_close');?>" type="button" name="close" onclick="close_window()" class="cu" style="width:70px;"></div> </div> </div> </body> </html> <script type="text/javascript"> <!-- //只能放到最下面 $(function(){ $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({id:'check_content_id',content:msg,lock:true,width:'200',height:'50'}, function(){$(obj).focus(); boxid = $(obj).attr('id'); if($('#'+boxid).attr('boxid')!=undefined) { check_content(boxid); } })}}); <?php echo $formValidator;?> /* * 加载禁用外边链接 */ $('#linkurl').attr('disabled',true); $('#islink').attr('checked',false); $('.edit_content').hide(); jQuery(document).bind('keydown', 'Alt+x', function (){close_window();}); }) document.title='<?php echo L('priview_modelfield');?>'; //--> </script>
108wo
phpcms/modules/content/templates/sitemodel_priview.tpl.php
PHP
asf20
4,362
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin'); ?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}}); $("#name").formValidator({onshow:"<?php echo L("input").L('model_name')?>",onfocus:"<?php echo L("input").L('model_name')?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('model_name')?>"}); }) //--> </script> <div class="pad-lr-10"> <form action="?m=content&c=sitemodel&a=edit" method="post" id="myform"> <fieldset> <legend><?php echo L('basic_configuration')?></legend> <table width="100%" class="table_form"> <tr> <th width="120"><?php echo L('model_name')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="info[name]" id="name" size="30" value="<?php echo $name;?>"/></td> </tr> <tr> <th><?php echo L('model_tablename')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="info[tablename]" id="tablename" size="30" value="<?php echo $tablename;?>" disabled/></td> </tr> <tr> <th><?php echo L('description')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="info[description]" id="description" size="30" value="<?php echo $description;?>"/></td> </tr> </table> </fieldset> <div class="bk15"></div> <fieldset> <legend><?php echo L('template_setting')?></legend> <table width="100%" class="table_form"> <tr> <th width="200"><?php echo L('available_styles');?></th> <td> <?php print_r($template_list);?> <?php echo form::select($style_list, $default_style, 'name="info[default_style]" id="template_list" onchange="load_file_list(this.value)"', L('please_select'))?> </td> </tr> <tr> <th width="200"><?php echo L('category_index_tpl');?></th> <td id="category_template"> <?php echo form::select_template($default_style,'content', $category_template, 'name="setting[category_template]" id="template_category"', 'category')?></td> </tr> <tr> <th ><?php echo L('category_list_tpl');?></th> <td id="list_template"><?php echo form::select_template($default_style,'content', $list_template, 'name="setting[list_template]" id="template_list"', 'list')?></td> </tr> <tr> <th><?php echo L('content_tpl');?></th> <td id="show_template"><?php echo form::select_template($default_style,'content', $show_template, 'name="setting[show_template]" id="template_show"','show')?></td> </tr> </table> </fieldset> <div class="bk15"></div> <input type="hidden" name="modelid" value="<?php echo $modelid;?>" /> <input type="submit" class="dialog" id="dosubmit" name="dosubmit" value="<?php echo L('submit');?>" /> </form> </div> <script language="JavaScript"> <!-- function load_file_list(id) { $.getJSON('?m=admin&c=category&a=public_tpl_file_list&style='+id, function(data){$('#category_template').html(data.category_template);$('#list_template').html(data.list_template);$('#show_template').html(data.show_template);}); } //--> </script> </body> </html>
108wo
phpcms/modules/content/templates/sitemodel_edit.tpl.php
PHP
asf20
3,320
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin');?> <div class="pad-10"> <div class="explain-col"> <?php echo L('html_notice');?> </div> <div class="bk10"></div> <div class="table-list"> <table width="100%" cellspacing="0"> <form action="?m=content&c=create_html&a=category" method="post" name="myform"> <input type="hidden" name="dosubmit" value="1"> <input type="hidden" name="type" value="lastinput"> <thead> <tr> <th align="center" width="150"><?php echo L('according_model');?></th> <th align="center" width="386"><?php echo L('select_category_area');?></th> <th align="center"><?php echo L('select_operate_content');?></th> </tr> </thead> <tbody height="200" class="nHover td-line"> <tr> <td align="center" rowspan="6"> <?php $models = getcache('model','commons'); $model_datas = array(); foreach($models as $_k=>$_v) { if($_v['siteid']!=$this->siteid) continue; $model_datas[$_v['modelid']] = $_v['name']; } echo form::select($model_datas,$modelid,'name="modelid" size="2" style="height:200px;width:130px;" onclick="change_model(this.value)"',L('no_limit_model')); ?> </td> </tr> <tr> <td align="center" rowspan="6"> <select name='catids[]' id='catids' multiple="multiple" style="height:200px;" title="<?php echo L('push_ctrl_to_select');?>"> <option value='0' selected><?php echo L('no_limit_category');?></option> <?php echo $string;?> </select></td> <td><font color="red"><?php echo L('every_time');?> <input type="text" name="pagesize" value="10" size="4"> <?php echo L('information_items');?></font></td> </tr> <tr> <td><?php echo L('update_all');?> <input type="button" name="dosubmit1" value="<?php echo L('submit_start_update');?> " class="button" onclick="myform.type.value='all';myform.submit();"></td> </tr> <tr> <td></td> </tr> </tbody> </form> </table> </div> </div> <script language="JavaScript"> <!-- window.top.$('#display_center_id').css('display','none'); function change_model(modelid) { window.location.href='?m=content&c=create_html&a=category&modelid='+modelid+'&pc_hash='+pc_hash; } //--> </script>
108wo
phpcms/modules/content/templates/create_html_category.tpl.php
PHP
asf20
2,250
<?php defined('IN_ADMIN') or exit('No permission resources.'); $show_header = $show_validator = 1; include $this->admin_tpl('header', 'admin'); ?> <script type="text/javascript"> <!-- $(document).ready(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();})}}); <?php if (is_array($html) && $html['validator']){ echo $html['validator']; unset($html['validator']); }?> }) //--> </script> <div class="pad-10"> <div class="col-tab"> <ul class="tabBut cu-li"> <li<?php if ($_GET['order']==1 || !isset($_GET['order'])) {?> class="on"<?php }?>><a href="?m=content&c=push&a=init&classname=position_api&action=position_list&order=1&modelid=<?php echo $_GET['modelid']?>&catid=<?php echo $_GET['catid']?>&id=<?php echo $_GET['id']?>"><?php echo L('push_to_position');?></a></li> <li<?php if ($_GET['order']==2) {?> class="on"<?php }?>><a href="?m=content&c=push&a=init&module=special&action=_push_special&order=2&modelid=<?php echo $_GET['modelid']?>&catid=<?php echo $_GET['catid']?>&id=<?php echo $_GET['id']?>"><?php echo L('push_to_special');?></a></li> <li<?php if ($_GET['order']==3) {?> class="on"<?php }?>><a href="?m=content&c=push&a=init&module=content&classname=push_api&action=category_list&order=3&tpl=push_to_category&modelid=<?php echo $_GET['modelid']?>&catid=<?php echo $_GET['catid']?>&id=<?php echo $_GET['id']?>"><?php echo L('push_to_category');?></a></li> </ul> <div class='content' style="height:auto;"> <form action="?m=content&c=push&a=init&module=<?php echo $_GET['module']?>&action=<?php echo $_GET['action']?>" method="post" name="myform" id="myform"><input type="hidden" name="modelid" value="<?php echo $_GET['modelid']?>"><input type="hidden" name="catid" value="<?php echo $_GET['catid']?>"> <input type='hidden' name="id" value='<?php echo $_GET['id']?>'> <input type="hidden" value="content" name="m"> <input type="hidden" value="content" name="c"> <input type="hidden" value="public_relationlist" name="a"> <input type="hidden" value="<?php echo $modelid;?>" name="modelid"> <?php $sitelist = getcache('sitelist','commons'); $siteid = $this->siteid; foreach($sitelist as $_k=>$_v) { $checked = $_k==$siteid ? 'checked' : ''; echo "<label class='ib' style='width:128px;padding:5px;'><input type='radio' name='select_siteid' $checked onclick='change_siteid($_k)'> " .$_v['name']."</label>"; } ?> <input type="hidden" value="<?php echo $siteid;?>" name="siteid" id="siteid"> </div> </div> <div style="width:500px; padding:2px; border:1px solid #d8d8d8; float:left; margin-top:10px; margin-right:10px"> <table width="100%" cellspacing="0" class="table-list" > <thead> <tr> <th width="100"><?php echo L('catid');?></th> <th ><?php echo L('catname');?></th> <th width="150" ><?php echo L('select_model_name');?></th> </tr> </thead> <tbody id="load_catgory"> <?php echo $categorys;?> </tbody> </table> </div> <div style="overflow:hidden;_float:left;margin-top:10px;*margin-top:0;_margin-top:0"> <fieldset> <legend><?php echo L('category_checked');?></legend> <ul class='list-dot-othors' id='catname'> <input type='hidden' name='ids' value="" id="relation"></ul> </fieldset> </div> </div> <style type="text/css"> .line_ff9966,.line_ff9966:hover td{background-color:#FF9966} .line_fbffe4,.line_fbffe4:hover td {background-color:#fbffe4} .list-dot-othors li{float:none; width:auto} </style> <div class="bk15"></div> <input type="hidden" name="return" value="<?php echo $return?>" /> <input type="submit" class="dialog" id="dosubmit" name="dosubmit" value="<?php echo L('submit')?>" /> </form> <SCRIPT LANGUAGE="JavaScript"> <!-- function select_list(obj,title,id) { var relation_ids = $('#relation').val(); var sid = 'v'+id; $(obj).attr('class','line_fbffe4'); var str = "<li id='"+sid+"'>·<span>"+title+"</span><a href='javascript:;' class='close' onclick=\"remove_id('"+sid+"')\"></a></li>"; $('#catname').append(str); if(relation_ids =='' ) { $('#relation').val(id); } else { relation_ids = relation_ids+'|'+id; $('#relation').val(relation_ids); } } function change_siteid(siteid) { $("#load_catgory").load("?m=content&c=content&a=public_getsite_categorys&siteid="+siteid); $("#siteid").val(siteid); } //移除ID function remove_id(id) { $('#'+id).remove(); } change_siteid(<?php echo $siteid;?>); //--> </SCRIPT>
108wo
phpcms/modules/content/templates/push_to_category.tpl.php
PHP
asf20
4,718
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin');?> <div id="closeParentTime" style="display:none"></div> <SCRIPT LANGUAGE="JavaScript"> <!-- if(window.top.$("#current_pos").data('clicknum')==1) { parent.document.getElementById('display_center_id').style.display=''; parent.document.getElementById('center_frame').src = '?m=content&c=content&a=public_categorys&type=add&menuid=<?php echo $_GET['menuid'];?>'; window.top.$("#current_pos").data('clicknum',0); } $(document).ready(function(){ setInterval(closeParent,3000); }); function closeParent() { if($('#closeParentTime').html() == '') { window.top.$(".left_menu").addClass("left_menu_on"); window.top.$("#openClose").addClass("close"); window.top.$("html").addClass("on"); $('#closeParentTime').html('1'); window.top.$("#openClose").data('clicknum',1); } } //--> </SCRIPT> <div class="pad-lr-10"> <div class="pad-10"> <div class="content-menu ib-a blue line-x"><a href="javascript:;" class=on><em><?php echo L('page_manage');?></em></a><span>|</span> <a href="<?php if(strpos($category['url'],'http://')===false) echo siteurl($this->siteid);echo $category['url'];?>" target="_blank"><em><?php echo L('click_vistor');?></em></a> <span>|</span> <a href="?m=block&c=block_admin&a=public_visualization&catid=<?php echo $catid;?>&type=page"><em><?php echo L('visualization_edit');?></em></a> </div> </div> <form name="myform" action="?m=content&c=content&a=add" method="post" enctype="multipart/form-data"> <div class="pad_10"> <div style='overflow-y:auto;overflow-x:hidden' class='scrolltable'> <table width="100%" cellspacing="0" class="table_form contentWrap"> <tr> <th width="80"> <?php echo L('title');?> </th> <td><input type="text" style="width:400px;" name="info[title]" id="title" value="<?php echo $title?>" style="color:<?php echo $style;?>" class="measure-input " onBlur="$.post('api.php?op=get_keywords&number=3&sid='+Math.random()*5, {data:$('#title').val()}, function(data){if(data && $('#keywords').val()=='') $('#keywords').val(data); })"/> <input type="hidden" name="style_color" id="style_color" value="<?php echo $style_color;?>"> <input type="hidden" name="style_font_weight" id="style_font_weight" value="<?php echo $style_font_weight;?>"> <img src="statics/images/icon/colour.png" width="15" height="16" onclick="colorpicker('title_colorpanel','set_title_color');" style="cursor:hand"/> <img src="statics/images/icon/bold.png" width="10" height="10" onclick="input_font_bold()" style="cursor:hand"/> <span id="title_colorpanel" style="position:absolute; z-index:200" class="colorpanel"></span> </td> </tr> <tr> <th width="80"> <?php echo L('keywords');?> </th> <td><input type="text" name="info[keywords]" id="keywords" value="<?php echo $keywords?>" size="50"> <?php echo L('explode_keywords');?></td> </tr> <tr> <th width="80"> <?php echo L('content');?> </th> <td> <textarea name="info[content]" id="content"><?php echo $content?></textarea> <?php echo form::editor('content','full','','','',1,1)?> </td></tr> </table> </div> <div class="bk10"></div> <div class="btn"> <input type="hidden" name="info[catid]" value="<?php echo $catid;?>" /> <input type="hidden" name="edit" value="<?php echo $title ? 1 : 0;?>" /> <input type="submit" class="button" name="dosubmit" value="<?php echo L('submit');?>" /> </div> </div> </form> </div> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>content_addtop.js"></script> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>colorpicker.js"></script> </body> </html>
108wo
phpcms/modules/content/templates/content_page.tpl.php
PHP
asf20
3,728
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin');?> <div class="subnav"> <div class="content-menu ib-a blue line-x"> <?php if($super_admin) {?> <a href='?m=content&c=content&a=public_checkall&menuid=822' class="on"><em><?php echo L('all_check_list');?></em></a> <?php } else { echo L('check_status'); } for ($j=0;$j<5;$j++) { ?> <span>|</span><a href='?m=content&c=content&a=public_checkall&menuid=822&status=<?php echo $j;?>' class="<?php if($status==$j) echo 'on';?>"><em><?php echo L('workflow_'.$j);?></em></a> <?php }?> </div> </div> <div class="pad-10"> <form name="myform" id="myform" action="" method="post" > <div class="table-list"> <table width="100%"> <thead> <tr> <th width="60">ID</th> <th><?php echo L('title');?></th> <th><?php echo L('select_model_name');?></th> <th width="90"><?php echo L('current_steps');?></th> <th width="50"><?php echo L('steps');?></th> <th width="90"><?php echo L('belong_category');?></th> <th width="118"><?php echo L('contribute_time');?></th> <th width="130"><?php echo L('username');?></th> <th width="50"><?php echo L('operations_manage');?></th> </tr> </thead> <tbody> <?php $model_cache = getcache('model','commons'); foreach ($datas as $r) { $arr_checkid = explode('-',$r['checkid']); $workflowid = $this->categorys[$r['catid']]['workflowid']; if($stepid = $workflows[$workflowid]['steps']) { $stepname = L('steps_'.$stepid); } else { $stepname = ''; } $modelname = $model_cache[$arr_checkid[2]]['name']; $flowname = L('workflow_'.$r['status']); ?> <tr> <td align='center' ><?php echo $arr_checkid[1];?></td> <td align='left' ><a href="javascript:;" onclick='change_color(this);window.open("?m=content&c=content&a=public_preview&steps=<?php echo $r['status']?>&catid=<?php echo $r['catid'];?>&id=<?php echo $arr_checkid[1];?>&pc_hash=<?php echo $_SESSION['pc_hash'];?>","manage")'><?php echo $r['title'];?></a></td> <td align='center' ><?php echo $modelname;?></td> <td align='center' ><?php echo $flowname;?></td> <td align='center' ><?php echo $stepname;?></td> <td align='center' ><a href="?m=content&c=content&a=init&menuid=822&catid=<?php echo $r['catid'];?>"><?php echo $this->categorys[$r['catid']]['catname'];?></a></td> <td align='center' ><?php echo format::date($r['inputtime'],1);?></td> <td align='center'> <?php if($r['sysadd']==0) { echo "<a href='?m=member&c=member&a=memberinfo&username=".urlencode($r['username'])."' >".$r['username']."</a>"; echo '<img src="'.IMG_PATH.'icon/contribute.png" title="'.L('member_contribute').'">'; } else { echo $r['username']; } ?></td> <td align='center' ><a href="javascript:;" onclick='change_color(this);window.open("?m=content&c=content&a=public_preview&steps=<?php echo $r['status']?>&catid=<?php echo $r['catid'];?>&id=<?php echo $arr_checkid[1];?>&pc_hash=<?php echo $_SESSION['pc_hash'];?>","manage")'><?php echo L('c_check');?></a></td> </tr> <?php }?> </tbody> </table> <div id="pages"><?php echo $pages?></div> </div> </form> </div> <script type="text/javascript"> <!-- window.top.$("#current_pos_attr").html('<?php echo L('checkall_content');?>'); function change_color(obj) { $(obj).css('color','red'); } //--> </script> </body> </html>
108wo
phpcms/modules/content/templates/content_checkall.tpl.php
PHP
asf20
3,517
<?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('type_name_tips')?>",onfocus:"<?php echo L("input").L('type_name')?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('type_name')?>"}); }) //--> </script> <form action="?m=content&c=type_manage&a=edit" method="post" id="myform"> <div style="padding:6px 3px"> <div class="col-2 col-left mr6" style="width:440px"> <h6><img src="<?php echo IMG_PATH;?>icon/sitemap-application-blue.png" width="16" height="16" /> <?php echo L('edit_type');?></h6> <table width="100%" class="table_form"> <tr> <th width="80"><?php echo L('type_name')?>:</th> <td class="y-bg"><input type="text" name="info[name]" id="name" class="inputtext" style="width:300px;" value="<?php echo $name;?>"></td> </tr> <tr> <th><?php echo L('description')?>:</th> <td class="y-bg"><textarea name="info[description]" maxlength="255" style="width:300px;height:60px;"><?php echo $description;?></textarea></td> </tr> </table> <div class="bk15"></div> <input type="submit" class="dialog" id="dosubmit" name="dosubmit" value="<?php echo L('submit');?>" /> </div> <div class="col-2 col-auto"> <div class="content" style="padding:1px;overflow-x:hidden;overflow-y:auto;height:480px;"> <table width="100%" class="table-list"> <thead> <tr> <th width="25"><input type="checkbox" value="" id="check_box" onclick="selectall('ids[]');" title="<?php echo L('selected_all');?>"></th><th align="left"><?php echo L('catname');?></th> </tr> </thead> <tbody> <?php echo $categorys;?> </tbody> </table> </div> </div> </div> <input type="hidden" name="typeid" value="<?php echo $typeid;?>"> <input type="hidden" name="catids_string" value="<?php echo $catids_string;?>"> </form> </body> </html>
108wo
phpcms/modules/content/templates/type_edit.tpl.php
PHP
asf20
2,265
<?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('model_manage');?>--<?php echo $r['name'];?><?php echo L('field_manage');?></h2> <div class="content-menu ib-a blue line-x"><a class="add fb" href="?m=content&c=sitemodel_field&a=add&modelid=<?php echo $modelid?>&menuid=<?php echo $_GET['menuid']?>"><em><?php echo L('add_field');?></em></a>  <a class="on" href="?m=content&c=sitemodel_field&a=init&modelid=<?php echo $modelid?>&menuid=<?php echo $_GET['menuid']?>"><em><?php echo L('manage_field');?></em></a><span>|</span><a href="?m=content&c=sitemodel_field&a=public_priview&modelid=<?php echo $modelid?>&menuid=<?php echo $_GET['menuid']?>" target="_blank"><em><?php echo L('priview_modelfield');?></em></a> </div></div> <div class="pad-lr-10"> <form name="myform" action="?m=content&c=sitemodel_field&a=listorder" 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']?>]' 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=content&c=sitemodel_field&a=edit&modelid=<?php echo $r['modelid']?>&fieldid=<?php echo $r['fieldid']?>&menuid=<?php echo $_GET['menuid']?>"><?php echo L('edit');?></a> | <?php if(!in_array($r['field'],$forbid_fields)) { ?> <a href="?m=content&c=sitemodel_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=content&c=sitemodel_field&a=delete&modelid=<?php echo $r['modelid']?>&fieldid=<?php echo $r['fieldid']?>&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/content/templates/sitemodel_field_manage.tpl.php
PHP
asf20
3,936
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin');?> <div class="bk10"></div> <link rel="stylesheet" href="<?php echo CSS_PATH;?>jquery.treeview.css" type="text/css" /> <script type="text/javascript" src="<?php echo JS_PATH;?>jquery.cookie.js"></script> <script type="text/javascript" src="<?php echo JS_PATH;?>jquery.treeview.js"></script> <SCRIPT LANGUAGE="JavaScript"> <!-- $(document).ready(function(){ $("#category_tree").treeview({ control: "#treecontrol", persist: "cookie", cookieId: "treeview-black" }); }); function open_list(obj) { window.top.$("#current_pos_attr").html($(obj).html()); } //--> </SCRIPT> <style type="text/css"> .filetree *{white-space:nowrap;} .filetree span.folder, .filetree span.file{display:auto;padding:1px 0 1px 16px;} </style> <div id="treecontrol"> <span style="display:none"> <a href="#"></a> <a href="#"></a> </span> <a href="#"><img src="<?php echo IMG_PATH;?>minus.gif" /> <img src="<?php echo IMG_PATH;?>application_side_expand.png" /> 展开/收缩</a> </div> <?php if($_GET['from']=='block') { ?> <ul class="filetree treeview"><li class="collapsable"><div class="hitarea collapsable-hitarea"></div><span><img src="<?php echo IMG_PATH.'icon/home.png';?>" width="15" height="14">&nbsp;<a href='?m=block&c=block_admin&a=public_visualization&type=index' target='right'><?php echo L('block_site_index');?></a></span></li></ul> <?php } else { ?> <ul class="filetree treeview"><li class="collapsable"><div class="hitarea collapsable-hitarea"></div><span><img src="<?php echo IMG_PATH.'icon/box-exclaim.gif';?>" width="15" height="14">&nbsp;<a href='?m=content&c=content&a=public_checkall&menuid=822' target='right'><?php echo L('checkall_content');?></a></span></li></ul> <?php } echo $categorys; ?>
108wo
phpcms/modules/content/templates/category_tree.tpl.php
PHP
asf20
1,864
<html> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <head><title>V9 JS站群跨域</title></head> <body onload="a()"> <script type="text/javascript"> function a(){ var q = location.search.replace('?','').split('|'); if (top.document.getElementById('comment_iframe')) top.document.getElementById('comment_iframe').height=(q[0] ? q[0] : '0'); if (top.document.getElementById('comment')) top.document.getElementById('comment').innerHTML=(q[1] ? q[1] : '0'); } </script> </body> </html>
108wo
phpcms/modules/content/templates/js.html
HTML
asf20
523
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin');?> <style type="text/css"> <!-- .showMsg{border: 1px solid #1e64c8; zoom:1; width:450px; height:172px;position:absolute;top:44%;left:50%;margin:-87px 0 0 -225px} .showMsg h5{background-image: url(<?php echo IMG_PATH?>msg_img/msg.png);background-repeat: no-repeat; color:#fff; padding-left:35px; height:25px; line-height:26px;*line-height:28px; overflow:hidden; font-size:14px; text-align:left} .showMsg .content{ margin-top:50px; font-size:14px; height:64px; position:relative} #search_div{ position:absolute; top:23px; border:1px solid #dfdfdf; text-align:left; padding:1px; left:89px;*left:88px; width:263px;*width:260px; background-color:#FFF; display:none; font-size:12px} #search_div li{ line-height:24px;} #search_div li a{ padding-left:6px;display:block} #search_div li a:hover{ background-color:#e2eaff} --> </style> <div class="showMsg" style="text-align:center"> <h5><?php echo L('quick_into');?></h5> <div class="content"> <input type="text" size="41" id="cat_search" value="<?php echo L('search_category');?>" onfocus="if(this.value == this.defaultValue) this.value = ''" onblur="if(this.value.replace(' ','') == '') this.value = this.defaultValue;"> <ul id="search_div"></ul> </div> </div> <script type="text/javascript"> <!-- if(window.top.$("#current_pos").data('clicknum')==1 || window.top.$("#current_pos").data('clicknum')==null) { parent.document.getElementById('display_center_id').style.display=''; parent.document.getElementById('center_frame').src = '?m=content&c=content&a=public_categorys&type=add&menuid=<?php echo $_GET['menuid'];?>&pc_hash=<?php echo $_SESSION['pc_hash'];?>'; window.top.$("#current_pos").data('clicknum',0); } $(document).ready(function(){ setInterval(closeParent,5000); }); function closeParent() { if($('#closeParentTime').html() == '') { window.top.$(".left_menu").addClass("left_menu_on"); window.top.$("#openClose").addClass("close"); window.top.$("html").addClass("on"); $('#closeParentTime').html('1'); window.top.$("#openClose").data('clicknum',1); } } $().ready( function(){ $('#cat_search').keyup( function(){ var value = $("#cat_search").val(); if (value.length > 0){ $.getJSON('?m=admin&c=category&a=public_ajax_search', {catname: value}, function(data){ if (data != null) { var str = ''; $.each(data, function(i,n){ if(n.type=='0') { str += '<li><a href="?m=content&c=content&a=init&menuid=822&catid='+n.catid+'&pc_hash='+pc_hash+'">'+n.catname+'</a></li>'; } else { str += '<li><a href="?m=content&c=content&a=add&menuid=822&catid='+n.catid+'&pc_hash='+pc_hash+'">'+n.catname+'</a></li>'; } }); $('#search_div').html(str); $('#search_div').show(); } else { $('#search_div').hide(); } }); } else { $('#search_div').hide(); } } ); } ) //--> </script> </body> </html>
108wo
phpcms/modules/content/templates/content_quick.tpl.php
PHP
asf20
3,051
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin');?> <div class="pad-lr-10"> <div class="table-list"> <table width="100%" cellspacing="0" > <thead> <tr> <th width="100">modelid</th> <th width="100"><?php echo L('model_name');?></th> <th width="100"><?php echo L('tablename');?></th> <th ><?php echo L('description');?></th> <th width="100"><?php echo L('status');?></th> <th width="100"><?php echo L('items');?></th> <th width="230"><?php echo L('operations_manage');?></th> </tr> </thead> <tbody> <?php foreach($datas as $r) { $tablename = $r['name']; ?> <tr> <td align='center'><?php echo $r['modelid']?></td> <td align='center'><?php echo $tablename?></td> <td align='center'><?php echo $r['tablename']?></td> <td align='center'>&nbsp;<?php echo $r['description']?></td> <td align='center'><?php echo $r['disabled'] ? L('icon_locked') : L('icon_unlock')?></td> <td align='center'><?php echo $r['items']?></td> <td align='center'><a href="?m=content&c=sitemodel_field&a=init&modelid=<?php echo $r['modelid']?>&menuid=<?php echo $_GET['menuid']?>"><?php echo L('field_manage');?></a> | <a href="javascript:edit('<?php echo $r['modelid']?>','<?php echo addslashes($tablename);?>')"><?php echo L('edit');?></a> | <a href="?m=content&c=sitemodel&a=disabled&modelid=<?php echo $r['modelid']?>&menuid=<?php echo $_GET['menuid']?>"><?php echo $r['disabled'] ? L('field_enabled') : L('field_disabled');?></a> | <a href="javascript:;" onclick="model_delete(this,'<?php echo $r['modelid']?>','<?php echo L('confirm_delete_model',array('message'=>addslashes($tablename)));?>',<?php echo $r['items']?>)"><?php echo L('delete')?></a> | <a href="?m=content&c=sitemodel&a=export&modelid=<?php echo $r['modelid']?>&menuid=<?php echo $_GET['menuid']?>""><?php echo L('export');?></a></td> </tr> <?php } ?> </tbody> </table> <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:'<?php echo L('edit_model');?>《'+name+'》',id:'edit',iframe:'?m=content&c=sitemodel&a=edit&modelid='+id,width:'580',height:'420'}, 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 model_delete(obj,id,name,items){ if(items) { alert('<?php echo L('model_does_not_allow_delete');?>'); return false; } window.top.art.dialog({content:name, fixed:true, style:'confirm', id:'model_delete'}, function(){ $.get('?m=content&c=sitemodel&a=delete&modelid='+id+'&pc_hash='+pc_hash,function(data){ if(data) { $(obj).parent().parent().fadeOut("slow"); } }) }, function(){}); }; //--> </script> </body> </html>
108wo
phpcms/modules/content/templates/sitemodel_manage.tpl.php
PHP
asf20
3,100
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin'); ?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}}); $("#name").formValidator({onshow:"<?php echo L("input").L('model_name')?>",onfocus:"<?php echo L("input").L('model_name')?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('model_name')?>"}); $("#tablename").formValidator({onshow:"<?php echo L("input").L('model_tablename')?>",onfocus:"<?php echo L("input").L('model_tablename')?>"}).regexValidator({regexp:"^([a-zA-Z0-9]|[_]){0,20}$",onerror:"<?php echo L("model_tablename_wrong");?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('model_tablename')?>"}).ajaxValidator({type : "get",url : "",data :"m=content&c=sitemodel&a=public_check_tablename",datatype : "html",async:'false',success : function(data){ if( data == "1" ){return true;}else{return false;}},buttons: $("#dosubmit"),onerror : "<?php echo L('model_tablename').L('exists')?>",onwait : "<?php echo L('connecting')?>"}); }) //--> </script> <div class="pad-lr-10"> <form action="?m=content&c=sitemodel&a=add" method="post" id="myform"> <fieldset> <legend><?php echo L('basic_configuration')?></legend> <table width="100%" class="table_form"> <tr> <th width="120"><?php echo L('model_name')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="info[name]" id="name" size="30" /></td> </tr> <tr> <th><?php echo L('model_tablename')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="info[tablename]" id="tablename" size="30" /></td> </tr> <tr> <th><?php echo L('description')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="info[description]" id="description" size="30"/></td> </tr> </table> </fieldset> <div class="bk15"></div> <fieldset> <legend><?php echo L('template_setting')?></legend> <table width="100%" class="table_form"> <tr> <th width="200"><?php echo L('available_styles');?></th> <td> <?php echo form::select($style_list, '', 'name="info[default_style]" id="default_style" onchange="load_file_list(this.value)"', L('please_select'))?> </td> </tr> <tr> <th width="200"><?php echo L('category_index_tpl')?>:</th> <td id="category_template"> </td> </tr> <tr> <th width="200"><?php echo L('category_list_tpl')?>:</th> <td id="list_template"> </td> </tr> <tr> <th width="200"><?php echo L('content_tpl')?>:</th> <td id="show_template"> </td> </tr> </table> </fieldset> <div class="bk15"></div> <input type="submit" class="dialog" id="dosubmit" name="dosubmit" value="<?php echo L('submit');?>" /> </form> </div> <script language="JavaScript"> <!-- function load_file_list(id) { $.getJSON('?m=admin&c=category&a=public_tpl_file_list&style='+id+'&catid=', function(data){$('#category_template').html(data.category_template);$('#list_template').html(data.list_template);$('#show_template').html(data.show_template);}); } //--> </script> </body> </html>
108wo
phpcms/modules/content/templates/sitemodel_add.tpl.php
PHP
asf20
3,393
<?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"}); $("#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=content&c=sitemodel_field&a=public_checkfield&modelid=<?php echo $modelid?>&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=content&c=sitemodel_field&a=init&modelid=<?php echo $modelid?>&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=content&c=sitemodel_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><strong><?php echo L('issystem_field');?></strong></th> <td> <input type="hidden" name="issystem" id="issystem" value="<?php echo $issystem ? 1 : 0;?>"> <input type="radio" name="info[issystem]" id="field_basic_table1" value="1" <?php if($issystem) echo 'checked';?> disabled> <?php echo L('yes');?> <input type="radio" id="field_basic_table0" name="info[issystem]" value="0" <?php if(!$issystem) echo 'checked';?> disabled> <?php echo L('no');?></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('unique');?></strong></th> <td><input type="radio" name="info[isunique]" value="1" id="field_allow_isunique1" <?php if($isunique) echo 'checked';?> <?php if(!$field_allow_isunique) echo 'disabled'; ?>> <?php echo L('yes');?> <input type="radio" name="info[isunique]" value="0" id="field_allow_isunique0" <?php if(!$isunique) echo 'checked';?> <?php if(!$field_allow_isunique) echo 'disabled'; ?>> <?php echo L('no');?></td> </tr> <tr> <th><strong><?php echo L('basic_field');?></strong><br /><?php echo L('basic_field_tips');?></th> <td><input type="radio" name="info[isbase]" value="1" <?php if($isbase) echo 'checked';?>> <?php echo L('yes');?> <input type="radio" name="info[isbase]" value="0" <?php if(!$isbase) echo 'checked';?>> <?php echo L('no');?> </td> </tr> <tr> <th><strong><?php echo L('as_search_field');?></strong></th> <td><input type="radio" name="info[issearch]" value="1" id="field_allow_search1" <?php if($issearch) echo 'checked';?> <?php if(!$field_allow_search) echo 'disabled'; ?>> <?php echo L('yes');?> <input type="radio" name="info[issearch]" value="0" id="field_allow_search0" <?php if(!$issearch) echo 'checked';?> <?php if(!$field_allow_search) echo 'disabled'; ?>> <?php echo L('no');?></td> </tr> <tr> <th><strong><?php echo L('allow_contributor');?></strong></th> <td><input type="radio" name="info[isadd]" value="1" <?php if($isadd) echo 'checked';?>/> <?php echo L('yes');?> <input type="radio" name="info[isadd]" value="0" <?php if(!$isadd) echo 'checked';?>/> <?php echo L('no');?></td> </tr> <tr> <th><strong><?php echo L('as_fulltext_field');?></strong></th> <td><input type="radio" name="info[isfulltext]" value="1" id="field_allow_fulltext1" <?php if($isfulltext) echo 'checked';?> <?php if(!$field_allow_fulltext) echo 'disabled'; ?>/> <?php echo L('yes');?> <input type="radio" name="info[isfulltext]" value="0" id="field_allow_fulltext0" <?php if(!$isfulltext) echo 'checked';?> <?php if(!$field_allow_fulltext) echo 'disabled'; ?>/> <?php echo L('no');?></td> </tr> <tr> <th><strong><?php echo L('as_omnipotent_field');?></strong><br><?php echo L('as_omnipotent_field_tips');?></th> <td><input type="radio" name="info[isomnipotent]" value="1" <?php if($isomnipotent) echo 'checked';?> <?php if(in_array($field,$forbid_fields)) echo 'disabled'; ?>/> <?php echo L('yes');?> <input type="radio" name="info[isomnipotent]" value="0" <?php if(!$isomnipotent) echo 'checked';?> /> <?php echo L('no');?></td> </tr> <tr> <th><strong><?php echo L('as_postion_info');?></strong></th> <td><input type="radio" name="info[isposition]" value="1" <?php if($isposition) echo 'checked';?> /> <?php echo L('yes');?> <input type="radio" name="info[isposition]" value="0" <?php if(!$isposition) echo 'checked';?>/> <?php echo L('no');?></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> <tr> <th><strong><?php echo L('disabled_role_field');?></strong></th> <td><?php echo form::checkbox($roles,$unsetroleids,'name="unsetroleids[]" id="unsetroleids"',0,'100');?> </td> </tr> </table> <div class="bk15"></div> <input name="info[modelid]" type="hidden" value="<?php echo $modelid?>"> <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/content/templates/sitemodel_field_edit.tpl.php
PHP
asf20
10,412
<?php defined('IN_ADMIN') or exit('No permission resources.'); $show_header = $show_validator = 1; include $this->admin_tpl('header', 'admin'); ?> <script type="text/javascript"> <!-- $(document).ready(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();})}}); <?php if (is_array($html) && $html['validator']){ echo $html['validator']; unset($html['validator']); }?> }) //--> </script> <div class="pad-10"> <div class="col-tab"> <ul class="tabBut cu-li"> <li<?php if ($_GET['order']==1 || !isset($_GET['order'])) {?> class="on"<?php }?>><a href="?m=content&c=push&a=init&classname=position_api&action=position_list&order=1&modelid=<?php echo $_GET['modelid']?>&catid=<?php echo $_GET['catid']?>&id=<?php echo $_GET['id']?>"><?php echo L('push_to_position');?></a></li> <li<?php if ($_GET['order']==2) {?> class="on"<?php }?>><a href="?m=content&c=push&a=init&module=special&action=_push_special&order=2&modelid=<?php echo $_GET['modelid']?>&catid=<?php echo $_GET['catid']?>&id=<?php echo $_GET['id']?>"><?php echo L('push_to_special');?></a></li> <li<?php if ($_GET['order']==3) {?> class="on"<?php }?>><a href="?m=content&c=push&a=init&module=content&classname=push_api&action=category_list&order=3&tpl=push_to_category&modelid=<?php echo $_GET['modelid']?>&catid=<?php echo $_GET['catid']?>&id=<?php echo $_GET['id']?>"><?php echo L('push_to_category');?></a></li> </ul> <div class='content' style="height:auto;"> <form action="?m=content&c=push&a=init&module=<?php echo $_GET['module']?>&action=<?php echo $_GET['action']?>" method="post" name="myform" id="myform"><input type="hidden" name="modelid" value="<?php echo $_GET['modelid']?>"><input type="hidden" name="catid" value="<?php echo $_GET['catid']?>"> <input type='hidden' name="id" value='<?php echo $_GET['id']?>'> <table width="100%" class="table_form"> <?php if (isset($html) && is_array($html)) { foreach ($html as $k => $v) { ?> <tr> <th width="80"><?php echo $v['name']?>:</th> <td class="y-bg"><?php echo creat_form($k, $v)?></td> </tr> <?php if ($v['ajax']['name']) {?> <tr> <th width="80"><?php echo $v['ajax']['name']?>:</th> <td class="y-bg" id="<?php echo $k?>_td"><input type="hidden" name="<?php echo $v['ajax']['id']?>" id="<?php echo $v['ajax']['id']?>"></td> </tr> <?php } ?> <?php } } else { echo $html; }?> </table> <div class="bk15"></div> <input type="hidden" name="return" value="<?php echo $return?>" /> <input type="submit" class="dialog" id="dosubmit" name="dosubmit" value="<?php echo L('submit')?>" /> </form> </div> </div> </div> </body> </html>
108wo
phpcms/modules/content/templates/push_list.tpl.php
PHP
asf20
2,806
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin');?> <div id="closeParentTime" style="display:none"></div> <SCRIPT LANGUAGE="JavaScript"> <!-- if(window.top.$("#current_pos").data('clicknum')==1 || window.top.$("#current_pos").data('clicknum')==null) { parent.document.getElementById('display_center_id').style.display=''; parent.document.getElementById('center_frame').src = '?m=content&c=content&a=public_categorys&type=add&menuid=<?php echo $_GET['menuid'];?>&pc_hash=<?php echo $_SESSION['pc_hash'];?>'; window.top.$("#current_pos").data('clicknum',0); } $(document).ready(function(){ setInterval(closeParent,5000); }); function closeParent() { if($('#closeParentTime').html() == '') { window.top.$(".left_menu").addClass("left_menu_on"); window.top.$("#openClose").addClass("close"); window.top.$("html").addClass("on"); $('#closeParentTime').html('1'); window.top.$("#openClose").data('clicknum',1); } } //--> </SCRIPT> <div class="pad-10"> <div class="content-menu ib-a blue line-x"> <!-- eddy 添加批量上传 start --> <script type="text/javascript"> <!-- function batchUpload() { window.top.art.dialog({id:'batchUpload'}).close(); window.top.art.dialog({title:'<?php echo $category['catname']; ?> 批量上传',id:'batchUpload',iframe:'?m=attachment&c=attachments&a=batchUpload&catid=<?php echo $catid; ?>&siteid=<?php echo $this->siteid; ?>',width:'700',height:'500'}, function(){window.top.right.location.reload(); window.top.art.dialog({id:'batchUpload'}).close()}, function(){window.top.art.dialog({id:'batchUpload'}).close()}); } //--> </script> <?php if($category['modelid'] == 13) { echo '<a class="add fb" href="javascript:;" onclick="batchUpload();" ><em>批量上传</em></a>'; } ?> <!-- eddy 添加批量上传 end --> <a class="add fb" href="javascript:;" onclick=javascript:openwinx('?m=content&c=content&a=add&menuid=&catid=<?php echo $catid;?>&pc_hash=<?php echo $_SESSION['pc_hash'];?>','')><em><?php echo L('add_content');?></em></a>  <a href="?m=content&c=content&a=init&catid=<?php echo $catid;?>&pc_hash=<?php echo $pc_hash;?>" <?php if($steps==0 && !isset($_GET['reject'])) echo 'class=on';?>><em><?php echo L('check_passed');?></em></a><span>|</span> <?php echo $workflow_menu;?> <a href="javascript:;" onclick="javascript:$('#searchid').css('display','');"><em><?php echo L('search');?></em></a> <?php if($category['ishtml']) {?> <span>|</span><a href="?m=content&c=create_html&a=category&pagesize=30&dosubmit=1&modelid=0&catids[0]=<?php echo $catid;?>&pc_hash=<?php echo $pc_hash;?>&referer=<?php echo urlencode($_SERVER['QUERY_STRING']);?>"><em><?php echo L('update_htmls',array('catname'=>$category['catname']));?></em></a> <?php }?> </div> <div id="searchid" style="display:<?php if(!isset($_GET['search'])) echo 'none';?>"> <form name="searchform" action="" method="get" > <input type="hidden" value="content" name="m"> <input type="hidden" value="content" name="c"> <input type="hidden" value="init" name="a"> <input type="hidden" value="<?php echo $catid;?>" name="catid"> <input type="hidden" value="<?php echo $steps;?>" name="steps"> <input type="hidden" value="1" name="search"> <input type="hidden" value="<?php echo $pc_hash;?>" name="pc_hash"> <table width="100%" cellspacing="0" class="search-form"> <tbody> <tr> <td> <div class="explain-col"> <?php echo L('addtime');?>: <?php echo form::date('start_time',$_GET['start_time'],0,0,'false');?>- &nbsp;<?php echo form::date('end_time',$_GET['end_time'],0,0,'false');?> <select name="posids"><option value='' <?php if($_GET['posids']=='') echo 'selected';?>><?php echo L('all');?></option> <option value="1" <?php if($_GET['posids']==1) echo 'selected';?>><?php echo L('elite');?></option> <option value="2" <?php if($_GET['posids']==2) echo 'selected';?>><?php echo L('no_elite');?></option> </select> <!-- eddy start 增加品牌条件过滤 --> <?php if($category['modelid'] == 13) {?> 品牌: <select name="brand_1" id="brand_1"> <option value="">全部</option> <?php foreach ($brand_1 AS $b1) { echo "<option value='".$b1['id']."'>".$b1['name']."</option>"; } ?> <option value="0">-未关联品牌-</option> </select> <select name="brand_2" id="brand_2"> <option value="">全部</option> </select> <script type="text/javascript"> var brands = <?php echo $brands_json; ?>; $(function(){ $("#brand_1").change(function(){ var bid_1 = this.value; var html=""; if(bid_1=="" || bid_1==="0") { $("#brand_2").html("<option value=''>全部</option>"); return false; } for(i in brands) { if(brands[i].id == bid_1) { for(j in brands[i].child) { html += "<option value='"+brands[i].child[j].id+"'>"+brands[i].child[j].name+"</option>"; } if(html=="") { $("#brand_2").html("<option value=''>全部</option>").hide(); }else { html = "<option value=''>全部</option>"+html; $("#brand_2").show().html(html); } } } }); }); </script> <?php }?> <!-- eddy end 增加品牌条件过滤 --> <select name="searchtype"> <option value='0' <?php if($_GET['searchtype']==0) echo 'selected';?>><?php echo L('title');?></option> <option value='1' <?php if($_GET['searchtype']==1) echo 'selected';?>><?php echo L('intro');?></option> <option value='2' <?php if($_GET['searchtype']==2) echo 'selected';?>><?php echo L('username');?></option> <option value='3' <?php if($_GET['searchtype']==3) echo 'selected';?>>ID</option> </select> <input name="keyword" type="text" value="<?php if(isset($keyword)) echo $keyword;?>" class="input-text" /> <input type="submit" name="search" class="button" value="<?php echo L('search');?>" /> </div> </td> </tr> </tbody> </table> </form> </div> <form name="myform" id="myform" action="" method="post" > <div class="table-list"> <table width="100%"> <thead> <tr> <th width="16"><input type="checkbox" value="" id="check_box" onclick="selectall('ids[]');"></th> <th width="37"><?php echo L('listorder');?></th> <th width="40">ID</th> <th><?php echo L('title');?></th> <th width="40"><?php echo L('hits');?></th> <th width="70"><?php echo L('publish_user');?></th> <th width="118"><?php echo L('updatetime');?></th> <th width="72"><?php echo L('operations_manage');?></th> </tr> </thead> <tbody> <?php if(is_array($datas)) { $sitelist = getcache('sitelist','commons'); $release_siteurl = $sitelist[$category['siteid']]['url']; $path_len = -strlen(WEB_PATH); $release_siteurl = substr($release_siteurl,0,$path_len); $this->hits_db = pc_base::load_model('hits_model'); foreach ($datas as $r) { $hits_r = $this->hits_db->get_one(array('hitsid'=>'c-'.$modelid.'-'.$r['id'])); ?> <tr> <td align="center"><input class="inputcheckbox " name="ids[]" value="<?php echo $r['id'];?>" type="checkbox"></td> <td align='center'><input name='listorders[<?php echo $r['id'];?>]' type='text' size='3' value='<?php echo $r['listorder'];?>' class='input-text-c'></td> <td align='center' ><?php echo $r['id'];?></td> <td> <?php if($status==99) { if($r['islink']) { echo '<a href="'.$r['url'].'" target="_blank">'; } elseif(strpos($r['url'],'http://')!==false) { echo '<a href="'.$r['url'].'" target="_blank">'; } else { echo '<a href="'.$release_siteurl.$r['url'].'" target="_blank">'; } } else { echo '<a href="javascript:;" onclick=\'window.open("?m=content&c=content&a=public_preview&steps='.$steps.'&catid='.$catid.'&id='.$r['id'].'","manage")\'>'; }?><span<?php echo title_style($r['style'])?>><?php echo $r['title'];?></span></a> <?php if($r['thumb']!='') {echo '<img src="'.IMG_PATH.'icon/small_img.gif" title="'.L('thumb').'">'; } if($r['posids']) {echo '<img src="'.IMG_PATH.'icon/small_elite.gif" title="'.L('elite').'">';} if($r['islink']) {echo ' <img src="'.IMG_PATH.'icon/link.png" title="'.L('islink_url').'">';}?></td> <td align='center' title="<?php echo L('today_hits');?>:<?php echo $hits_r['dayviews'];?>&#10;<?php echo L('yestoday_hits');?>:<?php echo $hits_r['yestodayviews'];?>&#10;<?php echo L('week_hits');?>:<?php echo $hits_r['weekviews'];?>&#10;<?php echo L('month_hits');?>:<?php echo $hits_r['monthviews'];?>"><?php echo $hits_r['views'];?></td> <td align='center'> <?php if($r['sysadd']==0) { echo "<a href='?m=member&c=member&a=memberinfo&username=".urlencode($r['username'])."&pc_hash=".$_SESSION['pc_hash']."' >".$r['username']."</a>"; echo '<img src="'.IMG_PATH.'icon/contribute.png" title="'.L('member_contribute').'">'; } else { echo $r['username']; } ?></td> <td align='center'><?php echo format::date($r['updatetime'],1);?></td> <td align='center'><a href="javascript:;" onclick="javascript:openwinx('?m=content&c=content&a=edit&catid=<?php echo $catid;?>&id=<?php echo $r['id']?>','')"><?php echo L('edit');?></a> | <a href="javascript:view_comment('<?php echo id_encode('content_'.$catid,$r['id'],$this->siteid);?>','<?php echo safe_replace($r['title']);?>')"><?php echo L('comment');?></a></td> </tr> <?php } } ?> </tbody> </table> <div class="btn"><label for="check_box"><?php echo L('selected_all');?>/<?php echo L('cancel');?></label> <input type="hidden" value="<?php echo $pc_hash;?>" name="pc_hash"> <input type="button" class="button" value="<?php echo L('listorder');?>" onclick="myform.action='?m=content&c=content&a=listorder&dosubmit=1&catid=<?php echo $catid;?>&steps=<?php echo $steps;?>';myform.submit();"/> <?php if($category['content_ishtml']) {?> <input type="button" class="button" value="<?php echo L('createhtml');?>" onclick="myform.action='?m=content&c=create_html&a=batch_show&dosubmit=1&catid=<?php echo $catid;?>&steps=<?php echo $steps;?>';myform.submit();"/> <?php } if($status!=99) {?> <input type="button" class="button" value="<?php echo L('passed_checked');?>" onclick="myform.action='?m=content&c=content&a=pass&catid=<?php echo $catid;?>&steps=<?php echo $steps;?>';myform.submit();"/> <?php }?> <input type="button" class="button" value="<?php echo L('delete');?>" onclick="myform.action='?m=content&c=content&a=delete&dosubmit=1&catid=<?php echo $catid;?>&steps=<?php echo $steps;?>';return confirm_delete()"/> <?php if(!isset($_GET['reject'])) { ?> <input type="button" class="button" value="<?php echo L('push');?>" onclick="push();"/> <?php if($workflow_menu) { ?><input type="button" class="button" value="<?php echo L('reject');?>" onclick="reject_check()"/> <div id='reject_content' style='background-color: #fff;border:#006699 solid 1px;position:absolute;z-index:10;padding:1px;display:none;'> <table cellpadding='0' cellspacing='1' border='0'><tr><tr><td colspan='2'><textarea name='reject_c' id='reject_c' style='width:300px;height:46px;' onfocus="if(this.value == this.defaultValue) this.value = ''" onblur="if(this.value.replace(' ','') == '') this.value = this.defaultValue;"><?php echo L('reject_msg');?></textarea></td><td><input type='button' value=' <?php echo L('submit');?> ' class="button" onclick="reject_check(1)"></td></tr> </table> </div> <?php }}?> <input type="button" class="button" value="<?php echo L('remove');?>" onclick="myform.action='?m=content&c=content&a=remove&catid=<?php echo $catid;?>';myform.submit();"/> <?php echo runhook('admin_content_init')?> </div> <div id="pages"><?php echo $pages;?></div> </div> </form> </div> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>cookie.js"></script> <script type="text/javascript"> <!-- function push() { var str = 0; var id = tag = ''; $("input[name='ids[]']").each(function() { if($(this).attr('checked')==true) { str = 1; id += tag+$(this).val(); tag = '|'; } }); if(str==0) { alert('<?php echo L('you_do_not_check');?>'); return false; } window.top.art.dialog({id:'push'}).close(); window.top.art.dialog({title:'<?php echo L('push');?>:',id:'push',iframe:'?m=content&c=push&action=position_list&catid=<?php echo $catid?>&modelid=<?php echo $modelid?>&id='+id,width:'800',height:'500'}, function(){var d = window.top.art.dialog({id:'push'}).data.iframe;// 使用内置接口获取iframe对象 var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'push'}).close()}); } function confirm_delete(){ if(confirm('<?php echo L('confirm_delete', array('message' => L('selected')));?>')) $('#myform').submit(); } function view_comment(id, name) { window.top.art.dialog({id:'view_comment'}).close(); window.top.art.dialog({yesText:'<?php echo L('dialog_close');?>',title:'<?php echo L('view_comment');?>:'+name,id:'view_comment',iframe:'index.php?m=comment&c=comment_admin&a=lists&show_center_id=1&commentid='+id,width:'800',height:'500'}, function(){window.top.art.dialog({id:'edit'}).close()}); } function reject_check(type) { if(type==1) { var str = 0; $("input[name='ids[]']").each(function() { if($(this).attr('checked')==true) { str = 1; } }); if(str==0) { alert('<?php echo L('you_do_not_check');?>'); return false; } document.getElementById('myform').action='?m=content&c=content&a=pass&catid=<?php echo $catid;?>&steps=<?php echo $steps;?>&reject=1'; document.getElementById('myform').submit(); } else { $('#reject_content').css('display',''); return false; } } setcookie('refersh_time', 0); function refersh_window() { var refersh_time = getcookie('refersh_time'); if(refersh_time==1) { window.location.reload(); } } setInterval("refersh_window()", 3000); //--> </script> </body> </html>
108wo
phpcms/modules/content/templates/content_list.tpl.php
PHP
asf20
14,238
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin');?> <div class="pad-10"> <div class="explain-col"> <?php echo L('html_notice');?> </div> <div class="bk10"></div> <div class="table-list"> <table width="100%" cellspacing="0"> <form action="?m=content&c=create_html&a=lists" method="post" name="myform"> <input type="hidden" name="dosubmit" value="1"> <input type="hidden" name="type" value="lastinput"> <thead> <tr> <th align="center" width="150"><?php echo L('according_model');?></th> <th align="center" width="386"><?php echo L('select_category_area');?></th> <th align="center"><?php echo L('select_operate_content');?></th> </tr> </thead> <tbody height="200" class="nHover td-line"> <tr> <td align="center" rowspan="6"> <?php $models = getcache('model','commons'); $model_datas = array(); foreach($models as $_k=>$_v) { if($_v['siteid']!=$this->siteid) continue; $model_datas[$_v['modelid']] = $_v['name']; } echo form::select($model_datas,$modelid,'name="modelid" size="2" style="height:200px;width:130px;" onclick="change_model(this.value)"',L('no_limit_model')); ?> </td> </tr> <tr> <td align="center" rowspan="6"> <select name='catids[]' id='catids' multiple="multiple" style="height:200px;" title="<?php echo L('push_ctrl_to_select');?>"> <option value='0' selected><?php echo L('no_limit_category');?></option> <?php echo $string;?> </select></td> <td><font color="red"><?php echo L('every_time');?> <input type="text" name="pagesize" value="100" size="4"> <?php echo L('information_items');?></font></td> </tr> <tr> <td><?php echo L('update_all');?> <input type="button" name="dosubmit1" value=" <?php echo L('submit_start_update');?> " class="button" onclick="myform.type.value='all';myform.submit();"></td> </tr> <?php if($modelid) { ?> <tr> <td><?php echo L('last_information');?> <input type="text" name="number" value="100" size="5"> <?php echo L('information_items');?> <input type="button" class="button" name="dosubmit2" value=" <?php echo L('submit_start_update');?>" onclick="myform.type.value='lastinput';myform.submit();"></td> </tr> <tr> <td><?php echo L('update_time_from');?> <?php echo form::date('fromdate');?> <?php echo L('to');?> <?php echo form::date('todate');?><?php echo L('in_information');?> <input type="button" name="dosubmit3" value=" <?php echo L('submit_start_update');?>" class="button" onclick="myform.type.value='date';myform.submit();"></td> </tr> <tr> <td><?php echo L('update_id_from');?> <input type="text" name="fromid" value="0" size="8"> <?php echo L('to');?> <input type="text" name="toid" size="8"> <?php echo L('in_information');?> <input type="button" class="button" name="dosubmit4" value=" <?php echo L('submit_start_update');?>" onclick="myform.type.value='id';myform.submit();"></td> </tr> <?php } ?> <tr> <td></td> </tr> </tbody> </form> </table> </div> </div> <script language="JavaScript"> <!-- window.top.$('#display_center_id').css('display','none'); function change_model(modelid) { window.location.href='?m=content&c=create_html&a=show&modelid='+modelid+'&pc_hash='+pc_hash; } //--> </script>
108wo
phpcms/modules/content/templates/create_html_list.tpl.php
PHP
asf20
3,330
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin');?> <div class="pad-10"> <div class="explain-col"> <?php echo L('updateurl_tips');?> </div> <div class="bk10"></div> <div class="table-list"> <table width="100%" cellspacing="0"> <form action="?m=content&c=create_html&a=update_urls" method="post" name="myform"> <input type="hidden" name="dosubmit" value="1"> <input type="hidden" name="type" value="lastinput"> <thead> <tr> <th align="center" width="150"><?php echo L('according_model');?></th> <th align="center" width="386"><?php echo L('select_category_area');?></th> <th align="center"><?php echo L('select_operate_content');?></th> </tr> </thead> <tbody height="200" class="nHover td-line"> <tr> <td align="center" rowspan="6"> <?php $models = getcache('model','commons'); $model_datas = array(); foreach($models as $_k=>$_v) { if($_v['siteid']!=$this->siteid) continue; $model_datas[$_v['modelid']] = $_v['name']; } echo form::select($model_datas,$modelid,'name="modelid" size="2" style="height:200px;width:130px;" onclick="change_model(this.value)"',L('no_limit_model')); ?> </td> </tr> <tr> <td align="center" rowspan="6"> <select name='catids[]' id='catids' multiple="multiple" style="height:200px;" title="<?php echo L('push_ctrl_to_select');?>"> <option value='0' selected><?php echo L('no_limit_category');?></option> <?php echo $string;?> </select></td> <td><font color="red"><?php echo L('every_time');?> <input type="text" name="pagesize" value="100" size="4"> <?php echo L('information_items');?></font></td> </tr> <tr> <td><?php echo L('update_all');?> <input type="button" name="dosubmit1" value=" <?php echo L('submit_start_update');?> " class="button" onclick="myform.type.value='all';myform.submit();"></td> </tr> <?php if($modelid) { ?> <tr> <td><?php echo L('last_information');?> <input type="text" name="number" value="100" size="5"> <?php echo L('information_items');?><input type="button" class="button" name="dosubmit2" value=" <?php echo L('submit_start_update');?> " onclick="myform.type.value='lastinput';myform.submit();"></td> </tr> <tr> <td><?php echo L('update_time_from');?> <?php echo form::date('fromdate');?> <?php echo L('to');?> <?php echo form::date('todate');?><?php echo L('in_information');?> <input type="button" name="dosubmit3" value=" <?php echo L('submit_start_update');?> " class="button" onclick="myform.type.value='date';myform.submit();"></td> </tr> <tr> <td><?php echo L('update_id_from');?> <input type="text" name="fromid" value="0" size="8"> <?php echo L('to');?> <input type="text" name="toid" size="8"> <?php echo L('in_information');?> <input type="button" class="button" name="dosubmit4" value=" <?php echo L('submit_start_update');?> " onclick="myform.type.value='id';myform.submit();"></td> </tr> <?php } ?> <tr> <td></td> </tr> </tbody> </form> </table> </div> </div> <script language="JavaScript"> <!-- window.top.$('#display_center_id').css('display','none'); function change_model(modelid) { window.location.href='?m=content&c=create_html&a=update_urls&modelid='+modelid+'&pc_hash='+pc_hash; } //--> </script>
108wo
phpcms/modules/content/templates/update_urls.tpl.php
PHP
asf20
3,348
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin');?> <form name="myform" action="?m=content&c=type_manage&a=listorder" method="post"> <div class="pad_10"> <div class="table-list"> <table width="100%" cellspacing="0" > <thead> <tr> <th width="5%"><?php echo L('listorder');?></td> <th width="5%">ID</th> <th width="20%"><?php echo L('type_name');?></th> <th width="*"><?php echo L('description');?></th> <th width="30%"><?php echo L('operations_manage');?></th> </tr> </thead> <tbody> <?php foreach($datas as $r) { ?> <tr> <td align="center"><input type="text" name="listorders[<?php echo $r['typeid']?>]" value="<?php echo $r['listorder']?>" size="3" class='input-text-c'></td> <td align="center"><?php echo $r['typeid']?></td> <td align="center"><?php echo $r['name']?></td> <td ><?php echo $r['description']?></td> <td align="center"><a href="javascript:edit('<?php echo $r['typeid']?>','<?php echo trim(new_addslashes($r['name']))?>')"><?php echo L('edit');?></a> | <a href="javascript:;" onclick="data_delete(this,'<?php echo $r['typeid']?>','<?php echo trim(new_addslashes($r['name']));?>')"><?php echo L('delete')?></a> </td> </tr> <?php } ?> </tbody> </table> <div class="btn"><input type="submit" class="button" name="dosubmit" value="<?php echo L('listorder')?>" /></div> </div> <div id="pages"><?php echo $pages;?></div> </div> </div> </form> <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:'<?php echo L('edit_type');?>《'+name+'》',id:'edit',iframe:'?m=content&c=type_manage&a=edit&typeid='+id,width:'780',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 data_delete(obj,id,name){ window.top.art.dialog({content:name, fixed:true, style:'confirm', id:'data_delete'}, function(){ $.get('?m=content&c=type_manage&a=delete&typeid='+id+'&pc_hash='+pc_hash,function(data){ if(data) { $(obj).parent().parent().fadeOut("slow"); } }) }, function(){}); }; //--> </script> </body> </html>
108wo
phpcms/modules/content/templates/type_list.tpl.php
PHP
asf20
2,399
<?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();})}}); $("#workname").formValidator({onshow:"<?php echo L("input").L('workflow_name')?>",onfocus:"<?php echo L("input").L('workflow_name')?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('workflow_name')?>"}); }) //--> </script> <div class="pad-lr-10"> <form action="?m=content&c=workflow&a=add" method="post" id="myform"> <table width="100%" class="table_form"> <tr> <th width="200"><?php echo L('workflow_name')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="info[workname]" id="workname" size="30" /></td> </tr> <tr> <th><?php echo L('description')?>:</th> <td class="y-bg"><textarea name="info[description]" maxlength="255" style="width:300px;height:60px;"></textarea></td> </tr> <tr> <th><?php echo L('steps')?>:</th> <td class="y-bg"> <select name="info[steps]" onchange="select_steps(this.value)"> <option value='1' selected><?php echo L('steps_1');?></option> <option value='2'><?php echo L('steps_2');?></option> <option value='3'><?php echo L('steps_3');?></option> <option value='4'><?php echo L('steps_4');?></option> </select></td> </tr> <tr id="step1"> <th><?php echo L('steps_1');?> <?php echo L('admin_users')?>:</th> <td class="y-bg"> <?php echo form::checkbox($admin_data,'','name="checkadmin1[]"','',120);?> </td> </tr> <tr id="step2" style="display:none"> <th><?php echo L('steps_2');?> <?php echo L('admin_users')?>:</th> <td class="y-bg"> <?php echo form::checkbox($admin_data,'','name="checkadmin2[]"','',120);?> </td> </tr> <tr id="step3" style="display:none"> <th><?php echo L('steps_3');?> <?php echo L('admin_users')?>:</th> <td class="y-bg"> <?php echo form::checkbox($admin_data,'','name="checkadmin3[]"','',120);?> </td> </tr> <tr id="step4" style="display:none"> <th><?php echo L('steps_4');?><?php echo L('admin_users')?>:</th> <td class="y-bg"> <?php echo form::checkbox($admin_data,'','name="checkadmin4[]"','',120);?> </td> </tr> <tr> <th><B><?php echo L('nocheck_users')?></B>:</th> <td class="y-bg"> <?php echo form::checkbox($admin_data,'','name="nocheck_users[]"','',120);?> </td> </tr> <tr> <th><?php echo L('checkstatus_flag')?>:</th> <td class="y-bg"> <input type="radio" name="info[flag]" value="1" > 是 <input type="radio" name="info[flag]" value="0" checked> 否 </td> </tr> </table> <div class="bk15"></div> <div class="btn"><input type="submit" id="dosubmit" class="button" name="dosubmit" value="<?php echo L('submit')?>"/></div> </form> </div> </body> </html> <SCRIPT LANGUAGE="JavaScript"> <!-- function select_steps(stepsid) { for(i=4;i>1;i--) { if(stepsid>=i) { $('#step'+i).css('display',''); } else { $('#step'+i).css('display','none'); } } } //--> </SCRIPT>
108wo
phpcms/modules/content/templates/workflow_add.tpl.php
PHP
asf20
3,314
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin'); ?> <script type="text/javascript"> <!-- $(function(){ $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}}); $("#name").formValidator({onshow:"<?php echo L("input").L('model_name')?>",onfocus:"<?php echo L("input").L('model_name')?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('model_name')?>"}); $("#tablename").formValidator({onshow:"<?php echo L("input").L('model_tablename')?>",onfocus:"<?php echo L("input").L('model_tablename')?>"}).regexValidator({regexp:"^([a-zA-Z0-9]|[_]){0,20}$",onerror:"<?php echo L("model_tablename_wrong");?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('model_name')?>"}).ajaxValidator({type : "get",url : "",data :"m=content&c=sitemodel&a=public_check_tablename",datatype : "html",async:'false',success : function(data){ if( data == "1" ){return true;}else{return false;}},buttons: $("#dosubmit"),onerror : "<?php echo L('model_tablename').L('exists')?>",onwait : "<?php echo L('connecting')?>"}); }) //--> </script> <div class="pad-lr-10"> <form action="?m=content&c=sitemodel&a=import" method="post" id="myform" enctype="multipart/form-data"> <fieldset> <legend><?php echo L('basic_configuration')?></legend> <table width="100%" class="table_form"> <tr> <th width="120"><?php echo L('model_name')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="info[modelname]" id="name" size="30" /></td> </tr> <tr> <th><?php echo L('model_tablename')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="info[tablename]" id="tablename" size="30" /></td> </tr> <tr> <th><?php echo L('description')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="info[description]" id="description" size="30"/></td> </tr> <tr> <th><?php echo L('import_model');?></th> <td> <input type="file" name="model_import" value="" class="input-text" id="model_import"></input> </td> </tr> </table> </fieldset> <div class="bk15"></div> <fieldset> <legend><?php echo L('template_setting')?></legend> <table width="100%" class="table_form"> <tr> <th width="200"><?php echo L('available_styles');?>:</th> <td> <?php echo form::select($style_list, '', 'name="default_style" id="default_style" onchange="load_file_list(this.value)"', L('please_select'))?> </td> </tr> <tr> <th width="200"><?php echo L('category_index_tpl')?>:</th> <td id="category_template"> </td> </tr> <tr> <th width="200"><?php echo L('category_list_tpl')?>:</th> <td id="list_template"> </td> </tr> <tr> <th width="200"><?php echo L('content_tpl')?>:</th> <td id="show_template"> </td> </tr> </table> </fieldset> <div class="bk15"></div> <div class="btn"><input type="submit" id="dosubmit" name="dosubmit" value="<?php echo L('submit');?>" class="button"/></div> </form> </div> <script language="JavaScript"> <!-- function load_file_list(id) { $.getJSON('?m=admin&c=category&a=public_tpl_file_list&style='+id+'&catid=', function(data){$('#category_template').html(data.category_template);$('#list_template').html(data.list_template);$('#show_template').html(data.show_template);}); } //--> </script> </body> </html>
108wo
phpcms/modules/content/templates/sitemodel_import.tpl.php
PHP
asf20
3,616
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin'); ?> <script type="text/javascript" src="<?php echo JS_PATH?>crop/swfobject.js"></script> <script> // 获取页面上的flash实例。 // @param flashID 这个参数是:flash 的 ID 。本例子的flash ID是 "myFlashID" ,在本页面搜索一下 "myFlashID" 可看到。 function getFlash(flashID) { // 判断浏览器类型 if (navigator.appName.indexOf("Microsoft") != -1) { return window[flashID]; } else { return document[flashID]; } } // flash 上传图片完成时回调的函数。 function uploadComplete(pic) { if(parent.document.getElementById('<?php echo $_GET['input']?>')) { var input = parent.document.getElementById('<?php echo $_GET['input']?>'); } else { var input = parent.right.document.getElementById('<?php echo $_GET['input']?>'); } <?php if (!empty($_GET['preview'])):?> if(parent.document.getElementById('<?php echo $_GET['preview']?>')) { var preview = parent.document.getElementById('<?php echo $_GET['preview']?>'); } else { var preview = parent.right.document.getElementById('<?php echo $_GET['preview']?>'); } <?php else:?> var preview = ''; <?php endif;?> if(pic) { input.value = pic; if (preview) preview.src = pic; } window.top.art.dialog({id:'crop'}).close(); } function uploadfile() { getFlash('myFlashID').upload(); } var swfVersionStr = "10.0.0"; var xiSwfUrlStr = "<?php echo JS_PATH?>crop/images/playerProductInstall.swf"; var flashvars = {}; // 图片地址 flashvars.picurl = "<?php echo $picurl?>"; // 上传地址,使用了 base64 加密 flashvars.uploadurl = "<?php echo base64_encode("index.php?m=attachment&c=attachments&a=crop_upload&module=$module&catid=$catid&file=".urlencode($picurl));?>"; var params = {}; params.quality = "high"; params.bgcolor = "#ffffff"; params.allowscriptaccess = "always"; params.allowfullscreen = "true"; var attributes = {}; attributes.id = "myFlashID"; attributes.name = "myFlashID"; attributes.align = "middle"; swfobject.embedSWF( "<?php echo JS_PATH?>crop/images/Main.swf", "flashContent", "680", "480", swfVersionStr, xiSwfUrlStr, flashvars, params, attributes); <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. --> swfobject.createCSS("#flashContent", "display:block;text-align:left;"); </script> </head> <body> <div id="flashContent"> <p> To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed. </p> <script type="text/javascript"> var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://"); document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='" + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" ); </script> </div> <noscript> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="680" height="480" id="myFlashID"> <param name="movie" value="<?php echo JS_PATH?>crop/images/Main.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="#ffffff" /> <param name="allowScriptAccess" value="always" /> <param name="allowFullScreen" value="true" /> <!--[if !IE]>--> <object type="application/x-shockwave-flash" data="<?php echo JS_PATH?>crop/images/Main.swf" width="680" height="480"> <param name="quality" value="high" /> <param name="bgcolor" value="#ffffff" /> <param name="allowScriptAccess" value="always" /> <param name="allowFullScreen" value="true" /> <!--<![endif]--> <!--[if gte IE 6]>--> <p> Either scripts and active content are not permitted to run or Adobe Flash Player version 10.0.0 or greater is not installed. </p> <!--<![endif]--> <a href="http://www.adobe.com/go/getflashplayer"> <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" /> </a> <!--[if !IE]>--> </object> <!--<![endif]--> </object> </noscript> </body> </html>
108wo
phpcms/modules/content/templates/crop.tpl.php
PHP
asf20
5,038
<?php defined('IN_ADMIN') or exit('No permission resources.');$addbg=1; include $this->admin_tpl('header','admin');?> <script type="text/javascript"> <!-- var charset = '<?php echo CHARSET;?>'; var uploadurl = '<?php echo pc_base::load_config('system','upload_url')?>'; //--> </script> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>content_addtop.js"></script> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>colorpicker.js"></script> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>hotkeys.js"></script> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>cookie.js"></script> <script type="text/javascript">var catid=<?php echo $catid;?></script> <form name="myform" id="myform" action="?m=content&c=content&a=add" method="post" enctype="multipart/form-data"> <div class="addContent"> <div class="crumbs"><?php echo L('add_content_position');?></div> <div class="col-right"> <div class="col-1"> <div class="content pad-6"> <?php if(is_array($forminfos['senior'])) { foreach($forminfos['senior'] as $field=>$info) { if($info['isomnipotent']) continue; if($info['formtype']=='omnipotent') { foreach($forminfos['base'] as $_fm=>$_fm_value) { if($_fm_value['isomnipotent']) { $info['form'] = str_replace('{'.$_fm.'}',$_fm_value['form'],$info['form']); } } foreach($forminfos['senior'] as $_fm=>$_fm_value) { if($_fm_value['isomnipotent']) { $info['form'] = str_replace('{'.$_fm.'}',$_fm_value['form'],$info['form']); } } } ?> <h6><?php if($info['star']){ ?> <font color="red">*</font><?php } ?> <?php echo $info['name']?></h6> <?php echo $info['form']?><?php echo $info['tips']?> <?php } } ?> <?php if($_SESSION['roleid']==1 || $priv_status) {?> <h6><?php echo L('c_status');?></h6> <span class="ib" style="width:90px"><label><input type="radio" name="status" value="99" checked/> <?php echo L('c_publish');?> </label></span> <?php if($workflowid) { ?><label><input type="radio" name="status" value="1" > <?php echo L('c_check');?> </label><?php }?> <?php }?> </div> </div> </div> <div class="col-auto"> <div class="col-1"> <div class="content pad-6"> <table width="100%" cellspacing="0" class="table_form"> <tbody> <?php if(is_array($forminfos['base'])) { foreach($forminfos['base'] as $field=>$info) { if($info['isomnipotent']) continue; if($info['formtype']=='omnipotent') { foreach($forminfos['base'] as $_fm=>$_fm_value) { if($_fm_value['isomnipotent']) { $info['form'] = str_replace('{'.$_fm.'}',$_fm_value['form'],$info['form']); } } foreach($forminfos['senior'] 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> </div> </div> </div> </div> </div> <div class="fixed-bottom"> <div class="fixed-but text-c"> <div class="button"><input value="<?php echo L('save_close');?>" type="submit" name="dosubmit" class="cu" style="width:145px;" onclick="refersh_window()"></div> <div class="button"><input value="<?php echo L('save_continue');?>" type="submit" name="dosubmit_continue" class="cu" style="width:130px;" title="Alt+X" onclick="refersh_window()"></div> <div class="button"><input value="<?php echo L('c_close');?>" type="button" name="close" onclick="refersh_window();close_window();" class="cu" style="width:70px;"></div> </div> </div> </form> </body> </html> <script type="text/javascript"> <!-- //只能放到最下面 $(function(){ $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({id:'check_content_id',content:msg,lock:true,width:'200',height:'50'}, function(){$(obj).focus(); boxid = $(obj).attr('id'); if($('#'+boxid).attr('boxid')!=undefined) { check_content(boxid); } })}}); <?php echo $formValidator;?> /* * 加载禁用外边链接 */ $('#linkurl').attr('disabled',true); $('#islink').attr('checked',false); $('.edit_content').hide(); jQuery(document).bind('keydown', 'Alt+x', function (){close_window();}); }) document.title='<?php echo L('add_content');?>'; self.moveTo(-4, -4); function refersh_window() { setcookie('refersh_time', 1); } //--> </script>
108wo
phpcms/modules/content/templates/content_add.tpl.php
PHP
asf20
4,726
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin'); ?> <div class="pad-10"> <input type="hidden" value="content" name="m"> <input type="hidden" value="content" name="c"> <input type="hidden" value="public_relationlist" name="a"> <input type="hidden" value="<?php echo $modelid;?>" name="modelid"> <fieldset> <legend><?php echo L('select_sitelist');?></legend> <?php foreach($sitelist as $_k=>$_v) { $checked = $_k==$siteid ? 'checked' : ''; echo "<label class='ib' style='width:128px'><input type='radio' name='select_siteid' $checked onclick='change_siteid($_k)'> " .$_v['name']."</label>"; } ?> </fieldset> <div style="width:500px; padding:2px; border:1px solid #d8d8d8; float:left; margin-top:10px; margin-right:10px; overflow:hidden"> <table width="100%" cellspacing="0" class="table-list" > <thead> <tr> <th width="100"><?php echo L('catid');?></th> <th ><?php echo L('catname');?></th> <th width="150" ><?php echo L('select_model_name');?></th> </tr> </thead> <tbody id="load_catgory"> <?php echo $categorys;?> </tbody> </table> </div> <div style="overflow:hidden;_float:left;margin-top:10px;*margin-top:0;_margin-top:0; width:144px"> <fieldset> <legend><?php echo L('category_checked');?></legend> <ul class='list-dot-othors' id='catname'></ul> </fieldset> </div> </div> <style type="text/css"> .line_ff9966,.line_ff9966:hover td{background-color:#FF9966} .line_fbffe4,.line_fbffe4:hover td {background-color:#fbffe4} .list-dot-othors li{float:none; width:auto} </style> <SCRIPT LANGUAGE="JavaScript"> <!-- function select_list(obj,title,id) { var relation_ids = window.top.$('#relation').val(); var sid = 'v'+id; $(obj).attr('class','line_fbffe4'); var str = "<li id='"+sid+"'>·<input type='hidden' name='othor_catid["+id+"]'><span>"+title+"</span><a href='javascript:;' class='close' onclick=\"remove_id('"+sid+"')\"></a></li>"; window.top.$('#add_othors_text').append(str); $('#catname').append(str); if(relation_ids =='' ) { window.top.$('#relation').val(id); } else { relation_ids = relation_ids+'|'+id; window.top.$('#relation').val(relation_ids); } } function change_siteid(siteid) { $("#load_catgory").load("?m=content&c=content&a=public_getsite_categorys&siteid="+siteid); } //移除ID function remove_id(id) { $('#'+id).remove(); window.top.$('#'+id).remove(); } change_siteid(<?php echo $this->siteid;?>); //--> </SCRIPT> </body> </html>
108wo
phpcms/modules/content/templates/add_othors.tpl.php
PHP
asf20
2,706
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin'); ?> <div class="workflow blue"> <div class="col <?php if($steps==1) echo 'off';?>"> <div class="content fillet"> <div class="title"> <div class="fillet"><?php echo L('steps_1');?><span class="o1"></span><span class="o2"></span><span class="o3"></span><span class="o4"></span><span class="line"></span></div> </div> <div class="name"><?php echo $checkadmin1;?></div> <span class="o1"></span><span class="o2"></span><span class="o3"></span><span class="o4"></span> </div> </div> <div class="col <?php if($steps==2) echo 'off';?>" style="display:<?php if($steps<2) echo 'none';?>"> <div class="content fillet"> <div class="title"> <div class="fillet"><?php echo L('steps_2');?><span class="o1"></span><span class="o2"></span><span class="o3"></span><span class="o4"></span><span class="line"></span></div> </div> <div class="name"><?php echo $checkadmin2;?></div> <span class="o1"></span><span class="o2"></span><span class="o3"></span><span class="o4"></span> </div> </div> <div class="col <?php if($steps==3) echo 'off';?>" style="display:<?php if($steps<3) echo 'none';?>"> <div class="content fillet"> <div class="title"> <div class="fillet"><?php echo L('steps_3');?><span class="o1"></span><span class="o2"></span><span class="o3"></span><span class="o4"></span><span class="line"></span></div> </div> <div class="name"><?php echo $checkadmin3;?></div> <span class="o1"></span><span class="o2"></span><span class="o3"></span><span class="o4"></span> </div> </div> <div class="col <?php if($steps==4) echo 'off';?>" style="display:<?php if($steps<4) echo 'none';?>"> <div class="content fillet"> <div class="title"> <div class="fillet"><?php echo L('steps_4');?><span class="o1"></span><span class="o2"></span><span class="o3"></span><span class="o4"></span><span class="line"></span></div> </div> <div class="name"><?php echo $checkadmin4;?></div> <span class="o1"></span><span class="o2"></span><span class="o3"></span><span class="o4"></span> </div> </div> </div> </body> </html>
108wo
phpcms/modules/content/templates/workflow_view.tpl.php
PHP
asf20
2,469
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin');?> <div class="pad-10"> <div class="content-menu ib-a blue line-x"><a href="?m=content&c=content&a=init&catid=46" class=on><em><?php echo L('remove');?></em></a> </div> <div class="bk10"></div> <form action="?m=content&c=content&a=remove" method="post" name="myform"> <div class="table-list"> <table width="100%" cellspacing="0"> <thead> <tr> <th align="center" width="50%"><?php echo L('from_where');?></th> <th align="center" width="50%"><?php echo L('move_to_categorys');?></th> </tr> </thead> <tbody height="200" class="nHover td-line"> <tr> <td align="center" rowspan="6"> <input type="radio" name="fromtype" value="0" checked id="fromtype_1" onclick="if(this.checked){$('#frombox_1').show();$('#frombox_2').hide();}">从指定ID: <input type="radio" name="fromtype" value="1" id="fromtype_2" onclick="if(this.checked){$('#frombox_1').hide();$('#frombox_2').show();}">从指定栏目 <div id="frombox_1" style="display:;"> <textarea name="ids" style="height:280px;width:350px;"><?php echo $ids;?></textarea> <br/> <?php echo L('move_tips');?> </div> <div id="frombox_2" style="display:none;"> <select name="fromid[]" id="fromid" multiple style="height:300px;width:350px;"> <option value='0' style="background:#F1F3F5;color:blue;"><?php echo L('from_category');?></option> <?php echo $source_string;?> </select> <br> <font color="red">Tips:</font><?php echo L('ctrl_source_select');?> </div> </td> </tr> <tr> <td align="center" rowspan="6"><br> <select name="tocatid" id="tocatid" size="2" style="height:300px;width:350px;"> <option value='0' style="background:#F1F3F5;color:blue;"><?php echo L('move_to_categorys');?></option> <?php echo $string;?> </select> </td> </tr> </tbody> </table> </div> <div class="btn"> <input type="submit" class="button" value="<?php echo L('submit');?>" name="dosubmit"/> </div> </form> </div>
108wo
phpcms/modules/content/templates/content_remove.tpl.php
PHP
asf20
2,063
<?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="content" name="m"> <input type="hidden" value="content" name="c"> <input type="hidden" value="public_relationlist" name="a"> <input type="hidden" value="<?php echo $modelid;?>" name="modelid"> <table width="100%" cellspacing="0" class="search-form"> <tbody> <tr> <td align="center"> <div class="explain-col"> <select name="field"> <option value='title' <?php if($_GET['field']=='title') echo 'selected';?>><?php echo L('title');?></option> <option value='keywords' <?php if($_GET['field']=='keywords') echo 'selected';?> ><?php echo L('keywords');?></option> <option value='description' <?php if($_GET['field']=='description') echo 'selected';?>><?php echo L('description');?></option> <option value='id' <?php if($_GET['field']=='id') echo 'selected';?>>ID</option> </select> <?php echo form::select_category('',$catid,'name="catid"',L('please_select_category'),$modelid,0,1);?> <input name="keywords" type="text" value="<?php echo stripslashes($_GET['keywords'])?>" style="width:330px;" class="input-text" /> <input type="submit" name="dosubmit" class="button" value="<?php echo L('search');?>" /> </div> </td> </tr> </tbody> </table> </form> <div class="table-list"> <table width="100%" cellspacing="0" > <thead> <tr> <th ><?php echo L('title');?></th> <th width="100"><?php echo L('belong_category');?></th> <th width="100"><?php echo L('addtime');?></th> </tr> </thead> <tbody> <?php foreach($infos as $r) { ?> <tr onclick="select_list(this,'<?php echo safe_replace($r['title']);?>',<?php echo $r['id'];?>)" class="cu" title="<?php echo L('click_to_select');?>"> <td align='left' ><?php echo $r['title'];?></td> <td align='center'><?php echo $this->categorys[$r['catid']]['catname'];?></td> <td align='center'><?php echo format::date($r['inputtime']);?></td> </tr> <?php }?> </tbody> </table> <div id="pages"><?php echo $pages;?></div> </div> </div> <style type="text/css"> .line_ff9966,.line_ff9966:hover td{ background-color:#FF9966; } .line_fbffe4,.line_fbffe4:hover td { background-color:#fbffe4; } </style> <SCRIPT LANGUAGE="JavaScript"> <!-- function select_list(obj,title,id) { var relation_ids = window.top.$('#relation').val(); var sid = 'v<?php echo $modelid;?>'+id; if($(obj).attr('class')=='line_ff9966' || $(obj).attr('class')==null) { $(obj).attr('class','line_fbffe4'); window.top.$('#'+sid).remove(); if(relation_ids !='' ) { var r_arr = relation_ids.split('|'); var newrelation_ids = ''; $.each(r_arr, function(i, n){ if(n!=id) { if(i==0) { newrelation_ids = n; } else { newrelation_ids = newrelation_ids+'|'+n; } } }); window.top.$('#relation').val(newrelation_ids); } } else { $(obj).attr('class','line_ff9966'); var str = "<li id='"+sid+"'>·<span>"+title+"</span><a href='javascript:;' class='close' onclick=\"remove_relation('"+sid+"',"+id+")\"></a></li>"; window.top.$('#relation_text').append(str); if(relation_ids =='' ) { window.top.$('#relation').val(id); } else { relation_ids = relation_ids+'|'+id; window.top.$('#relation').val(relation_ids); } } } //--> </SCRIPT> </body> </html>
108wo
phpcms/modules/content/templates/relationlist.tpl.php
PHP
asf20
3,596
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin');?> <form name="myform" action="?m=content&c=type_manage&a=listorder" method="post"> <div class="pad_10"> <div class="table-list"> <table width="100%" cellspacing="0" > <thead> <tr> <th width="5%">ID</th> <th width="20%" align="left"><?php echo L('workflow_name');?></th> <th width="20%"><?php echo L('steps');?></th> <th width="10%"><?php echo L('workflow_diagram');?></th> <th width="*"><?php echo L('description');?></th> <th width="30%"><?php echo L('operations_manage');?></th> </tr> </thead> <tbody> <?php $steps[1] = L('steps_1'); $steps[2] = L('steps_2'); $steps[3] = L('steps_3'); $steps[4] = L('steps_4'); foreach($datas as $r) { ?> <tr> <td align="center"><?php echo $r['workflowid']?></td> <td ><?php echo $r['workname']?></td> <td align="center"><?php echo $steps[$r['steps']]?></td> <td align="center"><a href="javascript:view('<?php echo $r['workflowid']?>','<?php echo $r['workname']?>')"><?php echo L('onclick_view');?></a></td> <td ><?php echo $r['description']?></td> <td align="center"><a href="javascript:edit('<?php echo $r['workflowid']?>','<?php echo $r['workname']?>')"><?php echo L('edit');?></a> | <a href="javascript:;" onclick="data_delete(this,'<?php echo $r['workflowid']?>','<?php echo L('confirm',array('message'=>$r['workname']));?>')"><?php echo L('delete')?></a> </td> </tr> <?php } ?> </tbody> </table> </div> </div> <div id="pages"><?php echo $pages;?></div> </div> </form> <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:'<?php echo L('edit_workflow');?>《'+name+'》',id:'edit',iframe:'?m=content&c=workflow&a=edit&workflowid='+id,width:'680',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 view(id, name) { window.top.art.dialog({id:'edit'}).close(); window.top.art.dialog({title:'<?php echo L('workflow_diagram');?>《'+name+'》',id:'edit',iframe:'?m=content&c=workflow&a=view&workflowid='+id,width:'580',height:'300'}, function(){var d = window.top.art.dialog({id:'edit'}).data.iframe;d.document.getElementById('dosubmit').click();return false;}, function(){window.top.art.dialog({id:'edit'}).close()}); } function data_delete(obj,id,name){ window.top.art.dialog({content:name, fixed:true, style:'confirm', id:'data_delete'}, function(){ $.get('?m=content&c=workflow&a=delete&workflowid='+id+'&pc_hash=<?php echo $_SESSION['pc_hash'];?>',function(data){ if(data) { $(obj).parent().parent().fadeOut("slow"); } }) }, function(){}); }; //--> </script> </body> </html>
108wo
phpcms/modules/content/templates/workflow_list.tpl.php
PHP
asf20
2,973
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin');?> <div class="pad-10"> <div class="explain-col"> <?php echo L('html_notice');?> </div> <div class="bk10"></div> <div class="table-list"> <table width="100%" cellspacing="0"> <form action="?m=content&c=create_html&a=show" method="post" name="myform"> <input type="hidden" name="dosubmit" value="1"> <input type="hidden" name="type" value="lastinput"> <thead> <tr> <th align="center" width="150"><?php echo L('according_model');?></th> <th align="center" width="386"><?php echo L('select_category_area');?></th> <th align="center"><?php echo L('select_operate_content');?></th> </tr> </thead> <tbody height="200" class="nHover td-line"> <tr> <td align="center" rowspan="6"> <?php $models = getcache('model','commons'); $model_datas = array(); foreach($models as $_k=>$_v) { if($_v['siteid']!=$this->siteid) continue; $model_datas[$_v['modelid']] = $_v['name']; } echo form::select($model_datas,$modelid,'name="modelid" size="2" style="height:200px;width:130px;" onclick="change_model(this.value)"',L('no_limit_model')); ?> </td> </tr> <tr> <td align="center" rowspan="6"> <select name='catids[]' id='catids' multiple="multiple" style="height:200px;" title="<?php echo L('push_ctrl_to_select');?>"> <option value='0' selected><?php echo L('no_limit_category');?></option> <?php echo $string;?> </select></td> <td><font color="red"><?php echo L('every_time');?> <input type="text" name="pagesize" value="10" size="4"> <?php echo L('information_items');?></font></td> </tr> <tr> <td><?php echo L('update_all');?> <input type="button" name="dosubmit1" value=" <?php echo L('submit_start_update');?> " class="button" onclick="myform.type.value='all';myform.submit();"></td> </tr> <?php if($modelid) { ?> <tr> <td><?php echo L('last_information');?> <input type="text" name="number" value="100" size="5"> <?php echo L('information_items');?><input type="button" class="button" name="dosubmit2" value=" <?php echo L('submit_start_update');?> " onclick="myform.type.value='lastinput';myform.submit();"></td> </tr> <tr> <td><?php echo L('update_time_from');?> <?php echo form::date('fromdate');?> <?php echo L('to');?> <?php echo form::date('todate');?><?php echo L('in_information');?> <input type="button" name="dosubmit3" value=" <?php echo L('submit_start_update');?> " class="button" onclick="myform.type.value='date';myform.submit();"></td> </tr> <tr> <td><?php echo L('update_id_from');?> <input type="text" name="fromid" value="0" size="8"> <?php echo L('to');?> <input type="text" name="toid" size="8"> <?php echo L('in_information');?> <input type="button" class="button" name="dosubmit4" value=" <?php echo L('submit_start_update');?> " onclick="myform.type.value='id';myform.submit();"></td> </tr> <?php } ?> <tr> <td></td> </tr> </tbody> </form> </table> </div> </div> <script language="JavaScript"> <!-- window.top.$('#display_center_id').css('display','none'); function change_model(modelid) { window.location.href='?m=content&c=create_html&a=show&modelid='+modelid+'&pc_hash='+pc_hash; } //--> </script>
108wo
phpcms/modules/content/templates/create_html_show.tpl.php
PHP
asf20
3,327
<?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"}); $("#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=content&c=sitemodel_field&a=public_checkfield&modelid=<?php echo $modelid?>", 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('model_manage');?>--<?php echo $m_r['name'].L('field_manage');?></h2> <div class="content-menu ib-a blue line-x"><a class="add fb" href="?m=content&c=sitemodel_field&a=add&modelid=<?php echo $modelid?>&menuid=<?php echo $_GET['menuid']?>"><em><?php echo L('add_field');?></em></a>  <a href="?m=content&c=sitemodel_field&a=init&modelid=<?php echo $modelid?>&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=content&c=sitemodel_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><strong><?php echo L('issystem_field');?></strong></th> <td> <input type="hidden" name="issystem" id="issystem" value="0"> <input type="radio" name="info[issystem]" id="field_basic_table1" value="1" onclick="$('#issystem').val('1');"> <?php echo L('yes');?> <input type="radio" id="field_basic_table0" name="info[issystem]" value="0" onclick="$('#issystem').val('0');" checked> <?php echo L('no');?></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('unique');?></strong></th> <td><input type="radio" name="info[isunique]" value="1" id="field_allow_isunique1"> <?php echo L('yes');?> <input type="radio" name="info[isunique]" value="0" id="field_allow_isunique0" checked> <?php echo L('no');?></td> </tr> <tr> <th><strong><?php echo L('basic_field');?></strong><br /><?php echo L('basic_field_tips');?></th> <td><input type="radio" name="info[isbase]" value="1" checked> <?php echo L('yes');?> <input type="radio" name="info[isbase]" value="0"> <?php echo L('no');?> </td> </tr> <tr> <th><strong><?php echo L('as_search_field');?></strong></th> <td><input type="radio" name="info[issearch]" value="1" id="field_allow_search1"> <?php echo L('yes');?> <input type="radio" name="info[issearch]" value="0" id="field_allow_search0" checked> <?php echo L('no');?></td> </tr> <tr> <th><strong><?php echo L('allow_contributor');?></strong></th> <td><input type="radio" name="info[isadd]" value="1" checked /> <?php echo L('yes');?> <input type="radio" name="info[isadd]" value="0" /> <?php echo L('no');?></td> </tr> <tr> <th><strong><?php echo L('as_fulltext_field');?></strong></th> <td><input type="radio" name="info[isfulltext]" value="1" id="field_allow_fulltext1" checked/> <?php echo L('yes');?> <input type="radio" name="info[isfulltext]" value="0" id="field_allow_fulltext0" /> <?php echo L('no');?></td> </tr> <tr> <th><strong><?php echo L('as_omnipotent_field');?></strong><br><?php echo L('as_omnipotent_field_tips');?></th> <td><input type="radio" name="info[isomnipotent]" value="1" /> <?php echo L('yes');?> <input type="radio" name="info[isomnipotent]" value="0" checked/> <?php echo L('no');?></td> </tr> <tr> <th><strong><?php echo L('as_postion_info');?></strong></th> <td><input type="radio" name="info[isposition]" value="1" /> <?php echo L('yes');?> <input type="radio" name="info[isposition]" value="0" checked/> <?php echo L('no');?></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> <tr> <th><strong><?php echo L('disabled_role_field');?></strong></th> <td><?php echo form::checkbox($roles,'','name="unsetroleids[]" id="unsetroleids"',0,'100');?> </td> </tr> </table> </div> <div class="bk15"></div> <input name="info[modelid]" type="hidden" value="<?php echo $modelid?>"> <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'); $.each( ['<?php echo implode("','",$att_css_js);?>'], function(i, n){ if(fieldtype==n) { $('#formattribute').css('display',''); $('#css').css('display',''); } }); $.getJSON("?m=content&c=sitemodel_field&a=public_field_setting&fieldtype="+fieldtype, function(data){ if(data.field_basic_table=='1') { $('#field_basic_table0').attr("disabled",false); $('#field_basic_table1').attr("disabled",false); } else { $('#field_basic_table0').attr("checked",true); $('#field_basic_table0').attr("disabled",true); $('#field_basic_table1').attr("disabled",true); } 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_fulltext=='1') { $('#field_allow_fulltext0').attr("disabled",false); $('#field_allow_fulltext1').attr("disabled",false); } else { $('#field_allow_fulltext0').attr("checked",true); $('#field_allow_fulltext0').attr("disabled",true); $('#field_allow_fulltext1').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/content/templates/sitemodel_field_add.tpl.php
PHP
asf20
10,848
<?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();})}}); $("#workname").formValidator({onshow:"<?php echo L("input").L('workflow_name')?>",onfocus:"<?php echo L("input").L('workflow_name')?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('workflow_name')?>"}); }) //--> </script> <div class="pad-lr-10"> <form action="?m=content&c=workflow&a=edit" method="post" id="myform"> <table width="100%" class="table_form"> <tr> <th width="150"><?php echo L('workflow_name')?>:</th> <td class="y-bg"><input type="text" class="input-text" name="info[workname]" id="workname" size="30" value="<?php echo $workname;?>"/></td> </tr> <tr> <th><?php echo L('description')?>:</th> <td class="y-bg"><textarea name="info[description]" maxlength="255" style="width:300px;height:60px;"><?php echo $description;?></textarea></td> </tr> <tr> <th><?php echo L('steps')?>:</th> <td class="y-bg"> <select name="info[steps]" onchange="select_steps(this.value)"> <option value='1' <?php if($steps==1) echo 'selected';?>><?php echo L('steps_1');?></option> <option value='2' <?php if($steps==2) echo 'selected';?>><?php echo L('steps_2');?></option> <option value='3' <?php if($steps==3) echo 'selected';?>><?php echo L('steps_3');?></option> <option value='4' <?php if($steps==4) echo 'selected';?>><?php echo L('steps_4');?></option> </select></td> </tr> <tr id="step1"> <th><?php echo L('steps_1');?> <?php echo L('admin_users')?>:</th> <td class="y-bg"> <?php echo form::checkbox($admin_data,$checkadmin1,'name="checkadmin1[]"','',120);?> </td> </tr> <tr id="step2" style="display:<?php if($steps<2) echo 'none';?>"> <th><?php echo L('steps_2');?> <?php echo L('admin_users')?>:</th> <td class="y-bg"> <?php echo form::checkbox($admin_data,$checkadmin2,'name="checkadmin2[]"','',120);?> </td> </tr> <tr id="step3" style="display:<?php if($steps<3) echo 'none';?>"> <th><?php echo L('steps_3');?> <?php echo L('admin_users')?>:</th> <td class="y-bg"> <?php echo form::checkbox($admin_data,$checkadmin3,'name="checkadmin3[]"','',120);?> </td> </tr> <tr id="step4" style="display:<?php if($steps<4) echo 'none';?>"> <th><?php echo L('steps_4');?> <?php echo L('admin_users')?>:</th> <td class="y-bg"> <?php echo form::checkbox($admin_data,$checkadmin4,'name="checkadmin4[]"','',120);?> </td> </tr> <tr> <th><B><?php echo L('nocheck_users')?></B>:</th> <td class="y-bg"> <?php echo form::checkbox($admin_data,$nocheck_users,'name="nocheck_users[]"','',120);?> </td> </tr> <tr> <th><?php echo L('checkstatus_flag')?>:</th> <td class="y-bg"> <input type="radio" name="info[flag]" value="1" <?php if($flag) echo 'checked';?>> 是 <input type="radio" name="info[flag]" value="0" <?php if(!$flag) echo 'checked';?>> 否 </td> </tr> </table> <div class="bk15"></div> <input type="hidden" name="workflowid" value="<?php echo $workflowid?>"/> <input type="submit" name="dosubmit" id="dosubmit" class="dialog" value="1" /> </form> </div> </body> </html> <SCRIPT LANGUAGE="JavaScript"> <!-- function select_steps(stepsid) { for(i=4;i>1;i--) { if(stepsid>=i) { $('#step'+i).css('display',''); } else { $('#step'+i).css('display','none'); } } } //--> </SCRIPT>
108wo
phpcms/modules/content/templates/workflow_edit.tpl.php
PHP
asf20
3,751
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header','admin');?> <style type="text/css"> html,body{ background:#e2e9ea} </style> <script type="text/javascript"> <!-- var charset = '<?php echo CHARSET;?>'; var uploadurl = '<?php echo pc_base::load_config('system','upload_url')?>'; //--> </script> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>content_addtop.js"></script> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>colorpicker.js"></script> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>hotkeys.js"></script> <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>cookie.js"></script> <script type="text/javascript">var catid=<?php echo $catid;?></script> <form name="myform" id="myform" action="?m=content&c=content&a=edit" method="post" enctype="multipart/form-data"> <div class="addContent"> <div class="crumbs"><?php echo L('edit_content_position');?></div> <div class="col-right"> <div class="col-1"> <div class="content pad-6"> <?php if(is_array($forminfos['senior'])) { foreach($forminfos['senior'] as $field=>$info) { if($info['isomnipotent']) continue; if($info['formtype']=='omnipotent') { foreach($forminfos['base'] as $_fm=>$_fm_value) { if($_fm_value['isomnipotent']) { $info['form'] = str_replace('{'.$_fm.'}',$_fm_value['form'],$info['form']); } } foreach($forminfos['senior'] as $_fm=>$_fm_value) { if($_fm_value['isomnipotent']) { $info['form'] = str_replace('{'.$_fm.'}',$_fm_value['form'],$info['form']); } } } ?> <h6><?php if($info['star']){ ?> <font color="red">*</font><?php } ?> <?php echo $info['name']?></h6> <?php echo $info['form']?><?php echo $info['tips']?> <?php } } ?> </div> </div> </div> <div class="col-auto"> <div class="col-1"> <div class="content pad-6"> <table width="100%" cellspacing="0" class="table_form"> <tbody> <?php if(is_array($forminfos['base'])) { foreach($forminfos['base'] as $field=>$info) { if($info['isomnipotent']) continue; if($info['formtype']=='omnipotent') { foreach($forminfos['base'] as $_fm=>$_fm_value) { if($_fm_value['isomnipotent']) { $info['form'] = str_replace('{'.$_fm.'}',$_fm_value['form'],$info['form']); } } foreach($forminfos['senior'] 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> </div> </div> </div> </div> </div> <div class="fixed-bottom"> <div class="fixed-but text-c"> <div class="button"> <input value="<?php if($r['upgrade']) echo $r['url'];?>" type="hidden" name="upgrade"> <input value="<?php echo $id;?>" type="hidden" name="id"><input value="<?php echo L('save_close');?>" type="submit" name="dosubmit" class="cu" onclick="refersh_window()"></div> <div class="button"><input value="<?php echo L('save_continue');?>" type="submit" name="dosubmit_continue" class="cu" onclick="refersh_window()"></div> <div class="button"><input value="<?php echo L('c_close');?>" type="button" name="close" onclick="refersh_window();close_window();" class="cu" title="Alt+X"></div> </div> </div> </form> </body> </html> <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(){$(obj).focus(); boxid = $(obj).attr('id'); if($('#'+boxid).attr('boxid')!=undefined) { check_content(boxid); } })}}); <?php echo $formValidator;?> /* * 加载禁用外边链接 */ jQuery(document).bind('keydown', 'Alt+x', function (){close_window();}); }) document.title='<?php echo L('edit_content').addslashes($data['title']);?>'; self.moveTo(0, 0); function refersh_window() { setcookie('refersh_time', 1); } //--> </script>
108wo
phpcms/modules/content/templates/content_edit.tpl.php
PHP
asf20
4,393
<?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('type_name_tips')?>",onfocus:"<?php echo L("input").L('type_name')?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('type_name')?>"}); }) //--> </script> <form action="?m=content&c=type_manage&a=add" method="post" id="myform"> <div style="padding:6px 3px"> <div class="col-2 col-left mr6" style="width:440px"> <h6><img src="<?php echo IMG_PATH;?>icon/sitemap-application-blue.png" width="16" height="16" /> <?php echo L('add_type');?></h6> <table width="100%" class="table_form"> <tr> <th width="80"><?php echo L('type_name')?>:</th> <td class="y-bg"><textarea name="info[name]" rows="2" cols="20" id="name" class="inputtext" style="height:80px;width:300px;"></textarea></td> </tr> <tr> <th><?php echo L('description')?>:</th> <td class="y-bg"><textarea name="info[description]" maxlength="255" style="width:300px;height:60px;"></textarea></td> </tr> </table> <div class="bk15"></div> <input type="submit" class="dialog" id="dosubmit" name="dosubmit" value="<?php echo L('submit');?>" /> </div> <div class="col-2 col-auto"> <div class="content" style="padding:1px;overflow-x:hidden;overflow-y:auto;height:480px;"> <table width="100%" class="table-list"> <thead> <tr> <th width="25"><input type="checkbox" value="" id="check_box" onclick="selectall('ids[]');" title="<?php echo L('selected_all');?>"></th><th align="left"><?php echo L('catname');?></th> </tr> </thead> <tbody> <?php echo $categorys;?> </tbody> </table> </div> </div> </div> </form> </body> </html>
108wo
phpcms/modules/content/templates/type_add.tpl.php
PHP
asf20
2,094
<?php defined('IN_PHPCMS') or exit('No permission resources.'); //模型缓存路径 define('CACHE_MODEL_PATH',CACHE_PATH.'caches_model'.DIRECTORY_SEPARATOR.'caches_data'.DIRECTORY_SEPARATOR); pc_base::load_app_func('util','content'); class MY_index { private $db; function __construct() { $this->db = pc_base::load_model('content_model'); $this->_userid = param::get_cookie('_userid'); $this->_username = param::get_cookie('_username'); $this->_groupid = param::get_cookie('_groupid'); } /** * 重写phpcms默认方式,未登录则显示登录页面,已登录显示列表页面 * Enter description here ... */ public function init() { //eddy start if(isset($_GET['siteid'])) { $siteid = intval($_GET['siteid']); } else { $siteid = 1; } if ($this->_userid > 0) { $this->lists(); } else { $setting = pc_base::load_config('system'); $forward = isset($_GET['forward']) && trim($_GET['forward']) ? urlencode($_GET['forward']) : ''; if(!empty($setting['connect_enable'])) { $snda_res = $this->_snda_get_appid(); $appid = $snda_res['appid']; $secretkey = $snda_res['secretkey']; $sid = md5("appArea=0appId=".$appid."service=".urlencode(APP_PATH.'index.php?m=member&c=index&a=public_snda_login&forward='.$forward).$secretkey); $sndaurl = "https://cas.sdo.com/cas/login?gateway=true&service=".urlencode(APP_PATH.'index.php?m=member&c=index&a=public_snda_login&forward='.$forward)."&appId=".$appid."&appArea=0&sid=".$sid; } $siteinfo = siteinfo($siteid); include template('member', 'login'); } //eddy end /*if(isset($_GET['siteid'])) { $siteid = intval($_GET['siteid']); } else { $siteid = 1; } $siteid = $GLOBALS['siteid'] = max($siteid,1); define('SITEID', $siteid); $_userid = $this->_userid; $_username = $this->_username; $_groupid = $this->_groupid; //SEO $SEO = seo($siteid); $sitelist = getcache('sitelist','commons'); $default_style = $sitelist[$siteid]['default_style']; $CATEGORYS = getcache('category_content_'.$siteid,'commons'); include template('content','index',$default_style);*/ } /** * eddy * 获取已申请的appid和secretkey,默认appid为200037400 */ private function _snda_get_appid() { $snda_res = pc_base::load_config('snda', 'snda_status'); if(strstr($snda_res, '|')) { $snda_res_arr = explode('|', $snda_res); $appid = isset($snda_res_arr[0]) ? $snda_res_arr[0] : ''; $secretkey = isset($snda_res_arr[1]) ? $snda_res_arr[1] : ''; } else { $appid = 200037400; $secretkey = ''; } return array('appid'=>$appid, 'secretkey'=>$secretkey); } //内容页 public function show() { $catid = intval($_GET['catid']); $id = intval($_GET['id']); if(!$catid || !$id) showmessage(L('information_does_not_exist'),'blank'); $_userid = $this->_userid; $_username = $this->_username; $_groupid = $this->_groupid; $page = intval($_GET['page']); $page = max($page,1); $siteids = getcache('category_content','commons'); $siteid = $siteids[$catid]; $CATEGORYS = getcache('category_content_'.$siteid,'commons'); if(!isset($CATEGORYS[$catid]) || $CATEGORYS[$catid]['type']!=0) showmessage(L('information_does_not_exist'),'blank'); $this->category = $CAT = $CATEGORYS[$catid]; $this->category_setting = $CAT['setting'] = string2array($this->category['setting']); $siteid = $GLOBALS['siteid'] = $CAT['siteid']; $MODEL = getcache('model','commons'); $modelid = $CAT['modelid']; $tablename = $this->db->table_name = $this->db->db_tablepre.$MODEL[$modelid]['tablename']; $r = $this->db->get_one(array('id'=>$id)); if(!$r || $r['status'] != 99) showmessage(L('info_does_not_exists'),'blank'); $this->db->table_name = $tablename.'_data'; $r2 = $this->db->get_one(array('id'=>$id)); $rs = $r2 ? array_merge($r,$r2) : $r; //再次重新赋值,以数据库为准 $catid = $CATEGORYS[$r['catid']]['catid']; $modelid = $CATEGORYS[$catid]['modelid']; require_once CACHE_MODEL_PATH.'content_output.class.php'; $content_output = new content_output($modelid,$catid,$CATEGORYS); $data = $content_output->get($rs); extract($data); //检查文章会员组权限 if($groupids_view && is_array($groupids_view)) { $_groupid = param::get_cookie('_groupid'); $_groupid = intval($_groupid); if(!$_groupid) { $forward = urlencode(get_url()); showmessage(L('login_website'),APP_PATH.'index.php?m=member&c=index&a=login&forward='.$forward); } if(!in_array($_groupid,$groupids_view)) showmessage(L('no_priv')); } else { //根据栏目访问权限判断权限 $_priv_data = $this->_category_priv($catid); if($_priv_data=='-1') { $forward = urlencode(get_url()); showmessage(L('login_website'),APP_PATH.'index.php?m=member&c=index&a=login&forward='.$forward); } elseif($_priv_data=='-2') { showmessage(L('no_priv')); } } if(module_exists('comment')) { $allow_comment = isset($allow_comment) ? $allow_comment : 1; } else { $allow_comment = 0; } //阅读收费 类型 $paytype = $rs['paytype']; $readpoint = $rs['readpoint']; $allow_visitor = 1; if($readpoint || $this->category_setting['defaultchargepoint']) { if(!$readpoint) { $readpoint = $this->category_setting['defaultchargepoint']; $paytype = $this->category_setting['paytype']; } //检查是否支付过 $allow_visitor = self::_check_payment($catid.'_'.$id,$paytype); if(!$allow_visitor) { $http_referer = urlencode(get_url()); $allow_visitor = sys_auth($catid.'_'.$id.'|'.$readpoint.'|'.$paytype).'&http_referer='.$http_referer; } else { $allow_visitor = 1; } } //最顶级栏目ID $arrparentid = explode(',', $CAT['arrparentid']); $top_parentid = $arrparentid[1] ? $arrparentid[1] : $catid; $template = $template ? $template : $CAT['setting']['show_template']; if(!$template) $template = 'show'; //SEO $seo_keywords = ''; if(!empty($keywords)) $seo_keywords = implode(',',$keywords); $SEO = seo($siteid, $catid, $title, $description, $seo_keywords); define('STYLE',$CAT['setting']['template_list']); if(isset($rs['paginationtype'])) { $paginationtype = $rs['paginationtype']; $maxcharperpage = $rs['maxcharperpage']; } $pages = $titles = ''; if($rs['paginationtype']==1) { //自动分页 if($maxcharperpage < 10) $maxcharperpage = 500; $contentpage = pc_base::load_app_class('contentpage'); $content = $contentpage->get_data($content,$maxcharperpage); } if($rs['paginationtype']!=0) { //手动分页 $CONTENT_POS = strpos($content, '[page]'); if($CONTENT_POS !== false) { $this->url = pc_base::load_app_class('url', 'content'); $contents = array_filter(explode('[page]', $content)); $pagenumber = count($contents); if (strpos($content, '[/page]')!==false && ($CONTENT_POS<7)) { $pagenumber--; } for($i=1; $i<=$pagenumber; $i++) { $pageurls[$i] = $this->url->show($id, $i, $catid, $rs['inputtime']); } $END_POS = strpos($content, '[/page]'); if($END_POS !== false) { if($CONTENT_POS>7) { $content = '[page]'.$title.'[/page]'.$content; } if(preg_match_all("|\[page\](.*)\[/page\]|U", $content, $m, PREG_PATTERN_ORDER)) { foreach($m[1] as $k=>$v) { $p = $k+1; $titles[$p]['title'] = strip_tags($v); $titles[$p]['url'] = $pageurls[$p][0]; } } } //当不存在 [/page]时,则使用下面分页 $pages = content_pages($pagenumber,$page, $pageurls); //判断[page]出现的位置是否在第一位 if($CONTENT_POS<7) { $content = $contents[$page]; } else { if ($page==1 && !empty($titles)) { $content = $title.'[/page]'.$contents[$page-1]; } else { $content = $contents[$page-1]; } } if($titles) { list($title, $content) = explode('[/page]', $content); $content = trim($content); if(strpos($content,'</p>')===0) { $content = '<p>'.$content; } if(stripos($content,'<p>')===0) { $content = $content.'</p>'; } } } } $this->db->table_name = $tablename; //上一页 $previous_page = $this->db->get_one("`catid` = '$catid' AND `id`<'$id' AND `status`=99",'*','id DESC'); //下一页 $next_page = $this->db->get_one("`catid`= '$catid' AND `id`>'$id' AND `status`=99"); if(empty($previous_page)) { $previous_page = array('title'=>L('first_page'), 'thumb'=>IMG_PATH.'nopic_small.gif', 'url'=>'javascript:alert(\''.L('first_page').'\');'); } if(empty($next_page)) { $next_page = array('title'=>L('last_page'), 'thumb'=>IMG_PATH.'nopic_small.gif', 'url'=>'javascript:alert(\''.L('last_page').'\');'); } include template('content',$template); } //列表页 public function lists() { //eddy 获取默认栏目ID //$catid = intval($_GET['catid']); if (!isset($_GET['catid']) || !intval($_GET['catid'])) { //$cat_db = pc_base::load_model('category_model'); //$level1_cats = $cat_db->select(array('parentid'=>TOP_PRODUCT_CATID, 'ismenu'=>1), 'catid', '1', 'listorder ASC'); //$catid = $level1_cats[0]['catid']; $catid = 17; } else { $catid = intval($_GET['catid']); } //eddy end $_priv_data = $this->_category_priv($catid); if($_priv_data=='-1') { $forward = urlencode(get_url()); showmessage(L('login_website'),APP_PATH.'index.php?m=member&c=index&a=login&forward='.$forward); } elseif($_priv_data=='-2') { showmessage(L('no_priv')); } $_userid = $this->_userid; $_username = $this->_username; $_groupid = $this->_groupid; if(!$catid) showmessage(L('category_not_exists'),'blank'); $siteids = getcache('category_content','commons'); $siteid = $siteids[$catid]; $CATEGORYS = getcache('category_content_'.$siteid,'commons'); if(!isset($CATEGORYS[$catid])) showmessage(L('category_not_exists'),'blank'); $CAT = $CATEGORYS[$catid]; $siteid = $GLOBALS['siteid'] = $CAT['siteid']; extract($CAT); $setting = string2array($setting); //SEO if(!$setting['meta_title']) $setting['meta_title'] = $catname; $SEO = seo($siteid, '',$setting['meta_title'],$setting['meta_description'],$setting['meta_keywords']); define('STYLE',$setting['template_list']); $page = $_GET['page']; $template = $setting['category_template'] ? $setting['category_template'] : 'category'; $template_list = $setting['list_template'] ? $setting['list_template'] : 'list'; if($type==0) { $template = $child ? $template : $template_list; $arrparentid = explode(',', $arrparentid); $top_parentid = $arrparentid[1] ? $arrparentid[1] : $catid; $array_child = array(); $self_array = explode(',', $arrchildid); //获取一级栏目ids foreach ($self_array as $arr) { if($arr!=$catid && $CATEGORYS[$arr][parentid]==$catid) { $array_child[] = $arr; } } $arrchildid = implode(',', $array_child); //URL规则 $urlrules = getcache('urlrules','commons'); $urlrules = str_replace('|', '~',$urlrules[$category_ruleid]); $tmp_urls = explode('~',$urlrules); $tmp_urls = isset($tmp_urls[1]) ? $tmp_urls[1] : $tmp_urls[0]; preg_match_all('/{\$([a-z0-9_]+)}/i',$tmp_urls,$_urls); if(!empty($_urls[1])) { foreach($_urls[1] as $_v) { $GLOBALS['URL_ARRAY'][$_v] = $_GET[$_v]; } } define('URLRULE', $urlrules); $GLOBALS['URL_ARRAY']['categorydir'] = $categorydir; $GLOBALS['URL_ARRAY']['catdir'] = $catdir; $GLOBALS['URL_ARRAY']['catid'] = $catid; //eddy start $memberModel = pc_base::load_model('member_model'); $memberinfo = $memberModel->get_one(array('userid'=>$_userid)); //----eddy bid $brand = $brandClasses = ''; if (isset($_GET['bid']) && $_GET['bid'] > 0) { $brand_db = pc_base::load_model('brand_model'); $brand = $brand_db->get_one(array('id'=>$_GET['bid'])); $brand_ids = $brand['id']; //获取分类列表 if ($brand['parentid'] == 0) { $parent_brand = $brand; $brandClasses = $brand_db->select(array('parentid'=>$brand['id']), 'id,name'); foreach ($brandClasses AS $v) { if ($v['id']!=$_GET['bid']) { $brand_ids .= ','.$v['id']; } } } else { $parent_brand = $brand_db->get_one(array('id'=>$brand['parentid'])); $brandClasses = $brand_db->select(array('parentid'=>$parent_brand['id']), 'id,name'); } } //新增 获取内容列表 -- start $content_tag = pc_base::load_app_class("content_tag", "content"); if (method_exists($content_tag, 'lists')) { if (!$_GET['num']) { $pagesize = 20; } else { $pagesize = intval($_GET['num']) ? intval($_GET['num']) : 20; $cookie_page_num = param::get_cookie('page_num'); if($cookie_page_num && $cookie_page_num!=$pagesize) { $page = 1; } param::set_cookie('page_num', $pagesize); } if ($_GET['sortkey']) { if ($_GET['sortkey']!=param::get_cookie('sortkey')) { $page = 1; } param::set_cookie('sortkey', $_GET['sortkey']); } //排序 $order = ''; switch ($_GET['sortkey']) { case 'ordernum': $order = '`ordernum` DESC'; break; case 'viewnum': $order = '`viewnum` DESC'; break; case 'goodnum': $order = '`goodnum` DESC, `badnum` ASC'; break; default: $order = '`updatetime` DESC'; } $page = intval($page) ? intval($page) : 1; if($page<=0){ $page=1; } $offset = ($page - 1) * $pagesize; $content_total = $content_tag->count(array('catid'=>$catid,'limit'=>$offset.",".$pagesize,'action'=>'lists','brand_ids'=>$brand_ids)); $product_pages = pages($content_total, $page, $pagesize, $urlrule); $product_data = $content_tag->lists(array('catid'=>$catid,'limit'=>$offset.",".$pagesize,'action'=>'lists','order' => $order,'brand_ids'=>$brand_ids)); } //-----------end include template('content',$template); } else { //单网页 $this->page_db = pc_base::load_model('page_model'); $r = $this->page_db->get_one(array('catid'=>$catid)); if($r) extract($r); $template = $setting['page_template'] ? $setting['page_template'] : 'page'; $arrchild_arr = $CATEGORYS[$parentid]['arrchildid']; if($arrchild_arr=='') $arrchild_arr = $CATEGORYS[$catid]['arrchildid']; $arrchild_arr = explode(',',$arrchild_arr); array_shift($arrchild_arr); $keywords = $keywords ? $keywords : $setting['meta_keywords']; $SEO = seo($siteid, 0, $title,$setting['meta_description'],$keywords); include template('content',$template); } } //JSON 输出 public function json_list() { if($_GET['type']=='keyword' && $_GET['modelid'] && $_GET['keywords']) { //根据关键字搜索 $modelid = intval($_GET['modelid']); $id = intval($_GET['id']); $MODEL = getcache('model','commons'); if(isset($MODEL[$modelid])) { $keywords = safe_replace(htmlspecialchars($_GET['keywords'])); $keywords = addslashes(iconv('utf-8','gbk',$keywords)); $this->db->set_model($modelid); $result = $this->db->select("keywords LIKE '%$keywords%'",'id,title,url',10); if(!empty($result)) { $data = array(); foreach($result as $rs) { if($rs['id']==$id) continue; if(CHARSET=='gbk') { foreach($rs as $key=>$r) { $rs[$key] = iconv('gbk','utf-8',$r); } } $data[] = $rs; } if(count($data)==0) exit('0'); echo json_encode($data); } else { //没有数据 exit('0'); } } } } /** * 检查支付状态 */ protected function _check_payment($flag,$paytype) { $_userid = $this->_userid; $_username = $this->_username; if(!$_userid) return false; pc_base::load_app_class('spend','pay',0); $setting = $this->category_setting; $repeatchargedays = intval($setting['repeatchargedays']); if($repeatchargedays) { $fromtime = SYS_TIME - 86400 * $repeatchargedays; $r = spend::spend_time($_userid,$fromtime,$flag); if($r['id']) return true; } return false; } /** * 检查阅读权限 * */ protected function _category_priv($catid) { $catid = intval($catid); if(!$catid) return '-2'; $_groupid = $this->_groupid; $_groupid = intval($_groupid); if($_groupid==0) $_groupid = 8; $this->category_priv_db = pc_base::load_model('category_priv_model'); $result = $this->category_priv_db->select(array('catid'=>$catid,'is_admin'=>0,'action'=>'visit')); if($result) { if(!$_groupid) return '-1'; foreach($result as $r) { if($r['roleid'] == $_groupid) return '1'; } return '-2'; } else { return '1'; } } /** * 点评 eddy */ function ajax_update() { $modelid = intval($_GET['modelid']); $id = intval($_GET['id']); $this->db->set_model($modelid); switch($_GET['t']) { case 'getKeywords': $data = array(); $product = $this->db->get_one(array('id'=>$id), 'id,keywords,bids,catid'); if (!$product) { //如果不存在此产品 die("false"); } $product['keywords'] = empty($product['keywords']) ? '' : explode(',', $product['keywords']); //关联供应商/设计师 $CATEGORYS = getcache('category_content_1','commons'); $cat = $CATEGORYS[$product['catid']]; //品牌信息 $bid = (empty($product['bids']) ? '' : intval($product['bids'])); if ($bid) { $brand_db = pc_base::load_model('brand_model'); $top_brand = $brand = $brand_db->get_one(array('id'=>$bid), 'id,userid,pcompanyname,parentid'); if ($brand['parentid']>0) { $top_brand = $brand_db->get_one(array('id'=>$brand['parentid']), 'id,userid,pcompanyname,parentid'); } } if(isset($top_brand['userid']) && $top_brand['userid'] > 0) { $member_model = pc_base::load_model('member_model'); $supplier = $member_model->get_one(array('userid'=>$top_brand['userid'])); $member_model->set_model($supplier['modelid']); $supplier = array_merge($supplier, $member_model->get_one(array('userid'=>$top_brand['userid']))); if($supplier['vip'] > 0 && $supplier['overduedate'] > SYS_TIME) { $data['companyname'] = (!empty($top_brand['pcompanyname']) ? $top_brand['pcompanyname'] : $supplier['companyname']); if ($top_bid) { $data['caturl'] = $cat['url'].'?bid='.$top_bid; } } } //更新查看次数 $this->db->query('UPDATE `'.$this->db->table_name.'` SET viewnum=viewnum+1 WHERE id='.$id); $data['keywords'] = $product['keywords']; echo json_encode($data); exit; case 'keywords': //关键词 $keywords = new_addslashes(trim($_GET['keywords'])); if (empty($keywords)) die(false); $product = $this->db->get_one(array('id'=>$id)); $product['keywords'] = str_replace(array(',', ','), array(' ', ' '), $product['keywords']); $arr_keywords = empty($product['keywords']) ? array() : explode(' ', $product['keywords']); if (!in_array($keywords, $arr_keywords)) { //更新产品表 $arr_keywords[] = $keywords; $this->db->update(array('keywords'=>implode(',', $arr_keywords)), array('id'=>$product['id'])); //更新tag表 $this->db_tags = pc_base::load_model('tags_model'); $this->db_tags_content = pc_base::load_model('tags_content_model'); $sql = ''; foreach($arr_keywords as $key){ if(!$this->db_tags_content->get_one("`tag`='$key' AND `contentid` = $id AND `catid` =$product[catid] ", 'contentid')){ if($this->db_tags->get_one("`tag`='$key'", 'tagid')){ $this->db_tags->query("UPDATE `".$this->db_tags->db_tablepre."tags` SET `usetimes`=usetimes+1 WHERE tag='$key'"); }else{ $this->db_tags->query("INSERT INTO `".$this->db_tags->db_tablepre."tags`(`tag`,`usetimes`,`lastusetime`,`lasthittime`)VALUES('$key',1,".SYS_TIME.",".SYS_TIME.")"); } $sql .= ",('$key','".$product[url]."','$product[title]',1,$modelid,$product[id],$product[catid],".SYS_TIME.")\n"; } } if($sql){ $sql = "INSERT INTO `".$this->db_tags_content->db_tablepre."tags_content` (`tag`,`url`,`title`,`siteid`,`modelid`,`contentid`,`catid`,`updatetime`) VALUES ".substr($sql, 1); $this->db_tags->query($sql); } } die(true); case 'good': //好评 echo $this->db->query('UPDATE `'.$this->db->table_name.'` SET goodnum=goodnum+1 WHERE id='.$id); exit; case 'bad': //坏评 echo $this->db->query('UPDATE `'.$this->db->table_name.'` SET badnum=badnum+1 WHERE id='.$id); exit; case 'getmyhelp': $data = array(); $product = $this->db->get_one(array('id'=>$id), 'id,bids,catid'); if (!$product) { //如果不存在此产品 die("false"); } $myhelp_db = pc_base::load_model('myhelp_model'); $data['myhelp_list'] = $myhelp_db->select(array('productid'=>$id), 'id,productid,title,username,modelid,inputtime,hits', 5, 'inputtime DESC'); if (is_array($data['myhelp_list'])) { foreach ($data['myhelp_list'] AS &$v) { $v['inputtime'] = date('m-d', $v['inputtime']); } } //关联供应商/设计师 $CATEGORYS = getcache('category_content_1','commons'); $cat = $CATEGORYS[$product['catid']]; //品牌信息 $bid = (empty($product['bids']) ? '' : intval($product['bids'])); if ($bid) { $brand_db = pc_base::load_model('brand_model'); $top_brand = $brand = $brand_db->get_one(array('id'=>$bid), 'id,userid,pcompanyname,parentid'); if ($brand['parentid']>0) { $top_brand = $brand_db->get_one(array('id'=>$brand['parentid']), 'id,userid,pcompanyname,parentid'); } } if(isset($top_brand['userid']) && $top_brand['userid'] > 0) { $member_model = pc_base::load_model('member_model'); $supplier = $member_model->get_one(array('userid'=>$top_brand['userid'])); $member_model->set_model($supplier['modelid']); $supplier = array_merge($supplier, $member_model->get_one(array('userid'=>$top_brand['userid']))); if($supplier['vip'] > 0 && $supplier['overduedate'] > SYS_TIME) { $data['companyname'] = (!empty($top_brand['pcompanyname']) ? $top_brand['pcompanyname'] : $supplier['companyname']); if ($top_bid) { $data['caturl'] = $cat['url'].'?bid='.$top_bid; } } } //更新查看次数 $this->db->query('UPDATE `'.$this->db->table_name.'` SET viewnum=viewnum+1 WHERE id='.$id); echo json_encode($data); exit; //case 'addOrder': //加入清单 //break; } } } ?>
108wo
phpcms/modules/content/MY_index.php
PHP
asf20
23,132
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); pc_base::load_sys_class('form','',0); class workflow extends admin { private $db,$admin_db; public $siteid; function __construct() { parent::__construct(); $this->db = pc_base::load_model('workflow_model'); $this->admin_db = pc_base::load_model('admin_model'); $this->siteid = $this->get_siteid(); } public function init () { $datas = array(); $result_datas = $this->db->listinfo(array('siteid'=>$this->siteid)); foreach($result_datas as $r) { $datas[] = $r; } $this->cache(); include $this->admin_tpl('workflow_list'); } public function add() { if(isset($_POST['dosubmit'])) { $_POST['info']['siteid'] = $this->siteid; $_POST['info']['workname'] = safe_replace($_POST['info']['workname']); $setting[1] = $_POST['checkadmin1']; $setting[2] = $_POST['checkadmin2']; $setting[3] = $_POST['checkadmin3']; $setting[4] = $_POST['checkadmin4']; $setting['nocheck_users'] = $_POST['nocheck_users']; $setting = array2string($setting); $_POST['info']['setting'] = $setting; $this->db->insert($_POST['info']); $this->cache(); showmessage(L('add_success')); } else { $show_validator = ''; $admin_data = array(); $result = $this->admin_db->select(); foreach($result as $_value) { if($_value['roleid']==1) continue; $admin_data[$_value['username']] = $_value['username']; } include $this->admin_tpl('workflow_add'); } } public function edit() { if(isset($_POST['dosubmit'])) { $workflowid = intval($_POST['workflowid']); $_POST['info']['workname'] = safe_replace($_POST['info']['workname']); $setting[1] = $_POST['checkadmin1']; $setting[2] = $_POST['checkadmin2']; $setting[3] = $_POST['checkadmin3']; $setting[4] = $_POST['checkadmin4']; $setting['nocheck_users'] = $_POST['nocheck_users']; $setting = array2string($setting); $_POST['info']['setting'] = $setting; $this->db->update($_POST['info'],array('workflowid'=>$workflowid)); $this->cache(); showmessage(L('update_success'), '', '', 'edit'); } else { $show_header = $show_validator = ''; $workflowid = intval($_GET['workflowid']); $admin_data = array(); $result = $this->admin_db->select(); foreach($result as $_value) { if($_value['roleid']==1) continue; $admin_data[$_value['username']] = $_value['username']; } $r = $this->db->get_one(array('workflowid'=>$workflowid)); extract($r); $setting = string2array($setting); $checkadmin1 = $this->implode_ids($setting[1]); $checkadmin2 = $this->implode_ids($setting[2]); $checkadmin3 = $this->implode_ids($setting[3]); $checkadmin4 = $this->implode_ids($setting[4]); $nocheck_users = $this->implode_ids($setting['nocheck_users']); include $this->admin_tpl('workflow_edit'); } } public function view() { $show_header = ''; $workflowid = intval($_GET['workflowid']); $admin_data = array(); $result = $this->admin_db->select(); foreach($result as $_value) { if($_value['roleid']==1) continue; $admin_data[$_value['username']] = $_value['username']; } $r = $this->db->get_one(array('workflowid'=>$workflowid)); extract($r); $setting = string2array($setting); $checkadmin1 = $this->implode_ids($setting[1],'、'); $checkadmin2 = $this->implode_ids($setting[2],'、'); $checkadmin3 = $this->implode_ids($setting[3],'、'); $checkadmin4 = $this->implode_ids($setting[4],'、'); include $this->admin_tpl('workflow_view'); } public function delete() { $_GET['workflowid'] = intval($_GET['workflowid']); $this->db->delete(array('workflowid'=>$_GET['workflowid'])); $this->cache(); exit('1'); } public function cache() { $datas = array(); $workflow_datas = $this->db->select(array('siteid'=>$this->siteid),'*',1000); foreach($workflow_datas as $_k=>$_v) { $datas[$_v['workflowid']] = $_v; } setcache('workflow_'.$this->siteid,$datas,'commons'); return true; } /** * 用逗号分隔数组 */ private function implode_ids($array, $flags = ',') { if(empty($array)) return true; $length = strlen($flags); $string = ''; foreach($array as $_v) { $string .= $_v.$flags; } return substr($string,0,-$length); } } ?>
108wo
phpcms/modules/content/workflow.php
PHP
asf20
4,460
<?php defined('IN_PHPCMS') or exit('No permission resources.'); //模型缓存路径 define('CACHE_MODEL_PATH',CACHE_PATH.'caches_model'.DIRECTORY_SEPARATOR.'caches_data'.DIRECTORY_SEPARATOR); pc_base::load_app_func('util','content'); class index { private $db; function __construct() { $this->db = pc_base::load_model('content_model'); $this->_userid = param::get_cookie('_userid'); $this->_username = param::get_cookie('_username'); $this->_groupid = param::get_cookie('_groupid'); } //首页 public function init() { if(isset($_GET['siteid'])) { $siteid = intval($_GET['siteid']); } else { $siteid = 1; } $siteid = $GLOBALS['siteid'] = max($siteid,1); define('SITEID', $siteid); $_userid = $this->_userid; $_username = $this->_username; $_groupid = $this->_groupid; //SEO $SEO = seo($siteid); $sitelist = getcache('sitelist','commons'); $default_style = $sitelist[$siteid]['default_style']; $CATEGORYS = getcache('category_content_'.$siteid,'commons'); include template('content','index',$default_style); } //内容页 public function show() { $catid = intval($_GET['catid']); $id = intval($_GET['id']); if(!$catid || !$id) showmessage(L('information_does_not_exist'),'blank'); $_userid = $this->_userid; $_username = $this->_username; $_groupid = $this->_groupid; $page = intval($_GET['page']); $page = max($page,1); $siteids = getcache('category_content','commons'); $siteid = $siteids[$catid]; $CATEGORYS = getcache('category_content_'.$siteid,'commons'); if(!isset($CATEGORYS[$catid]) || $CATEGORYS[$catid]['type']!=0) showmessage(L('information_does_not_exist'),'blank'); $this->category = $CAT = $CATEGORYS[$catid]; $this->category_setting = $CAT['setting'] = string2array($this->category['setting']); $siteid = $GLOBALS['siteid'] = $CAT['siteid']; $MODEL = getcache('model','commons'); $modelid = $CAT['modelid']; $tablename = $this->db->table_name = $this->db->db_tablepre.$MODEL[$modelid]['tablename']; $r = $this->db->get_one(array('id'=>$id)); if(!$r || $r['status'] != 99) showmessage(L('info_does_not_exists'),'blank'); $this->db->table_name = $tablename.'_data'; $r2 = $this->db->get_one(array('id'=>$id)); $rs = $r2 ? array_merge($r,$r2) : $r; //再次重新赋值,以数据库为准 $catid = $CATEGORYS[$r['catid']]['catid']; $modelid = $CATEGORYS[$catid]['modelid']; require_once CACHE_MODEL_PATH.'content_output.class.php'; $content_output = new content_output($modelid,$catid,$CATEGORYS); $data = $content_output->get($rs); extract($data); //检查文章会员组权限 if($groupids_view && is_array($groupids_view)) { $_groupid = param::get_cookie('_groupid'); $_groupid = intval($_groupid); if(!$_groupid) { $forward = urlencode(get_url()); showmessage(L('login_website'),APP_PATH.'index.php?m=member&c=index&a=login&forward='.$forward); } if(!in_array($_groupid,$groupids_view)) showmessage(L('no_priv')); } else { //根据栏目访问权限判断权限 $_priv_data = $this->_category_priv($catid); if($_priv_data=='-1') { $forward = urlencode(get_url()); showmessage(L('login_website'),APP_PATH.'index.php?m=member&c=index&a=login&forward='.$forward); } elseif($_priv_data=='-2') { showmessage(L('no_priv')); } } if(module_exists('comment')) { $allow_comment = isset($allow_comment) ? $allow_comment : 1; } else { $allow_comment = 0; } //阅读收费 类型 $paytype = $rs['paytype']; $readpoint = $rs['readpoint']; $allow_visitor = 1; if($readpoint || $this->category_setting['defaultchargepoint']) { if(!$readpoint) { $readpoint = $this->category_setting['defaultchargepoint']; $paytype = $this->category_setting['paytype']; } //检查是否支付过 $allow_visitor = self::_check_payment($catid.'_'.$id,$paytype); if(!$allow_visitor) { $http_referer = urlencode(get_url()); $allow_visitor = sys_auth($catid.'_'.$id.'|'.$readpoint.'|'.$paytype).'&http_referer='.$http_referer; } else { $allow_visitor = 1; } } //最顶级栏目ID $arrparentid = explode(',', $CAT['arrparentid']); $top_parentid = $arrparentid[1] ? $arrparentid[1] : $catid; $template = $template ? $template : $CAT['setting']['show_template']; if(!$template) $template = 'show'; //SEO $seo_keywords = ''; if(!empty($keywords)) $seo_keywords = implode(',',$keywords); $SEO = seo($siteid, $catid, $title, $description, $seo_keywords); define('STYLE',$CAT['setting']['template_list']); if(isset($rs['paginationtype'])) { $paginationtype = $rs['paginationtype']; $maxcharperpage = $rs['maxcharperpage']; } $pages = $titles = ''; if($rs['paginationtype']==1) { //自动分页 if($maxcharperpage < 10) $maxcharperpage = 500; $contentpage = pc_base::load_app_class('contentpage'); $content = $contentpage->get_data($content,$maxcharperpage); } if($rs['paginationtype']!=0) { //手动分页 $CONTENT_POS = strpos($content, '[page]'); if($CONTENT_POS !== false) { $this->url = pc_base::load_app_class('url', 'content'); $contents = array_filter(explode('[page]', $content)); $pagenumber = count($contents); if (strpos($content, '[/page]')!==false && ($CONTENT_POS<7)) { $pagenumber--; } for($i=1; $i<=$pagenumber; $i++) { $pageurls[$i] = $this->url->show($id, $i, $catid, $rs['inputtime']); } $END_POS = strpos($content, '[/page]'); if($END_POS !== false) { if($CONTENT_POS>7) { $content = '[page]'.$title.'[/page]'.$content; } if(preg_match_all("|\[page\](.*)\[/page\]|U", $content, $m, PREG_PATTERN_ORDER)) { foreach($m[1] as $k=>$v) { $p = $k+1; $titles[$p]['title'] = strip_tags($v); $titles[$p]['url'] = $pageurls[$p][0]; } } } //当不存在 [/page]时,则使用下面分页 $pages = content_pages($pagenumber,$page, $pageurls); //判断[page]出现的位置是否在第一位 if($CONTENT_POS<7) { $content = $contents[$page]; } else { if ($page==1 && !empty($titles)) { $content = $title.'[/page]'.$contents[$page-1]; } else { $content = $contents[$page-1]; } } if($titles) { list($title, $content) = explode('[/page]', $content); $content = trim($content); if(strpos($content,'</p>')===0) { $content = '<p>'.$content; } if(stripos($content,'<p>')===0) { $content = $content.'</p>'; } } } } $this->db->table_name = $tablename; //上一页 $previous_page = $this->db->get_one("`catid` = '$catid' AND `id`<'$id' AND `status`=99",'*','id DESC'); //下一页 $next_page = $this->db->get_one("`catid`= '$catid' AND `id`>'$id' AND `status`=99"); if(empty($previous_page)) { $previous_page = array('title'=>L('first_page'), 'thumb'=>IMG_PATH.'nopic_small.gif', 'url'=>'javascript:alert(\''.L('first_page').'\');'); } if(empty($next_page)) { $next_page = array('title'=>L('last_page'), 'thumb'=>IMG_PATH.'nopic_small.gif', 'url'=>'javascript:alert(\''.L('last_page').'\');'); } include template('content',$template); } //列表页 public function lists() { $catid = intval($_GET['catid']); $_priv_data = $this->_category_priv($catid); if($_priv_data=='-1') { $forward = urlencode(get_url()); showmessage(L('login_website'),APP_PATH.'index.php?m=member&c=index&a=login&forward='.$forward); } elseif($_priv_data=='-2') { showmessage(L('no_priv')); } $_userid = $this->_userid; $_username = $this->_username; $_groupid = $this->_groupid; if(!$catid) showmessage(L('category_not_exists'),'blank'); $siteids = getcache('category_content','commons'); $siteid = $siteids[$catid]; $CATEGORYS = getcache('category_content_'.$siteid,'commons'); if(!isset($CATEGORYS[$catid])) showmessage(L('category_not_exists'),'blank'); $CAT = $CATEGORYS[$catid]; $siteid = $GLOBALS['siteid'] = $CAT['siteid']; extract($CAT); $setting = string2array($setting); //SEO if(!$setting['meta_title']) $setting['meta_title'] = $catname; $SEO = seo($siteid, '',$setting['meta_title'],$setting['meta_description'],$setting['meta_keywords']); define('STYLE',$setting['template_list']); $page = $_GET['page']; $template = $setting['category_template'] ? $setting['category_template'] : 'category'; $template_list = $setting['list_template'] ? $setting['list_template'] : 'list'; if($type==0) { $template = $child ? $template : $template_list; $arrparentid = explode(',', $arrparentid); $top_parentid = $arrparentid[1] ? $arrparentid[1] : $catid; $array_child = array(); $self_array = explode(',', $arrchildid); //获取一级栏目ids foreach ($self_array as $arr) { if($arr!=$catid && $CATEGORYS[$arr][parentid]==$catid) { $array_child[] = $arr; } } $arrchildid = implode(',', $array_child); //URL规则 $urlrules = getcache('urlrules','commons'); $urlrules = str_replace('|', '~',$urlrules[$category_ruleid]); $tmp_urls = explode('~',$urlrules); $tmp_urls = isset($tmp_urls[1]) ? $tmp_urls[1] : $tmp_urls[0]; preg_match_all('/{\$([a-z0-9_]+)}/i',$tmp_urls,$_urls); if(!empty($_urls[1])) { foreach($_urls[1] as $_v) { $GLOBALS['URL_ARRAY'][$_v] = $_GET[$_v]; } } define('URLRULE', $urlrules); $GLOBALS['URL_ARRAY']['categorydir'] = $categorydir; $GLOBALS['URL_ARRAY']['catdir'] = $catdir; $GLOBALS['URL_ARRAY']['catid'] = $catid; include template('content',$template); } else { //单网页 $this->page_db = pc_base::load_model('page_model'); $r = $this->page_db->get_one(array('catid'=>$catid)); if($r) extract($r); $template = $setting['page_template'] ? $setting['page_template'] : 'page'; $arrchild_arr = $CATEGORYS[$parentid]['arrchildid']; if($arrchild_arr=='') $arrchild_arr = $CATEGORYS[$catid]['arrchildid']; $arrchild_arr = explode(',',$arrchild_arr); array_shift($arrchild_arr); $keywords = $keywords ? $keywords : $setting['meta_keywords']; $SEO = seo($siteid, 0, $title,$setting['meta_description'],$keywords); include template('content',$template); } } //JSON 输出 public function json_list() { if($_GET['type']=='keyword' && $_GET['modelid'] && $_GET['keywords']) { //根据关键字搜索 $modelid = intval($_GET['modelid']); $id = intval($_GET['id']); $MODEL = getcache('model','commons'); if(isset($MODEL[$modelid])) { $keywords = safe_replace(htmlspecialchars($_GET['keywords'])); $keywords = addslashes(iconv('utf-8','gbk',$keywords)); $this->db->set_model($modelid); $result = $this->db->select("keywords LIKE '%$keywords%'",'id,title,url',10); if(!empty($result)) { $data = array(); foreach($result as $rs) { if($rs['id']==$id) continue; if(CHARSET=='gbk') { foreach($rs as $key=>$r) { $rs[$key] = iconv('gbk','utf-8',$r); } } $data[] = $rs; } if(count($data)==0) exit('0'); echo json_encode($data); } else { //没有数据 exit('0'); } } } } /** * 检查支付状态 */ protected function _check_payment($flag,$paytype) { $_userid = $this->_userid; $_username = $this->_username; if(!$_userid) return false; pc_base::load_app_class('spend','pay',0); $setting = $this->category_setting; $repeatchargedays = intval($setting['repeatchargedays']); if($repeatchargedays) { $fromtime = SYS_TIME - 86400 * $repeatchargedays; $r = spend::spend_time($_userid,$fromtime,$flag); if($r['id']) return true; } return false; } /** * 检查阅读权限 * */ protected function _category_priv($catid) { $catid = intval($catid); if(!$catid) return '-2'; $_groupid = $this->_groupid; $_groupid = intval($_groupid); if($_groupid==0) $_groupid = 8; $this->category_priv_db = pc_base::load_model('category_priv_model'); $result = $this->category_priv_db->select(array('catid'=>$catid,'is_admin'=>0,'action'=>'visit')); if($result) { if(!$_groupid) return '-1'; foreach($result as $r) { if($r['roleid'] == $_groupid) return '1'; } return '-2'; } else { return '1'; } } } ?>
108wo
phpcms/modules/content/index.php
PHP
asf20
12,585
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_class('admin','admin',0); pc_base::load_sys_class('form','',0); class type_manage extends admin { private $db,$category_db; public $siteid; function __construct() { parent::__construct(); $this->db = pc_base::load_model('type_model'); $this->siteid = $this->get_siteid(); $this->model = getcache('model','commons'); $this->category_db = pc_base::load_model('category_model'); } public function init () { $datas = array(); $result_datas = $this->db->listinfo(array('siteid'=>$this->siteid,'module'=>'content'),'listorder ASC,typeid DESC',$_GET['page']); $pages = $this->db->pages; foreach($result_datas as $r) { $r['modelname'] = $this->model[$r['modelid']]['name']; $datas[] = $r; } $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=content&c=type_manage&a=add\', title:\''.L('add_type').'\', width:\'780\', height:\'500\', lock:true}, function(){var d = window.top.art.dialog({id:\'add\'}).data.iframe;var form = d.document.getElementById(\'dosubmit\');form.click();return false;}, function(){window.top.art.dialog({id:\'add\'}).close()});void(0);', L('add_type')); $this->cache(); include $this->admin_tpl('type_list'); } public function add() { if(isset($_POST['dosubmit'])) { $_POST['info']['siteid'] = $this->siteid; $_POST['info']['module'] = 'content'; if(empty($_POST['info']['name'])) showmessage(L("input").L('type_name')); $names = explode("\n", $_POST['info']['name']); $ids = $_POST['ids']; foreach ($names as $name) { $_POST['info']['name'] = $name; $typeid = $this->db->insert($_POST['info'],true); if(!empty($ids)) { foreach ($ids as $catid) { $r = $this->category_db->get_one(array('catid'=>$catid),'usable_type'); if($r['usable_type']) { $usable_type = $r['usable_type'].$typeid.','; } else { $usable_type = ','.$typeid.','; } $this->category_db->update(array('usable_type'=>$usable_type),array('catid'=>$catid,'siteid'=>$this->siteid)); } } } showmessage(L('add_success'), '', '', 'add'); } else { $show_header = $show_validator = ''; $categorys = $this->public_getsite_categorys(); include $this->admin_tpl('type_add'); } } public function edit() { if(isset($_POST['dosubmit'])) { $typeid = intval($_POST['typeid']); $this->db->update($_POST['info'],array('typeid'=>$typeid)); $ids = $_POST['ids']; if(!empty($ids)) { foreach ($ids as $catid) { $r = $this->category_db->get_one(array('catid'=>$catid),'usable_type'); if($r['usable_type']) { $usable_type = array(); $usable_type_arr = explode(',', $r['usable_type']); foreach ($usable_type_arr as $_usable_type_arr) { if($_usable_type_arr && $_usable_type_arr!=$typeid) $usable_type[] = $_usable_type_arr; } $usable_type = ','.implode(',', $usable_type).','; $usable_type = $usable_type.$typeid.','; } else { $usable_type = ','.$typeid.','; } $this->category_db->update(array('usable_type'=>$usable_type),array('catid'=>$catid,'siteid'=>$this->siteid)); } } //删除取消的 $catids_string = $_POST['catids_string']; if($catids_string) { $catids_string = explode(',', $catids_string); foreach ($catids_string as $catid) { $r = $this->category_db->get_one(array('catid'=>$catid),'usable_type'); $usable_type = array(); $usable_type_arr = explode(',', $r['usable_type']); foreach ($usable_type_arr as $_usable_type_arr) { if(!$_usable_type_arr || !in_array($catid, $ids)) continue; $usable_type[] = $_usable_type_arr; } if(!empty($usable_type)) { $usable_type = ','.implode(',', $usable_type).','; } else { $usable_type = ''; } $this->category_db->update(array('usable_type'=>$usable_type),array('catid'=>$catid,'siteid'=>$this->siteid)); } } $this->category_cache(); showmessage(L('update_success'), '', '', 'edit'); } else { $show_header = $show_validator = ''; $typeid = intval($_GET['typeid']); $r = $this->db->get_one(array('typeid'=>$typeid)); extract($r); $categorys = $this->public_getsite_categorys($typeid); $catids_string = empty($this->catids_string) ? 0 : $this->catids_string = implode(',', $this->catids_string); include $this->admin_tpl('type_edit'); } } public function delete() { $_GET['typeid'] = intval($_GET['typeid']); $this->db->delete(array('typeid'=>$_GET['typeid'])); exit('1'); } /** * 排序 */ public function listorder() { if(isset($_POST['dosubmit'])) { foreach($_POST['listorders'] as $id => $listorder) { $this->db->update(array('listorder'=>$listorder),array('typeid'=>$id)); } showmessage(L('operation_success'),HTTP_REFERER); } else { showmessage(L('operation_failure')); } } public function cache() { $datas = array(); $result_datas = $this->db->select(array('siteid'=>$this->siteid,'module'=>'content'),'*',1000,'listorder ASC,typeid ASC'); foreach($result_datas as $_key=>$_value) { $datas[$_value['typeid']] = $_value; } setcache('type_content',$datas,'commons'); $this->category_cache(); return true; } /** * 选择可用栏目 */ public function public_getsite_categorys($typeid = 0) { $siteid = $this->siteid; $this->categorys = getcache('category_content_'.$siteid,'commons'); $tree = pc_base::load_sys_class('tree'); $tree->icon = array('&nbsp;&nbsp;&nbsp;│ ','&nbsp;&nbsp;&nbsp;├─ ','&nbsp;&nbsp;&nbsp;└─ '); $tree->nbsp = '&nbsp;&nbsp;&nbsp;'; $categorys = array(); $this->catids_string = array(); foreach($this->categorys as $r) { if($r['siteid']!=$siteid || $r['type']!=0) continue; if($r['child']) { $r['checkbox'] = ''; $r['style'] = 'color:#8A8A8A;'; } else { $checked = ''; if($typeid && $r['usable_type']) { $usable_type = explode(',', $r['usable_type']); if(in_array($typeid, $usable_type)) { $checked = 'checked'; $this->catids_string[] = $r['catid']; } } $r['checkbox'] = "<input type='checkbox' name='ids[]' value='{$r[catid]}' {$checked}>"; $r['style'] = ''; } $categorys[$r['catid']] = $r; } $str = "<tr> <td align='center'>\$checkbox</td> <td style='\$style'>\$spacer\$catname</td> </tr>"; $tree->init($categorys); $categorys = $tree->get_tree(0, $str); return $categorys; } /** * 更新栏目缓存 */ private function category_cache() { $categorys = array(); $this->categorys = $this->category_db->select(array('siteid'=>$this->siteid, 'module'=>'content'),'*',10000,'listorder ASC'); foreach($this->categorys as $r) { unset($r['module']); $setting = string2array($r['setting']); $r['create_to_html_root'] = $setting['create_to_html_root']; $r['ishtml'] = $setting['ishtml']; $r['content_ishtml'] = $setting['content_ishtml']; $r['category_ruleid'] = $setting['category_ruleid']; $r['show_ruleid'] = $setting['show_ruleid']; $r['workflowid'] = $setting['workflowid']; $r['isdomain'] = '0'; if(strpos($r['url'], 'http://') === false) { $r['url'] = siteurl($r['siteid']).$r['url']; } elseif ($r['ishtml']) { $r['isdomain'] = '1'; } $categorys[$r['catid']] = $r; } setcache('category_content_'.$this->siteid,$categorys,'commons'); return true; } } ?>
108wo
phpcms/modules/content/type_manage.php
PHP
asf20
7,627
<?php defined('IN_PHPCMS') or exit('No permission resources.'); class url{ private $urlrules,$categorys,$html_root; public function __construct() { $this->urlrules = getcache('urlrules','commons'); self::set_siteid(); $this->categorys = getcache('category_content_'.$this->siteid,'commons'); $this->html_root = pc_base::load_config('system','html_root'); } /** * 内容页链接 * @param $id 内容id * @param $page 当前页 * @param $catid 栏目id * @param $time 添加时间 * @param $prefix 前缀 * @param $data 数据 * @param $action 操作方法 * @param $upgrade 是否是升级数据 * @return array 0=>url , 1=>生成路径 */ public function show($id, $page = 0, $catid = 0, $time = 0, $prefix = '',$data = '',$action = 'edit',$upgrade = 0) { $page = max($page,1); $urls = $catdir = ''; $category = $this->categorys[$catid]; $setting = string2array($category['setting']); $content_ishtml = $setting['content_ishtml']; //当内容为转换或升级时 if($upgrade || (isset($_POST['upgrade']) && defined('IN_ADMIN') && $_POST['upgrade'])) { if($_POST['upgrade']) $upgrade = $_POST['upgrade']; $upgrade = '/'.ltrim($upgrade,WEB_PATH); if($page==1) { $url_arr[0] = $url_arr[1] = $upgrade; } else { $lasttext = strrchr($upgrade,'.'); $len = -strlen($lasttext); $path = substr($upgrade,0,$len); $url_arr[0] = $url_arr[1] = $path.'_'.$page.$lasttext; } } else { $show_ruleid = $setting['show_ruleid']; $urlrules = $this->urlrules[$show_ruleid]; if(!$time) $time = SYS_TIME; $urlrules_arr = explode('|',$urlrules); if($page==1) { $urlrule = $urlrules_arr[0]; } else { $urlrule = isset($urlrules_arr[1]) ? $urlrules_arr[1] : $urlrules_arr[0]; } $domain_dir = ''; if (strpos($category['url'], '://')!==false && strpos($category['url'], '?')===false) { if (preg_match('/^((http|https):\/\/)?([^\/]+)/i', $category['url'], $matches)) { $match_url = $matches[0]; $url = $match_url.'/'; } $db = pc_base::load_model('category_model'); $r = $db->get_one(array('url'=>$url), '`catid`'); if($r) $domain_dir = $this->get_categorydir($r['catid']).$this->categorys[$r['catid']]['catdir'].'/'; } $categorydir = $this->get_categorydir($catid); $catdir = $category['catdir']; $year = date('Y',$time); $month = date('m',$time); $day = date('d',$time); $urls = str_replace(array('{$categorydir}','{$catdir}','{$year}','{$month}','{$day}','{$catid}','{$id}','{$page}'),array($categorydir,$catdir,$year,$month,$day,$catid,$id,$page),$urlrule); $create_to_html_root = $category['create_to_html_root']; if($create_to_html_root || $category['sethtml']) { $html_root = ''; } else { $html_root = $this->html_root; } if($content_ishtml && $url) { if ($domain_dir && $category['isdomain']) { $url_arr[1] = $html_root.'/'.$domain_dir.$urls; $url_arr[0] = $url.$urls; } else { $url_arr[1] = $html_root.'/'.$urls; $url_arr[0] = WEB_PATH == '/' ? $match_url.$html_root.'/'.$urls : $match_url.rtrim(WEB_PATH,'/').$html_root.'/'.$urls; } } elseif($content_ishtml) { $url_arr[0] = WEB_PATH == '/' ? $html_root.'/'.$urls : rtrim(WEB_PATH,'/').$html_root.'/'.$urls; $url_arr[1] = $html_root.'/'.$urls; } else { $url_arr[0] = $url_arr[1] = APP_PATH.$urls; } } //生成静态 ,在添加文章的时候,同时生成静态,不在批量更新URL处调用 if($content_ishtml && $data) { $data['id'] = $id; $url_arr['content_ishtml'] = 1; $url_arr['data'] = $data; } return $url_arr; } /** * 获取栏目的访问路径 * 在修复栏目路径处重建目录结构用 * @param intval $catid 栏目ID * @param intval $page 页数 */ public function category_url($catid, $page = 1) { $category = $this->categorys[$catid]; if($category['type']==2) return $category['url']; $page = max(intval($page), 1); $setting = string2array($category['setting']); $category_ruleid = $setting['category_ruleid']; $urlrules = $this->urlrules[$category_ruleid]; $urlrules_arr = explode('|',$urlrules); if ($page==1) { $urlrule = $urlrules_arr[0]; } else { $urlrule = $urlrules_arr[1]; } if (!$setting['ishtml']) { //如果不生成静态 $url = str_replace(array('{$catid}', '{$page}'), array($catid, $page), $urlrule); if (strpos($url, '\\')!==false) { $url = APP_PATH.str_replace('\\', '/', $url); } } else { //生成静态 if ($category['arrparentid']) { $parentids = explode(',', $category['arrparentid']); } $parentids[] = $catid; $domain_dir = ''; foreach ($parentids as $pid) { //循环查询父栏目是否设置了二级域名 $r = $this->categorys[$pid]; if (strpos(strtolower($r['url']), '://')!==false && strpos($r['url'], '?')===false) { $r['url'] = preg_replace('/([(http|https):\/\/]{0,})([^\/]*)([\/]{1,})/i', '$1$2/', $r['url'], -1); //取消掉双'/'情况 if (substr_count($r['url'], '/')==3 && substr($r['url'],-1,1)=='/') { //如果url中包含‘http://’并且‘/’在3个则为二级域名设置栏目 $url = $r['url']; $domain_dir = $this->get_categorydir($pid).$this->categorys[$pid]['catdir'].'/'; //得到二级域名的目录 } } } $category_dir = $this->get_categorydir($catid); $urls = str_replace(array('{$categorydir}','{$catdir}','{$catid}','{$page}'),array($category_dir,$category['catdir'],$catid,$page),$urlrule); if ($url && $domain_dir) { //如果存在设置二级域名的情况 if (strpos($urls, $domain_dir)===0) { $url = str_replace(array($domain_dir, '\\'), array($url, '/'), $urls); } else { $urls = $domain_dir.$urls; $url = str_replace(array($domain_dir, '\\'), array($url, '/'), $urls); } } else { //不存在二级域名的情况 $url = $urls; } } if (in_array(basename($url), array('index.html', 'index.htm', 'index.shtml'))) { $url = dirname($url).'/'; } if (strpos($url, '://')===false) $url = str_replace('//', '/', $url); if(strpos($url, '/')===0) $url = substr($url,1); return $url; } /** * 生成列表页分页地址 * @param $ruleid 角色id * @param $categorydir 父栏目路径 * @param $catdir 栏目路径 * @param $catid 栏目id * @param $page 当前页 */ public function get_list_url($ruleid,$categorydir, $catdir, $catid, $page = 1) { $urlrules = $this->urlrules[$ruleid]; $urlrules_arr = explode('|',$urlrules); if ($page==1) { $urlrule = $urlrules_arr[0]; } else { $urlrule = $urlrules_arr[1]; } $urls = str_replace(array('{$categorydir}','{$catdir}','{$year}','{$month}','{$day}','{$catid}','{$page}'),array($categorydir,$catdir,$year,$month,$day,$catid,$page),$urlrule); return $urls; } /** * 获取父栏目路径 * @param $catid * @param $dir */ private function get_categorydir($catid, $dir = '') { $setting = array(); $setting = string2array($this->categorys[$catid]['setting']); if ($setting['create_to_html_root']) return $dir; if ($this->categorys[$catid]['parentid']) { $dir = $this->categorys[$this->categorys[$catid]['parentid']]['catdir'].'/'.$dir; return $this->get_categorydir($this->categorys[$catid]['parentid'], $dir); } else { return $dir; } } /** * 设置当前站点 */ private function set_siteid() { if(defined('IN_ADMIN')) { $this->siteid = get_siteid(); } else { if (param::get_cookie('siteid')) { $this->siteid = param::get_cookie('siteid'); } else { $this->siteid = 1; } } } }
108wo
phpcms/modules/content/classes/url.class.php
PHP
asf20
7,812
<?php defined('IN_PHPCMS') or exit('No permission resources.'); /** * 全站搜索内容入库接口 */ class search_api extends admin { private $siteid,$categorys,$db; public function __construct() { $this->siteid = $this->get_siteid(); $this->categorys = getcache('category_content_'.$this->siteid,'commons'); $this->db = pc_base::load_model('content_model'); } public function set_model($modelid) { $this->modelid = $modelid; $this->db->set_model($modelid); } /** * 全文索引API * @param $pagesize 每页条数 * @param $page 当前页 */ public function fulltext_api($pagesize = 100, $page = 1) { $system_keys = $model_keys = array(); $fulltext_array = getcache('model_field_'.$this->modelid,'model'); foreach($fulltext_array AS $key=>$value) { if($value['issystem'] && $value['isfulltext']) { $system_keys[] = $key; } } if(empty($system_keys)) return ''; $system_keys = 'id,inputtime,'.implode(',',$system_keys); $offset = $pagesize*($page-1); $result = $this->db->select('',$system_keys,"$offset, $pagesize"); //模型从表字段 foreach($fulltext_array AS $key=>$value) { if(!$value['issystem'] && $value['isfulltext']) { $model_keys[] = $key; } } if(empty($model_keys)) return ''; $model_keys = 'id,'.implode(',',$model_keys); $this->db->table_name = $this->db->table_name.'_data'; $result_data = $this->db->select('',$model_keys,"$offset, $pagesize",'','','id'); //处理结果 foreach($result as $r) { $fulltextcontent = ''; foreach($r as $field=>$_r) { if($field=='id') continue; $fulltextcontent .= strip_tags($_r).' '; } if(!empty($result_data[$r['id']])) { foreach($result_data[$r['id']] as $_r) { if($field=='id') continue; $fulltextcontent .= strip_tags($_r).' '; } } $temp['fulltextcontent'] = str_replace("'",'',$fulltextcontent); $temp['title'] = addslashes($r['title']); $temp['adddate'] = $r['inputtime']; $data[$r['id']] = $temp; } return $data; } /** * 计算总数 * @param $modelid */ public function total($modelid) { $this->modelid = $modelid; $this->db->set_model($modelid); return $this->db->count(); } }
108wo
phpcms/modules/content/classes/search_api.class.php
PHP
asf20
2,269
<?php /** * contentpage.class.php 文章内容页分页类 * * @copyright (C) 2005-2010 PHPCMS * @license http://www.phpcms.cn/license/ * @lastmodify 2010-8-12 */ class contentpage { private $additems = array (); //定义需要补全的开头html代码 private $bottonitems = array (); //定义需要补全的结尾HTML代码 private $html_tag = array (); //HTML标记数组 private $surplus; //剩余字符数 public $content; //定义返回的字符 public function __construct() { //定义HTML数组 $this->html_tag = array ('p', 'div', 'h', 'span', 'strong', 'ul', 'ol', 'li', 'table', 'tr', 'tbody', 'dl', 'dt', 'dd'); $this->html_end_tag = array ('/p', '/div', '/h', '/span', '/strong', '/ul', '/ol', '/li', '/table', '/tr', '/tbody', '/dl', '/dt', '/dd'); $this->content = ''; //临时内容存储器 $this->data = array(); //内容存储 } /** * 处理并返回字符串 * * @param string $content 待处理的字符串 * @param intval $maxwords 每页最大字符数。去除HTML标记后字符数 * @return 处理后的字符串 */ public function get_data($content = '', $maxwords = 10000) { if (!$content) return ''; $this->data = array(); $this->content = ''; //exit($maxwords); $this->surplus = $maxwords; //开始时将剩余字符设置为最大 //判断是否存在html标记,不存在直接按字符数分页;如果存在HTML标记,需要补全缺失的HTML标记 if (strpos($content, '<')!==false) { $content_arr = explode('<', $content); //将字符串按‘<’分割成数组 $this->total = count($content_arr); //计算数组值的个数,便于计算是否执行到字符串的尾部 foreach ($content_arr as $t => $c) { if ($c) { $s = strtolower($c); //大小写不区分 //$isadd = 0; if ((strpos($c, ' ')!==false) && (strpos($c, '>')===false)) { $min_point = intval(strpos($c, ' ')); } elseif ((strpos($c, ' ')===false) && (strpos($c, '>')!==false)) { $min_point = intval(strpos($c, '>')); } elseif ((strpos($c, ' ')!==false) && (strpos($c, '>')!==false)) { $min_point = min(intval(strpos($c, ' ')), intval(strpos($c, '>'))); } $find = substr($c, 0, $min_point); //if ($t>26) echo $s.'{}'.$find.'<br>'; //preg_match('/(.*)([^>|\s])/i', $c, $matches); if (in_array(strtolower($find), $this->html_tag)) { $str = '<'.$c; $this->bottonitems[$t] = '</'.$find.'>'; //属于定义的HTML范围,将结束标记存入补全的结尾数组 if(preg_match('/<'.$find.'(.*)>/i', $str, $match)) { $this->additems[$t] = $match[0]; //匹配出开始标记,存入补全的开始数组 } $this->separate_content($str, $maxwords, $match[0], $t); //加入返回字符串中 } elseif (in_array(strtolower($find), $this->html_end_tag)) { //判断是否属于定义的HTML结尾标记 ksort($this->bottonitems); ksort($this->additems); if (is_array($this->bottonitems) && !empty($this->bottonitems)) array_pop($this->bottonitems); //当属于是,将开始和结尾的补全数组取消一个 if (is_array($this->additems) && !empty($this->additems)) array_pop($this->additems); $str = '<'.$c; $this->separate_content($str, $maxwords, '', $t); //加入返回字符串中 } else { $tag = '<'.$c; if ($this->surplus >= 0) { $this->surplus = $this->surplus-strlen(strip_tags($tag)); if ($this->surplus<0) { $this->surplus = 0; } } $this->content .= $tag; //不在定义的HTML标记范围,则将其追加到返回字符串中 if (intval($t+1) == $this->total) { //判断是否还有剩余字符 $this->content .= $this->bottonitem(); $this->data[] = $this->content; } } } } } else { $this->content .= $this->separate_content($content, $maxwords); //纯文字时 } return implode('[page]', $this->data); } /** * 处理每条数据 * @param string $str 每条数据 * @param intval $max 每页的最大字符 * @param string $tag HTML标记 * @param intval $t 处理第几个数组,方便判断是否到字符串的末尾 * @param intval $n 处理的次数 * @param intval $total 总共的次数,防止死循环 * @return boolen */ private function separate_content($str = '', $max, $tag = '', $t = 0, $n = 1, $total = 0) { $html = $str; $str = strip_tags($str); if ($str) $str = @str_replace(array(' '), '', $str); if ($str) { if ($n == 1) { $total = ceil((strlen($str)-$this->surplus)/$max)+1; } if ($total<$n) { return true; } else { $n++; } if (strlen($str)>$this->surplus) { //当前字符数超过最大分页数时 $remove_str = str_cut($str, $this->surplus, ''); $this->content .= $tag.$remove_str; //连同标记加入返回字符串 $this->content .= $this->bottonitem(); //补全尾部标记 $this->data[] = $this->content; //将临时的内容放入数组中 $this->content = ''; //设置为空 $this->content .= $this->additem(); //补全开始标记 $str = str_replace($remove_str, '', $str); //去除已加入 $this->surplus = $max; return $this->separate_content($str, $max, '', $t, $n, $total); //判断剩余字符 } elseif (strlen($str)==$this->surplus) { //当前字符刚好等于时(彩票几率) $this->content .= $html; $this->content .= $this->bottonitem(); if (intval($t+1) != $this->total) { //判断是否还有剩余字符 $this->data[] = $this->content; //将临时的内容放入数组中 $this->content = ''; //设置为空 $this->content .= $this->additem(); } $this->surplus = $max; } else { //当前字符数少于最大分页数 $this->content .= $html; if (intval($t+1) == $this->total) { //判断是否还有剩余字符 $this->content .= $this->bottonitem(); $this->data[] = $this->content; } $this->surplus = $this->surplus-strlen($str); } } else { $this->content .= $html; if ($this->surplus == 0) { $this->content .= $this->bottonitem(); if (intval($t+1) != $this->total) { //判断是否还有剩余字符 $this->data[] = $this->content; //将临时的内容放入数组中 $this->content = ''; //设置为空 $this->surplus = $max; $this->content .= $this->additem(); } } } if ($t==($this->total-1)) { $pop_arr = array_pop($this->data); if ($pop = strip_tags($pop_arr)) { $this->data[] = $pop_arr; } } return true; } /** * 补全开始HTML标记 */ private function additem() { $content = ''; if (is_array($this->additems) && !empty($this->additems)) { ksort($this->additems); foreach ($this->additems as $add) { $content .= $add; } } return $content; } /** * 补全结尾HTML标记 */ private function bottonitem() { $content = ''; if (is_array($this->bottonitems) && !empty($this->bottonitems)) { krsort($this->bottonitems); foreach ($this->bottonitems as $botton) { $content .= $botton; } } return $content; } } ?>
108wo
phpcms/modules/content/classes/contentpage.class.php
PHP
asf20
7,303
<?php /** * position_api.class.php 推荐至栏目接口类 * * @copyright (C) 2005-2010 PHPCMS * @license http://www.phpcms.cn/license/ * @lastmodify 2010-10-14 */ defined('IN_PHPCMS') or exit('No permission resources.'); class push_api { private $db, $pos_data; //数据调用属性 public function __construct() { $this->db = pc_base::load_model('content_model'); //加载数据模型 } /** * 接口处理方法 * @param array $param 属性 请求时,为模型、栏目数组。提交添加为二维信息数据 。例:array(1=>array('title'=>'多发发送方法', ....)) * @param array $arr 参数 表单数据,只在请求添加时传递。 例:array('modelid'=>1, 'catid'=>12); */ public function category_list($param = array(), $arr = array()) { if ($arr['dosubmit']) { $id = $_POST['id']; if(empty($id)) return true; $id_arr = explode('|',$id); if(count($id_arr)==0) return true; $old_catid = intval($_POST['catid']); if(!$old_catid) return true; $ids = $_POST['ids']; if(empty($ids)) return true; $ids = explode('|', $ids); $siteid = intval($_POST['siteid']); $siteids = getcache('category_content','commons'); $oldsiteid = $siteids[$old_catid]; $this->categorys = getcache('category_content_'.$oldsiteid,'commons'); $modelid = $this->categorys[$old_catid]['modelid']; $this->db->set_model($modelid); $tablename = $this->db->table_name; $this->hits_db = pc_base::load_model('hits_model'); foreach($id_arr as $id) { $this->db->table_name = $tablename; $r = $this->db->get_one(array('id'=>$id)); $linkurl = preg_match('/^http:\/\//',$r['url']) ? $r['url'] : siteurl($siteid).$r['url']; foreach($ids as $catid) { $siteid = $siteids[$catid]; $this->categorys = getcache('category_content_'.$siteid,'commons'); $modelid = $this->categorys[$catid]['modelid']; $this->db->set_model($modelid); $newid = $this->db->insert( array('title'=>$r['title'], 'style'=>$r['style'], 'thumb'=>$r['thumb'], 'keywords'=>$r['keywords'], 'description'=>$r['description'], 'status'=>$r['status'], 'catid'=>$catid, 'url'=>$linkurl, 'sysadd'=>1, 'username'=>$r['username'], 'inputtime'=>$r['inputtime'], 'updatetime'=>$r['updatetime'], 'islink'=>1 ),true); $this->db->table_name = $this->db->table_name.'_data'; $this->db->insert(array('id'=>$newid)); $hitsid = 'c-'.$modelid.'-'.$newid; $this->hits_db->insert(array('hitsid'=>$hitsid,'updatetime'=>SYS_TIME)); } } return true; } else { $siteid = get_siteid(); $this->categorys = getcache('category_content_'.$siteid,'commons'); $tree = pc_base::load_sys_class('tree'); $tree->icon = array('&nbsp;&nbsp;&nbsp;│ ','&nbsp;&nbsp;&nbsp;├─ ','&nbsp;&nbsp;&nbsp;└─ '); $tree->nbsp = '&nbsp;&nbsp;&nbsp;'; $categorys = array(); $this->catids_string = array(); if($_SESSION['roleid'] != 1) { $this->priv_db = pc_base::load_model('category_priv_model'); $priv_result = $this->priv_db->select(array('action'=>'add','roleid'=>$_SESSION['roleid'],'siteid'=>$siteid,'is_admin'=>1)); $priv_catids = array(); foreach($priv_result as $_v) { $priv_catids[] = $_v['catid']; } if(empty($priv_catids)) return ''; } foreach($this->categorys as $r) { if($r['siteid']!=$siteid || $r['type']!=0) continue; if($_SESSION['roleid'] != 1 && !in_array($r['catid'],$priv_catids)) { $arrchildid = explode(',',$r['arrchildid']); $array_intersect = array_intersect($priv_catids,$arrchildid); if(empty($array_intersect)) continue; } if($r['child']) { $r['checkbox'] = ''; $r['style'] = 'color:#8A8A8A;'; } else { $checked = ''; if($typeid && $r['usable_type']) { $usable_type = explode(',', $r['usable_type']); if(in_array($typeid, $usable_type)) { $checked = 'checked'; $this->catids_string[] = $r['catid']; } } $r['checkbox'] = "<input type='checkbox' name='ids[]' value='{$r[catid]}' {$checked}>"; $r['style'] = ''; } $categorys[$r['catid']] = $r; } $str = "<tr> <td align='center'>\$checkbox</td> <td style='\$style'>\$spacer\$catname</td> </tr>"; $tree->init($categorys); $categorys = $tree->get_tree(0, $str); return $categorys; } } } ?>
108wo
phpcms/modules/content/classes/push_api.class.php
PHP
asf20
4,562
<?php /** * @package RSSBuilder * @category FLP */ /** * Abstract class for getting ini preferences * * Tested with WAMP (XP-SP1/1.3.27/4.0.12/4.3.2) * Last change: 2003-06-26 * * @desc Abstract class for the RSS classes * @access protected * @author Michael Wimmer <flaimo 'at' gmx 'dot' net> * @copyright Michael Wimmer * @link http://www.flaimo.com/ * @global array $GLOBALS['_TICKER_ini_settings'] * @abstract * @package RSSBuilder * @category FLP * @version 1.002 */ class RSSBase { /*-----------------------*/ /* C O N S T R U C T O R */ /*-----------------------*/ /** * Constructor * * @desc Constructor * @return void * @access private */ function RSSBase() { } // end constructor } // end class RSSBase //--------------------------------------------------------------------------- /** * Class for creating a RSS file * * Tested with WAMP (XP-SP1/1.3.27/4.0.12/4.3.2) * Last change: 2003-06-26 * * @desc Class for creating a RSS file * @access public * @author Michael Wimmer <flaimo@gmx.net> * @copyright Michael Wimmer * @link http://www.flaimo.com/ * @example rss_sample_script.php Sample script * @package RSSBuilder * @category FLP * @version 1.002 */ class RSSBuilder extends RSSBase { /*-------------------*/ /* V A R I A B L E S */ /*-------------------*/ /**#@+ * @access private * @var string */ /** * encoding of the XML file * * @desc encoding of the XML file */ var $encoding; /** * URL where the RSS document will be made available * * @desc URL where the RSS document will be made available */ var $about; /** * title of the rss stream * * @desc title of the rss stream */ var $title; /** * description of the rss stream * * @desc description of the rss stream */ var $description; /** * publisher of the rss stream (person, an organization, or a service) * * @desc publisher of the rss stream */ var $publisher; /** * creator of the rss stream (person, an organization, or a service) * * @desc creator of the rss stream */ var $creator; /** * creation date of the file (format: 2003-05-29T00:03:07+0200) * * @desc creation date of the file (format: 2003-05-29T00:03:07+0200) */ var $date; /** * iso format language * * @desc iso format language */ var $language; /** * copyrights for the rss stream * * @desc copyrights for the rss stream */ var $rights; /** * URL to an small image * * @desc URL to an small image */ var $image_link; /** * spatial location, temporal period or jurisdiction * * spatial location (a place name or geographic coordinates), temporal * period (a period label, date, or date range) or jurisdiction (such as a * named administrative entity) * * @desc spatial location, temporal period or jurisdiction */ var $coverage; /** * person, an organization, or a service * * @desc person, an organization, or a service */ var $contributor; /** * 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' * * @desc 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' */ var $period; /** * date (format: 2003-05-29T00:03:07+0200) * * Defines a base date to be used in concert with updatePeriod and * updateFrequency to calculate the publishing schedule. * * @desc base date to calculate from (format: 2003-05-29T00:03:07+0200) */ var $base; /** * category (rss 2.0) * * @desc category (rss 2.0) * @since 1.001 - 2003-05-30 */ var $category; /** * compiled outputstring * * @desc compiled outputstring */ var $output; /**#@-*/ /**#@+ * @access private */ /** * every X hours/days/weeks/... * * @desc every X hours/days/weeks/... * @var int */ var $frequency; /** * caching time in minutes (rss 2.0) * * @desc caching time in minutes (rss 2.0) * @var int * @since 1.001 - 2003-05-30 */ var $cache; /** * array wich all the rss items * * @desc array wich all the rss items * @var array */ var $items = array(); /** * use DC data * * @desc use DC data * @var boolean */ var $use_dc_data = FALSE; /** * use SY data * * @desc use SY data * @var boolean */ var $use_sy_data = FALSE; /**#@-*/ /*-----------------------*/ /* C O N S T R U C T O R */ /*-----------------------*/ /**#@+ * @return void */ /** * Constructor * * @desc Constructor * @param string $encoding encoding of the xml file * @param string $about URL where the RSS document will be made available * @param string $title * @param string $description * @param string $image_link URL * @uses setEncoding() * @uses setAbout() * @uses setTitle() * @uses setDescription() * @uses setImageLink() * @uses setCategory() * @uses etCache() * @access private */ function RSSBuilder($encoding = '', $about = '', $title = '', $description = '', $image_link = '', $category = '', $cache = '') { $this->setEncoding($encoding); $this->setAbout($about); $this->setTitle($title); $this->setDescription($description); $this->setImageLink($image_link); $this->setCategory($category); $this->setCache($cache); } // end constructor /*-------------------*/ /* F U N C T I O N S */ /*-------------------*/ /** * add additional DC data * * @desc add additional DC data * @param string $publisher person, an organization, or a service * @param string $creator person, an organization, or a service * @param string $date format: 2003-05-29T00:03:07+0200 * @param string $language iso-format * @param string $rights copyright information * @param string $coverage spatial location (a place name or geographic coordinates), temporal period (a period label, date, or date range) or jurisdiction (such as a named administrative entity) * @param string $contributor person, an organization, or a service * @uses setPublisher() * @uses setCreator() * @uses setDate() * @uses setLanguage() * @uses setRights() * @uses setCoverage() * @uses setContributor() * @access public */ function addDCdata($publisher = '', $creator = '', $date = '', $language = '', $rights = '', $coverage = '', $contributor = '') { $this->setPublisher($publisher); $this->setCreator($creator); $this->setDate($date); $this->setLanguage($language); $this->setRights($rights); $this->setCoverage($coverage); $this->setContributor($contributor); $this->use_dc_data = (boolean) TRUE; } // end function /** * add additional SY data * * @desc add additional DC data * @param string $period 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' * @param int $frequency every x hours/days/weeks/... * @param string $base format: 2003-05-29T00:03:07+0200 * @uses setPeriod() * @uses setFrequency() * @uses setBase() * @access public */ function addSYdata($period = '', $frequency = '', $base = '') { $this->setPeriod($period); $this->setFrequency($frequency); $this->setBase($base); $this->use_sy_data = (boolean) TRUE; } // end function /**#@-*/ /**#@+ * @return void * @access private */ /** * Sets $encoding variable * * @desc Sets $encoding variable * @param string $encoding encoding of the xml file * @see $encoding */ function setEncoding($encoding = '') { if (!isset($this->encoding)) { $this->encoding = (string) ((strlen(trim($encoding)) > 0) ? trim($encoding) : 'UTF-8'); } // end if } // end function /** * Sets $about variable * * @desc Sets $about variable * @param string $about * @see $about */ function setAbout($about = '') { if (!isset($this->about) && strlen(trim($about)) > 0) { $this->about = (string) trim($about); } // end if } // end function /** * Sets $title variable * * @desc Sets $title variable * @param string $title * @see $title */ function setTitle($title = '') { if (!isset($this->title) && strlen(trim($title)) > 0) { $this->title = (string) trim($title); } // end if } // end function /** * Sets $description variable * * @desc Sets $description variable * @param string $description * @see $description */ function setDescription($description = '') { if (!isset($this->description) && strlen(trim($description)) > 0) { $this->description = (string) trim($description); } // end if } // end function /** * Sets $publisher variable * * @desc Sets $publisher variable * @param string $publisher * @see $publisher */ function setPublisher($publisher = '') { if (!isset($this->publisher) && strlen(trim($publisher)) > 0) { $this->publisher = (string) trim($publisher); } // end if } // end function /** * Sets $creator variable * * @desc Sets $creator variable * @param string $creator * @see $creator */ function setCreator($creator = '') { if (!isset($this->creator) && strlen(trim($creator)) > 0) { $this->creator = (string) trim($creator); } // end if } // end function /** * Sets $date variable * * @desc Sets $date variable * @param string $date format: 2003-05-29T00:03:07+0200 * @see $date */ function setDate($date = '') { if (!isset($this->date) && strlen(trim($date)) > 0) { $this->date = (string) trim($date); } // end if } // end function /** * Sets $language variable * * @desc Sets $language variable * @param string $language * @see $language * @uses isValidLanguageCode() */ function setLanguage($language = '') { if (!isset($this->language) && $this->isValidLanguageCode($language) === TRUE) { $this->language = (string) trim($language); } // end if } // end function /** * Sets $rights variable * * @desc Sets $rights variable * @param string $rights * @see $rights */ function setRights($rights = '') { if (!isset($this->rights) && strlen(trim($rights)) > 0) { $this->rights = (string) trim($rights); } // end if } // end function /** * Sets $coverage variable * * @desc Sets $coverage variable * @param string $coverage * @see $coverage */ function setCoverage($coverage = '') { if (!isset($this->coverage) && strlen(trim($coverage)) > 0) { $this->coverage = (string) trim($coverage); } // end if } // end function /** * Sets $contributor variable * * @desc Sets $contributor variable * @param string $contributor * @see $contributor */ function setContributor($contributor = '') { if (!isset($this->contributor) && strlen(trim($contributor)) > 0) { $this->contributor = (string) trim($contributor); } // end if } // end function /** * Sets $image_link variable * * @desc Sets $image_link variable * @param string $image_link * @see $image_link */ function setImageLink($image_link = '') { if (!isset($this->image_link) && strlen(trim($image_link)) > 0) { $this->image_link = (string) trim($image_link); } // end if } // end function /** * Sets $period variable * * @desc Sets $period variable * @param string $period 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' * @see $period */ function setPeriod($period = '') { if (!isset($this->period) && strlen(trim($period)) > 0) { switch ($period) { case 'hourly': case 'daily': case 'weekly': case 'monthly': case 'yearly': $this->period = (string) trim($period); break; default: $this->period = (string) ''; break; } // end switch } // end if } // end function /** * Sets $frequency variable * * @desc Sets $frequency variable * @param int $frequency * @see $frequency */ function setFrequency($frequency = '') { if (!isset($this->frequency) && strlen(trim($frequency)) > 0) { $this->frequency = (int) $frequency; } // end if } // end function /** * Sets $base variable * * @desc Sets $base variable * @param string $base * @see $base */ function setBase($base = '') { if (!isset($this->base) && strlen(trim($base)) > 0) { $this->base = (string) trim($base); } // end if } // end function /** * Sets $category variable * * @desc Sets $category variable * @param string $category * @see $category * @since 1.001 - 2003-05-30 */ function setCategory($category = '') { if (strlen(trim($category)) > 0) { $this->category = (string) trim($category); } // end if } // end function /** * Sets $cache variable * * @desc Sets $cache variable * @param int $cache * @see $cache * @since 1.001 - 2003-05-30 */ function setCache($cache = '') { if (strlen(trim($cache)) > 0) { $this->cache = (int) $cache; } // end if } // end function /**#@-*/ /**#@+ * @access public */ /** * Checks if a given string is a valid iso-language-code * * @desc Checks if a given string is a valid iso-language-code * @param string $code String that should validated * @return boolean $isvalid If string is valid or not * @static */ function isValidLanguageCode($code = '') { return (boolean) ((preg_match('(^([a-zA-Z]{2})$)',$code) > 0) ? TRUE : FALSE); } // end function /** * Returns $encoding variable * * @desc Returns $encoding variable * @return string $encoding * @see $image_link */ function getEncoding() { return (string) $this->encoding; } // end function /** * Returns $about variable * * @desc Returns $about variable * @return string $about * @see $about */ function getAbout() { return (string) $this->about; } // end function /** * Returns $title variable * * @desc Returns $title variable * @return string $title * @see $title */ function getTitle() { return (string) $this->title; } // end function /** * Returns $description variable * * @desc Returns $description variable * @return string $description * @see $description */ function getDescription() { return (string) $this->description; } // end function /** * Returns $publisher variable * * @desc Returns $publisher variable * @return string $publisher * @see $publisher */ function getPublisher() { return (string) $this->publisher; } // end function /** * Returns $creator variable * * @desc Returns $creator variable * @return string $creator * @see $creator */ function getCreator() { return (string) $this->creator; } // end function /** * Returns $date variable * * @desc Returns $date variable * @return string $date * @see $date */ function getDate() { return (string) $this->date; } // end function /** * Returns $language variable * * @desc Returns $language variable * @return string $language * @see $language */ function getLanguage() { return (string) $this->language; } // end function /** * Returns $rights variable * * @desc Returns $rights variable * @return string $rights * @see $rights */ function getRights() { return (string) $this->rights; } // end function /** * Returns $coverage variable * * @desc Returns $coverage variable * @return string $coverage * @see $coverage */ function getCoverage() { return (string) $this->coverage; } // end function /** * Returns $contributor variable * * @desc Returns $contributor variable * @return string $contributor * @see $contributor */ function getContributor() { return (string) $this->contributor; } // end function /** * Returns $image_link variable * * @desc Returns $image_link variable * @return string $image_link * @see $image_link */ function getImageLink() { return (string) $this->image_link; } // end function /** * Returns $period variable * * @desc Returns $period variable * @return string $period * @see $period */ function getPeriod() { return (string) $this->period; } // end function /** * Returns $frequency variable * * @desc Returns $frequency variable * @return string $frequency * @see $frequency */ function getFrequency() { return (int) $this->frequency; } // end function /** * Returns $base variable * * @desc Returns $base variable * @return string $base * @see $base */ function getBase() { return (string) $this->base; } // end function /** * Returns $category variable * * @desc Returns $category variable * @return string $category * @see $category * @since 1.001 - 2003-05-30 */ function getCategory() { return (string) $this->category; } // end function /** * Returns $cache variable * * @desc Returns $cache variable * @return int $cache * @see $cache * @since 1.001 - 2003-05-30 */ function getCache() { return (int) $this->cache; } // end function /** * Adds another rss item to the object * * @desc Adds another rss item to the object * @param string $about URL * @param string $title * @param string $link URL * @param string $description (optional) * @param string $subject some sort of category (optional dc value - only shows up if DC data has been set before) * @param string $date format: 2003-05-29T00:03:07+0200 (optional dc value - only shows up if DC data has been set before) * @param string $author some sort of category author of item * @param string $comments url to comment page rss 2.0 value * @param string $image optional mod_im value for dispaying a different pic for every item * @return void * @see $items * @uses RSSItem */ function addItem($about = '', $title = '', $link = '', $description = '', $subject = '', $date = '', $author = '', $comments = '', $image = '') { $item = new RSSItem($about, $title, $link, $description, $subject, $date, $author, $comments, $image); $this->items[] = $item; } // end function /** * Deletes a rss item from the array * * @desc Deletes a rss item from the array * @param int $id id of the element in the $items array * @return boolean true if item was deleted * @see $items */ function deleteItem($id = -1) { if (array_key_exists($id, $this->items)) { unset($this->items[$id]); return (boolean) TRUE; } else { return (boolean) FALSE; } // end if } // end function /** * Returns an array with all the keys of the $items array * * @desc Returns an array with all the keys of the $items array * @return array array with all the keys of the $items array * @see $items */ function getItemList() { return (array) array_keys($this->items); } // end function /** * Returns the $items array * * @desc Returns the $items array * @return array $items */ function getItems() { return (array) $this->items; } // end function /** * Returns a single rss item by ID * * @desc Returns a single rss item by ID * @param int $id id of the element in the $items array * @return mixed RSSItem or FALSE * @see RSSItem */ function getItem($id = -1) { if (array_key_exists($id, $this->items)) { return (object) $this->items[$id]; } else { return (boolean) FALSE; } // end if } // end function /**#@-*/ /**#@+ * @return void * @access private */ /** * creates the output based on the 0.91 rss version * * @desc creates the output based on the 0.91 rss version * @see $output */ function createOutputV090() { // not implemented $this->createOutputV100(); } // end function /** * creates the output based on the 0.91 rss version * * @desc creates the output based on the 0.91 rss version * @see $output * @since 1.001 - 2003-05-30 */ function createOutputV091() { $this->output = (string) '<!DOCTYPE rss SYSTEM "http://my.netscape.com/publish/formats/rss-0.91.dtd">' . "\n"; $this->output .= (string) '<rss version="0.91">' . "\n"; $this->output .= (string) '<channel>' . "\n"; if (strlen($this->rights) > 0) { $this->output .= (string) '<copyright>' . $this->rights . '</copyright>' . "\n"; } // end if if (strlen($this->date) > 0) { $this->output .= (string) '<pubDate>' .$this->date . '</pubDate>' . "\n"; $this->output .= (string) '<lastBuildDate>' .$this->date . '</lastBuildDate>' . "\n"; } // end if if (strlen($this->about) > 0) { $this->output .= (string) '<docs>' . $this->about . '</docs>' . "\n"; } // end if if (strlen($this->description) > 0) { $this->output .= (string) '<description>' . $this->description . '</description>' . "\n"; } // end if if (strlen($this->about) > 0) { $this->output .= (string) '<link>' . $this->about . '</link>' . "\n"; } // end if if (strlen($this->title) > 0) { $this->output .= (string) '<title>' . $this->title . '</title>' . "\n"; } // end if if (strlen($this->image_link) > 0) { $this->output .= (string) '<image>' . "\n"; $this->output .= (string) '<title>' . $this->title . '</title>' . "\n"; $this->output .= (string) '<url>' . $this->image_link . '</url>' . "\n"; $this->output .= (string) '<link>' . $this->about . '</link>' . "\n"; if (strlen($this->description) > 0) { $this->output .= (string) '<description>' . $this->description . '</description>' . "\n"; } // end if $this->output .= (string) '</image>' . "\n"; } // end if if (strlen($this->publisher) > 0) { $this->output .= (string) '<managingEditor>' . $this->publisher . '</managingEditor>' . "\n"; } // end if if (strlen($this->creator) > 0) { $this->output .= (string) '<webMaster>' . $this->creator . '</webMaster>' . "\n"; } // end if if (strlen($this->language) > 0) { $this->output .= (string) '<language>' . $this->language . '</language>' . "\n"; } // end if if (count($this->getItemList()) > 0) { foreach ($this->getItemList() as $id) { $item =& $this->items[$id]; if (strlen($item->getTitle()) > 0 && strlen($item->getLink()) > 0) { $this->output .= (string) '<item>' . "\n"; $this->output .= (string) '<title>' . $item->getTitle() . '</title>' . "\n"; $this->output .= (string) '<link>' . $item->getLink() . '</link>' . "\n"; if (strlen($item->getDescription()) > 0) { $this->output .= (string) '<description>' . $item->getDescription() . '</description>' . "\n"; } // end if $this->output .= (string) '</item>' . "\n"; } // end if } // end foreach } // end if $this->output .= (string) '</channel>' . "\n"; $this->output .= (string) '</rss>' . "\n"; } // end function /** * creates the output based on the 1.0 rss version * * @desc creates the output based on the 1.0 rss version * @see $output */ function createOutputV100() { $this->output = (string) '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:im="http://purl.org/rss/1.0/item-images/" '; if ($this->use_dc_data === TRUE) { $this->output .= (string) 'xmlns:dc="http://purl.org/dc/elements/1.1/" '; } // end if if ($this->use_sy_data === TRUE) { $this->output .= (string) 'xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" '; } // end if $this->output .= (string) 'xmlns="http://purl.org/rss/1.0/">' . "\n"; if (strlen($this->about) > 0) { $this->output .= (string) '<channel rdf:about="' . $this->about . '">' . "\n"; } else { $this->output .= (string) '<channel>' . "\n"; } // end if if (strlen($this->title) > 0) { $this->output .= (string) '<title>' . $this->title . '</title>' . "\n"; } // end if if (strlen($this->about) > 0) { $this->output .= (string) '<link>' . $this->about . '</link>' . "\n"; } // end if if (strlen($this->description) > 0) { $this->output .= (string) '<description>' . $this->description . '</description>' . "\n"; } // end if // additional dc data if (strlen($this->publisher) > 0) { $this->output .= (string) '<dc:publisher>' . $this->publisher . '</dc:publisher>' . "\n"; } // end if if (strlen($this->creator) > 0) { $this->output .= (string) '<dc:creator>' . $this->creator . '</dc:creator>' . "\n"; } // end if if (strlen($this->date) > 0) { $this->output .= (string) '<dc:date>' .$this->date . '</dc:date>' . "\n"; } // end if if (strlen($this->language) > 0) { $this->output .= (string) '<dc:language>' . $this->language . '</dc:language>' . "\n"; } // end if if (strlen($this->rights) > 0) { $this->output .= (string) '<dc:rights>' . $this->rights . '</dc:rights>' . "\n"; } // end if if (strlen($this->coverage) > 0) { $this->output .= (string) '<dc:coverage>' . $this->coverage . '</dc:coverage>' . "\n"; } // end if if (strlen($this->contributor) > 0) { $this->output .= (string) '<dc:contributor>' . $this->contributor . '</dc:contributor>' . "\n"; } // end if // additional SY data if (strlen($this->period) > 0) { $this->output .= (string) '<sy:updatePeriod>' . $this->period . '</sy:updatePeriod>' . "\n"; } // end if if (strlen($this->frequency) > 0) { $this->output .= (string) '<sy:updateFrequency>' . $this->frequency . '</sy:updateFrequency>' . "\n"; } // end if if (strlen($this->base) > 0) { $this->output .= (string) '<sy:updateBase>' . $this->base . '</sy:updateBase>' . "\n"; } // end if if (strlen($this->image_link) > 0) { $this->output .= (string) '<image rdf:about="' . $this->image_link . '">' . "\n"; $this->output .= (string) '<title>' . $this->title . '</title>' . "\n"; $this->output .= (string) '<url>' . $this->image_link . '</url>' . "\n"; $this->output .= (string) '<link>' . $this->about . '</link>' . "\n"; if (strlen($this->description) > 0) { $this->output .= (string) '<description>' . $this->description . '</description>' . "\n"; } // end if $this->output .= (string) '</image>' . "\n"; } // end if if (count($this->getItemList()) > 0) { $this->output .= (string) '<items><rdf:Seq>' . "\n"; foreach ($this->getItemList() as $id) { $item =& $this->items[$id]; if (strlen($item->getAbout()) > 0) { $this->output .= (string) ' <rdf:li resource="' . $item->getAbout() . '" />' . "\n"; } // end if } // end foreach $this->output .= (string) '</rdf:Seq></items>' . "\n"; } // end if $this->output .= (string) '</channel>' . "\n"; if (count($this->getItemList()) > 0) { foreach ($this->getItemList() as $id) { $item =& $this->items[$id]; if (strlen($item->getTitle()) > 0 && strlen($item->getLink()) > 0) { if (strlen($item->getAbout()) > 0) { $this->output .= (string) '<item rdf:about="' . $item->getAbout() . '">' . "\n"; } else { $this->output .= (string) '<item>' . "\n"; } // end if $this->output .= (string) '<title>' . $item->getTitle() . '</title>' . "\n"; $this->output .= (string) '<link>' . $item->getLink() . '</link>' . "\n"; if (strlen($item->getDescription()) > 0) { $this->output .= (string) '<description>' . $item->getDescription() . '</description>' . "\n"; } // end if if ($this->use_dc_data === TRUE && strlen($item->getSubject()) > 0) { $this->output .= (string) '<dc:subject>' . $item->getSubject() . '</dc:subject>' . "\n"; } // end if if ($this->use_dc_data === TRUE && strlen($item->getDate()) > 0) { $this->output .= (string) '<dc:date>' . $item->getDate() . '</dc:date>' . "\n"; } // end if if (strlen($item->getImage()) > 0) { $this->output .= (string) '<im:image>' . $item->getImage() . '</im:image>' . "\n"; } // end if $this->output .= (string) '</item>' . "\n"; } // end if } // end foreach } // end if $this->output .= (string) '</rdf:RDF>'; } // end function /** * creates the output based on the 2.0 rss draft * * @desc creates the output based on the 0.91 rss draft * @see $output * @since 1.001 - 2003-05-30 */ function createOutputV200() { $this->output = (string) '<rss version="2.0" xmlns:im="http://purl.org/rss/1.0/item-images/" '; if ($this->use_dc_data === TRUE) { $this->output .= (string) 'xmlns:dc="http://purl.org/dc/elements/1.1/" '; } // end if if ($this->use_sy_data === TRUE) { $this->output .= (string) 'xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" '; } // end if $this->output .= (string) '>' . "\n"; $this->output .= (string) '<channel>' . "\n"; if (strlen($this->rights) > 0) { $this->output .= (string) '<copyright>' . $this->rights . '</copyright>' . "\n"; } // end if if (strlen($this->date) > 0) { $this->output .= (string) '<pubDate>' .$this->date . '</pubDate>' . "\n"; $this->output .= (string) '<lastBuildDate>' .$this->date . '</lastBuildDate>' . "\n"; } // end if if (strlen($this->about) > 0) { $this->output .= (string) '<docs>' . $this->about . '</docs>' . "\n"; } // end if if (strlen($this->description) > 0) { $this->output .= (string) '<description>' . $this->description . '</description>' . "\n"; } // end if if (strlen($this->about) > 0) { $this->output .= (string) '<link>' . $this->about . '</link>' . "\n"; } // end if if (strlen($this->title) > 0) { $this->output .= (string) '<title>' . $this->title . '</title>' . "\n"; } // end if if (strlen($this->image_link) > 0) { $this->output .= (string) '<image>' . "\n"; $this->output .= (string) '<title>' . $this->title . '</title>' . "\n"; $this->output .= (string) '<url>' . $this->image_link . '</url>' . "\n"; $this->output .= (string) '<link>' . $this->about . '</link>' . "\n"; if (strlen($this->description) > 0) { $this->output .= (string) '<description>' . $this->description . '</description>' . "\n"; } // end if $this->output .= (string) '</image>' . "\n"; } // end if if (strlen($this->publisher) > 0) { $this->output .= (string) '<managingEditor>' . $this->publisher . '</managingEditor>' . "\n"; } // end if if (strlen($this->creator) > 0) { $this->output .= (string) '<webMaster>' . $this->creator . '</webMaster>' . "\n"; $this->output .= (string) '<generator>' . $this->creator . '</generator>' . "\n"; } // end if if (strlen($this->language) > 0) { $this->output .= (string) '<language>' . $this->language . '</language>' . "\n"; } // end if if (strlen($this->category) > 0) { $this->output .= (string) '<category>' . $this->category . '</category>' . "\n"; } // end if if (strlen($this->cache) > 0) { $this->output .= (string) '<ttl>' . $this->cache . '</ttl>' . "\n"; } // end if // additional dc data if (strlen($this->publisher) > 0) { $this->output .= (string) '<dc:publisher>' . $this->publisher . '</dc:publisher>' . "\n"; } // end if if (strlen($this->creator) > 0) { $this->output .= (string) '<dc:creator>' . $this->creator . '</dc:creator>' . "\n"; } // end if if (strlen($this->date) > 0) { $this->output .= (string) '<dc:date>' .$this->date . '</dc:date>' . "\n"; } // end if if (strlen($this->language) > 0) { $this->output .= (string) '<dc:language>' . $this->language . '</dc:language>' . "\n"; } // end if if (strlen($this->rights) > 0) { $this->output .= (string) '<dc:rights>' . $this->rights . '</dc:rights>' . "\n"; } // end if if (strlen($this->coverage) > 0) { $this->output .= (string) '<dc:coverage>' . $this->coverage . '</dc:coverage>' . "\n"; } // end if if (strlen($this->contributor) > 0) { $this->output .= (string) '<dc:contributor>' . $this->contributor . '</dc:contributor>' . "\n"; } // end if // additional SY data if (strlen($this->period) > 0) { $this->output .= (string) '<sy:updatePeriod>' . $this->period . '</sy:updatePeriod>' . "\n"; } // end if if (strlen($this->frequency) > 0) { $this->output .= (string) '<sy:updateFrequency>' . $this->frequency . '</sy:updateFrequency>' . "\n"; } // end if if (strlen($this->base) > 0) { $this->output .= (string) '<sy:updateBase>' . $this->base . '</sy:updateBase>' . "\n"; } // end if if (count($this->getItemList()) > 0) { foreach ($this->getItemList() as $id) { $item =& $this->items[$id]; if (strlen($item->getTitle()) > 0 && strlen($item->getLink()) > 0) { $this->output .= (string) '<item>' . "\n"; $this->output .= (string) '<title>' . $item->getTitle() . '</title>' . "\n"; $this->output .= (string) '<link>' . $item->getLink() . '</link>' . "\n"; if (strlen($item->getDescription()) > 0) { $this->output .= (string) '<description>' . $item->getDescription() . '</description>' . "\n"; } // end if if ($this->use_dc_data === TRUE && strlen($item->getSubject()) > 0) { $this->output .= (string) '<category>' . $item->getSubject() . '</category>' . "\n"; } // end if if ($this->use_dc_data === TRUE && strlen($item->getDate()) > 0) { $this->output .= (string) '<pubDate>' . $item->getDate() . '</pubDate>' . "\n"; } // end if if (strlen($item->getAbout()) > 0) { $this->output .= (string) '<guid>' . $item->getAbout() . '</guid>' . "\n"; } // end if if (strlen($item->getAuthor()) > 0) { $this->output .= (string) '<author>' . $item->getAuthor() . '</author>' . "\n"; } // end if if (strlen($item->getComments()) > 0) { $this->output .= (string) '<comments>' . $item->getComments() . '</comments>' . "\n"; } // end if if (strlen($item->getImage()) > 0) { $this->output .= (string) '<im:image>' . $item->getImage() . '</im:image>' . "\n"; } // end if $this->output .= (string) '</item>' . "\n"; } // end if } // end foreach } // end if $this->output .= (string) '</channel>' . "\n"; $this->output .= (string) '</rss>' . "\n"; } // end function /** * creates the output * * @desc creates the output * @uses createOutputV090() * @uses createOutputV091() * @uses createOutputV200() * @uses createOutputV100() */ function createOutput($version = '') { if (strlen(trim($version)) === 0) { $version = (string) '1.0'; } // end if switch ($version) { case '0.9': $this->createOutputV090(); break; case '0.91': $this->createOutputV091(); break; case '2.00': $this->createOutputV200(); break; case '1.0': default: $this->createOutputV100(); break; } // end switch } // end function /**#@-*/ /**#@+ * @return void * @access public * @uses createOutput() */ /** * echos the output * * use this function if you want to directly output the rss stream * * @desc echos the output */ function outputRSS($version = '') { if (!isset($this->output)) { $this->createOutput($version); } // end if header ('content-type: text/xml'); header('Content-Disposition: inline; filename=rss_' . str_replace(' ','',$this->title) . '.xml'); $this->output = '<?xml version="1.0" encoding="' . $this->encoding . '"?>' . "\n" . '<!-- RSS generated by phpcms.cn RSS Builder [' . date('Y-m-d H:i:s') .'] --> '. "\n" . $this->output; echo $this->output; } // end function /** * returns the output * * use this function if you want to have the output stream as a string (for example to write it in a cache file) * * @desc returns the output */ function getRSSOutput($version = '') { if (!isset($this->output)) { $this->createOutput($version); } // end if return (string) '<?xml version="1.0" encoding="' . $this->encoding . '"?>' . "\n" . '<!-- RSS generated by phpcms.cn RSS Builder [' . date('Y-m-d H:i:s') .'] --> ' . $this->output; } // end function /**#@-*/ } // end class RSSBuilder //--------------------------------------------------------------------------- /** * single rss item object * * Tested with WAMP (XP-SP1/1.3.27/4.0.12/4.3.2) * Last change: 2003-06-26 * * @desc single rss item object * @access private * @author Michael Wimmer <flaimo@gmx.net> * @copyright Michael Wimmer * @link http://www.flaimo.com/ * @package RSSBuilder * @category FLP * @version 1.002 */ class RSSItem extends RSSBase { /*-------------------*/ /* V A R I A B L E S */ /*-------------------*/ /**#@+ * @access private * @var string */ /** * URL * * @desc URL */ var $about; /** * headline * * @desc headline */ var $title; /** * URL to the full item * * @desc URL to the full item */ var $link; /** * optional description * * @desc optional description */ var $description; /** * optional subject (category) * * @desc optional subject (category) */ var $subject; /** * optional date * * @desc optional date */ var $date; /** * author of item * * @desc author of item * @since 1.001 - 2003-05-30 */ var $author; /** * url to comments page (rss 2.0) * * @desc url to comments page (rss 2.0) * @since 1.001 - 2003-05-30 */ var $comments; /** * imagelink for this item (mod_im only) * * @desc imagelink for this item (mod_im only) * @since 1.002 - 2003-06-26 */ var $image; /**#@-*/ /*-----------------------*/ /* C O N S T R U C T O R */ /*-----------------------*/ /**#@+ * @access private * @return void */ /** * Constructor * * @desc Constructor * @param string $about URL * @param string $title * @param string $link URL * @param string $description (optional) * @param string $subject some sort of category (optional) * @param string $date format: 2003-05-29T00:03:07+0200 (optional) * @param string $author some sort of category author of item * @param string $comments url to comment page rss 2.0 value * @param string $image optional mod_im value for dispaying a different pic for every item * @uses setAbout() * @uses setTitle() * @uses setLink() * @uses setDescription() * @uses setSubject() * @uses setDate() * @uses setAuthor() * @uses setComments() * @uses setImage() */ function RSSItem($about = '', $title = '', $link = '', $description = '', $subject = '', $date = '', $author = '', $comments = '', $image = '') { $this->setAbout($about); $this->setTitle($title); $this->setLink($link); $this->setDescription($description); $this->setSubject($subject); $this->setDate($date); $this->setAuthor($author); $this->setComments($comments); $this->setImage($image); } // end constructor /** * Sets $about variable * * @desc Sets $about variable * @param string $about * @see $about */ function setAbout($about = '') { if (!isset($this->about) && strlen(trim($about)) > 0) { $this->about = (string) trim($about); } // end if } // end function /** * Sets $title variable * * @desc Sets $title variable * @param string $title * @see $title */ function setTitle($title = '') { if (!isset($this->title) && strlen(trim($title)) > 0) { $this->title = (string) trim($title); } // end if } // end function /** * Sets $link variable * * @desc Sets $link variable * @param string $link * @see $link */ function setLink($link = '') { if (!isset($this->link) && strlen(trim($link)) > 0) { $this->link = (string) trim($link); } // end if } // end function /** * Sets $description variable * * @desc Sets $description variable * @param string $description * @see $description */ function setDescription($description = '') { if (!isset($this->description) && strlen(trim($description)) > 0) { $this->description = (string) trim($description); } // end if } // end function /** * Sets $subject variable * * @desc Sets $subject variable * @param string $subject * @see $subject */ function setSubject($subject = '') { if (!isset($this->subject) && strlen(trim($subject)) > 0) { $this->subject = (string) trim($subject); } // end if } // end function /** * Sets $date variable * * @desc Sets $date variable * @param string $date * @see $date */ function setDate($date = '') { if (!isset($this->date) && strlen(trim($date)) > 0) { $this->date = (string) trim($date); } // end if } // end function /** * Sets $author variable * * @desc Sets $author variable * @param string $author * @see $author * @since 1.001 - 2003-05-30 */ function setAuthor($author = '') { if (!isset($this->author) && strlen(trim($author)) > 0) { $this->author = (string) trim($author); } // end if } // end function /** * Sets $comments variable * * @desc Sets $comments variable * @param string $comments * @see $comments * @since 1.001 - 2003-05-30 */ function setComments($comments = '') { if (!isset($this->comments) && strlen(trim($comments)) > 0) { $this->comments = (string) trim($comments); } // end if } // end function /** * Sets $image variable * * @desc Sets $image variable * @param string $image * @see $image * @since 1.002 - 2003-06-26 */ function setImage($image = '') { if (!isset($this->image) && strlen(trim($image)) > 0) { $this->image = (string) trim($image); } // end if } // end function /**#@-*/ /**#@+ * @access public */ /** * Returns $about variable * * @desc Returns $about variable * @return string $about * @see $about */ function getAbout() { return (string) $this->about; } // end function /** * Returns $title variable * * @desc Returns $title variable * @return string $title * @see $title */ function getTitle() { return (string) $this->title; } // end function /** * Returns $link variable * * @desc Returns $link variable * @return string $link * @see $link */ function getLink() { return (string) $this->link; } // end function /** * Returns $description variable * * @desc Returns $description variable * @return string $description * @see $description */ function getDescription() { return (string) $this->description; } // end function /** * Returns $subject variable * * @desc Returns $subject variable * @return string $subject * @see $subject */ function getSubject() { return (string) $this->subject; } // end function /** * Returns $date variable * * @desc Returns $date variable * @return string $date * @see $date */ function getDate() { return (string) $this->date; } // end function /** * Returns $author variable * * @desc Returns $author variable * @return string $author * @see $author * @since 1.001 - 2003-05-30 */ function getAuthor() { return (string) $this->author; } // end function /** * Returns $comments variable * * @desc Returns $comments variable * @return string $comments * @see $comments * @since 1.001 - 2003-05-30 */ function getComments() { return (string) $this->comments; } // end function /** * Returns $image variable * * @desc Returns $image variable * @return string $image * @see $image * @since 1.002 - 2003-06-26 */ function getImage() { return (string) $this->image; } // end function /**#@-*/ } // end class RSSItem ?>
108wo
phpcms/modules/content/classes/rssbuilder.class.php
PHP
asf20
43,903
<?php class content_tag { private $db; public function __construct() { $this->db = pc_base::load_model('content_model'); $this->position = pc_base::load_model('position_data_model'); } /** * 初始化模型 * @param $catid */ public function set_modelid($catid) { $siteids = getcache('category_content','commons'); if(!$siteids[$catid]) return false; $siteid = $siteids[$catid]; $this->category = getcache('category_content_'.$siteid,'commons'); if($this->category[$catid]['type']!=0) return false; $this->modelid = $this->category[$catid]['modelid']; $this->db->set_model($this->modelid); $this->tablename = $this->db->table_name; if(empty($this->category)) { return false; } else { return true; } } /** * 分页统计 * @param $data */ public function count($data) { if($data['action'] == 'lists') { $catid = intval($data['catid']); if(!$this->set_modelid($catid)) return false; if(isset($data['where'])) { $sql = $data['where']; } else { if($this->category[$catid]['child']) { $catids_str = $this->category[$catid]['arrchildid']; $pos = strpos($catids_str,',')+1; $catids_str = substr($catids_str, $pos); $sql = "status=99 AND catid IN ($catids_str)"; } else { $sql = "status=99 AND catid='$catid'"; } } return $this->db->count($sql); } } /** * 列表页标签 * @param $data */ public function lists($data) { $catid = intval($data['catid']); if(!$this->set_modelid($catid)) return false; if(isset($data['where'])) { $sql = $data['where']; } else { $thumb = intval($data['thumb']) ? " AND thumb != ''" : ''; if($this->category[$catid]['child']) { $catids_str = $this->category[$catid]['arrchildid']; $pos = strpos($catids_str,',')+1; $catids_str = substr($catids_str, $pos); $sql = "status=99 AND catid IN ($catids_str)".$thumb; } else { $sql = "status=99 AND catid='$catid'".$thumb; } } $order = $data['order']; $return = $this->db->select($sql, '*', $data['limit'], $order, '', 'id'); //调用副表的数据 if (isset($data['moreinfo']) && intval($data['moreinfo']) == 1) { $ids = array(); foreach ($return as $v) { if (isset($v['id']) && !empty($v['id'])) { $ids[] = $v['id']; } else { continue; } } if (!empty($ids)) { $this->db->table_name = $this->db->table_name.'_data'; $ids = implode('\',\'', $ids); $r = $this->db->select("`id` IN ('$ids')", '*', '', '', '', 'id'); if (!empty($r)) { foreach ($r as $k=>$v) { if (isset($return[$k])) $return[$k] = array_merge($v, $return[$k]); } } } } return $return; } /** * 相关文章标签 * @param $data */ public function relation($data) { $catid = intval($data['catid']); if(!$this->set_modelid($catid)) return false; $order = $data['order']; $sql = "`status`=99"; $limit = $data['id'] ? $data['limit']+1 : $data['limit']; if($data['relation']) { $relations = explode('|',$data['relation']); $relations = array_diff($relations, array(null)); $relations = implode(',',$relations); $sql = " `id` IN ($relations)"; $key_array = $this->db->select($sql, '*', $limit, $order,'','id'); } elseif($data['keywords']) { $keywords = str_replace('%', '',$data['keywords']); $keywords_arr = explode(' ',$keywords); $key_array = array(); $number = 0; $i =1; foreach ($keywords_arr as $_k) { $sql2 = $sql." AND `keywords` LIKE '%$_k%'".(isset($data['id']) && intval($data['id']) ? " AND `id` != '".abs(intval($data['id']))."'" : ''); $r = $this->db->select($sql2, '*', $limit, '','','id'); $number += count($r); foreach ($r as $id=>$v) { if($i<= $data['limit'] && !in_array($id, $key_array)) $key_array[$id] = $v; $i++; } if($data['limit']<$number) break; } } if($data['id']) unset($key_array[$data['id']]); return $key_array; } /** * 排行榜标签 * @param $data */ public function hits($data) { $catid = intval($data['catid']); if(!$this->set_modelid($catid)) return false; $this->hits_db = pc_base::load_model('hits_model'); $sql = $desc = $ids = ''; $array = $ids_array = array(); $order = $data['order']; $hitsid = 'c-'.$this->modelid.'-%'; $sql = "hitsid LIKE '$hitsid'"; if(isset($data['day'])) { $updatetime = SYS_TIME-intval($data['day'])*86400; $sql .= " AND updatetime>'$updatetime'"; } if($this->category[$catid]['child']) { $catids_str = $this->category[$catid]['arrchildid']; $pos = strpos($catids_str,',')+1; $catids_str = substr($catids_str, $pos); $sql .= " AND catid IN ($catids_str)"; } else { $sql .= " AND catid='$catid'"; } $hits = array(); $result = $this->hits_db->select($sql, '*', $data['limit'], $order); foreach ($result as $r) { $pos = strpos($r['hitsid'],'-',2) + 1; $ids_array[] = $id = substr($r['hitsid'],$pos); $hits[$id] = $r; } $ids = implode(',', $ids_array); if($ids) { $sql = "status=99 AND id IN ($ids)"; } else { $sql = ''; } $this->db->table_name = $this->tablename; $result = $this->db->select($sql, '*', $data['limit'],'','','id'); foreach ($ids_array as $id) { if($result[$id]['title']!='') { $array[$id] = $result[$id]; $array[$id] = array_merge($array[$id], $hits[$id]); } } return $array; } /** * 栏目标签 * @param $data */ public function category($data) { $data['catid'] = intval($data['catid']); $array = array(); $siteid = $data['siteid'] && intval($data['siteid']) ? intval($data['siteid']) : get_siteid(); $categorys = getcache('category_content_'.$siteid,'commons'); $site = siteinfo($siteid); $i = 1; foreach ($categorys as $catid=>$cat) { if($i>$data['limit']) break; if((!$cat['ismenu']) || $siteid && $cat['siteid']!=$siteid) continue; if (strpos($cat['url'], '://') === false) { $cat['url'] = substr($site['domain'],0,-1).$cat['url']; } if($cat['parentid']==$data['catid']) { $array[$catid] = $cat; $i++; } } return $array; } /** * 推荐位 * @param $data */ public function position($data) { $sql = ''; $array = array(); $posid = intval($data['posid']); $order = $data['order']; $thumb = (empty($data['thumb']) || intval($data['thumb']) == 0) ? 0 : 1; $siteid = $GLOBALS['siteid'] ? $GLOBALS['siteid'] : 1; $catid = (empty($data['catid']) || $data['catid'] == 0) ? '' : intval($data['catid']); if($catid) { $siteids = getcache('category_content','commons'); if(!$siteids[$catid]) return false; $siteid = $siteids[$catid]; $this->category = getcache('category_content_'.$siteid,'commons'); } if($catid && $this->category[$catid]['child']) { $catids_str = $this->category[$catid]['arrchildid']; $pos = strpos($catids_str,',')+1; $catids_str = substr($catids_str, $pos); $sql = "`catid` IN ($catids_str) AND "; } elseif($catid && !$this->category[$catid]['child']) { $sql = "`catid` = '$catid' AND "; } if($thumb) $sql .= "`thumb` = '1' AND "; if(isset($data['where'])) $sql .= $data['where'].' AND '; if(isset($data['expiration']) && $data['expiration']==1) $sql .= '(`expiration` >= \''.SYS_TIME.'\' OR `expiration` = \'0\' ) AND '; $sql .= "`posid` = '$posid' AND `siteid` = '".$siteid."'"; $pos_arr = $this->position->select($sql, '*', $data['limit'],$order); if(!empty($pos_arr)) { foreach ($pos_arr as $info) { $key = $info['catid'].'-'.$info['id']; $array[$key] = string2array($info['data']); $array[$key]['url'] = go($info['catid'],$info['id']); $array[$key]['id'] = $info['id']; $array[$key]['catid'] = $info['catid']; $array[$key]['listorder'] = $info['listorder']; } } return $array; } /** * 可视化标签 */ public function pc_tag() { $positionlist = getcache('position','commons'); $sites = pc_base::load_app_class('sites','admin'); $sitelist = $sites->pc_tag_list(); foreach ($positionlist as $_v) if($_v['siteid'] == get_siteid() || $_v['siteid'] == 0) $poslist[$_v['posid']] = $_v['name']; return array( 'action'=>array('lists'=>L('list','', 'content'),'position'=>L('position','', 'content'), 'category'=>L('subcat', '', 'content'), 'relation'=>L('related_articles', '', 'content'), 'hits'=>L('top', '', 'content')), 'lists'=>array( 'catid'=>array('name'=>L('catid', '', 'content'),'htmltype'=>'input_select_category','data'=>array('type'=>0),'validator'=>array('min'=>1)), 'order'=>array('name'=>L('sort', '', 'content'), 'htmltype'=>'select','data'=>array('id DESC'=>L('id_desc', '', 'content'), 'updatetime DESC'=>L('updatetime_desc', '', 'content'), 'listorder ASC'=>L('listorder_asc', '', 'content'))), 'thumb'=>array('name'=>L('thumb', '', 'content'), 'htmltype'=>'radio','data'=>array('0'=>L('all_list', '', 'content'), '1'=>L('thumb_list', '', 'content'))), 'moreinfo'=>array('name'=>L('moreinfo', '', 'content'), 'htmltype'=>'radio', 'data'=>array('1'=>L('yes'), '0'=>L('no'))) ), 'position'=>array( 'posid'=>array('name'=>L('posid', '', 'content'),'htmltype'=>'input_select','data'=>$poslist,'validator'=>array('min'=>1)), 'catid'=>array('name'=>L('catid', '', 'content'),'htmltype'=>'input_select_category','data'=>array('type'=>0),'validator'=>array('min'=>0)), 'thumb'=>array('name'=>L('thumb', '', 'content'), 'htmltype'=>'radio','data'=>array('0'=>L('all_list', '', 'content'), '1'=>L('thumb_list', '', 'content'))), 'order'=>array('name'=>L('sort', '', 'content'), 'htmltype'=>'select','data'=>array('listorder DESC'=>L('listorder_desc', '', 'content'),'listorder ASC'=>L('listorder_asc', '', 'content'),'id DESC'=>L('id_desc', '', 'content'))), ), 'category'=>array( 'siteid'=>array('name'=>L('siteid'), 'htmltype'=>'input_select', 'data'=>$sitelist), 'catid'=>array('name'=>L('catid', '', 'content'), 'htmltype'=>'input_select_category', 'data'=>array('type'=>0)) ), 'relation'=>array( 'catid'=>array('name'=>L('catid', '', 'content'), 'htmltype'=>'input_select_category', 'data'=>array('type'=>0), 'validator'=>array('min'=>1)), 'order'=>array('name'=>L('sort', '', 'content'), 'htmltype'=>'select','data'=>array('id DESC'=>L('id_desc', '', 'content'), 'updatetime DESC'=>L('updatetime_desc', '', 'content'), 'listorder ASC'=>L('listorder_asc', '', 'content'))), 'relation'=>array('name'=>L('relevant_articles_id', '', 'content'), 'htmltype'=>'input'), 'keywords'=>array('name'=>L('key_word', '', 'content'), 'htmltype'=>'input') ), 'hits'=>array( 'catid'=>array('name'=>L('catid', '', 'content'), 'htmltype'=>'input_select_category', 'data'=>array('type'=>0), 'validator'=>array('min'=>1)), 'day'=>array('name'=>L('day_select', '', 'content'), 'htmltype'=>'input', 'data'=>array('type'=>0)), ), ); } }
108wo
phpcms/modules/content/classes/content_tag.class.php
PHP
asf20
11,110
<?php defined('IN_PHPCMS') or exit('No permission resources.'); if (!module_exists('comment')) showmessage(L('module_not_exists')); class comment_api { private $db; function __construct() { $this->db = pc_base::load_model('content_model'); } /** * 获取评论信息 * @param $module 模型 * @param $contentid 文章ID * @param $siteid 站点ID */ function get_info($module, $contentid, $siteid) { list($module, $catid) = explode('_', $module); if (empty($contentid) || empty($catid)) { return false; } $this->db->set_catid($catid); $r = $this->db->get_one(array('catid'=>$catid, 'id'=>$contentid), '`title`'); $category = getcache('category_content_'.$siteid, 'commons'); $model = getcache('model', 'commons'); $cat = $category[$catid]; $data_info = array(); if ($cat['type']==0) { if ($model[$cat['modelid']]['tablename']) { $this->db->table_name = $this->db->db_tablepre.$model[$cat['modelid']]['tablename'].'_data'; $data_info = $this->db->get_one(array('id'=>$contentid)); } } if ($r) { return array('title'=>$r['title'], 'url'=>go($catid, $contentid, 1), 'allow_comment'=>(isset($data_info['allow_comment']) ? $data_info['allow_comment'] : 1)); } else { return false; } } }
108wo
phpcms/modules/content/classes/comment_api.class.php
PHP
asf20
1,309
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_app_func('util','content'); pc_base::load_sys_func('dir'); class html { private $siteid,$url,$html_root,$queue,$categorys; public function __construct() { $this->queue = pc_base::load_model('queue_model'); define('HTML',true); self::set_siteid(); $this->categorys = getcache('category_content_'.$this->siteid,'commons'); $this->url = pc_base::load_app_class('url', 'content'); $this->html_root = pc_base::load_config('system','html_root'); $this->sitelist = getcache('sitelist','commons'); } /** * 生成内容页 * @param $file 文件地址 * @param $data 数据 * @param $array_merge 是否合并 * @param $action 方法 * @param $upgrade 是否是升级数据 */ public function show($file, $data = '', $array_merge = 1,$action = 'add',$upgrade = 0) { if($upgrade) $file = '/'.ltrim($file,WEB_PATH); $allow_visitor = 1; $id = $data['id']; if($array_merge) { $data = new_stripslashes($data); $data = array_merge($data['system'],$data['model']); } //通过rs获取原始值 $rs = $data; if(isset($data['paginationtype'])) { $paginationtype = $data['paginationtype']; $maxcharperpage = $data['maxcharperpage']; } else { $paginationtype = 0; } $catid = $data['catid']; $CATEGORYS = $this->categorys; $CAT = $CATEGORYS[$catid]; $CAT['setting'] = string2array($CAT['setting']); define('STYLE',$CAT['setting']['template_list']); //最顶级栏目ID $arrparentid = explode(',', $CAT['arrparentid']); $top_parentid = $arrparentid[1] ? $arrparentid[1] : $catid; //$file = '/'.$file; //添加到发布点队列 //当站点为非系统站点 if($this->siteid!=1) { $site_dir = $this->sitelist[$this->siteid]['dirname']; $file = $this->html_root.'/'.$site_dir.$file; } $this->queue->add_queue($action,$file,$this->siteid); $modelid = $CAT['modelid']; require_once CACHE_MODEL_PATH.'content_output.class.php'; $content_output = new content_output($modelid,$catid,$CATEGORYS); $output_data = $content_output->get($data); extract($output_data); if(module_exists('comment')) { $allow_comment = isset($allow_comment) ? $allow_comment : 1; } else { $allow_comment = 0; } $this->db = pc_base::load_model('content_model'); $this->db->set_model($modelid); //上一页 $previous_page = $this->db->get_one("id<'$id' AND status=99",'*','id DESC'); //下一页 $next_page = $this->db->get_one("id>'$id' AND status=99"); if(empty($previous_page)) { $previous_page = array('title'=>L('first_page','','content'), 'thumb'=>IMG_PATH.'nopic_small.gif', 'url'=>'javascript:alert(\''.L('first_page','','content').'\');'); } if(empty($next_page)) { $next_page = array('title'=>L('last_page','','content'), 'thumb'=>IMG_PATH.'nopic_small.gif', 'url'=>'javascript:alert(\''.L('last_page','','content').'\');'); } $title = strip_tags($title); //SEO $seo_keywords = ''; if(!empty($keywords)) $seo_keywords = implode(',',$keywords); $siteid = $this->siteid; $SEO = seo($siteid, $catid, $title, $description, $seo_keywords); $ishtml = 1; $template = $template ? $template : $CAT['setting']['show_template']; //分页处理 $pages = $titles = ''; if($paginationtype==1) { //自动分页 if($maxcharperpage < 10) $maxcharperpage = 500; $contentpage = pc_base::load_app_class('contentpage'); $content = $contentpage->get_data($content,$maxcharperpage); } if($paginationtype!=0) { //手动分页 $CONTENT_POS = strpos($content, '[page]'); if($CONTENT_POS !== false) { $this->url = pc_base::load_app_class('url', 'content'); $contents = array_filter(explode('[page]', $content)); $pagenumber = count($contents); if (strpos($content, '[/page]')!==false && ($CONTENT_POS<7)) { $pagenumber--; } for($i=1; $i<=$pagenumber; $i++) { $upgrade = $upgrade ? '/'.ltrim($file,WEB_PATH) : ''; $pageurls[$i] = $this->url->show($id, $i, $catid, $data['inputtime'],'','','edit',$upgrade); } $END_POS = strpos($content, '[/page]'); if($END_POS !== false) { if($CONTENT_POS>7) { $content = '[page]'.$title.'[/page]'.$content; } if(preg_match_all("|\[page\](.*)\[/page\]|U", $content, $m, PREG_PATTERN_ORDER)) { foreach($m[1] as $k=>$v) { $p = $k+1; $titles[$p]['title'] = strip_tags($v); $titles[$p]['url'] = $pageurls[$p][0]; } } } //生成分页 foreach ($pageurls as $page=>$urls) { $pages = content_pages($pagenumber,$page, $pageurls); //判断[page]出现的位置是否在第一位 if($CONTENT_POS<7) { $content = $contents[$page]; } else { if ($page==1 && !empty($titles)) { $content = $title.'[/page]'.$contents[$page-1]; } else { $content = $contents[$page-1]; } } if($titles) { list($title, $content) = explode('[/page]', $content); $content = trim($content); if(strpos($content,'</p>')===0) { $content = '<p>'.$content; } if(stripos($content,'<p>')===0) { $content = $content.'</p>'; } } $pagefile = $urls[1]; if($this->siteid!=1) { $pagefile = $this->html_root.'/'.$site_dir.$pagefile; } $this->queue->add_queue($action,$pagefile,$this->siteid); $pagefile = PHPCMS_PATH.$pagefile; ob_start(); include template('content', $template); $this->createhtml($pagefile); } return true; } } //分页处理结束 $file = PHPCMS_PATH.$file; ob_start(); include template('content', $template); return $this->createhtml($file); } /** * 生成栏目列表 * @param $catid 栏目id * @param $page 当前页数 */ public function category($catid, $page = 0) { $CAT = $this->categorys[$catid]; @extract($CAT); if(!$ishtml) return false; if(!$catid) showmessage(L('category_not_exists','content'),'blank'); $CATEGORYS = $this->categorys; if(!isset($CATEGORYS[$catid])) showmessage(L('information_does_not_exist', 'content'),'blank'); $siteid = $CAT['siteid']; $copyjs = ''; $setting = string2array($setting); if(!$setting['meta_title']) $setting['meta_title'] = $catname; $SEO = seo($siteid, '',$setting['meta_title'],$setting['meta_description'],$setting['meta_keywords']); define('STYLE',$setting['template_list']); $page = intval($page); $parentdir = $CAT['parentdir']; $catdir = $CAT['catdir']; //检查是否生成到根目录 $create_to_html_root = $CAT['sethtml']; //$base_file = $parentdir.$catdir.'/'; //生成地址 if($CAT['create_to_html_root']) $parentdir = ''; $base_file = $this->url->get_list_url($setting['category_ruleid'],$parentdir, $catdir, $catid, $page); $base_file = '/'.$base_file; //非系统站点时,生成到指定目录 if($this->siteid!=1) { $site_dir = $this->sitelist[$this->siteid]['dirname']; if($create_to_html_root) { $base_file = '/'.$site_dir.$base_file; } else { $base_file = '/'.$site_dir.$this->html_root.$base_file; } } //判断二级域名是否直接绑定到该栏目 $root_domain = preg_match('/^((http|https):\/\/)([a-z0-9\-\.]+)\/$/',$CAT['url']) ? 1 : 0; $count_number = substr_count($CAT['url'], '/'); $urlrules = getcache('urlrules','commons'); $urlrules = explode('|',$urlrules[$category_ruleid]); if($create_to_html_root) { if($this->siteid==1) { $file = PHPCMS_PATH.$base_file; } else { $file = PHPCMS_PATH.substr($this->html_root,1).$base_file; } //添加到发布点队列 $this->queue->add_queue('add',$base_file,$this->siteid); //评论跨站调用所需的JS文件 if(substr($base_file, -10)=='index.html' && $count_number==3) { $copyjs = 1; $this->queue->add_queue('add',$base_file,$this->siteid); } //URLRULES if($CAT['isdomain']) { $second_domain = 1; foreach ($urlrules as $_k=>$_v) { $urlrules[$_k] = $_v; } } else { foreach ($urlrules as $_k=>$_v) { $urlrules[$_k] = '/'.$_v; } } } else { $file = PHPCMS_PATH.substr($this->html_root,1).$base_file; //添加到发布点队列 $this->queue->add_queue('add',$this->html_root.$base_file,$this->siteid); //评论跨站调用所需的JS文件 if(substr($base_file, -10)=='index.html' && $count_number==3) { $copyjs = 1; $this->queue->add_queue('add',$this->html_root.$base_file,$this->siteid); } //URLRULES $htm_prefix = $root_domain ? '' : $this->html_root; $htm_prefix = rtrim(WEB_PATH,'/').$htm_prefix; if($CAT['isdomain']) { $second_domain = 1; } else { $second_domain = 0;//判断该栏目是否绑定了二级域名或者上级栏目绑定了二级域名,存在的话,重新构造列表页url规则 foreach ($urlrules as $_k=>$_v) { $urlrules[$_k] = $htm_prefix.'/'.$_v; } } } if($type==0) { $template = $setting['category_template'] ? $setting['category_template'] : 'category'; $template_list = $setting['list_template'] ? $setting['list_template'] : 'list'; $template = $child ? $template : $template_list; $arrparentid = explode(',', $arrparentid); $top_parentid = $arrparentid[1] ? $arrparentid[1] : $catid; $array_child = array(); $self_array = explode(',', $arrchildid); foreach ($self_array as $arr) { if($arr!=$catid) $array_child[] = $arr; } $arrchildid = implode(',', $array_child); //URL规则 $urlrules = implode('~', $urlrules); define('URLRULE', $urlrules); //绑定域名时,设置$catdir 为空 if($root_domain) $parentdir = $catdir = ''; if($second_domain) { $parentdir = ''; $parentdir = str_replace($catdir.'/', '', $CAT['url']); } $GLOBALS['URL_ARRAY'] = array('categorydir'=>$parentdir, 'catdir'=>$catdir, 'catid'=>$catid); } else { //单网页 $datas = $this->page($catid); if($datas) extract($datas); $template = $setting['page_template'] ? $setting['page_template'] : 'page'; $parentid = $CATEGORYS[$catid]['parentid']; $arrchild_arr = $CATEGORYS[$parentid]['arrchildid']; if($arrchild_arr=='') $arrchild_arr = $CATEGORYS[$catid]['arrchildid']; $arrchild_arr = explode(',',$arrchild_arr); array_shift($arrchild_arr); $keywords = $keywords ? $keywords : $setting['meta_keywords']; $SEO = seo($siteid, 0, $title,$setting['meta_description'],$keywords); } ob_start(); include template('content',$template); return $this->createhtml($file, $copyjs); } /** * 更新首页 */ public function index() { if($this->siteid==1) { $file = PHPCMS_PATH.'index.html'; //添加到发布点队列 $this->queue->add_queue('edit','/index.html',$this->siteid); } else { $site_dir = $this->sitelist[$this->siteid]['dirname']; $file = $this->html_root.'/'.$site_dir.'/index.html'; //添加到发布点队列 $this->queue->add_queue('edit',$file,$this->siteid); $file = PHPCMS_PATH.$file; } define('SITEID', $this->siteid); //SEO $SEO = seo($this->siteid); $siteid = $this->siteid; $CATEGORYS = $this->categorys; $style = $this->sitelist[$siteid]['default_style']; return ''; //eddy 禁止生成首页 ob_start(); include template('content','index',$style); return $this->createhtml($file, 1); } /** * 单网页 * @param $catid */ public function page($catid) { $this->page_db = pc_base::load_model('page_model'); $data = $this->page_db->get_one(array('catid'=>$catid)); return $data; } /** * 写入文件 * @param $file 文件路径 * @param $copyjs 是否复制js,跨站调用评论时,需要该js */ private function createhtml($file, $copyjs = '') { $data = ob_get_contents(); ob_clean(); $dir = dirname($file); if(!is_dir($dir)) { mkdir($dir, 0777,1); } if ($copyjs && !file_exists($dir.'/js.html')) { @copy(PC_PATH.'modules/content/templates/js.html', $dir.'/js.html'); } $strlen = file_put_contents($file, $data); @chmod($file,0777); if(!is_writable($file)) { $file = str_replace(PHPCMS_PATH,'',$file); showmessage(L('file').':'.$file.'<br>'.L('not_writable')); } return $strlen; } /** * 设置当前站点id */ private function set_siteid() { if(defined('IN_ADMIN')) { $this->siteid = $GLOBALS['siteid'] = get_siteid(); } else { if (param::get_cookie('siteid')) { $this->siteid = $GLOBALS['siteid'] = param::get_cookie('siteid'); } else { $this->siteid = $GLOBALS['siteid'] = 1; } } } /** * 生成相关栏目列表、只生成前5页 * @param $catid */ public function create_relation_html($catid) { for($page = 1; $page < 6; $page++) { $this->category($catid,$page); } //检查当前栏目的父栏目,如果存在则生成 $arrparentid = $this->categorys[$catid]['arrparentid']; if($arrparentid) { $arrparentid = explode(',', $arrparentid); foreach ($arrparentid as $catid) { if($catid) $this->category($catid,1); } } } }
108wo
phpcms/modules/content/classes/html.class.php
PHP
asf20
13,388
<?php class MY_content_tag { private $db; public function __construct() { $this->db = pc_base::load_model('content_model'); $this->position = pc_base::load_model('position_data_model'); } /** * 初始化模型 * @param $catid */ public function set_modelid($catid) { $siteids = getcache('category_content','commons'); if(!$siteids[$catid]) return false; $siteid = $siteids[$catid]; $this->category = getcache('category_content_'.$siteid,'commons'); if($this->category[$catid]['type']!=0) return false; $this->modelid = $this->category[$catid]['modelid']; $this->db->set_model($this->modelid); $this->tablename = $this->db->table_name; if(empty($this->category)) { return false; } else { return true; } } /** * 分页统计 * @param $data */ public function count($data) { if($data['action'] == 'lists') { $catid = intval($data['catid']); if(!$this->set_modelid($catid)) return false; if(isset($data['where'])) { $sql = $data['where']; } else { if($this->category[$catid]['child']) { $catids_str = $this->category[$catid]['arrchildid']; $pos = strpos($catids_str,',')+1; $catids_str = substr($catids_str, $pos); $sql = "status=99 AND catid IN ($catids_str)"; } else { $sql = "status=99 AND catid='$catid'"; } //----------eddy if ($data['brand_ids']) { $sql .= " AND `bids` IN (".$data['brand_ids'].")"; } //----------eddy end } return $this->db->count($sql); } } /** * 列表页标签 * @param $data */ public function lists($data) { $catid = intval($data['catid']); if(!$this->set_modelid($catid)) return false; if(isset($data['where'])) { $sql = $data['where']; } else { $thumb = intval($data['thumb']) ? " AND thumb != ''" : ''; if($this->category[$catid]['child']) { $catids_str = $this->category[$catid]['arrchildid']; $pos = strpos($catids_str,',')+1; $catids_str = substr($catids_str, $pos); $sql = "status=99 AND catid IN ($catids_str)".$thumb; } else { $sql = "status=99 AND catid='$catid'".$thumb; } //----------eddy if ($data['brand_ids']) { $sql .= " AND `bids` IN (".$data['brand_ids'].")"; } //----------eddy end } $order = $data['order']; $return = $this->db->select($sql, '*', $data['limit'], $order, '', 'id'); //调用副表的数据 if (isset($data['moreinfo']) && intval($data['moreinfo']) == 1) { $ids = array(); foreach ($return as $v) { if (isset($v['id']) && !empty($v['id'])) { $ids[] = $v['id']; } else { continue; } } if (!empty($ids)) { $this->db->table_name = $this->db->table_name.'_data'; $ids = implode('\',\'', $ids); $r = $this->db->select("`id` IN ('$ids')", '*', '', '', '', 'id'); if (!empty($r)) { foreach ($r as $k=>$v) { if (isset($return[$k])) $return[$k] = array_merge($v, $return[$k]); } } } } return $return; } /** * 相关文章标签 * @param $data */ public function relation($data) { $catid = intval($data['catid']); if(!$this->set_modelid($catid)) return false; $order = $data['order']; $sql = "`status`=99"; $limit = $data['id'] ? $data['limit']+1 : $data['limit']; if($data['relation']) { $relations = explode('|',$data['relation']); $relations = array_diff($relations, array(null)); $relations = implode(',',$relations); $sql = " `id` IN ($relations)"; $key_array = $this->db->select($sql, '*', $limit, $order,'','id'); } elseif($data['keywords']) { $keywords = str_replace('%', '',$data['keywords']); $keywords_arr = explode(' ',$keywords); $key_array = array(); $number = 0; $i =1; foreach ($keywords_arr as $_k) { $sql2 = $sql." AND `keywords` LIKE '%$_k%'".(isset($data['id']) && intval($data['id']) ? " AND `id` != '".abs(intval($data['id']))."'" : ''); $r = $this->db->select($sql2, '*', $limit, '','','id'); $number += count($r); foreach ($r as $id=>$v) { if($i<= $data['limit'] && !in_array($id, $key_array)) $key_array[$id] = $v; $i++; } if($data['limit']<$number) break; } } if($data['id']) unset($key_array[$data['id']]); return $key_array; } /** * 排行榜标签 * @param $data */ public function hits($data) { $catid = intval($data['catid']); if(!$this->set_modelid($catid)) return false; $this->hits_db = pc_base::load_model('hits_model'); $sql = $desc = $ids = ''; $array = $ids_array = array(); $order = $data['order']; $hitsid = 'c-'.$this->modelid.'-%'; $sql = "hitsid LIKE '$hitsid'"; if(isset($data['day'])) { $updatetime = SYS_TIME-intval($data['day'])*86400; $sql .= " AND updatetime>'$updatetime'"; } if($this->category[$catid]['child']) { $catids_str = $this->category[$catid]['arrchildid']; $pos = strpos($catids_str,',')+1; $catids_str = substr($catids_str, $pos); $sql .= " AND catid IN ($catids_str)"; } else { $sql .= " AND catid='$catid'"; } $hits = array(); $result = $this->hits_db->select($sql, '*', $data['limit'], $order); foreach ($result as $r) { $pos = strpos($r['hitsid'],'-',2) + 1; $ids_array[] = $id = substr($r['hitsid'],$pos); $hits[$id] = $r; } $ids = implode(',', $ids_array); if($ids) { $sql = "status=99 AND id IN ($ids)"; } else { $sql = ''; } $this->db->table_name = $this->tablename; $result = $this->db->select($sql, '*', $data['limit'],'','','id'); foreach ($ids_array as $id) { if($result[$id]['title']!='') { $array[$id] = $result[$id]; $array[$id] = array_merge($array[$id], $hits[$id]); } } return $array; } /** * 栏目标签 * @param $data */ public function category($data) { $data['catid'] = intval($data['catid']); $array = array(); $siteid = $data['siteid'] && intval($data['siteid']) ? intval($data['siteid']) : get_siteid(); $categorys = getcache('category_content_'.$siteid,'commons'); $site = siteinfo($siteid); $i = 1; foreach ($categorys as $catid=>$cat) { if($i>$data['limit']) break; if((!$cat['ismenu']) || $siteid && $cat['siteid']!=$siteid) continue; if (strpos($cat['url'], '://') === false) { $cat['url'] = substr($site['domain'],0,-1).$cat['url']; } if($cat['parentid']==$data['catid']) { $array[$catid] = $cat; $i++; } } return $array; } /** * 推荐位 * @param $data */ public function position($data) { $sql = ''; $array = array(); $posid = intval($data['posid']); $order = $data['order']; $thumb = (empty($data['thumb']) || intval($data['thumb']) == 0) ? 0 : 1; $siteid = $GLOBALS['siteid'] ? $GLOBALS['siteid'] : 1; $catid = (empty($data['catid']) || $data['catid'] == 0) ? '' : intval($data['catid']); if($catid) { $siteids = getcache('category_content','commons'); if(!$siteids[$catid]) return false; $siteid = $siteids[$catid]; $this->category = getcache('category_content_'.$siteid,'commons'); } if($catid && $this->category[$catid]['child']) { $catids_str = $this->category[$catid]['arrchildid']; $pos = strpos($catids_str,',')+1; $catids_str = substr($catids_str, $pos); $sql = "`catid` IN ($catids_str) AND "; } elseif($catid && !$this->category[$catid]['child']) { $sql = "`catid` = '$catid' AND "; } if($thumb) $sql .= "`thumb` = '1' AND "; if(isset($data['where'])) $sql .= $data['where'].' AND '; if(isset($data['expiration']) && $data['expiration']==1) $sql .= '(`expiration` >= \''.SYS_TIME.'\' OR `expiration` = \'0\' ) AND '; $sql .= "`posid` = '$posid' AND `siteid` = '".$siteid."'"; $pos_arr = $this->position->select($sql, '*', $data['limit'],$order); if(!empty($pos_arr)) { foreach ($pos_arr as $info) { $key = $info['catid'].'-'.$info['id']; $array[$key] = string2array($info['data']); $array[$key]['url'] = go($info['catid'],$info['id']); $array[$key]['id'] = $info['id']; $array[$key]['catid'] = $info['catid']; $array[$key]['listorder'] = $info['listorder']; } } return $array; } /** * 可视化标签 */ public function pc_tag() { $positionlist = getcache('position','commons'); $sites = pc_base::load_app_class('sites','admin'); $sitelist = $sites->pc_tag_list(); foreach ($positionlist as $_v) if($_v['siteid'] == get_siteid() || $_v['siteid'] == 0) $poslist[$_v['posid']] = $_v['name']; return array( 'action'=>array('lists'=>L('list','', 'content'),'position'=>L('position','', 'content'), 'category'=>L('subcat', '', 'content'), 'relation'=>L('related_articles', '', 'content'), 'hits'=>L('top', '', 'content')), 'lists'=>array( 'catid'=>array('name'=>L('catid', '', 'content'),'htmltype'=>'input_select_category','data'=>array('type'=>0),'validator'=>array('min'=>1)), 'order'=>array('name'=>L('sort', '', 'content'), 'htmltype'=>'select','data'=>array('id DESC'=>L('id_desc', '', 'content'), 'updatetime DESC'=>L('updatetime_desc', '', 'content'), 'listorder ASC'=>L('listorder_asc', '', 'content'))), 'thumb'=>array('name'=>L('thumb', '', 'content'), 'htmltype'=>'radio','data'=>array('0'=>L('all_list', '', 'content'), '1'=>L('thumb_list', '', 'content'))), 'moreinfo'=>array('name'=>L('moreinfo', '', 'content'), 'htmltype'=>'radio', 'data'=>array('1'=>L('yes'), '0'=>L('no'))) ), 'position'=>array( 'posid'=>array('name'=>L('posid', '', 'content'),'htmltype'=>'input_select','data'=>$poslist,'validator'=>array('min'=>1)), 'catid'=>array('name'=>L('catid', '', 'content'),'htmltype'=>'input_select_category','data'=>array('type'=>0),'validator'=>array('min'=>0)), 'thumb'=>array('name'=>L('thumb', '', 'content'), 'htmltype'=>'radio','data'=>array('0'=>L('all_list', '', 'content'), '1'=>L('thumb_list', '', 'content'))), 'order'=>array('name'=>L('sort', '', 'content'), 'htmltype'=>'select','data'=>array('listorder DESC'=>L('listorder_desc', '', 'content'),'listorder ASC'=>L('listorder_asc', '', 'content'),'id DESC'=>L('id_desc', '', 'content'))), ), 'category'=>array( 'siteid'=>array('name'=>L('siteid'), 'htmltype'=>'input_select', 'data'=>$sitelist), 'catid'=>array('name'=>L('catid', '', 'content'), 'htmltype'=>'input_select_category', 'data'=>array('type'=>0)) ), 'relation'=>array( 'catid'=>array('name'=>L('catid', '', 'content'), 'htmltype'=>'input_select_category', 'data'=>array('type'=>0), 'validator'=>array('min'=>1)), 'order'=>array('name'=>L('sort', '', 'content'), 'htmltype'=>'select','data'=>array('id DESC'=>L('id_desc', '', 'content'), 'updatetime DESC'=>L('updatetime_desc', '', 'content'), 'listorder ASC'=>L('listorder_asc', '', 'content'))), 'relation'=>array('name'=>L('relevant_articles_id', '', 'content'), 'htmltype'=>'input'), 'keywords'=>array('name'=>L('key_word', '', 'content'), 'htmltype'=>'input') ), 'hits'=>array( 'catid'=>array('name'=>L('catid', '', 'content'), 'htmltype'=>'input_select_category', 'data'=>array('type'=>0), 'validator'=>array('min'=>1)), 'day'=>array('name'=>L('day_select', '', 'content'), 'htmltype'=>'input', 'data'=>array('type'=>0)), ), ); } }
108wo
phpcms/modules/content/classes/MY_content_tag.class.php
PHP
asf20
11,408
<?php defined('IN_PHPCMS') or exit('No permission resources.'); //模型原型存储路径 define('MODEL_PATH',PC_PATH.'modules'.DIRECTORY_SEPARATOR.'content'.DIRECTORY_SEPARATOR.'fields'.DIRECTORY_SEPARATOR); pc_base::load_app_class('admin','admin',0); define('CACHE_MODEL_PATH',CACHE_PATH.'caches_model'.DIRECTORY_SEPARATOR.'caches_data'.DIRECTORY_SEPARATOR); pc_base::load_app_func('util'); class sitemodel_field extends admin { private $db,$model_db; public $siteid; 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() { $show_header = ''; $modelid = $_GET['modelid']; $this->cache_field($modelid); $datas = $this->db->select(array('modelid'=>$modelid),'*',100,'listorder ASC'); $r = $this->model_db->get_one(array('modelid'=>$modelid)); require MODEL_PATH.'fields.inc.php'; include $this->admin_tpl('sitemodel_field_manage'); } public function add() { if(isset($_POST['dosubmit'])) { $model_cache = getcache('model','commons'); $modelid = $_POST['info']['modelid'] = intval($_POST['info']['modelid']); $model_table = $model_cache[$modelid]['tablename']; $tablename = $_POST['issystem'] ? $this->db->db_tablepre.$model_table : $this->db->db_tablepre.$model_table.'_data'; $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']; require MODEL_PATH.$field_type.DIRECTORY_SEPARATOR.'config.inc.php'; if(isset($_POST['setting']['fieldtype'])) { $field_type = $_POST['setting']['fieldtype']; } require MODEL_PATH.'add.sql.php'; //附加属性值 $_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']) : ''; $this->db->insert($_POST['info']); $this->cache_field($modelid); showmessage(L('add_success'),'?m=content&c=sitemodel_field&a=init&modelid='.$modelid.'&menuid=59'); } else { $show_header = $show_validator = $show_dialog = ''; pc_base::load_sys_class('form','',0); require MODEL_PATH.'fields.inc.php'; $modelid = $_GET['modelid']; $f_datas = $this->db->select(array('modelid'=>$modelid),'field,name',100,'listorder ASC'); $m_r = $this->model_db->get_one(array('modelid'=>$modelid)); foreach($f_datas as $_k=>$_v) { $exists_field[] = $_v['field']; } $all_field = array(); foreach($fields as $_k=>$_v) { if(in_array($_k,$not_allow_fields) || in_array($_k,$exists_field) && in_array($_k,$unique_fields)) continue; $all_field[$_k] = $_v; } $modelid = $_GET['modelid']; //角色缓存 $roles = getcache('role','commons'); $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('sitemodel_field_add'); } } public function edit() { if(isset($_POST['dosubmit'])) { $model_cache = getcache('model','commons'); $modelid = $_POST['info']['modelid'] = intval($_POST['info']['modelid']); $model_table = $model_cache[$modelid]['tablename']; $tablename = $_POST['issystem'] ? $this->db->db_tablepre.$model_table : $this->db->db_tablepre.$model_table.'_data'; $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']; require MODEL_PATH.$field_type.DIRECTORY_SEPARATOR.'config.inc.php'; if(isset($_POST['setting']['fieldtype'])) { $field_type = $_POST['setting']['fieldtype']; } $oldfield = $_POST['oldfield']; require MODEL_PATH.'edit.sql.php'; //附加属性值 $_POST['info']['setting'] = array2string($_POST['setting']); $fieldid = intval($_POST['fieldid']); $_POST['info']['unsetgroupids'] = isset($_POST['unsetgroupids']) ? implode(',',$_POST['unsetgroupids']) : ''; $_POST['info']['unsetroleids'] = isset($_POST['unsetroleids']) ? implode(',',$_POST['unsetroleids']) : ''; $this->db->update($_POST['info'],array('fieldid'=>$fieldid,'siteid'=>$this->siteid)); $this->cache_field($modelid); showmessage(L('update_success'),'?m=content&c=sitemodel_field&a=init&modelid='.$modelid.'&menuid=59'); } else { $show_header = $show_validator = $show_dialog = ''; pc_base::load_sys_class('form','',0); require MODEL_PATH.'fields.inc.php'; $modelid = intval($_GET['modelid']); $fieldid = intval($_GET['fieldid']); $m_r = $this->model_db->get_one(array('modelid'=>$modelid)); $r = $this->db->get_one(array('fieldid'=>$fieldid)); extract($r); require MODEL_PATH.$formtype.DIRECTORY_SEPARATOR.'config.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(); //角色缓存 $roles = getcache('role','commons'); $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('sitemodel_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)); $modelid = $_GET['modelid']; $this->cache_field($modelid); showmessage(L('operation_success'),HTTP_REFERER); } public function delete() { $fieldid = intval($_GET['fieldid']); $r = $this->db->get_one(array('fieldid'=>$_GET['fieldid'],'siteid'=>$this->siteid)); //必须放在删除字段前、在删除字段部分,重置了 tablename $this->db->delete(array('fieldid'=>$_GET['fieldid'],'siteid'=>$this->siteid)); $model_cache = getcache('model','commons'); $modelid = intval($_GET['modelid']); $model_table = $model_cache[$modelid]['tablename']; $tablename = $r['issystem'] ? $model_table : $model_table.'_data'; $this->db->drop_field($tablename,$r['field']); showmessage(L('operation_success'),HTTP_REFERER); } /** * 排序 */ public function listorder() { if(isset($_POST['dosubmit'])) { foreach($_POST['listorders'] as $id => $listorder) { $this->db->update(array('listorder'=>$listorder),array('fieldid'=>$id)); } 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']); $model_cache = getcache('model','commons'); $tablename = $model_cache[$modelid]['tablename']; $issystem = intval($_GET['issystem']); if($issystem) { $this->db->table_name = $this->db->db_tablepre.$tablename; } else { $this->db->table_name = $this->db->db_tablepre.$tablename.'_data'; } $fields = $this->db->get_fields(); if(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 $modelid 模型id */ public function cache_field($modelid = 0) { $field_array = array(); $fields = $this->db->select(array('modelid'=>$modelid,'disabled'=>$disabled),'*',100,'listorder ASC'); foreach($fields as $_value) { $setting = string2array($_value['setting']); $_value = array_merge($_value,$setting); $field_array[$_value['field']] = $_value; } setcache('model_field_'.$modelid,$field_array,'model'); return true; } /** * 预览模型 */ public function public_priview() { pc_base::load_sys_class('form','',0); $show_header = $show_validator = $show_dialog = ''; $modelid = intval($_GET['modelid']); require CACHE_MODEL_PATH.'content_form.class.php'; $content_form = new content_form($modelid); $r = $this->model_db->get_one(array('modelid'=>$modelid)); $forminfos = $content_form->get(); include $this->admin_tpl('sitemodel_priview'); } } ?>
108wo
phpcms/modules/content/sitemodel_field.php
PHP
asf20
9,671
function pages($field, $value, $fieldinfo) { extract($fieldinfo); if($value) { $v = explode('|', $value); $data = "<select name=\"info[paginationtype]\" id=\"paginationtype\" onchange=\"if(this.value==1)\$('#paginationtype1').css('display','');else \$('#paginationtype1').css('display','none');\">"; $type = array(L('page_type1'), L('page_type2'), L('page_type3')); if($v[0]==1) $con = 'style="display:"'; else $con = 'style="display:none"'; foreach($type as $i => $val) { if($i==$v[0]) $tag = 'selected'; else $tag = ''; $data .= "<option value=\"$i\" $tag>$val</option>"; } $data .= "</select><span id=\"paginationtype1\" $con><input name=\"info[maxcharperpage]\" type=\"text\" id=\"maxcharperpage\" value=\"$v[1]\" size=\"8\" maxlength=\"8\">".L('page_maxlength')."</span>"; return $data; } else { return "<select name=\"info[paginationtype]\" id=\"paginationtype\" onchange=\"if(this.value==1)\$('#paginationtype1').css('display','');else \$('#paginationtype1').css('display','none');\"> <option value=\"0\">".L('page_type1')."</option> <option value=\"1\">".L('page_type2')."</option> <option value=\"2\">".L('page_type3')."</option> </select> <span id=\"paginationtype1\" style=\"display:none\"><input name=\"info[maxcharperpage]\" type=\"text\" id=\"maxcharperpage\" value=\"10000\" size=\"8\" maxlength=\"8\">".L('page_maxlength')."</span>"; } }
108wo
phpcms/modules/content/fields/pages/form.inc.php
PHP
asf20
1,493
<?php defined('IN_ADMIN') or exit('No permission resources.'); $field_type = 'pages'; //字段数据库类型 $field_basic_table = 0; //是否允许作为主表字段 $field_allow_index = 0; //是否允许建立索引 $field_minlength = 0; //字符长度默认最小值 $field_maxlength = ''; //字符长度默认最大值 $field_allow_search = 0; //作为搜索条件 $field_allow_fulltext = 0; //作为全站搜索信息 $field_allow_isunique = 0; //是否允许值唯一 ?>
108wo
phpcms/modules/content/fields/pages/config.inc.php
PHP
asf20
497
<?php defined('IN_PHPCMS') or exit('No permission resources.');?>
108wo
phpcms/modules/content/fields/pages/field_edit_form.inc.php
PHP
asf20
65
function title($field, $value, $fieldinfo) { extract($fieldinfo); $style_arr = explode(';',$this->data['style']); $style_color = $style_arr[0]; $style_font_weight = $style_arr[1] ? $style_arr[1] : ''; $style = 'color:'.$this->data['style']; if(!$value) $value = $defaultvalue; $errortips = $this->fields[$field]['errortips']; $errortips_max = L('title_is_empty'); if($errortips) $this->formValidator .= '$("#'.$field.'").formValidator({onshow:"",onfocus:"'.$errortips.'"}).inputValidator({min:'.$minlength.',max:'.$maxlength.',onerror:"'.$errortips_max.'"});'; $str = '<input type="text" style="width:400px;'.($style_color ? 'color:'.$style_color.';' : '').($style_font_weight ? 'font-weight:'.$style_font_weight.';' : '').'" name="info['.$field.']" id="'.$field.'" value="'.$value.'" style="'.$style.'" class="measure-input " onBlur="$.post(\'api.php?op=get_keywords&number=3&sid=\'+Math.random()*5, {data:$(\'#title\').val()}, function(data){if(data && $(\'#keywords\').val()==\'\') $(\'#keywords\').val(data); })" onkeyup="strlen_verify(this, \'title_len\', '.$maxlength.');"/><input type="hidden" name="style_color" id="style_color" value="'.$style_color.'"> <input type="hidden" name="style_font_weight" id="style_font_weight" value="'.$style_font_weight.'">'; if(defined('IN_ADMIN')) $str .= '<input type="button" class="button" id="check_title_alt" value="'.L('check_title','','content').'" onclick="$.get(\'?m=content&c=content&a=public_check_title&catid='.$this->catid.'&sid=\'+Math.random()*5, {data:$(\'#title\').val()}, function(data){if(data==\'1\') {$(\'#check_title_alt\').val(\''.L('title_repeat').'\');$(\'#check_title_alt\').css(\'background-color\',\'#FFCC66\');} else if(data==\'0\') {$(\'#check_title_alt\').val(\''.L('title_not_repeat').'\');$(\'#check_title_alt\').css(\'background-color\',\'#F8FFE1\')}})" style="width:73px;"/><img src="'.IMG_PATH.'icon/colour.png" width="15" height="16" onclick="colorpicker(\''.$field.'_colorpanel\',\'set_title_color\');" style="cursor:hand"/> <img src="'.IMG_PATH.'icon/bold.png" width="10" height="10" onclick="input_font_bold()" style="cursor:hand"/> <span id="'.$field.'_colorpanel" style="position:absolute;" class="colorpanel"></span>'; $str .= L('can_enter').'<B><span id="title_len">'.$maxlength.'</span></B> '.L('characters'); return $str; }
108wo
phpcms/modules/content/fields/title/form.inc.php
PHP
asf20
2,364
<?php defined('IN_ADMIN') or exit('No permission resources.'); $field_type = 'varchar'; //字段数据库类型 $field_basic_table = 1; //是否允许作为主表字段 $field_allow_index = 0; //是否允许建立索引 $field_minlength = 1; //字符长度默认最小值 $field_maxlength = 80; //字符长度默认最大值 $field_allow_search = 1; //作为搜索条件 $field_allow_fulltext = 1; //作为全站搜索信息 $field_allow_isunique = 0; //是否允许值唯一 ?>
108wo
phpcms/modules/content/fields/title/config.inc.php
PHP
asf20
499
<?php defined('IN_PHPCMS') or exit('No permission resources.');?>
108wo
phpcms/modules/content/fields/title/field_edit_form.inc.php
PHP
asf20
65
function title($field, $value) { $value = htmlspecialchars($value); return $value; }
108wo
phpcms/modules/content/fields/title/output.inc.php
PHP
asf20
95
<?php class content_input { var $modelid; var $fields; var $data; function __construct($modelid) { $this->db = pc_base::load_model('sitemodel_field_model'); $this->db_pre = $this->db->db_tablepre; $this->modelid = $modelid; $this->fields = getcache('model_field_'.$modelid,'model'); //初始化附件类 pc_base::load_sys_class('attachment','',0); $this->siteid = param::get_cookie('siteid'); $this->attachment = new attachment('content','0',$this->siteid); $this->site_config = getcache('sitelist','commons'); $this->site_config = $this->site_config[$this->siteid]; } function get($data,$isimport = 0) { $this->data = $data; $info = array(); foreach($data as $field=>$value) { //if(!isset($this->fields[$field]) || check_in($_roleid, $this->fields[$field]['unsetroleids']) || check_in($_groupid, $this->fields[$field]['unsetgroupids'])) continue; $name = $this->fields[$field]['name']; $minlength = $this->fields[$field]['minlength']; $maxlength = $this->fields[$field]['maxlength']; $pattern = $this->fields[$field]['pattern']; $errortips = $this->fields[$field]['errortips']; if(empty($errortips)) $errortips = $name.' '.L('not_meet_the_conditions'); $length = strlen($value); if($minlength && $length < $minlength) { if($isimport) { return false; } else { showmessage($name.' '.L('not_less_than').' '.$minlength.L('characters')); } } if($maxlength && $length > $maxlength) { if($isimport) { $value = str_cut($value,$maxlength,''); } else { showmessage($name.' '.L('not_more_than').' '.$maxlength.L('characters')); } } elseif($maxlength) { $value = str_cut($value,$maxlength,''); } if($pattern && $length && !preg_match($pattern, $value) && !$isimport) showmessage($errortips); $MODEL = getcache('model', 'commons'); $this->db->table_name = $this->fields[$field]['issystem'] ? $this->db_pre.$MODEL[$this->modelid]['tablename'] : $this->db_pre.$MODEL[$this->modelid]['tablename'].'_data'; if($this->fields[$field]['isunique'] && $this->db->get_one(array($field=>$value),$field) && ROUTE_A != 'edit') showmessage($name.L('the_value_must_not_repeat')); $func = $this->fields[$field]['formtype']; if(method_exists($this, $func)) $value = $this->$func($field, $value); if($this->fields[$field]['issystem']) { $info['system'][$field] = $value; } else { $info['model'][$field] = $value; } //颜色选择为隐藏域 在这里进行取值 $info['system']['style'] = $_POST['style_color'] ? strip_tags($_POST['style_color']) : ''; if($_POST['style_font_weight']) $info['system']['style'] = $info['system']['style'].';'.strip_tags($_POST['style_font_weight']); } return $info; } }?>
108wo
phpcms/modules/content/fields/content_input.class.php
PHP
asf20
2,835
<?php defined('IN_ADMIN') or exit('No permission resources.'); $defaultvalue = isset($_POST['setting']['defaultvalue']) ? $_POST['setting']['defaultvalue'] : ''; //正整数 UNSIGNED && SIGNED $minnumber = isset($_POST['setting']['minnumber']) ? $_POST['setting']['minnumber'] : 1; $decimaldigits = isset($_POST['setting']['decimaldigits']) ? $_POST['setting']['decimaldigits'] : ''; switch($field_type) { case 'varchar': if(!$maxlength) $maxlength = 255; $maxlength = min($maxlength, 255); $sql = "ALTER TABLE `$tablename` ADD `$field` VARCHAR( $maxlength ) NOT NULL DEFAULT '$defaultvalue'"; $this->db->query($sql); break; case 'tinyint': if(!$maxlength) $maxlength = 3; $minnumber = intval($minnumber); $defaultvalue = intval($defaultvalue); $this->db->query("ALTER TABLE `$tablename` ADD `$field` TINYINT( $maxlength ) ".($minnumber >= 0 ? 'UNSIGNED' : '')." NOT NULL DEFAULT '$defaultvalue'"); break; case 'number': $minnumber = intval($minnumber); $defaultvalue = $decimaldigits == 0 ? intval($defaultvalue) : floatval($defaultvalue); $sql = "ALTER TABLE `$tablename` ADD `$field` ".($decimaldigits == 0 ? 'INT' : 'FLOAT')." ".($minnumber >= 0 ? 'UNSIGNED' : '')." NOT NULL DEFAULT '$defaultvalue'"; $this->db->query($sql); break; case 'smallint': $minnumber = intval($minnumber); $this->db->query("ALTER TABLE `$tablename` ADD `$field` SMALLINT ".($minnumber >= 0 ? 'UNSIGNED' : '')." NOT NULL"); break; case 'int': $minnumber = intval($minnumber); $defaultvalue = intval($defaultvalue); $sql = "ALTER TABLE `$tablename` ADD `$field` INT ".($minnumber >= 0 ? 'UNSIGNED' : '')." NOT NULL DEFAULT '$defaultvalue'"; $this->db->query($sql); break; case 'mediumint': $minnumber = intval($minnumber); $defaultvalue = intval($defaultvalue); $sql = "ALTER TABLE `$tablename` ADD `$field` INT ".($minnumber >= 0 ? 'UNSIGNED' : '')." NOT NULL DEFAULT '$defaultvalue'"; $this->db->query($sql); break; case 'mediumtext': $this->db->query("ALTER TABLE `$tablename` ADD `$field` MEDIUMTEXT NOT NULL"); break; case 'text': $this->db->query("ALTER TABLE `$tablename` ADD `$field` TEXT NOT NULL"); break; case 'date': $this->db->query("ALTER TABLE `$tablename` ADD `$field` DATE NULL"); break; case 'datetime': $this->db->query("ALTER TABLE `$tablename` ADD `$field` DATETIME NULL"); break; case 'timestamp': $this->db->query("ALTER TABLE `$tablename` ADD `$field` TIMESTAMP NOT NULL"); break; //特殊自定义字段 case 'pages': $this->db->query("ALTER TABLE `$tablename` ADD `paginationtype` TINYINT( 1 ) NOT NULL DEFAULT '0'"); $this->db->query("ALTER TABLE `$tablename` ADD `maxcharperpage` MEDIUMINT( 6 ) NOT NULL DEFAULT '0'"); break; case 'readpoint': $defaultvalue = intval($defaultvalue); $this->db->query("ALTER TABLE `$tablename` ADD `readpoint` smallint(5) unsigned NOT NULL default '$defaultvalue'"); $this->db->query("ALTER TABLE `$tablename` ADD `paytype` tinyint(1) unsigned NOT NULL default '0'"); break; } ?>
108wo
phpcms/modules/content/fields/add.sql.php
PHP
asf20
3,102
function map($field, $value, $fieldinfo) { extract($fieldinfo); $setting = string2array($setting); $size = $setting['size']; $errortips = $this->fields[$field]['errortips']; $modelid = $this->fields[$field]['modelid']; $tips = $value ? L('editmark','','map') : L('addmark','','map'); return '<input type="button" name="'.$field.'_mark" id="'.$field.'_mark" value="'.$tips.'" class="button" onclick="omnipotent(\'selectid\',\''.APP_PATH.'api.php?op=map&field='.$field.'&modelid='.$modelid.'\',\''.L('mapmark','','map').'\',1,700,420)"><input type="hidden" name="info['.$field.']" value="'.$value.'" id="'.$field.'" >'; }
108wo
phpcms/modules/content/fields/map/form.inc.php
PHP
asf20
645