示例#1
0
	public function __construct() {
		parent::__construct();
		$this->tablename = '';
		$setting = new_html_special_chars(getcache('formguide', 'commons'));
		$this->M = $setting[$this->get_siteid()];
		$this->db = pc_base::load_model('sitemodel_model');
	}
示例#2
0
文件: space.php 项目: klj123wan/czsz
 function __construct()
 {
     parent::__construct();
     $setting = new_html_special_chars(getcache('poster', 'commons'));
     $this->M = $setting[$this->get_siteid()];
     $this->db = pc_base::load_model('poster_space_model');
 }
示例#3
0
文件: index.php 项目: hxzyzz/ddc
	 /**
	 *	申请友情链接 
	 */
	public function register() { 
 		$siteid = SITEID;
 		if(isset($_POST['dosubmit'])){
 			if($_POST['name']==""){
 				showmessage(L('sitename_noempty'),"?m=link&c=index&a=register&siteid=$siteid");
 			}
 			if($_POST['url']==""){
 				showmessage(L('siteurl_not_empty'),"?m=link&c=index&a=register&siteid=$siteid");
 			}
 			if(!in_array($_POST['linktype'],array('0','1'))){
 				$_POST['linktype'] = '0';
 			}
 			$link_db = pc_base::load_model(link_model);
 			$_POST['logo'] =new_html_special_chars($_POST['logo']);
 			
 			if($_POST['linktype']=='0'){
 				$sql = array('siteid'=>$siteid,'typeid'=>$_POST['typeid'],'linktype'=>$_POST['linktype'],'name'=>$_POST['name'],'url'=>$_POST['url']);
 			}else{
 				$sql = array('siteid'=>$siteid,'typeid'=>$_POST['typeid'],'linktype'=>$_POST['linktype'],'name'=>$_POST['name'],'url'=>$_POST['url'],'logo'=>$_POST['logo']);
 			}
 			$link_db->insert($sql);
 			showmessage(L('add_success'), "?m=link&c=index&siteid=$siteid");
 		} else {
  			$setting = getcache('link', 'commons');
			$setting = $setting[$siteid];
 			if($setting['is_post']=='0'){
 				showmessage(L('suspend_application'), HTTP_REFERER);
 			}
 			$this->type = pc_base::load_model('type_model');
 			$types = $this->type->get_types($siteid);//获取站点下所有友情链接分类
 			pc_base::load_sys_class('form', '', 0);
  			$SEO = seo(SITEID, '', L('application_links'), '', '');
   			include template('link', 'register');
 		}
	} 
示例#4
0
/**
 * 返回经htmlspecialchars处理过的字符串或数组
 * @param $obj 需要处理的字符串或数组
 * @return mixed
 */
function new_html_special_chars($string) {
	$encoding = 'utf-8';
	if(strtolower(CHARSET)=='gbk') $encoding = 'ISO-8859-15';
	if(!is_array($string)) return htmlspecialchars($string,ENT_QUOTES,$encoding);
	foreach($string as $key => $val) $string[$key] = new_html_special_chars($val);
	return $string;
}
 function get($data = array())
 {
     $_groupid = param::get_cookie('_groupid');
     $this->data = $data;
     if (isset($data['id'])) {
         $this->id = $data['id'];
     }
     $info = array();
     $info = array();
     if (is_array($this->fields)) {
         foreach ($this->fields as $field => $v) {
             $func = $v['formtype'];
             $value = isset($data[$field]) ? new_html_special_chars($data[$field]) : '';
             if ($func == 'pages' && isset($data['maxcharperpage'])) {
                 $value = $data['paginationtype'] . '|' . $data['maxcharperpage'];
             }
             if (!method_exists($this, $func)) {
                 continue;
             }
             $form = $this->{$func}($field, $value, $v);
             if ($form !== false) {
                 $star = $v['minlength'] || $v['pattern'] ? 1 : 0;
                 $info[$field] = array('name' => $v['name'], 'tips' => $v['tips'], 'form' => $form, 'star' => $star, 'isomnipotent' => $v['isomnipotent'], 'formtype' => $v['formtype']);
             }
         }
     }
     return $info;
 }
示例#6
0
 function get($data = array())
 {
     $_roleid = param::get_cookie('_roleid');
     $_groupid = param::get_cookie('_groupid');
     $this->data = $data;
     if (isset($data['id'])) {
         $this->id = $data['id'];
     }
     $info = array();
     foreach ($this->fields as $field => $v) {
         if (defined('IN_ADMIN')) {
             if ($v['disabled'] || $v['iscore'] || check_in($_roleid, $v['unsetroleids']) || check_in($_groupid, $v['unsetgroupids'])) {
                 continue;
             }
         } else {
             if ($v['disabled'] || $v['iscore'] || !$v['isadd'] || check_in($_roleid, $v['unsetroleids']) || check_in($_groupid, $v['unsetgroupids'])) {
                 continue;
             }
         }
         $func = $v['formtype'];
         $value = isset($data[$field]) ? new_html_special_chars($data[$field]) : '';
         if ($func == 'pages' && isset($data['maxcharperpage'])) {
             $value = $data['paginationtype'] . '|' . $data['maxcharperpage'];
         }
         if (!method_exists($this, $func)) {
             continue;
         }
         $form = $this->{$func}($field, $value, $v);
         if ($form !== false) {
             $star = $v['minlength'] || $v['pattern'] ? 1 : 0;
             $info[$field] = array('name' => $v['name'], 'tips' => $v['tips'], 'form' => $form, 'star' => $star, 'isbase' => $v['isbase'], 'isomnipotent' => $v['isomnipotent'], 'formtype' => $v['formtype']);
         }
     }
     return $info;
 }
示例#7
0
 function __construct()
 {
     parent::__construct();
     $this->M = new_html_special_chars(getcache('vote', 'commons'));
     $this->db = pc_base::load_model('vote_subject_model');
     $this->db2 = pc_base::load_model('vote_option_model');
 }
示例#8
0
	/**
	 * serialize
	 * @param $data 数组
	 * @return string
	 */
	public function xml_serialize(&$data, $level = 0, $prior_key = NULL) {
		if($level == 0) {
			ob_start();
			echo "<?xml version=\"1.0\" encoding=\"".CHARSET."\"?>\n<root>","\n";
		}
		while(list($key, $value) = each($data)) {
			if(!strpos($key, ' attr')) {
				if(is_array($value) and array_key_exists(0, $value)) {
					$this->xml_serialize($value, $level, $key);    
				} else {
					$tag = $prior_key ? $prior_key : (is_numeric($key) ? 'item' : $key);
					echo str_repeat("\t", $level),'<',$tag;
					if(array_key_exists("$key attr", $data)) {
						while(list($attr_name, $attr_value) = each($data["$key attr"])) {
							echo ' ',$attr_name,'="',new_html_special_chars($attr_value),'"';
						}
						reset($data["$key attr"]);   
					}
					if(is_null($value)) {
						echo " />\n";
					} elseif(!is_array($value)) {
						echo '>',new_html_special_chars($value),"</$tag>\n";
					} else {
						echo ">\n",$this->xml_serialize($value, $level+1),str_repeat("\t", $level),"</$tag>\n";
					}
				}
			}
		}
		reset($data);   
		if($level == 0) {
			$str = &ob_get_contents();
			ob_end_clean();
			return $str.'</root>';
		}
	}
示例#9
0
 public function __construct()
 {
     $this->urlrules = getcache('urlrules', 'commons');
     $this->M = new_html_special_chars(getcache('ask', 'commons'));
     self::set_siteid();
     $this->categorys = getcache('category_ask_' . $this->siteid, 'commons');
     $this->html_root = pc_base::load_config('system', 'html_root');
 }
示例#10
0
	/**
	 * 首页  友情链接分类 循环 .
	 * @param  $data
	 */
	public function type_lists($data) {
			if (!in_array($data['listorder'], array('desc', 'asc'))) {
					$data ['listorder'] = 'desc';
				}
 			$sql = array('module'=>ROUTE_M,'siteid'=>$data['siteid']);
 			$r = $this->type_db->select($sql, '*', $data['limit'], 'listorder '.$data['listorder']);
			return new_html_special_chars($r);
	}
示例#11
0
 function __construct()
 {
     $this->db = pc_base::load_model('sitemodel_model');
     $this->m_db = pc_base::load_model('sitemodel_field_model');
     $this->M = new_html_special_chars(getcache('formguide', 'commons'));
     $this->siteid = intval($_GET[siteid]);
     $this->M = $this->M[$this->siteid];
 }
示例#12
0
 function __construct()
 {
     //parent::__construct();
     $this->M = new_html_special_chars(getcache('ask', 'commons'));
     $this->db = pc_base::load_model('ask_model');
     $this->db2 = pc_base::load_model('ask_posts_model');
     $this->db3 = pc_base::load_model('category_model');
     $this->siteid = get_siteid();
 }
示例#13
0
/**
 * 返回经htmlspecialchars处理过的字符串或数组
 * @param $obj 需要处理的字符串或数组
 * @return mixed
 */
function new_html_special_chars($string)
{
    if (!is_array($string)) {
        return htmlspecialchars($string);
    }
    foreach ($string as $key => $val) {
        $string[$key] = new_html_special_chars($val);
    }
    return $string;
}
示例#14
0
 function __construct()
 {
     parent::__construct();
     $this->M = new_html_special_chars(getcache('ask', 'commons'));
     $this->db = pc_base::load_model('ask_model');
     $this->db2 = pc_base::load_model('answer_model');
     $this->db3 = pc_base::load_model('category_model');
     $this->db_m = pc_base::load_model('member_model');
     $this->siteid = $this->get_siteid();
     $this->categorys = getcache('category_ask_' . $this->siteid, 'commons');
 }
示例#15
0
 public function init()
 {
     $allow_visitor = new_html_special_chars($_GET['allow_visitor']);
     $auth = sys_auth($allow_visitor, 'DECODE');
     if (strpos($auth, '|') === false) {
         showmessage(L('illegal_operation'));
     }
     $auth_str = explode('|', $auth);
     $flag = $auth_str[0];
     if (!preg_match('/^([0-9]+)|([0-9]+)/', $flag)) {
         showmessage(L('illegal_operation'));
     }
     $readpoint = intval($auth_str[1]);
     $paytype = intval($auth_str[2]);
     $http_referer = urldecode($_GET['http_referer']);
     if (!$readpoint) {
         showmessage(L('illegal_operation'));
     }
     pc_base::load_app_class('spend', 'pay', 0);
     $flag_arr = explode('_', $flag);
     $catid = $flag_arr[0];
     $siteids = getcache('category_content', 'commons');
     $siteid = $siteids[$catid];
     $CATEGORYS = getcache('category_content_' . $siteid, 'commons');
     if (isset($CATEGORYS[$catid])) {
         $setting = string2array($CATEGORYS[$catid]['setting']);
         $repeatchargedays = intval($setting['repeatchargedays']);
         if ($repeatchargedays) {
             $fromtime = SYS_TIME - 86400 * $repeatchargedays;
             $r = spend::spend_time($this->userid, $fromtime, $flag);
             if ($r) {
                 showmessage(L('have_pay'), $http_referer, 1000);
             }
         }
     }
     if ($paytype) {
         if (spend::amount($readpoint, L('msg_readpoint'), $this->userid, $this->username, '', '', $flag) == false) {
             $msg = spend::get_msg();
             $http_referer = APP_PATH . 'index.php?m=pay&c=deposit&a=pay';
         } else {
             $msg = L('readpoint_pay', array('readpoint' => $readpoint));
         }
     } else {
         if (spend::point($readpoint, L('msg_readpoint'), $this->userid, $this->username, '', '', $flag) == false) {
             $msg = spend::get_msg();
             $http_referer = APP_PATH . 'index.php?m=pay&c=deposit&a=pay';
         } else {
             $msg = L('readpoint_pay_point', array('readpoint' => $readpoint));
         }
     }
     showmessage($msg, $http_referer, 3000);
 }
示例#16
0
 function __construct()
 {
     pc_base::load_app_func('global');
     pc_base::load_sys_class('format', '', 0);
     $this->M = new_html_special_chars(getcache('ask', 'commons'));
     $this->db = pc_base::load_model('ask_model');
     $this->db2 = pc_base::load_model('answer_model');
     $this->db3 = pc_base::load_model('category_model');
     $this->db_m = pc_base::load_model('member_model');
     $this->db_actor = pc_base::load_model('ask_actor_model');
     $this->db_credit = pc_base::load_model('ask_credit_model');
     $siteid = get_siteid();
     define("SITEID", $siteid);
 }
示例#17
0
/**
 * 返回经addslashe处理过的字符串或数组
 * @param $obj 需要处理的字符串或数组
 * @return mixed
 */
function new_html_special_chars($string)
{
    $encoding = 'utf-8';
    if (strtolower(CHARSET) == 'gbk') {
        $encoding = 'gb2312';
    }
    if (!is_array($string)) {
        return htmlspecialchars($string, ENT_COMPAT, $encoding);
    }
    foreach ($string as $key => $val) {
        $string[$key] = new_html_special_chars($val);
    }
    return $string;
}
示例#18
0
 function __construct()
 {
     if (!module_exists(ROUTE_M)) {
         showmessage(L('module_not_exists'));
     }
     parent::__construct();
     $this->M = new_html_special_chars(getcache('ask', 'commons'));
     $this->db = pc_base::load_model('ask_model');
     $this->db2 = pc_base::load_model('answer_model');
     $this->db3 = pc_base::load_model('category_model');
     $this->db_m = pc_base::load_model('member_model');
     $this->db_actor = pc_base::load_model('ask_actor_model');
     $this->db_credit = pc_base::load_model('ask_credit_model');
     $this->siteid = $this->get_siteid();
     $this->categorys = getcache('category_ask_' . $this->siteid, 'commons');
 }
示例#19
0
文件: link.php 项目: hxzyzz/ddc
	public function init() {
		if($_GET['typeid']!=''){
			$where = array('typeid'=>$_GET['typeid'],'siteid'=>$this->get_siteid());
		}else{
			$where = array('siteid'=>$this->get_siteid());
		}
 		$page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1;
		$infos = $this->db->listinfo($where,$order = 'listorder DESC,linkid DESC',$page, $pages = '9');
		$pages = $this->db->pages;
		$types = $this->db2->listinfo(array('module'=>ROUTE_M,'siteid'=>$this->get_siteid()),$order = 'typeid DESC');
		$types = new_html_special_chars($types);
 		$type_arr = array ();
 		foreach($types as $typeid=>$type){
			$type_arr[$type['typeid']] = $type['name'];
		}
		$big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=link&c=link&a=add\', title:\''.L('link_add').'\', width:\'700\', height:\'450\'}, function(){var d = window.top.art.dialog({id:\'add\'}).data.iframe;var form = d.document.getElementById(\'dosubmit\');form.click();return false;}, function(){window.top.art.dialog({id:\'add\'}).close()});void(0);', L('link_add'));
		include $this->admin_tpl('link_list');
	}
示例#20
0
 public function init()
 {
     $siteid = $this->get_siteid();
     $setting = getcache('mail', 'commons');
     if ($_GET['typeid'] != '') {
         $where = array('typeid' => $_GET['typeid'], 'siteid' => $this->get_siteid());
     } else {
         $where = array('siteid' => $this->get_siteid());
     }
     $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1;
     $infos = $this->db->listinfo($where, $order = 'addtime DESC,mailid DESC', $page, $pages = '10');
     $pages = $this->db->pages;
     $types = $this->db2->listinfo(array('module' => ROUTE_M, 'siteid' => $this->get_siteid()), $order = 'typeid DESC');
     $types = new_html_special_chars($types);
     $type_arr = array();
     foreach ($types as $typeid => $type) {
         $type_arr[$type['typeid']] = $type['name'];
     }
     $big_menu = array('javascript:;', L('mail'));
     include $this->admin_tpl('mail_list');
 }
示例#21
0
	public function edit_file() {
		if (empty($this->tpl_edit)) {
			showmessage(L('tpl_edit'));
		}
		$dir = isset($_GET['dir']) && trim($_GET['dir']) ? str_replace(array('..\\', '../', './', '.\\'), '', urldecode(trim($_GET['dir']))) : '';
		$file = isset($_GET['file']) && trim($_GET['file']) ? trim($_GET['file']) : '';
		if ($file) {
			preg_match('/^([a-zA-Z0-9])?([^.|-|_]+)/i', $file, $file_t);
			$file_t = $file_t[0];
			$file_t_v = array('header'=>array('{$SEO[\'title\']}'=>L('seo_title'), '{$SEO[\'site_title\']}'=>L('site_title'), '{$SEO[\'keyword\']}'=>L('seo_keyword'), '{$SEO[\'description\']}'=>L('seo_des')), 'category'=>array('{$catid}'=>L('cat_id'), '{$catname}'=>L('cat_name'), '{$url}'=>L('cat_url'), '{$r[catname]}'=>L('cat_name'), '{$r[url]}'=>'URL', '{$CATEGORYS}'=>L('cats')), 'list'=>array('{$catid}'=>L('cat_id'), '{$catname}'=>L('cat_name'), '{$url}'=>L('cat_url'), '{$CATEGORYS}'=>L('cats')), 'show'=> array('{$title}'=>L('title'), '{$inputtime}'=>L('inputtime'), '{$copyfrom}'=>L('comeform'), '{$content}'=>L('content'), '{$previous_page[url]}'=>L('pre_url'), '{$previous_page[title]}'=>L('pre_title'), '{$next_page[url]}'=>L('next_url'), '{$next_page[title]}'=>L('next_title')), 'page'=>array('{$CATEGORYS}'=>L('cats'), '{$content}'=>L('content')));
		}
		if (substr($file, -4, 4) != 'html') showmessage(L("can_edit_html_files"));
		$filepath = $this->filepath.$dir.DIRECTORY_SEPARATOR.$file;
		$is_write = 0;
		if (is_writable($filepath)) {
			$is_write = 1;
		}
		if ($_POST['dosubmit']) {
			$code = isset($_POST['code']) ? stripslashes($_POST['code']) : showmessage(L('illegal_operation'), HTTP_REFERER);
			$code = str_replace(array('<?','{php'),array('<?','{ php'),$code);
			if ($is_write == 1) {
				pc_base::load_app_func('global');
				creat_template_bak($filepath, $this->style, $dir);
				file_put_contents($filepath,htmlspecialchars_decode($code));
				showmessage(L('operation_success'), HTTP_REFERER);
			} else{
				showmessage(L("file_does_not_writable"), HTTP_REFERER);
			}
		} else {
			if (file_exists($filepath)) {
				$data = new_html_special_chars(file_get_contents($filepath));
			} else {
				showmessage(L('file_does_not_exists'));
			}
		}
		$show_header = true;
		include $this->admin_tpl('file_edit_file');
	}
示例#22
0
 /**
  * 单选框
  * 
  * @param $array 选项 二维数组
  * @param $id 默认选中值
  * @param $str 属性
  */
 public static function radio($array = array(), $id = 0, $str = '', $width = 0, $field = '')
 {
     $string = '';
     foreach ($array as $key => $value) {
         $checked = trim($id) == trim($key) ? 'checked' : '';
         if ($width) {
             $string .= '<label class="ib" style="width:' . $width . 'px">';
         }
         $string .= '<input type="radio" ' . $str . ' id="' . $field . '_' . new_html_special_chars($key) . '" ' . $checked . ' value="' . $key . '"> ' . $value;
         if ($width) {
             $string .= '</label>';
         }
     }
     return $string;
 }
示例#23
0
 /**
  * 统计广告展示次数
  * @param intval $siteid 站点ID
  * @param intval $spaceid 广告版位ID
  * @param intval $id 广告ID
  * @return boolen 
  */
 protected function show_stat($siteid = 0, $spaceid = 0, $id = 0)
 {
     $M = new_html_special_chars(getcache('poster', 'commons'));
     if ($M['enablehits'] == 0) {
         return true;
     }
     //$siteid = intval($siteid);
     $spaceid = intval($spaceid);
     $id = intval($id);
     if (!$id) {
         return false;
     }
     if (!$siteid || !$spaceid) {
         $r = $this->db->get_one(array('id' => $id), 'siteid, spaceid');
         $siteid = $r['id'];
         $spaceid = $r['spaceid'];
     }
     $ip = ip();
     $ip_area = pc_base::load_sys_class('ip_area');
     $area = $ip_area->get($ip);
     $username = param::get_cookie('username') ? param::get_cookie('username') : '';
     $this->db->update(array('hits' => '+=1'), array('id' => $id));
     $this->s_db->insert(array('pid' => $id, 'siteid' => $siteid, 'spaceid' => $spaceid, 'username' => $username, 'area' => $area, 'ip' => $ip, 'referer' => safe_replace(HTTP_REFERER), 'clicktime' => SYS_TIME, 'type' => 0));
     return true;
 }
示例#24
0
</a></span><br/>
<span style="height:22"><a href="?m=special&c=special&a=edit&specialid=<?php 
        echo $info['id'];
        ?>
&menuid=<?php 
        echo $_GET['menuid'];
        ?>
"><?php 
        echo L('edit_special');
        ?>
</a></span> | 
<span style="height:22"><a href="?m=special&c=special&a=delete&id=<?php 
        echo $info['id'];
        ?>
" onclick="return confirm('<?php 
        echo L('confirm', array('message' => addslashes(new_html_special_chars($info['title']))));
        ?>
')"><?php 
        echo L('del_special');
        ?>
</a></span></td>
	</tr>
<?php 
    }
}
?>
</tbody>
    </table>
  
    <div class="btn"><label for="check_box"><?php 
echo L('selected_all');
示例#25
0
文件: index.php 项目: boylzj/omguitar
 /**
  * 查看系统短消息
  */
 public function read_group()
 {
     if ((!isset($_GET['group_id']) || empty($_GET['group_id'])) && (!isset($_POST['group_id']) || empty($_POST['group_id']))) {
         return false;
     }
     //查询消息详情
     $infos = $this->message_group_db->get_one(array('id' => $_GET['group_id']));
     $infos = new_html_special_chars($infos);
     if (!is_array($infos)) {
         showmessage(L('message_not_exist'), 'blank');
     }
     //检查查看表是否有记录,无则向message_data 插入浏览记录
     $check = $this->message_data_db->select(array('userid' => $this->_userid, 'group_message_id' => $_GET['group_id']));
     if (!$check) {
         $this->message_data_db->insert(array('userid' => $this->_userid, 'group_message_id' => $_GET['group_id']));
     }
     include template('message', 'read_group');
 }
示例#26
0
        ?>
&val=<?php 
        echo $form['disabled'] ? 0 : 1;
        ?>
"><?php 
        if ($form['disabled'] == 0) {
            echo L('field_disabled');
        } else {
            echo L('field_enabled');
        }
        ?>
</a> | <a href="?m=formguide&c=formguide&a=delete&formid=<?php 
        echo $form['modelid'];
        ?>
" onClick="return confirm('<?php 
        echo L('confirm', array('message' => addslashes(new_html_special_chars($form['name']))));
        ?>
')"><?php 
        echo L('del');
        ?>
</a> | <a href="javascript:stat('<?php 
        echo $form['modelid'];
        ?>
', '<?php 
        echo safe_replace($form['name']);
        ?>
');void(0);"><?php 
        echo L('stat');
        ?>
</a></td>
	</tr>
示例#27
0
	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(new_html_special_chars($_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');
				}
			}
		}

	}
示例#28
0
文件: index.php 项目: klj123wan/czsz
 /**
  * 表单展示
  */
 public function show()
 {
     if (!isset($_GET['formid']) || empty($_GET['formid'])) {
         $_GET['action'] ? exit : showmessage(L('form_no_exist'), HTTP_REFERER);
     }
     $siteid = $_GET['siteid'] ? intval($_GET['siteid']) : 1;
     $formid = intval($_GET['formid']);
     $r = $this->db->get_one(array('modelid' => $formid, 'siteid' => $siteid, 'disabled' => 0), 'tablename, setting');
     if (!$r) {
         $_GET['action'] ? exit : showmessage(L('form_no_exist'), HTTP_REFERER);
     }
     $setting = string2array($r['setting']);
     if ($setting['enabletime']) {
         if ($setting['starttime'] > SYS_TIME || $setting['endtime'] + 3600 * 24 < SYS_TIME) {
             $_GET['action'] ? exit : showmessage(L('form_expired'), APP_PATH . 'index.php?m=formguide&c=index&a=index');
         }
     }
     $userid = param::get_cookie('_userid');
     if ($setting['allowunreg'] == 0 && !$userid && $_GET['action'] != 'js') {
         showmessage(L('please_login_in'), APP_PATH . 'index.php?m=member&c=index&a=login&forward=' . urlencode(HTTP_REFERER));
     }
     if (isset($_POST['dosubmit'])) {
         $tablename = 'form_' . $r['tablename'];
         $this->m_db->change_table($tablename);
         $data = array();
         require CACHE_MODEL_PATH . 'formguide_input.class.php';
         $formguide_input = new formguide_input($formid);
         $data = new_addslashes($_POST['info']);
         $data = new_html_special_chars($data);
         $data = $formguide_input->get($data);
         $data['userid'] = $userid;
         $data['username'] = param::get_cookie('_username');
         $data['datetime'] = SYS_TIME;
         $data['ip'] = ip();
         $dataid = $this->m_db->insert($data, true);
         if ($dataid) {
             if ($setting['sendmail']) {
                 pc_base::load_sys_func('mail');
                 $mails = explode(',', $setting['mails']);
                 if (is_array($mails)) {
                     foreach ($mails as $m) {
                         sendmail($m, L('tips'), $this->M['mailmessage']);
                     }
                 }
             }
             $this->db->update(array('items' => '+=1'), array('modelid' => $formid, 'siteid' => $this->siteid));
         }
         showmessage(L('thanks'), APP_PATH);
     } else {
         if ($setting['allowunreg'] == 0 && !$userid && $_GET['action'] == 'js') {
             $no_allowed = 1;
         }
         pc_base::load_sys_class('form', '', '');
         $f_info = $this->db->get_one(array('modelid' => $formid, 'siteid' => $this->siteid));
         extract($f_info);
         $tablename = 'form_' . $r['tablename'];
         $this->m_db->change_table($tablename);
         $ip = ip();
         $where = array();
         if ($userid) {
             $where = array('userid' => $userid);
         } else {
             $where = array('ip' => $ip);
         }
         $re = $this->m_db->get_one($where, 'datetime');
         $setting = string2array($setting);
         if ($setting['allowmultisubmit'] == 0 && $re['datetime'] || SYS_TIME - $re['datetime'] < $this->M['interval'] * 60) {
             $_GET['action'] ? exit : showmessage(L('had_participate'), APP_PATH . 'index.php?m=formguide&c=index&a=index');
         }
         require CACHE_MODEL_PATH . 'formguide_form.class.php';
         $formguide_form = new formguide_form($formid, $no_allowed);
         $forminfos_data = $formguide_form->get();
         $SEO = seo($this->siteid, L('formguide'), $name);
         if (isset($_GET['action']) && $_GET['action'] == 'js') {
             if (!function_exists('ob_gzhandler')) {
                 ob_clean();
             }
             ob_start();
         }
         $template = $_GET['action'] == 'js' ? $js_template : $show_template;
         include template('formguide', $template, $default_style);
         if (isset($_GET['action']) && $_GET['action'] == 'js') {
             $data = ob_get_contents();
             ob_clean();
             exit(format_js($data));
         }
     }
 }
 function video($field, $value)
 {
     $video_content_db = pc_base::load_model('video_content_model');
     $video_store_db = pc_base::load_model('video_store_model');
     //先获取目前contentid下面的videoid
     $videos = $video_content_db->select(array('contentid' => $this->id, 'modelid' => $this->modelid), 'videoid', '', '`listorder` ASC', '', 'videoid');
     if (is_array($videos) && !empty($videos)) {
         $videoids = '';
         foreach ($videos as $_vid => $r) {
             $videoids .= $_vid . ',';
         }
         $videoids = substr($videoids, 0, -1);
         $result = $video_store_db->select("`videoid` IN({$videoids}) AND `status`=21", '*', '', '', '', 'videoid');
         $pagenumber = count($result);
         $return_data = array();
         if ($pagenumber > 0) {
             if (is_array($result) && !empty($result)) {
                 //首先对$result按照$videos的videoid排序
                 foreach ($videos as $_vid => $v) {
                     if ($result[$_vid]) {
                         $new_result[] = $result[$_vid];
                     }
                 }
                 unset($result, $_vid, $v);
             }
             $this->url = pc_base::load_app_class('url', 'content');
             for ($i = 1; $i <= $pagenumber; $i++) {
                 $pageurls[$i] = $this->url->show($this->id, $i, $this->data['catid'], $this->data['inputtime']);
             }
             //构建返回数组
             foreach ($pageurls as $page => $urls) {
                 $_k = $page - 1;
                 if ($_k == 0) {
                     $arr = reset($new_result);
                 } else {
                     $arr = next($new_result);
                 }
                 $return_data['data'][$page]['title'] = $arr['title'] ? new_html_special_chars($arr['title']) : new_html_special_chars($this->data['title']);
                 $return_data['data'][$page]['url'] = $urls[0];
                 $return_data['vid'] = $arr['vid'];
                 $return_data['channelid'] = $arr['channelid'];
             }
             $category_db = pc_base::load_model('category_model');
             $r = $category_db->get_one(array('catid' => $this->data['catid']), 'modelid, setting, siteid');
             $setting = string2array($r['setting']);
             $siteid = intval($r['siteid']);
             if ($setting['content_ishtml']) {
                 if (!function_exists('content_pages')) {
                     pc_base::load_app_func('util', 'content');
                 }
                 $modelid = intval($r['modelid']);
                 $data = $this->data;
                 unset($data[$field]);
                 $output_data = $this->get($data);
                 extract($output_data);
                 $id = $this->id;
                 //SEO
                 $seo_keywords = '';
                 if (!empty($keywords)) {
                     $seo_keywords = implode(',', $keywords);
                 }
                 $SEO = seo($siteid, $catid, $title, $description, $seo_keywords);
                 $this->html_root = pc_base::load_config('system', 'html_root');
                 $this->sitelist = getcache('sitelist', 'commons');
                 $this->queue = pc_base::load_model('queue_model');
                 $template = $this->data['template'] ? $this->data['template'] : $setting['show_template'];
                 foreach ($pageurls as $page => $urls) {
                     $_k = $page - 1;
                     if ($_k == 0) {
                         $arr = $first = reset($new_result);
                     } else {
                         $arr = next($new_result);
                     }
                     $return_data['vid'] = $arr['vid'];
                     ${$field} = $return_data;
                     $pagefile = $urls[1];
                     if ($siteid != 1) {
                         $site_dir = $this->sitelist[$siteid]['dirname'];
                         $pagefile = $this->html_root . '/' . $site_dir . $pagefile;
                     }
                     $this->queue->add_queue('add', $pagefile, $siteid);
                     $pagefile = PHPCMS_PATH . $pagefile;
                     ob_start();
                     include template('content', $template);
                     $data = ob_get_contents();
                     ob_clean();
                     $dir = dirname($pagefile);
                     if (!is_dir($dir)) {
                         mkdir($dir, 0777, 1);
                     }
                     $strlen = file_put_contents($pagefile, $data);
                     @chmod($file, 0777);
                 }
                 $return_data['vid'] = $first['vid'];
                 unset($new_result);
             }
             return $return_data;
         } else {
             return array();
         }
     }
 }
示例#30
0
if(is_array($infos)){
	foreach($infos as $info){
?>   
	<tr>
	<td align="center">
	<input type="checkbox" name="spaceid[]" value="<?php echo $info['spaceid']?>">
	</td>
	<td><?php echo $info['name']?></td>
	<td align="center"><?php echo $TYPES[$info['type']]?></td>
	<td align="center"><?php echo $info['width']?>*<?php echo $info['height']?></td>
	<td align="center"><?php echo $info['items']?></td>
	<td align="center"><?php echo $info['description']?></td>
	<td align="center">
	<a href="?m=poster&c=space&a=public_preview&spaceid=<?php echo $info['spaceid']?>" target="_blank"><?php echo L('preview')?></a> | <a href="javascript:call(<?php echo $info['spaceid']?>);void(0);"><?php echo L('get_code')?></a> | <a href='?m=poster&c=poster&a=init&spaceid=<?php echo $info['spaceid']?>&menuid=<?php echo $_GET['menuid']?>' ><?php echo L('ad_list')?></a> | 
	<a href="###" onclick="edit(<?php echo $info['spaceid']?>, '<?php echo addslashes(new_html_special_chars($info['name']))?>')" title="<?php echo L('edit')?>" ><?php echo L('edit')?></a> | 
	<a href='?m=poster&c=space&a=delete&spaceid=<?php echo $info['spaceid']?>' onClick="return confirm('<?php echo L('confirm', array('message' => addslashes(new_html_special_chars($info['name']))))?>')"><?php echo L('delete')?></a>
	| <a href="index.php?m=poster&c=poster&a=add&spaceid=<?php echo $info['spaceid']?>&menuid=<?php echo $_GET['menuid']?>&pc_hash=<?php echo $_SESSION['pc_hash']?>">添加广告</a>
	</td>
	</tr>
<?php 
	}
}
?>
</tbody>
    </table>
    <div class="btn"><label for="check_box"><?php echo L('selected_all')?>/<?php echo L('cancel')?></label>
		<input name="submit" type="submit" class="button" value="<?php echo L('remove_all_selected')?>" onClick="return confirm('<?php echo L('confirm', array('message' => L('selected')))?>')">&nbsp;&nbsp;</div>  </div>
 <div id="pages"><?php echo $pages?></div>
</form>
</div>
<script type="text/javascript">