Ejemplo n.º 1
0
 private function _format($id, $data, $type)
 {
     switch ($type) {
         case '1':
             // json
             if (CHARSET == 'gbk') {
                 $data = array_iconv($data, 'gbk', 'utf-8');
             }
             return json_encode($data);
             break;
         case '2':
             // xml
             $xml = Loader::lib('Xml');
             return $xml->xml_serialize($data);
             break;
         case '3':
             // js
             Loader::func('dbsource:global');
             ob_start();
             include template_url($id);
             $html = ob_get_contents();
             ob_clean();
             return format_js($html);
             break;
     }
 }
Ejemplo n.º 2
0
 /**
  * 显示心情代码
  */
 public function init()
 {
     $mood_id =& $this->mood_id;
     $setting =& $this->setting;
     ob_start();
     include template('mood', 'index');
     $html = ob_get_contents();
     ob_clean();
     echo format_js($html);
 }
Ejemplo n.º 3
0
Archivo: index.php Proyecto: hxzyzz/ddc
	public function init() {
		$mood_id =& $this->mood_id;
		$setting =& $this->setting;
		$mood_db = pc_base::load_model('mood_model');
		$data = $mood_db->get_one(array('catid'=>$this->catid, 'siteid'=>$this->siteid, 'contentid'=>$this->contentid));
		foreach ($setting as $k=>$v) {
			$setting[$k]['fields'] = 'n'.$k;
			if (!isset($data[$setting[$k]['fields']])) $data[$setting[$k]['fields']] = 0;
			if (isset($data['total']) && !empty($data['total'])) {
				$setting[$k]['per'] = ceil(($data[$setting[$k]['fields']]/$data['total']) * 60);
			} else {
				$setting[$k]['per'] = 0;
			}
		}
		ob_start();
		include template('mood', 'index');
		$html = ob_get_contents();
		ob_clean();
		echo format_js($html);
	}
Ejemplo n.º 4
0
 /**
  * 评论首页和内容页调用
  */
 public function init()
 {
     $hot = isset($_GET['hot']) && intval($_GET['hot']) ? intval($_GET['hot']) : 0;
     $commentid =& $this->commentid;
     $applications =& $this->applications;
     $contentid =& $this->contentid;
     $username = cookie('_username', L('yuncms_friends'));
     $userid = cookie('_userid');
     $setting = S('common/comment');
     $SEO = seo('');
     // SEO
     // 通过API接口调用数据的标题、URL地址
     if (!($data = get_comment_api($commentid))) {
         $this->_show_msg(L('illegal_parameters'));
     } else {
         $title = $data['title'];
         $url = $data['url'];
         if (isset($data['allow_comment']) && empty($data['allow_comment'])) {
             showmessage(L('canot_allow_comment'));
         }
         unset($data);
     }
     if (isset($_GET['js'])) {
         if (strpos($url, SITE_URL) === 0) {
             $domain = SITE_URL;
         } else {
             $urls = parse_url($url);
             $domain = $urls['scheme'] . '://' . $urls['host'] . (isset($urls['port']) && !empty($urls['port']) ? ":" . $urls['port'] : '') . '/';
         }
         ob_start();
         include template('comment', 'show_list');
         $html = ob_get_contents();
         ob_clean();
         echo format_js($html);
     } else {
         include template('comment', 'list');
     }
 }
Ejemplo n.º 5
0
/**
 * 写入缓存动态页面
 */
function cache_page($ttl = 360, $isjs = 0)
{
    if ($ttl == 0 || !defined('CACHE_PAGE_ID')) {
        return false;
    }
    $contents = ob_get_contents();
    if ($isjs) {
        $contents = format_js($contents);
    }
    $contents = "<!--expiretime:" . (SYS_TIME + $ttl) . "-->\n" . $contents;
    setcache(CACHE_PAGE_ID, $contents, 'page_tmp/' . substr(CACHE_PAGE_ID, 0, 2));
}
Ejemplo n.º 6
0
 /**
  * 投票显示页
  */
 public function show()
 {
     $type = intval($_GET['type']);
     //调用方式ID
     $subjectid = abs(intval($_GET['subjectid']));
     if (!$subjectid) {
         showmessage(L('vote_novote'), 'blank');
     }
     //取出投票标题
     $subject_arr = $this->vote->get_subject($subjectid);
     $siteid = $subject_arr['siteid'];
     //增加判断,防止模板调用不存在投票时js报错 wangtiecheng
     if (!is_array($subject_arr)) {
         if (isset($_GET['action']) && $_GET['action'] == 'js') {
             exit;
         } else {
             showmessage(L('vote_novote'), 'blank');
         }
     }
     extract($subject_arr);
     //显示模版
     $template = $template ? $template : 'vote_tp';
     //获取投票选项
     $options = $this->vote_option->get_options($subjectid);
     //新建一数组用来存新组合数据
     $total = 0;
     $vote_data = array();
     $vote_data['total'] = 0;
     //所有投票选项总数
     $vote_data['votes'] = 0;
     //投票人数
     //获取投票结果信息
     $infos = $this->vote_data->select(array('subjectid' => $subjectid), 'data');
     //循环每个会员的投票记录
     foreach ($infos as $subjectid_arr) {
         extract($subjectid_arr);
         $arr = string2array($data);
         foreach ($arr as $key => $values) {
             $vote_data[$key] += 1;
         }
         $total += array_sum($arr);
         $vote_data['votes']++;
     }
     $vote_data['total'] = $total;
     //取出投票时间,如果当前时间不在投票时间范围内,则选项变灰不可选
     if (date("Y-m-d", SYS_TIME) > $todate || date("Y-m-d", SYS_TIME) < $fromdate) {
         $check_status = 'disabled';
         $display = 'display:none;';
     } else {
         $check_status = '';
     }
     //JS调用
     if ($_GET['action'] == 'js') {
         if (!function_exists('ob_gzhandler')) {
             ob_clean();
         }
         ob_start();
         //$template = 'submit';
         $template = $subject_arr['template'];
         //根据TYPE值,判断调用模版
         switch ($type) {
             case 3:
                 //首页、栏目页调用
                 $true_template = 'vote_tp_3';
                 break;
             case 2:
                 //内容页调用
                 $true_template = 'vote_tp_2';
                 break;
             default:
                 $true_template = $template;
         }
         include template('vote', $true_template);
         $data = ob_get_contents();
         ob_clean();
         exit(format_js($data));
     }
     //SEO设置
     $SEO = seo(SITEID, '', $subject, $description, $subject);
     //前台投票列表调用默认页面,以免页面样式错乱.
     if ($_GET['show_type'] == 1) {
         include template('vote', 'vote_tp');
     } else {
         include template('vote', $template);
     }
 }
Ejemplo n.º 7
0
 /**
  * 表单展示
  */
 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));
         }
     }
 }
Ejemplo n.º 8
0
 public function synlogout($get, $post)
 {
     $res = '';
     foreach ($this->applist as $v) {
         if ($v['appid'] != $this->appid) {
             $f = strstr($v['url'] . $v['apifilename'], '?') ? '&' : '?';
             $res .= '<script type="text/javascript" src="' . $v['url'] . $v['apifilename'] . $f . 'time=' . SYS_TIME . '&code=' . urlencode(sys_auth('action=synlogout&time=' . SYS_TIME, 'ENCODE', $v['authkey'])) . '" reload="1"></script>';
         }
     }
     header("Content-type: text/javascript");
     return format_js($res);
 }
Ejemplo n.º 9
0
    exit;
}
if (isset($_GET["main"])) {
    main_switch();
    exit;
}
if (isset($_GET["script"])) {
    main_switch_scripts();
    exit;
}
if (isset($_GET["popup"])) {
    popup();
    exit;
}
if (isset($_GET["format-index"])) {
    format_js();
    exit;
}
if (isset($_GET["format-index-popup"])) {
    format_popup();
    exit;
}
if (isset($_GET["format_type"])) {
    format_operation();
    exit;
}
if (isset($_GET["change-label-js"])) {
    change_label_js();
    exit;
}
if (isset($_GET["change-label-popup"])) {
Ejemplo n.º 10
0
 public function mini()
 {
     $_username = cookie('_username');
     $_userid = cookie('_userid');
     ob_start();
     include template('member', 'mini');
     $html = ob_get_contents();
     ob_clean();
     echo format_js($html);
 }
Ejemplo n.º 11
0
	
	$user=new usersMenus();
	if($user->blkid_installed==false){header('location:users.index.php');die();}
	if(($user->AsSystemAdministrator==false) OR ($user->AsSambaAdministrator==false)) {die();}
	
	
	if(isset($_GET["uuid-infos"])){uuid_js();exit;}
	if(isset($_GET["uuid-popup"])){uuid_popup();exit;}
	
	
	if(isset($_GET["js"])){js();exit;}
	if(isset($_GET["usb_infos"])){main_usb_infos();exit;}
	if(isset($_GET["main"])){main_switch();exit;}
	if(isset($_GET["script"])){main_switch_scripts();exit;}
	if(isset($_GET["popup"])){popup();exit;}
	if(isset($_GET["format-index"])){format_js();exit;}
	if(isset($_GET["format-index-popup"])){format_popup();exit;}
	if(isset($_GET["format_type"])){format_operation();exit;}
	if(isset($_GET["change-label-js"])){change_label_js();exit;}
	if(isset($_GET["change-label-popup"])){change_label_popup();exit;}
	if(isset($_GET["change-label-perform"])){change_label_perform();exit;}
	
	//umount=yes&uuid=$UUID
	if(isset($_GET["umount"])){umount_js();exit;}
	if(isset($_GET["umount-index-popup"])){umount_popup();exit;}
	if(isset($_GET["umount-mounted"])){umount_mounted();exit;}
	
	//mount=yes&uuid=$UUID&mounted=$path&type=$TYPE
	if(isset($_GET["mount"])){mount_js();exit;}
	if(isset($_GET["mount-index-popup"])){mount_popup();exit;}
	if(isset($_GET["mount-mounted"])){mount_mounted();exit;}
Ejemplo n.º 12
0
 /**
  * 表单展示
  */
 public function show()
 {
     if (!isset($_GET['formid']) || empty($_GET['formid'])) {
         $_GET['do'] ? exit : showmessage(L('form_no_exist'), HTTP_REFERER);
     }
     $formid = intval($_GET['formid']);
     $r = $this->db->where(array('modelid' => $formid, 'disabled' => 0))->field('tablename, setting')->find();
     if (!$r) {
         $_GET['do'] ? exit : showmessage(L('form_no_exist'), HTTP_REFERER);
     }
     $setting = string2array($r['setting']);
     if ($setting['enabletime']) {
         if ($setting['starttime'] > TIME || $setting['endtime'] + 3600 * 24 < TIME) {
             $_GET['do'] ? exit : showmessage(L('form_expired'), U('formguide/index'));
         }
     }
     $userid = cookie('_userid');
     if ($setting['allowunreg'] == 0 && !$userid && $_GET['do'] != 'js') {
         showmessage(L('please_login_in'), U('member/passport/login', array('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.php';
         $formguide_input = new formguide_input($formid);
         $data = $formguide_input->get($_POST['info']);
         $data['userid'] = !empty($userid) ? $userid : 0;
         $data['username'] = cookie('_username');
         $data['datetime'] = TIME;
         $data['ip'] = IP;
         $dataid = $this->m_db->insert($data, true);
         if ($dataid) {
             if ($setting['sendmail']) {
                 $mails = explode(',', $setting['mails']);
                 if (is_array($mails)) {
                     foreach ($mails as $m) {
                         sendmail($m, L('tips'), $this->M['mailmessage']);
                     }
                 }
             }
             $this->db->where(array('modelid' => $formid))->update(array('items' => '+=1'));
         }
         showmessage(L('thanks'), SITE_URL);
     } else {
         if ($setting['allowunreg'] == 0 && !$userid && $_GET['do'] == 'js') {
             $no_allowed = 1;
         }
         $f_info = $this->db->getby_modelid($formid);
         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->where($where)->field('datetime')->find();
         $setting = string2array($setting);
         if ($setting['allowmultisubmit'] == 0 && isset($re['datetime']) || TIME - $re['datetime'] < $this->M['interval'] * 60) {
             $_GET['act'] ? exit : showmessage(L('had_participate'), U('formguide/index/init'));
         }
         require CACHE_MODEL_PATH . 'formguide_form.php';
         $formguide_form = new formguide_form($formid, $no_allowed);
         $forminfos_data = $formguide_form->get();
         $SEO = seo(L('formguide'), $name);
         if (isset($_GET['do']) && $_GET['do'] == 'js') {
             if (!function_exists('ob_gzhandler')) {
                 ob_clean();
             }
             ob_start();
         }
         $template = $_GET['do'] == 'js' ? $js_template : $show_template;
         include template('formguide', $template, $default_style);
         if (isset($_GET['do']) && $_GET['do'] == 'js') {
             $data = ob_get_contents();
             ob_clean();
             exit(format_js($data));
         }
     }
 }