function get_playlist_byid($id)
{
    $params['client_id'] = "f1652f5ab2517d4d";
    $params['playlist_id'] = $id;
    $params['count'] = 100;
    $base_url = "https://openapi.youku.com/v2/playlists/videos.json";
    $url = $base_url . "?" . http_build_query($params);
    $s = file_data($url);
    $result = json_decode($s, true);
    $video = $result['videos'];
    if (empty($video)) {
        return false;
    }
    $result['videoname'] = array();
    $result['videolink'] = array();
    $result['videoimg'] = array();
    $result['videotime'] = array();
    foreach ($video as $vk => $vv) {
        //http://player.56.com/cpm_MTA4NzEzNDUz.swf
        $result['videoname'][$vk] = diconv($vv['title'], "utf-8");
        $result['videolink'][$vk] = 'http://player.youku.com/player.php/Type/Folder/Fid/19466264/Ob/1/sid/' . $vv['id'] . '/v.swf';
        $result['videoimg'][$vk] = $vv['thumbnail'];
        $result['videotime'][$vk] = strtotime($vv['published']);
    }
    unset($result['videos']);
    return $result;
}
Exemple #2
0
 public static function mobileoutput()
 {
     global $_G;
     if (!defined('TPL_DEFAULT')) {
         $content = ob_get_contents();
         ob_end_clean();
         $content = preg_replace("/href=\"(\\w+\\.php)(.*?)\"/e", "mobilereplace('\\1', '\\2')", $content);
         ob_start();
         $content = '<?xml version="1.0" encoding="utf-8"?>' . $content;
         if ('utf-8' != CHARSET) {
             @header('Content-Type: text/html; charset=utf-8');
             $content = diconv($content, CHARSET, 'utf-8');
         }
         echo $content;
         exit;
     } elseif (defined('TPL_DEFAULT') && !$_G['cookie']['dismobilemessage'] && $_G['mobile']) {
         ob_end_clean();
         ob_start();
         $_G['forcemobilemessage'] = true;
         $query_sting_tmp = str_replace(array('&mobile=yes', 'mobile=yes'), array(''), $_SERVER['QUERY_STRING']);
         $_G['setting']['mobile']['pageurl'] = $_G['siteurl'] . substr($_G['PHP_SELF'], 1) . ($query_sting_tmp ? '?' . $query_sting_tmp . '&mobile=no' : '?mobile=no');
         unset($query_sting_tmp);
         dsetcookie('dismobilemessage', '1', 3600);
         showmessage('not_in_mobile');
         exit;
     }
 }
Exemple #3
0
 private static function _convert($post)
 {
     foreach ($post as $k => $v) {
         $post[$k] = diconv($v, CHARSET, 'UTF-8');
     }
     return $post;
 }
function get_album_by_aid($aid)
{
    $params['aid'] = $aid;
    $url = "http://oapi.56.com/album/info.json";
    $url = $url . '?' . signRequest($params);
    $s = file_get_contents($url);
    $result = json_decode($s, true);
    $video = $result[videolist][data];
    if (empty($video)) {
        return false;
    }
    $result['videoname'] = array();
    $result['videolink'] = array();
    $result['videoimg'] = array();
    $result['videotime'] = array();
    foreach ($video as $vk => $vv) {
        //http://player.56.com/cpm_MTA4NzEzNDUz.swf
        $result['videoname'][$vk] = diconv($vv['video_title'], "utf-8");
        $result['videolink'][$vk] = 'http://player.56.com/w_' . $vv['video_id'];
        $result['videolink'][$vk] .= base64_decode("LnN3Zi8xMDMxX3NtYXJ0Y29tZS5zd2Y=");
        $result['videoimg'][$vk] = $vv['video_cover'];
        $result['videotime'][$vk] = $vv['add_time'];
    }
    unset($result[videolist][data]);
    return $result;
}
function build_cache_creditrule()
{
    $data = array();
    foreach (C::t('common_credit_rule')->fetch_all_rule() as $rule) {
        $rule['rulenameuni'] = urlencode(diconv($rule['rulename'], CHARSET, 'UTF-8', true));
        $data[$rule['action']] = $rule;
    }
    savecache('creditrule', $data);
}
Exemple #6
0
 public function makeDownloadurl($sha1, $filesize, $filename)
 {
     global $_G;
     $filename = trim($filename, ' "');
     // Discuz! 默认的filename两侧会加上 双引号
     $filename = diconv($filename, CHARSET, 'UTF-8');
     $filename = $this->str2hex($filename);
     $filename = strtolower($filename[1]);
     $post = 'http://dz.xf.qq.com/ftn.php?v=1&&';
     $k = self::$_util->hashHmac('sha1', sprintf('%s|%s|%s', $sha1, $_G['timestamp'], self::$_siteId), self::$_encKey);
     $parm = array('site_id' => self::$_siteId, 't' => $_G['timestamp'], 'sha1' => $sha1, 'filesize' => $filesize, 'filename' => $filename, 'k' => $k, 'ip' => $_G['clientip']);
     return $post . self::$_util->httpBuildQuery($parm, '', '&&');
 }
Exemple #7
0
function make_downloadurl($sha1, $filesize, $filename)
{
    global $_G;
    $filename = trim($filename, ' "');
    // Discuz! 默认的filename两侧会加上 双引号
    $filename = diconv($filename, CHARSET, 'UTF-8');
    $filename = str2hex($filename);
    $filename = strtolower($filename[1]);
    $post = 'http://dz.xf.qq.com/ftn.php?v=1&&';
    $k = _hash_hmac('sha1', sprintf('%s|%s|%s', $sha1, $_G['timestamp'], $_G['setting']['ftn_site_id']), $_G['setting']['xf_storage_enc_key']);
    $parm = array('site_id' => $_G['setting']['ftn_site_id'], 't' => $_G['timestamp'], 'sha1' => $sha1, 'filesize' => $filesize, 'filename' => $filename, 'k' => $k, 'ip' => $_G['clientip']);
    return $post . cloud_http_build_query($parm, '', '&&');
}
function build_cache_creditrule()
{
    $data = array();
    $query = DB::query("SELECT * FROM " . DB::table('common_credit_rule'));
    while ($rule = DB::fetch($query)) {
        if (strtoupper(CHARSET) != 'UTF-8') {
            $rule['rulenameuni'] = urlencode(diconv($rule['rulename'], CHARSET, 'UTF-8', true));
        } else {
            $rule['rulenameuni'] = $rule['rulename'];
        }
        $data[$rule['action']] = $rule;
    }
    save_syscache('creditrule', $data);
}
Exemple #9
0
function getpagelink($city, $page, $updatetype = false)
{
    global $_G;
    require_once libfile('class/xml');
    $goodsxmlfile = MOKUAI_DIR . '/shop/1.0/Data/lashou_' . $city . '.xml';
    $goodss = xml2array(file_get_contents($goodsxmlfile));
    $goodslist_text = file_get_contents('http://' . $city . '.lashou.com/page' . $page);
    $ga0 = explode('<div class="content-list">', $goodslist_text);
    $ga1 = explode('<!-- main end -->', $ga0[1]);
    $ga2 = explode('<div class="com-img">', $ga1[0]);
    foreach ($ga2 as $k => $v) {
        $ga3 = explode('.lashou.com/deal/', $v);
        $ga4 = explode('.html', $ga3[1]);
        if ($ga4[0]) {
            $goodss[$ga4[0]]['oldid'] = $ga4[0];
        }
    }
    file_put_contents($goodsxmlfile, diconv(array2xml($goodss, 1), "UTF-8", $_G['charset'] . "//IGNORE"));
    return $goodss;
}
 public static function text($param)
 {
     list($data) = $param;
     self::_init();
     global $_G;
     $data['content'] = diconv($data['content'], 'UTF-8');
     $isloginkeyword = self::_custom('text', $data['content']);
     if (!$_G['wechat']['setting']['wsq_allow']) {
         return;
     }
     $authcode = C::t('#wechat#mobile_wechat_authcode')->fetch_by_code($data['content']);
     if (!$authcode || $authcode['status']) {
         if ($isloginkeyword) {
             wsq::report('loginclick');
             self::_show('access', $data['from']);
         }
     } else {
         wsq::report('sendnum');
         self::_show('sendnum', $data['from'] . "\t" . $authcode['sid'], 60);
     }
 }
 function variable($variables = array())
 {
     global $_G;
     $globals = array('cookiepre' => $_G['config']['cookie']['cookiepre'], 'auth' => $_G['cookie']['auth'], 'saltkey' => $_G['cookie']['saltkey'], 'member_uid' => $_G['member']['uid'], 'member_username' => $_G['member']['username'], 'groupid' => $_G['groupid'], 'formhash' => FORMHASH, 'ismoderator' => $_G['forum']['ismoderator'], 'readaccess' => $_G['group']['readaccess']);
     if (!empty($_GET['submodule']) == 'checkpost') {
         $apifile = 'source/plugin/mobile/api/' . $_GET['version'] . '/sub_checkpost.php';
         if (file_exists($apifile)) {
             require_once $apifile;
             $globals = $globals + mobile_api_sub::getvariable();
         }
     }
     $xml = array('Version' => '2', 'Charset' => strtoupper($_G['charset']), 'Variables' => array_merge($globals, $variables));
     if (!empty($_G['messageparam'])) {
         $message_result = lang('plugin/mobile', $_G['messageparam'][0], $_G['messageparam'][2]);
         if ($message_result == $_G['messageparam'][0]) {
             $vars = explode(':', $_G['messageparam'][0]);
             if (count($vars) == 2) {
                 $message_result = lang('plugin/' . $vars[0], $vars[1], $_G['messageparam'][2]);
                 $_G['messageparam'][0] = $vars[1];
             } else {
                 $message_result = lang('message', $_G['messageparam'][0], $_G['messageparam'][2]);
             }
         }
         $message_result = strip_tags($message_result);
         if ($_G['messageparam'][4]) {
             $_G['messageparam'][0] = "custom";
         }
         if ($_G['messageparam'][3]['login'] && !$_G['uid']) {
             $_G['messageparam'][0] .= '//' . $_G['messageparam'][3]['login'];
         }
         $xml['Message'] = array("messageval" => $_G['messageparam'][0], "messagestr" => $message_result);
         if ($_GET['mobilemessage']) {
             $return = mobile_core::json($xml);
             header("HTTP/1.1 301 Moved Permanently");
             header("Location:discuz://" . $_G['messageparam'][0] . "//" . rawurlencode(diconv($message_result, $_G['charset'], "utf-8")) . ($return ? "//" . rawurlencode($return) : ''));
             exit;
         }
     }
     return $xml;
 }
function get_tplaylist_byid($id)
{
    $url = "http://api.tudou.com/v6/playlist/video_list?app_key=a3f35cc3746929ab&format=json&pageSize=100&playlistCode=" . $id;
    $s = file_get_contents($url);
    $result = json_decode($s, true);
    $video = $result['results'];
    if (empty($result)) {
        return false;
    }
    $result['videoname'] = array();
    $result['videolink'] = array();
    $result['videoimg'] = array();
    $result['videotime'] = array();
    foreach ($video as $vk => $vv) {
        //http://player.56.com/cpm_MTA4NzEzNDUz.swf
        $result['videoname'][$vk] = diconv($vv['title'], "utf-8");
        $result['videolink'][$vk] = $vv['outerPlayerUrl'];
        $result['videoimg'][$vk] = $vv['picUrl'];
        $result['videotime'][$vk] = strtotime($vv['pubDate']);
    }
    return $result;
}
        C::t('common_setting')->update_batch($settings);
        updatecache('setting');
    }
    $locationUrl = ADMINSCRIPT . '?frames=yes&action=cloud&operation=doctor';
    cpmsg('cloud_idkeysetting_success', '', 'succeed', array(), '<p class="marginbot"><a href="###" onclick="top.location = \'' . $locationUrl . '\'" class="lightlink">' . cplang('message_redirect') . '</a></p><script type="text/JavaScript">setTimeout("top.location = \'' . $locationUrl . '\'", 3000);</script>');
} elseif ($op == 'apitest') {
    $doctorService = Cloud::loadClass('Service_Doctor');
    $APIType = intval($_GET['api_type']);
    $APIIP = trim($_GET['api_ip']);
    $startTime = microtime(true);
    $testStatus = $doctorService->testAPI($APIType, $APIIP, $_G['setting']);
    $endTime = microtime(true);
    $otherTips = '';
    if ($APIIP) {
        if ($_GET['api_description']) {
            $otherTips = diconv(trim($_GET['api_description']), 'UTF-8');
        }
    } else {
        if ($APIType == 1) {
            $otherTips = '<a href="javascript:;" onClick="display(\'cloud_tbody_api_test\')">' . $lang['cloud_doctor_api_test_other'] . '</a>';
        } elseif ($APIType == 2) {
            $otherTips = '<a href="javascript:;" onClick="display(\'cloud_tbody_manyou_test\')">' . $lang['cloud_doctor_manyou_test_other'] . '</a>';
        } elseif ($APIType == 3) {
            $otherTips = '<a href="javascript:;" onClick="display(\'cloud_tbody_qzone_test\')">' . $lang['cloud_doctor_qzone_test_other'] . '</a>';
        }
    }
    ajaxshowheader();
    if ($testStatus) {
        printf($lang['cloud_doctor_api_test_success'], $lang['cloud_doctor_result_success'], $APIIP, $endTime - $startTime, $otherTips);
    } else {
        printf($lang['cloud_doctor_api_test_failure'], $lang['cloud_doctor_result_failure'], $APIIP, $otherTips);
        $outxml .= '<shuffle>' . $musicmsgs['config']['shuffle'] . '</shuffle>' . "\n";
        $outxml .= '<repeat>all</repeat>' . "\n";
        $outxml .= '<volume>100</volume>';
        $outxml .= '<linktarget>_top</linktarget> ' . "\n";
        $outxml .= '<backcolor>0x' . substr($musicmsgs['config']['crontabcolor'], -6) . '</backcolor> ' . "\n";
        $outxml .= '<frontcolor>0x' . substr($musicmsgs['config']['buttoncolor'], -6) . '</frontcolor>' . "\n";
        $outxml .= '<lightcolor>0x' . substr($musicmsgs['config']['fontcolor'], -6) . '</lightcolor>' . "\n";
        $outxml .= '<jpgfile>' . $musicmsgs['config']['crontabbj'] . '</jpgfile>' . "\n";
        $outxml .= '<callback></callback> ' . "\n";
        $outxml .= '</mp3config>' . "\n";
        $outxml .= '<trackList>' . "\n";
        foreach ($musicmsgs['mp3list'] as $value) {
            $outxml .= '<track><annotation>' . $value['mp3name'] . '</annotation><location>' . $value['mp3url'] . '</location><image>' . $value['cdbj'] . '</image></track>' . "\n";
        }
        $outxml .= '</trackList></playlist>';
        $outxml = diconv($outxml, CHARSET, 'UTF-8');
        obclean();
        @header("Expires: -1");
        @header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE);
        @header("Pragma: no-cache");
        @header("Content-type: application/xml; charset=utf-8");
        echo $outxml;
    }
    exit;
} else {
    $viewuids = $_G['cookie']['viewuids'] ? explode('_', $_G['cookie']['viewuids']) : array();
    if (!$_G['setting']['preventrefresh'] || $_G['uid'] && !$space['self'] && !in_array($space['uid'], $viewuids)) {
        member_count_update($space['uid'], array('views' => 1));
        $viewuids[$space['uid']] = $space['uid'];
        dsetcookie('viewuids', implode('_', $viewuids));
    }
Exemple #15
0
 public function setThreadTitle($title)
 {
     $this->_threadTitle = baidu_strip_invalid_xml(diconv(trim($title), CHARSET, 'utf-8'));
 }
 /**
  * 上传相册图片
  * 
  * @param mixed $allowValue 允许上传图片编号(file=name[]).
  * @param int   $albumId 相册ID
  *
  * @return array 
  */
 private function _uploadAlbum($allowValue, $albumId)
 {
     global $_G;
     $_FILES["Filedata"] = array('name' => $_FILES['uploadFile']['name'][$allowValue], 'type' => $_FILES['uploadFile']['type'][$allowValue], 'tmp_name' => $_FILES['uploadFile']['tmp_name'][$allowValue], 'error' => $_FILES['uploadFile']['error'][$allowValue], 'size' => $_FILES['uploadFile']['size'][$allowValue]);
     // /source/module/misc/misc_swfupload.php
     $res = array();
     if (helper_access::check_module('album')) {
         require_once libfile('function/spacecp');
         if ($_FILES["Filedata"]['error']) {
             $file = lang('spacecp', 'file_is_too_big');
         } else {
             require_once libfile('function/home');
             $_FILES["Filedata"]['name'] = addslashes(diconv(urldecode($_FILES["Filedata"]['name']), 'UTF-8'));
             // 为了水印的问题来修改discuz的方法
             Yii::import('application.components.discuz.source.function.function_spacecp', true);
             $file = mobcent_pic_save($_FILES["Filedata"], $albumId, '', true, 0);
             if (!empty($file) && is_array($file)) {
                 $url = pic_get($file['filepath'], 'album', $file['thumb'], $file['remote']);
                 $bigimg = pic_get($file['filepath'], 'album', 0, $file['remote']);
                 // echo "{\"picid\":\"$file[picid]\", \"url\":\"$url\", \"bigimg\":\"$bigimg\"}";
                 // die;
                 $res['id'] = $file['picid'];
                 $res['urlName'] = $_G['setting']['ftp']['on'] == 1 ? $this->_processPath($bigimg) : $this->getController()->dzRootUrl . '/' . $bigimg;
                 // ??图片的描述:暂时albumPicDesc[]的方式传进来
                 // C::t('home_pic')->update_for_uid($_G['uid'], $file['picid'], array('title'=>'123321', 'albumid' => $albumId));
                 // if($albumId) {
                 //     album_update_pic($albumId);
                 // }
             }
             // echo WebUtils::u($file);
         }
     }
     return $res;
 }
Exemple #17
0
function build_cache_setting() {
	global $_G;

	$skipkeys = array('posttableids', 'mastermobile', 'masterqq', 'masteremail', 'closedreason',
		'creditsnotify', 'backupdir', 'custombackup', 'jswizard', 'maxonlines', 'modreasons', 'newsletter',
		'postno', 'postnocustom', 'customauthorinfo', 'domainwhitelist', 'ipregctrl',
		'ipverifywhite', 'fastsmiley', 'defaultdoing', 'antitheftsetting',
		);
	$serialized = array('reginput', 'memory', 'search', 'creditspolicy', 'ftp', 'secqaa', 'ec_credit', 'qihoo', 'spacedata',
		'infosidestatus', 'uc', 'indexhot', 'relatedtag', 'sitemessage', 'uchome', 'heatthread', 'recommendthread',
		'disallowfloat', 'allowviewuserthread', 'advtype', 'click', 'card', 'rewritestatus', 'rewriterule', 'privacy', 'focus',
		'forumkeys', 'article_tags', 'verify', 'seotitle', 'seodescription', 'seokeywords', 'domain', 'ranklist', 'my_search_data',
		'seccodedata', 'inviteconfig', 'advexpiration', 'allowpostcomment', /*(IN_MOBILE)*/ 'mobile', 'connect', 'upgrade', 'patch', 'strongpw',
		'posttable_info', 'threadtable_info', 'profilegroup', 'antitheft', 'makehtml', 'guestviewthumb', 'grid', 'guesttipsinthread'
		);

	$data = array();

	foreach(C::t('common_setting')->fetch_all_not_key($skipkeys) as $setting) {
		if($setting['skey'] == 'extcredits') {
			if(is_array($setting['svalue'] = dunserialize($setting['svalue']))) {
				foreach($setting['svalue'] as $key => $value) {
					if($value['available']) {
						unset($setting['svalue'][$key]['available']);
					} else {
						unset($setting['svalue'][$key]);
					}
				}
			}
		} elseif($setting['skey'] == 'creditsformula') {
			if(!checkformulacredits($setting['svalue'])) {
				$setting['svalue'] = '$member[\'extcredits1\']';
			} else {
				$setting['svalue'] = preg_replace("/(friends|doings|blogs|albums|polls|sharings|digestposts|posts|threads|oltime|extcredits[1-8])/", "\$member['\\1']", $setting['svalue']);
			}
		} elseif($setting['skey'] == 'maxsmilies') {
			$setting['svalue'] = $setting['svalue'] <= 0 ? -1 : $setting['svalue'];
		} elseif($setting['skey'] == 'threadsticky') {
			$setting['svalue'] = explode(',', $setting['svalue']);
		} elseif($setting['skey'] == 'attachdir') {
			$setting['svalue'] = preg_replace("/\.asp|\\0/i", '0', $setting['svalue']);
			$setting['svalue'] = str_replace('\\', '/', substr($setting['svalue'], 0, 2) == './' ? DISCUZ_ROOT.$setting['svalue'] : $setting['svalue']);
			$setting['svalue'] .= substr($setting['svalue'], -1, 1) != '/' ? '/' : '';
		} elseif($setting['skey'] == 'attachurl') {
			$setting['svalue'] .= substr($setting['svalue'], -1, 1) != '/' ? '/' : '';
		} elseif($setting['skey'] == 'onlinehold') {
			$setting['svalue'] = $setting['svalue'] * 60;
		} elseif(in_array($setting['skey'], $serialized)) {
			$setting['svalue'] = @dunserialize($setting['svalue'], $setting['skey']);
			if($setting['skey'] == 'search') {
				foreach($setting['svalue'] as $key => $val) {
					foreach($val as $k => $v) {
						$setting['svalue'][$key][$k] = max(0, intval($v));
					}
				}
			} elseif($setting['skey'] == 'ftp') {
				$setting['svalue']['attachurl'] .= substr($setting['svalue']['attachurl'], -1, 1) != '/' ? '/' : '';
			} elseif($setting['skey'] == 'inviteconfig') {
				$setting['svalue']['invitecodeprompt'] = stripslashes($setting['svalue']['invitecodeprompt']);
			} elseif($setting['skey'] == 'profilegroup') {
				$profile_settings = C::t('common_member_profile_setting')->fetch_all_by_available(1);
				foreach($setting['svalue'] as $key => $val) {
					$temp = array();
					foreach($profile_settings as $pval) {
						if(in_array($pval['fieldid'], $val['field'])) {
							$temp[$pval['fieldid']] = $pval['fieldid'];
						}
					}
					foreach($val['field'] as $fieldid) {
						if(!in_array($fieldid, $temp)) {
							$temp[$fieldid] = $fieldid;
						}
					}
					$setting['svalue'][$key]['field'] = $temp;
				}
				C::t('common_setting')->update('profilegroup', $setting['svalue']);
			}
		}
		$_G['setting'][$setting['skey']] = $data[$setting['skey']] = $setting['svalue'];
	}

	$usergroup = C::t('common_usergroup')->fetch_by_credits($data['initcredits'], '');
	$data['newusergroupid'] = $usergroup['groupid'];
	$data['buyusergroupexists'] = C::t('common_usergroup')->buyusergroup_exists();

	if($data['srchhotkeywords']) {
		$data['srchhotkeywords'] = explode("\n", $data['srchhotkeywords']);
	}

	if($data['search']) {
		$searchstatus = 0;
		foreach($data['search'] as $item) {
			if($item['status']) {
				$searchstatus = 1;
				break;
			}
		}
		if(!$searchstatus) {
			$data['search'] = array();
		}
	}

	$data['creditspolicy'] = array_merge($data['creditspolicy'], get_cachedata_setting_creditspolicy());

	if($data['heatthread']['iconlevels']) {
		$data['heatthread']['iconlevels'] = explode(',', $data['heatthread']['iconlevels']);
		arsort($data['heatthread']['iconlevels']);
	} else {
		$data['heatthread']['iconlevels'] = array();
	}
	if($data['verify']) {
		foreach($data['verify'] as $key => $value) {
			if($value['available']) {
				if(!empty($value['unverifyicon'])) {
					$icourl = parse_url($value['unverifyicon']);
					if(!$icourl['host'] && !file_exists($value['unverifyicon'])) {
						$data['verify'][$key]['unverifyicon'] = $data['attachurl'].'common/'.$value['unverifyicon'];
					}
				}
				if(!empty($value['icon'])) {
					$icourl = parse_url($value['icon']);
					if(!$icourl['host'] && !file_exists($value['icon'])) {
						$data['verify'][$key]['icon'] = $data['attachurl'].'common/'.$value['icon'];
					}
				}
			}
		}
	}

	if($data['recommendthread']['status']) {
		if($data['recommendthread']['iconlevels']) {
			$data['recommendthread']['iconlevels'] = explode(',', $data['recommendthread']['iconlevels']);
			arsort($data['recommendthread']['iconlevels']);
		} else {
			$data['recommendthread']['iconlevels'] = array();
		}
	} else {
		$data['recommendthread'] = array('allow' => 0);
	}

	if($data['commentnumber'] && !$data['allowpostcomment']) {
		$data['commentnumber'] = 0;
	}

	if(!empty($data['ftp'])) {
		if(!empty($data['ftp']['allowedexts'])) {
			$data['ftp']['allowedexts'] = str_replace(array("\r\n", "\r"), array("\n", "\n"), $data['ftp']['allowedexts']);
			$data['ftp']['allowedexts'] = explode("\n", strtolower($data['ftp']['allowedexts']));
			array_walk($data['ftp']['allowedexts'], 'trim');
		}
		if(!empty($data['ftp']['disallowedexts'])) {
			$data['ftp']['disallowedexts'] = str_replace(array("\r\n", "\r"), array("\n", "\n"), $data['ftp']['disallowedexts']);
			$data['ftp']['disallowedexts'] = explode("\n", strtolower($data['ftp']['disallowedexts']));
			array_walk($data['ftp']['disallowedexts'], 'trim');
		}
		$data['ftp']['connid'] = 0;
	}

	if(!empty($data['forumkeys'])) {
		$data['forumfids'] = array_flip($data['forumkeys']);
	} else {
		$data['forumfids'] = array();
	}

	$data['commentitem'] = explode("\t", $data['commentitem']);
	$commentitem = array();
	foreach($data['commentitem'] as $k => $v) {
		$tmp = explode(chr(0).chr(0).chr(0), $v);
		if(count($tmp) > 1) {
			$commentitem[$tmp[0]] = $tmp[1];
		} else {
			$commentitem[$k] = $v;
		}
	}
	$data['commentitem'] = $commentitem;

	if($data['allowviewuserthread']['allow']) {
		$data['allowviewuserthread'] = is_array($data['allowviewuserthread']['fids']) && $data['allowviewuserthread']['fids'] && !in_array('', $data['allowviewuserthread']['fids']) ? dimplode($data['allowviewuserthread']['fids']) : '';
	} else {
		$data['allowviewuserthread'] = -1;
	}

	include_once DISCUZ_ROOT.'./source/discuz_version.php';
	$_G['setting']['version'] = $data['version'] = DISCUZ_VERSION;
/*vot*/	$_G['setting']['release'] = $data['release'] = DISCUZ_RELEASE;
/*vot*/	$_G['setting']['ml_revision'] = $data['ml_revision'] = DISCUZ_ML_REVISION;

	$data['sitemessage']['time'] = !empty($data['sitemessage']['time']) ? $data['sitemessage']['time'] * 1000 : 0;
	foreach (array('register', 'login', 'newthread', 'reply') as $type) {
		$data['sitemessage'][$type] = !empty($data['sitemessage'][$type]) ? explode("\n", $data['sitemessage'][$type]) : array();
	}

	$data['cachethreadon'] = C::t('forum_forum')->fetch_threadcacheon_num() ? 1 : 0;
	$data['disallowfloat'] = is_array($data['disallowfloat']) ? implode('|', $data['disallowfloat']) : '';

	if(!$data['imagelib']) unset($data['imageimpath']);

	if(is_array($data['relatedtag']['order'])) {
		asort($data['relatedtag']['order']);
		$relatedtag = array();
		foreach($data['relatedtag']['order'] AS $k => $v) {
			$relatedtag['status'][$k] = $data['relatedtag']['status'][$k];
			$relatedtag['name'][$k] = $data['relatedtag']['name'][$k];
			$relatedtag['limit'][$k] = $data['relatedtag']['limit'][$k];
			$relatedtag['template'][$k] = $data['relatedtag']['template'][$k];
		}
		$data['relatedtag'] = $relatedtag;

		foreach((array)$data['relatedtag']['status'] AS $appid => $status) {
			if(!$status) {
				unset($data['relatedtag']['limit'][$appid]);
			}
		}
		unset($data['relatedtag']['status'], $data['relatedtag']['order'], $relatedtag);
	}

	$data['domain']['defaultindex'] = isset($data['defaultindex']) && $data['defaultindex'] != '#' ? $data['defaultindex'] : '';
	$data['domain']['holddomain'] = isset($data['holddomain']) ? $data['holddomain'] : '';
	$data['domain']['list'] = array();
	foreach(C::t('common_domain')->fetch_all_by_idtype(array('subarea', 'forum', 'topic', 'channel')) as $value) {
		$data['domain']['list'][$value['domain'].'.'.$value['domainroot']] = array('id' => $value['id'], 'idtype' => $value['idtype']);
	}
	writetocache('domain', getcachevars(array('domain' => $data['domain'])));

	$data['seccodedata'] = is_array($data['seccodedata']) ? $data['seccodedata'] : array();
	if($data['seccodedata']['type'] == 2) {
		if(extension_loaded('ming')) {
			unset($data['seccodedata']['background'], $data['seccodedata']['adulterate'],
			$data['seccodedata']['ttf'], $data['seccodedata']['angle'],
			$data['seccodedata']['color'], $data['seccodedata']['size'],
			$data['seccodedata']['animator']);
		} else {
			$data['seccodedata']['animator'] = 0;
		}
	} elseif($data['seccodedata']['type'] == 99) {
		$data['seccodedata']['width'] = 32;
		$data['seccodedata']['height'] = 24;
	}

	$data['watermarktype'] = !empty($data['watermarktype']) ? dunserialize($data['watermarktype']) : array();
	$data['watermarktext'] = !empty($data['watermarktext']) ? dunserialize($data['watermarktext']) : array();
	foreach($data['watermarktype'] as $k => $v) {
		if($data['watermarktype'][$k] == 'text' && $data['watermarktext']['text'][$k]) {
			if($data['watermarktext']['text'][$k] && strtoupper(CHARSET) != 'UTF-8') {
				$data['watermarktext']['text'][$k] = diconv($data['watermarktext']['text'][$k], CHARSET, 'UTF-8', true);
			}
			$data['watermarktext']['text'][$k] = bin2hex($data['watermarktext']['text'][$k]);
			if(file_exists('static/image/seccode/font/en/'.$data['watermarktext']['fontpath'][$k])) {
				$data['watermarktext']['fontpath'][$k] = 'static/image/seccode/font/en/'.$data['watermarktext']['fontpath'][$k];
			} elseif(file_exists('static/image/seccode/font/ch/'.$data['watermarktext']['fontpath'][$k])) {
				$data['watermarktext']['fontpath'][$k] = 'static/image/seccode/font/ch/'.$data['watermarktext']['fontpath'][$k];
			} else {
				$data['watermarktext']['fontpath'][$k] = 'static/image/seccode/font/'.$data['watermarktext']['fontpath'][$k];
			}
			$data['watermarktext']['color'][$k] = preg_replace('/#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/e', "hexdec('\\1').','.hexdec('\\2').','.hexdec('\\3')", $data['watermarktext']['color'][$k]);
			$data['watermarktext']['shadowcolor'][$k] = preg_replace('/#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/e', "hexdec('\\1').','.hexdec('\\2').','.hexdec('\\3')", $data['watermarktext']['shadowcolor'][$k]);
		} else {
			$data['watermarktext']['text'][$k] = '';
			$data['watermarktext']['fontpath'][$k] = '';
			$data['watermarktext']['color'][$k] = '';
			$data['watermarktext']['shadowcolor'][$k] = '';
		}
	}

	$data['styles'] = array();
	foreach(C::t('common_style')->fetch_all_data(false, 1) as $style) {
		$data['styles'][$style['styleid']] = dhtmlspecialchars($style['name']);
	}

	$exchcredits = array();
	$allowexchangein = $allowexchangeout = FALSE;
	foreach((array)$data['extcredits'] as $id => $credit) {
		$data['extcredits'][$id]['img'] = $credit['img'] ? '<img style="vertical-align:middle" src="'.$credit['img'].'" />' : '';
		if(!empty($credit['ratio'])) {
			$exchcredits[$id] = $credit;
			$credit['allowexchangein'] && $allowexchangein = TRUE;
			$credit['allowexchangeout'] && $allowexchangeout = TRUE;
		}
		$data['creditnotice'] && $data['creditnames'][] = str_replace("'", "\'", dhtmlspecialchars($id.'|'.$credit['title'].'|'.$credit['unit']));
	}
	$data['creditnames'] = $data['creditnotice'] ? @implode(',', $data['creditnames']) : '';

	$creditstranssi = explode(',', $data['creditstrans']);
	$data['creditstrans'] = $creditstranssi[0];
	unset($creditstranssi[0]);
	$data['creditstransextra'] = $creditstranssi;
	for($i = 1;$i < 11;$i++) {
		$data['creditstransextra'][$i] = $data['creditstrans'] ? (!$data['creditstransextra'][$i] ? $data['creditstrans'] : $data['creditstransextra'][$i]) : 0;
	}
	$data['exchangestatus'] = $allowexchangein && $allowexchangeout;
	$data['transferstatus'] = isset($data['extcredits'][$data['creditstrans']]);

	list($data['zoomstatus'], $data['imagemaxwidth']) = explode("\t", $data['zoomstatus']);
	$data['imagemaxwidth'] = intval($data['imagemaxwidth']);

	require_once DISCUZ_ROOT.'./config/config_ucenter.php';
	$data['ucenterurl'] = UC_API;

	foreach(C::t('common_magic')->fetch_all_data(1) as $magic) {
		$magic['identifier'] = str_replace(':', '_', $magic['identifier']);
		$data['magics'][$magic['identifier']] = $magic['name'];
	}

	$data['tradeopen'] = C::t('common_usergroup_field')->count_by_field('allowposttrade', 1) ? 1 : 0;
	$data['medalstatus'] = intval(C::t('forum_medal')->count_by_available());

	$focus = array();
	if($data['focus']['data']) {
		foreach($data['focus']['data'] as $k => $v) {
			if($v['available'] && $v['position']) {
				foreach($v['position'] as $position) {
					$focus[$position][$k] = $k;
				}
			}
		}
	}
	$data['focus'] = $focus;

	list($data['plugins'], $data['pluginlinks'], $data['hookscript'], $data['hookscriptmobile'], $data['threadplugins'], $data['specialicon']) = get_cachedata_setting_plugin();

	if(empty($data['defaultindex'])) $data['defaultindex'] = array();
	list($data['navs'], $data['subnavs'], $data['menunavs'], $data['navmns'], $data['navmn'], $data['navdms'], $data['navlogos']) = get_cachedata_mainnav();

	$data['footernavs'] = get_cachedata_footernav();
	$data['spacenavs'] = get_cachedata_spacenavs();
	$data['mynavs'] = get_cachedata_mynavs();
	$data['topnavs'] = get_cachedata_topnav();
	$data['profilenode'] = get_cachedata_threadprofile();

	require_once DISCUZ_ROOT.'./uc_client/client.php';
	$ucapparray = uc_app_ls();
	$data['allowsynlogin'] = isset($ucapparray[UC_APPID]['synlogin']) ? $ucapparray[UC_APPID]['synlogin'] : 1;
	$appnamearray = array('UCHOME','XSPACE','DISCUZ','SUPESITE','SUPEV','ECSHOP','ECMALL','OTHER');
	$data['ucapp'] = $data['ucappopen'] = array();
	$data['uchomeurl'] = '';
	$data['discuzurl'] = $_G['siteurl'];
	$appsynlogins = 0;
	foreach($ucapparray as $apparray) {
		if($apparray['appid'] != UC_APPID) {
			if(!empty($apparray['synlogin'])) {
				$appsynlogins = 1;
			}
			if($data['uc']['navlist'][$apparray['appid']] && $data['uc']['navopen']) {
				$data['ucapp'][$apparray['appid']]['name'] = $apparray['name'];
				$data['ucapp'][$apparray['appid']]['url'] = $apparray['url'];
			}
		} else {
			$data['discuzurl'] = $apparray['url'];
		}
		if(!empty($apparray['viewprourl'])) {
			$data['ucapp'][$apparray['appid']]['viewprourl'] = $apparray['url'].$apparray['viewprourl'];
		}
		foreach($appnamearray as $name) {
			if($apparray['type'] == $name && $apparray['appid'] != UC_APPID) {
				$data['ucappopen'][$name] = 1;
				if($name == 'UCHOME') {
					$data['uchomeurl'] = $apparray['url'];
				} elseif($name == 'XSPACE') {
					$data['xspaceurl'] = $apparray['url'];
				}
			}
		}
	}
	$data['allowsynlogin'] = $data['allowsynlogin'] && $appsynlogins ? 1 : 0;
	$data['homeshow'] = $data['uchomeurl'] && $data['uchome']['homeshow'] ? $data['uchome']['homeshow'] : '0';

	unset($data['allowthreadplugin']);
	if($data['jspath'] == 'data/cache/') {
		writetojscache();
	} elseif(!$data['jspath']) {
		$data['jspath'] = 'static/js/';
	}

	if($data['cacheindexlife']) {
		$cachedir = DISCUZ_ROOT.'./'.$data['cachethreaddir'];
		$tidmd5 = substr(md5(0), 3);
		@unlink($cachedir.'/'.$tidmd5[0].'/'.$tidmd5[1].'/'.$tidmd5[2].'/0.htm');
	}

	$reginputbwords = array('username', 'password', 'password2', 'email');
	if(in_array($data['reginput']['username'], $reginputbwords) || !preg_match('/^[A-z]\w+?$/', $data['reginput']['username'])) {
		$data['reginput']['username'] = random(6);
	}
	if(in_array($data['reginput']['password'], $reginputbwords) || !preg_match('/^[A-z]\w+?$/', $data['reginput']['password'])) {
		$data['reginput']['password'] = random(6);
	}
	if(in_array($data['reginput']['password2'], $reginputbwords) || !preg_match('/^[A-z]\w+?$/', $data['reginput']['password2'])) {
		$data['reginput']['password2'] = random(6);
	}
	if(in_array($data['reginput']['email'], $reginputbwords) || !preg_match('/^[A-z]\w+?$/', $data['reginput']['email'])) {
		$data['reginput']['email'] = random(6);
	}

	$defaultcurhost = empty($_G['setting']['domain']['app']['default']) ? '{CURHOST}' : $_G['setting']['domain']['app']['default'];
	$output = array('str'=>array(), 'preg' => array()); //str为二级域名的查找和替换,preg为rewrite和默认域名的查找和替换
	$_G['domain'] = array();
	if(is_array($_G['setting']['domain']['app'])) {
		$apps = $_G['setting']['domain']['app'];
		$repflag = $apps['portal'] || $apps['forum'] || $apps['group'] || $apps['home'] || $apps['default'];
		foreach($apps as $app => $domain) {
			if(in_array($app, array('default', 'mobile'))) {
				continue;
			}
			$appphp = "{$app}.php";
			if(!$domain) {
				$domain = $defaultcurhost;
			}
			if($domain != '{CURHOST}') {
				$domain = 'http://'.$domain.$_G['siteport'].'/';
			}
			if($repflag) {
				$output['str']['search'][$app] = "<a href=\"{$app}.php";
				$output['str']['replace'][$app] = '<a href="'.$domain.$appphp;
				$_G['domain']['pregxprw'][$app] = '<a href\="('.preg_quote($domain, '/').')'.$appphp;
			} else {
				$_G['domain']['pregxprw'][$app] = '<a href\="()'.$appphp;
			}
		}
	}
	if($_G['setting']['rewritestatus'] || $output['str']['search']) {
		if($_G['setting']['rewritestatus']) {
			require_once libfile('function/admincp');
			$output['preg'] = rewritedata(0);
		}
		if($output['preg']) {
			foreach($data['footernavs'] as $id => $nav) {
				$data['footernavs'][$id]['code'] = preg_replace($output['preg']['search'], $output['preg']['replace'], $nav['code']);
			}
			foreach($data['spacenavs'] as $id => $nav) {
				$data['spacenavs'][$id]['code'] = preg_replace($output['preg']['search'], $output['preg']['replace'], $nav['code']);
			}
			foreach($data['mynavs'] as $id => $nav) {
				$data['mynavs'][$id]['code'] = preg_replace($output['preg']['search'], $output['preg']['replace'], $nav['code']);
			}
			foreach($data['topnavs'] as $id => $nav) {
				$data['topnavs'][$id]['code'] = preg_replace($output['preg']['search'], $output['preg']['replace'], $nav['code']);
			}
			foreach($data['plugins']['jsmenu'] as $key => $nav) {
				$data['plugins']['jsmenu'][$key]['url'] = preg_replace($output['preg']['search'], $output['preg']['replace'], $nav['url']);
			}
		}
	}
	$data['output'] = $output;
	$data['connect'] = in_array('qqconnect', $data['plugins']['available']) ? $data['connect'] : array();

	savecache('setting', $data);
	$_G['setting'] = $data;
}
Exemple #18
0
function cnsubstr($str, $strlen = 20)
{
    if (empty($str) || !is_numeric($strlen)) {
        return false;
    }
    if (strlen($str) <= $strlen) {
        return $str;
    }
    //得到第$length个字符 并判断是否为非中文 若为非中文
    //直接返回$length长的字符串
    $str = diconv($str, CHARSET, "GBK");
    $last_word_needed = substr($str, $strlen - 1, 1);
    if (!ord($last_word_needed) > 128) {
        $needed_sub_sentence = substr($str, 0, $strlen) . '...';
        $needed_sub_sentence = diconv($needed_sub_sentence, "GBK", CHARSET);
        return $needed_sub_sentence;
    } else {
        for ($i = 0; $i < $strlen; $i++) {
            if (ord($str[$i]) > 128) {
                $i++;
            }
        }
        //end of for
        $needed_sub_sentence = substr($str, 0, $i) . '...';
        $needed_sub_sentence = diconv($needed_sub_sentence, "GBK", CHARSET);
        return $needed_sub_sentence;
    }
}
 public static function clear($str)
 {
     $config = self::getList();
     $str = str_replace($config, '', $str);
     return diconv($str, 'UTF-8', CHARSET);
 }
Exemple #20
0
function build_cache_setting()
{
    global $_G;
    $table = 'common_setting';
    $skipkeys = array('posttableids', 'siteuniqueid', 'mastermobile', 'closedreason', 'creditsnotify', 'backupdir', 'custombackup', 'jswizard', 'maxonlines', 'modreasons', 'newsletter', 'postno', 'postnocustom', 'customauthorinfo', 'domainwhitelist', 'ipregctrl', 'ipverifywhite', 'fastsmiley', 'defaultdoing', 'profilegroup');
    $serialized = array('reginput', 'memory', 'search', 'creditspolicy', 'ftp', 'secqaa', 'ec_credit', 'qihoo', 'spacedata', 'infosidestatus', 'uc', 'indexhot', 'relatedtag', 'sitemessage', 'uchome', 'heatthread', 'recommendthread', 'disallowfloat', 'allowviewuserthread', 'advtype', 'click', 'card', 'rewritestatus', 'rewriterule', 'privacy', 'focus', 'forumkeys', 'article_tags', 'verify', 'seotitle', 'seodescription', 'seokeywords', 'domain', 'ranklist', 'seccodedata', 'inviteconfig', 'advexpiration', 'allowpostcomment', 'mobile', 'connect');
    $data = array();
    $query = DB::query("SELECT * FROM " . DB::table($table) . " WHERE skey NOT IN(" . dimplode($skipkeys) . ')');
    while ($setting = DB::fetch($query)) {
        if ($setting['skey'] == 'extcredits') {
            if (is_array($setting['svalue'] = unserialize($setting['svalue']))) {
                foreach ($setting['svalue'] as $key => $value) {
                    if ($value['available']) {
                        unset($setting['svalue'][$key]['available']);
                    } else {
                        unset($setting['svalue'][$key]);
                    }
                }
            }
        } elseif ($setting['skey'] == 'creditsformula') {
            if (!checkformulacredits($setting['svalue'])) {
                $setting['svalue'] = '$member[\'extcredits1\']';
            } else {
                $setting['svalue'] = preg_replace("/(friends|doings|blogs|albums|polls|sharings|digestposts|posts|threads|oltime|extcredits[1-8])/", "\$member['\\1']", $setting['svalue']);
            }
        } elseif ($setting['skey'] == 'maxsmilies') {
            $setting['svalue'] = $setting['svalue'] <= 0 ? -1 : $setting['svalue'];
        } elseif ($setting['skey'] == 'threadsticky') {
            $setting['svalue'] = explode(',', $setting['svalue']);
        } elseif ($setting['skey'] == 'attachdir') {
            $setting['svalue'] = preg_replace("/\\.asp|\\0/i", '0', $setting['svalue']);
            $setting['svalue'] = str_replace('\\', '/', substr($setting['svalue'], 0, 2) == './' ? DISCUZ_ROOT . $setting['svalue'] : $setting['svalue']);
            $setting['svalue'] .= substr($setting['svalue'], -1, 1) != '/' ? '/' : '';
        } elseif ($setting['skey'] == 'attachurl') {
            $setting['svalue'] .= substr($setting['svalue'], -1, 1) != '/' ? '/' : '';
        } elseif ($setting['skey'] == 'onlinehold') {
            $setting['svalue'] = $setting['svalue'] * 60;
        } elseif (in_array($setting['skey'], $serialized)) {
            $setting['svalue'] = @unserialize($setting['svalue']);
            if ($setting['skey'] == 'search') {
                foreach ($setting['svalue'] as $key => $val) {
                    foreach ($val as $k => $v) {
                        $setting['svalue'][$key][$k] = max(0, intval($v));
                    }
                }
            }
            if ($setting['skey'] == 'ftp') {
                $setting['svalue']['attachurl'] .= substr($setting['svalue']['attachurl'], -1, 1) != '/' ? '/' : '';
            }
        }
        $_G['setting'][$setting['skey']] = $data[$setting['skey']] = $setting['svalue'];
    }
    DB::free_result($query);
    $data['newusergroupid'] = DB::result_first("SELECT groupid FROM " . DB::table('common_usergroup') . " WHERE creditshigher<=" . intval($data['initcredits']) . " AND " . intval($data['initcredits']) . "<creditslower LIMIT 1");
    if ($data['srchhotkeywords']) {
        $data['srchhotkeywords'] = explode("\n", $data['srchhotkeywords']);
    }
    if ($data['search']) {
        $searchstatus = 0;
        foreach ($data['search'] as $item) {
            if ($item['status']) {
                $searchstatus = 1;
                break;
            }
        }
        if (!$searchstatus) {
            $data['search'] = array();
        }
    }
    $data['creditspolicy'] = array_merge($data['creditspolicy'], get_cachedata_setting_creditspolicy());
    if ($data['heatthread']['iconlevels']) {
        $data['heatthread']['iconlevels'] = explode(',', $data['heatthread']['iconlevels']);
        arsort($data['heatthread']['iconlevels']);
    } else {
        $data['heatthread']['iconlevels'] = array();
    }
    if ($data['verify']) {
        foreach ($data['verify'] as $key => $value) {
            if ($value['available'] && !empty($value['icon'])) {
                $icourl = parse_url($value['icon']);
                if (!$icourl['host'] && !file_exists($value['icon'])) {
                    $data['verify'][$key]['icon'] = $data['attachurl'] . 'common/' . $value['icon'];
                }
            }
        }
    }
    if ($data['recommendthread']['status']) {
        if ($data['recommendthread']['iconlevels']) {
            $data['recommendthread']['iconlevels'] = explode(',', $data['recommendthread']['iconlevels']);
            arsort($data['recommendthread']['iconlevels']);
        } else {
            $data['recommendthread']['iconlevels'] = array();
        }
    } else {
        $data['recommendthread'] = array('allow' => 0);
    }
    if ($data['commentnumber'] && !$data['allowpostcomment']) {
        $data['commentnumber'] = 0;
    }
    if (!empty($data['ftp'])) {
        if (!empty($data['ftp']['allowedexts'])) {
            $data['ftp']['allowedexts'] = str_replace(array("\r\n", "\r"), array("\n", "\n"), $data['ftp']['allowedexts']);
            $data['ftp']['allowedexts'] = explode("\n", strtolower($data['ftp']['allowedexts']));
            array_walk($data['ftp']['allowedexts'], 'trim');
        }
        if (!empty($data['ftp']['disallowedexts'])) {
            $data['ftp']['disallowedexts'] = str_replace(array("\r\n", "\r"), array("\n", "\n"), $data['ftp']['disallowedexts']);
            $data['ftp']['disallowedexts'] = explode("\n", strtolower($data['ftp']['disallowedexts']));
            array_walk($data['ftp']['disallowedexts'], 'trim');
        }
        $data['ftp']['connid'] = 0;
    }
    if (!empty($data['forumkeys'])) {
        $data['forumfids'] = array_flip($data['forumkeys']);
    } else {
        $data['forumfids'] = array();
    }
    $data['commentitem'] = explode("\t", $data['commentitem']);
    $commentitem = array();
    foreach ($data['commentitem'] as $k => $v) {
        $tmp = explode(chr(0) . chr(0) . chr(0), $v);
        if (count($tmp) > 1) {
            $commentitem[$tmp[0]] = $tmp[1];
        } else {
            $commentitem[$k] = $v;
        }
    }
    $data['commentitem'] = $commentitem;
    if ($data['allowviewuserthread']['allow']) {
        $data['allowviewuserthread'] = is_array($data['allowviewuserthread']['fids']) && $data['allowviewuserthread']['fids'] && !in_array('', $data['allowviewuserthread']['fids']) ? dimplode($data['allowviewuserthread']['fids']) : '';
    } else {
        $data['allowviewuserthread'] = false;
    }
    include_once DISCUZ_ROOT . './source/discuz_version.php';
    $_G['setting']['version'] = $data['version'] = DISCUZ_VERSION;
    $data['sitemessage']['time'] = !empty($data['sitemessage']['time']) ? $data['sitemessage']['time'] * 1000 : 0;
    foreach (array('register', 'login', 'newthread', 'reply') as $type) {
        $data['sitemessage'][$type] = !empty($data['sitemessage'][$type]) ? explode("\n", $data['sitemessage'][$type]) : array();
    }
    $data['cachethreadon'] = DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_forum') . " WHERE status='1' AND threadcaches>0") ? 1 : 0;
    $data['disallowfloat'] = is_array($data['disallowfloat']) ? implode('|', $data['disallowfloat']) : '';
    if (!$data['imagelib']) {
        unset($data['imageimpath']);
    }
    if (is_array($data['relatedtag']['order'])) {
        asort($data['relatedtag']['order']);
        $relatedtag = array();
        foreach ($data['relatedtag']['order'] as $k => $v) {
            $relatedtag['status'][$k] = $data['relatedtag']['status'][$k];
            $relatedtag['name'][$k] = $data['relatedtag']['name'][$k];
            $relatedtag['limit'][$k] = $data['relatedtag']['limit'][$k];
            $relatedtag['template'][$k] = $data['relatedtag']['template'][$k];
        }
        $data['relatedtag'] = $relatedtag;
        foreach ((array) $data['relatedtag']['status'] as $appid => $status) {
            if (!$status) {
                unset($data['relatedtag']['limit'][$appid]);
            }
        }
        unset($data['relatedtag']['status'], $data['relatedtag']['order'], $relatedtag);
    }
    $data['domain']['defaultindex'] = isset($data['defaultindex']) && $data['defaultindex'] != '#' ? $data['defaultindex'] : '';
    $data['domain']['holddomain'] = isset($data['holddomain']) ? $data['holddomain'] : '';
    $data['domain']['list'] = array();
    $query = DB::query("SELECT * FROM " . DB::table('common_domain') . " WHERE idtype IN('subarea', 'forum', 'topic', 'channel')");
    while ($value = DB::fetch($query)) {
        $data['domain']['list'][$value['domain'] . '.' . $value['domainroot']] = array('id' => $value['id'], 'idtype' => $value['idtype']);
    }
    writetocache('domain', getcachevars(array('domain' => $data['domain'])));
    $data['seccodedata'] = is_array($data['seccodedata']) ? $data['seccodedata'] : array();
    if ($data['seccodedata']['type'] == 2) {
        if (extension_loaded('ming')) {
            unset($data['seccodedata']['background'], $data['seccodedata']['adulterate'], $data['seccodedata']['ttf'], $data['seccodedata']['angle'], $data['seccodedata']['color'], $data['seccodedata']['size'], $data['seccodedata']['animator']);
        } else {
            $data['seccodedata']['animator'] = 0;
        }
    } elseif ($data['seccodedata']['type'] == 99) {
        $data['seccodedata']['width'] = 32;
        $data['seccodedata']['height'] = 24;
    }
    $data['watermarktype'] = !empty($data['watermarktype']) ? unserialize($data['watermarktype']) : array();
    $data['watermarktext'] = !empty($data['watermarktext']) ? unserialize($data['watermarktext']) : array();
    foreach ($data['watermarktype'] as $k => $v) {
        if ($data['watermarktype'][$k] == 'text' && $data['watermarktext']['text'][$k]) {
            if ($data['watermarktext']['text'][$k] && strtoupper(CHARSET) != 'UTF-8') {
                $data['watermarktext']['text'][$k] = diconv($data['watermarktext']['text'][$k], CHARSET, 'UTF-8', true);
            }
            $data['watermarktext']['text'][$k] = bin2hex($data['watermarktext']['text'][$k]);
            if (file_exists('static/image/seccode/font/en/' . $data['watermarktext']['fontpath'][$k])) {
                $data['watermarktext']['fontpath'][$k] = 'static/image/seccode/font/en/' . $data['watermarktext']['fontpath'][$k];
            } elseif (file_exists('static/image/seccode/font/ch/' . $data['watermarktext']['fontpath'][$k])) {
                $data['watermarktext']['fontpath'][$k] = 'static/image/seccode/font/ch/' . $data['watermarktext']['fontpath'][$k];
            } else {
                $data['watermarktext']['fontpath'][$k] = 'static/image/seccode/font/' . $data['watermarktext']['fontpath'][$k];
            }
            $data['watermarktext']['color'][$k] = preg_replace('/#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/e', "hexdec('\\1').','.hexdec('\\2').','.hexdec('\\3')", $data['watermarktext']['color'][$k]);
            $data['watermarktext']['shadowcolor'][$k] = preg_replace('/#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/e', "hexdec('\\1').','.hexdec('\\2').','.hexdec('\\3')", $data['watermarktext']['shadowcolor'][$k]);
        } else {
            $data['watermarktext']['text'][$k] = '';
            $data['watermarktext']['fontpath'][$k] = '';
            $data['watermarktext']['color'][$k] = '';
            $data['watermarktext']['shadowcolor'][$k] = '';
        }
    }
    $data['styles'] = array();
    $query = DB::query("SELECT s.styleid, s.name, s.extstyle, t.directory FROM " . DB::table('common_style') . " s\n\t\t\t\tLEFT JOIN " . DB::table('common_template') . " t ON s.templateid=t.templateid\n\t\t\t\tWHERE s.available='1'");
    while ($style = DB::fetch($query)) {
        $data['styles'][$style['styleid']] = dhtmlspecialchars($style['name']);
    }
    $exchcredits = array();
    $allowexchangein = $allowexchangeout = FALSE;
    foreach ((array) $data['extcredits'] as $id => $credit) {
        $data['extcredits'][$id]['img'] = $credit['img'] ? '<img style="vertical-align:middle" src="' . $credit['img'] . '" />' : '';
        if (!empty($credit['ratio'])) {
            $exchcredits[$id] = $credit;
            $credit['allowexchangein'] && ($allowexchangein = TRUE);
            $credit['allowexchangeout'] && ($allowexchangeout = TRUE);
        }
        $data['creditnotice'] && ($data['creditnames'][] = str_replace("'", "\\'", htmlspecialchars($id . '|' . $credit['title'] . '|' . $credit['unit'])));
    }
    $data['creditnames'] = $data['creditnotice'] ? @implode(',', $data['creditnames']) : '';
    $creditstranssi = explode(',', $data['creditstrans']);
    $data['creditstrans'] = $creditstranssi[0];
    unset($creditstranssi[0]);
    $data['creditstransextra'] = $creditstranssi;
    for ($i = 1; $i < 11; $i++) {
        $data['creditstransextra'][$i] = $data['creditstrans'] ? !$data['creditstransextra'][$i] ? $data['creditstrans'] : $data['creditstransextra'][$i] : 0;
    }
    $data['exchangestatus'] = $allowexchangein && $allowexchangeout;
    $data['transferstatus'] = isset($data['extcredits'][$data['creditstrans']]);
    list($data['zoomstatus'], $data['imagemaxwidth']) = explode("\t", $data['zoomstatus']);
    $data['imagemaxwidth'] = intval($data['imagemaxwidth']);
    require_once DISCUZ_ROOT . './config/config_ucenter.php';
    $data['ucenterurl'] = UC_API;
    $query = DB::query("SELECT identifier, name FROM " . DB::table('common_magic') . " WHERE available='1'");
    while ($magic = DB::fetch($query)) {
        $data['magics'][$magic['identifier']] = $magic['name'];
    }
    $data['tradeopen'] = DB::result_first("SELECT count(*) FROM " . DB::table('common_usergroup_field') . " WHERE allowposttrade='1'") ? 1 : 0;
    $data['medalstatus'] = intval(DB::result_first("SELECT count(*) FROM " . DB::table('forum_medal') . " WHERE available='1'"));
    $focus = array();
    if ($data['focus']['data']) {
        foreach ($data['focus']['data'] as $k => $v) {
            if ($v['available'] && $v['position']) {
                foreach ($v['position'] as $position) {
                    $focus[$position][$k] = $k;
                }
            }
        }
    }
    $data['focus'] = $focus;
    list($data['plugins'], $data['pluginlinks'], $data['hookscript'], $data['hookscriptmobile'], $data['threadplugins'], $data['specialicon']) = get_cachedata_setting_plugin();
    if (empty($data['defaultindex'])) {
        $data['defaultindex'] = array();
    }
    list($data['navs'], $data['subnavs'], $data['menunavs'], $data['navmns'], $data['navmn'], $data['navdms'], $data['navlogos']) = get_cachedata_mainnav();
    $data['footernavs'] = get_cachedata_footernav();
    $data['spacenavs'] = get_cachedata_spacenavs();
    $data['mynavs'] = get_cachedata_mynavs();
    $data['topnavs'] = get_cachedata_topnav();
    require_once DISCUZ_ROOT . './uc_client/client.php';
    $ucapparray = uc_app_ls();
    $data['allowsynlogin'] = isset($ucapparray[UC_APPID]['synlogin']) ? $ucapparray[UC_APPID]['synlogin'] : 1;
    $appnamearray = array('UCHOME', 'XSPACE', 'DISCUZ', 'SUPESITE', 'SUPEV', 'ECSHOP', 'ECMALL', 'OTHER');
    $data['ucapp'] = $data['ucappopen'] = array();
    $data['uchomeurl'] = '';
    $data['discuzurl'] = $_G['siteurl'];
    $appsynlogins = 0;
    foreach ($ucapparray as $apparray) {
        if ($apparray['appid'] != UC_APPID) {
            if (!empty($apparray['synlogin'])) {
                $appsynlogins = 1;
            }
            if ($data['uc']['navlist'][$apparray['appid']] && $data['uc']['navopen']) {
                $data['ucapp'][$apparray['appid']]['name'] = $apparray['name'];
                $data['ucapp'][$apparray['appid']]['url'] = $apparray['url'];
            }
        } else {
            $data['discuzurl'] = $apparray['url'];
        }
        if (!empty($apparray['viewprourl'])) {
            $data['ucapp'][$apparray['appid']]['viewprourl'] = $apparray['url'] . $apparray['viewprourl'];
        }
        foreach ($appnamearray as $name) {
            if ($apparray['type'] == $name && $apparray['appid'] != UC_APPID) {
                $data['ucappopen'][$name] = 1;
                if ($name == 'UCHOME') {
                    $data['uchomeurl'] = $apparray['url'];
                } elseif ($name == 'XSPACE') {
                    $data['xspaceurl'] = $apparray['url'];
                }
            }
        }
    }
    $data['allowsynlogin'] = $data['allowsynlogin'] && $appsynlogins ? 1 : 0;
    $data['homeshow'] = $data['uchomeurl'] && $data['uchome']['homeshow'] ? $data['uchome']['homeshow'] : '0';
    unset($data['allowthreadplugin']);
    if ($data['jspath'] == 'data/cache/') {
        writetojscache();
    } elseif (!$data['jspath']) {
        $data['jspath'] = 'static/js/';
    }
    if ($data['cacheindexlife']) {
        $cachedir = DISCUZ_ROOT . './' . $data['cachethreaddir'];
        $tidmd5 = substr(md5(0), 3);
        @unlink($cachedir . '/' . $tidmd5[0] . '/' . $tidmd5[1] . '/' . $tidmd5[2] . '/0.htm');
    }
    $reginputbwords = array('username', 'password', 'password2', 'email');
    if (in_array($data['reginput']['username'], $reginputbwords) || !preg_match('/^[A-z]\\w+?$/', $data['reginput']['username'])) {
        $data['reginput']['username'] = random(6);
    }
    if (in_array($data['reginput']['password'], $reginputbwords) || !preg_match('/^[A-z]\\w+?$/', $data['reginput']['password'])) {
        $data['reginput']['password'] = random(6);
    }
    if (in_array($data['reginput']['password2'], $reginputbwords) || !preg_match('/^[A-z]\\w+?$/', $data['reginput']['password2'])) {
        $data['reginput']['password2'] = random(6);
    }
    if (in_array($data['reginput']['email'], $reginputbwords) || !preg_match('/^[A-z]\\w+?$/', $data['reginput']['email'])) {
        $data['reginput']['email'] = random(6);
    }
    $defaultcurhost = empty($_G['setting']['domain']['app']['default']) ? '{CURHOST}' : $_G['setting']['domain']['app']['default'];
    $output = array('str' => array(), 'preg' => array());
    //str為二級域名的查找和替換,preg為rewrite和默認域名的查找和替換
    $_G['domain'] = array();
    if (is_array($_G['setting']['domain']['app'])) {
        $apps = $_G['setting']['domain']['app'];
        $repflag = $apps['portal'] || $apps['forum'] || $apps['group'] || $apps['home'] || $apps['default'];
        foreach ($apps as $app => $domain) {
            if (in_array($app, array('default', 'mobile'))) {
                continue;
            }
            $appphp = "{$app}.php";
            if (!$domain) {
                $domain = $defaultcurhost;
            }
            if ($domain != '{CURHOST}') {
                $domain = 'http://' . $domain . $_G['siteport'] . '/';
            }
            if ($repflag) {
                $output['str']['search'][$app] = "<a href=\"{$app}.php";
                $output['str']['replace'][$app] = '<a href="' . $domain . $appphp;
                $_G['domain']['pregxprw'][$app] = '<a href\\="(' . preg_quote($domain, '/') . ')' . $appphp;
            } else {
                $_G['domain']['pregxprw'][$app] = '<a href\\="()' . $appphp;
            }
        }
    }
    if ($_G['setting']['rewritestatus'] || $output['str']['search']) {
        if ($_G['setting']['rewritestatus']) {
            require_once libfile('function/admincp');
            $output['preg'] = rewritedata(0);
        }
        if ($repflag) {
            if ($defaultcurhost != '{CURHOST}') {
                $defaultcurhost = 'http://' . $defaultcurhost . $_G['siteport'] . '/';
            }
            $output['preg']['search'][] = "/<a href=\"(\\w+\\.php)/";
            $output['preg']['replace'][] = '<a href="' . $defaultcurhost . "\$1";
        }
    }
    $data['output'] = $output;
    save_syscache('setting', $data);
    $_G['setting'] = $data;
}
 function mobile_iconv_recurrence($value)
 {
     if (is_array($value)) {
         foreach ($value as $key => $val) {
             $value[$key] = $this->mobile_iconv_recurrence($val);
         }
     } else {
         $value = addslashes(diconv(stripslashes($value), 'utf-8', CHARSET));
     }
     return $value;
 }
Exemple #22
0
$discuz = C::app();
$discuz->init_cron = false;
$discuz->init_session = false;
$discuz->init();
$_G['uid'] = intval($_POST['uid']);
if (empty($_G['uid']) && $_GET['operation'] != 'upload' || $_POST['hash'] != md5(substr(md5($_G['config']['security']['authkey']), 8) . $_G['uid'])) {
    exit;
} else {
    if ($_G['uid']) {
        $_G['member'] = getuserbyuid($_G['uid']);
    }
    $_G['groupid'] = $_G['member']['groupid'];
    loadcache('usergroup_' . $_G['member']['groupid']);
    $_G['group'] = $_G['cache']['usergroup_' . $_G['member']['groupid']];
}
$_FILES['Filedata']['name'] = diconv(urldecode($_FILES['Filedata']['name']), 'UTF-8');
$_FILES['Filedata']['type'] = $_GET['filetype'];
$forumattachextensions = '';
$fid = intval($_GET['fid']);
if ($fid) {
    $forum = $fid != $_G['fid'] ? C::t('forum_forum')->fetch_info_by_fid($fid) : $_G['forum'];
    if ($forum['status'] == 3 && $forum['level']) {
        $levelinfo = C::t('forum_grouplevel')->fetch($forum['level']);
        if ($postpolicy = $levelinfo['postpolicy']) {
            $postpolicy = dunserialize($postpolicy);
            $forumattachextensions = $postpolicy['attachextensions'];
        }
    } else {
        $forumattachextensions = $forum['attachextensions'];
    }
    if ($forumattachextensions) {
Exemple #23
0
            }
            $postlist[$k] = $post;
        }
    }
    unset($uids, $users);
    if ($_G['group']['allowpostattach'] || $_G['group']['allowpostimage']) {
        $attachlist = getattach(0);
        $attachs = $attachlist['attachs'];
        $imgattachs = $attachlist['imgattachs'];
        unset($attachlist);
    }
    getgpc('infloat') ? include template('forum/post_infloat') : (include template('forum/post'));
} else {
    $modpost = C::m('forum_post', $_G['tid']);
    $bfmethods = $afmethods = array();
    $params = array('subject' => $subject, 'message' => $message, 'special' => $special, 'extramessage' => $extramessage, 'bbcodeoff' => $_GET['bbcodeoff'], 'smileyoff' => $_GET['smileyoff'], 'htmlon' => $_GET['htmlon'], 'parseurloff' => $_GET['parseurloff'], 'usesig' => $_GET['usesig'], 'isanonymous' => $_GET['isanonymous'], 'noticetrimstr' => $_GET['noticetrimstr'], 'noticeauthor' => $_GET['noticeauthor'], 'from' => $_GET['from'], 'sechash' => $_GET['sechash'], 'geoloc' => diconv($_GET['geoloc'], 'UTF-8'));
    if (!empty($_GET['trade']) && $thread['special'] == 2 && $_G['group']['allowposttrade']) {
        $bfmethods[] = array('class' => 'extend_thread_trade', 'method' => 'before_newreply');
    }
    $attentionon = empty($_GET['attention_add']) ? 0 : 1;
    $attentionoff = empty($attention_remove) ? 0 : 1;
    $bfmethods[] = array('class' => 'extend_thread_rushreply', 'method' => 'before_newreply');
    if ($_G['group']['allowat']) {
        $bfmethods[] = array('class' => 'extend_thread_allowat', 'method' => 'before_newreply');
    }
    $bfmethods[] = array('class' => 'extend_thread_comment', 'method' => 'before_newreply');
    $modpost->attach_before_method('newreply', array('class' => 'extend_thread_filter', 'method' => 'before_newreply'));
    if ($_G['group']['allowat']) {
        $afmethods[] = array('class' => 'extend_thread_allowat', 'method' => 'after_newreply');
    }
    $afmethods[] = array('class' => 'extend_thread_rushreply', 'method' => 'after_newreply');
     if (!$groups) {
         cpmsg_error('wechat:mass_get_group_failed');
     }
     if (intval($_GET['id']) > 0) {
         $mass = C::t('#wechat#mobile_wechat_masssend')->fetch(intval($_GET['id']));
     }
     $massmessage = $mass['resource_id'] ? "[resource={$mass['resource_id']}]" : $mass['text'];
     showtips(lang('plugin/wechat', 'mass_add_tips'));
     WeChatSetting::showResource();
     showformheader('plugins&operation=config&identifier=wechat&pmod=masssend_setting&ac=add', 'enctype');
     showtableheader();
     showtablerow('', '', array(lang('plugin/wechat', 'mass_type')));
     showtablerow('', array('', 'class="td23 td28"', '', 'class="td29"'), array("<textarea class=\"tarea\" name=\"massmessage\" id=\"res_subscribe\" rows=\"5\" cols=\"40\">{$massmessage}</textarea>" . "<br /><a href=\"javascript:;\" id=\"rsel\" onclick=\"showResource('res_subscribe')\">" . lang('plugin/wechat', 'mass_select_media') . "</a>"));
     $select = array('group_id', array());
     foreach ($groups as $g) {
         $select[1][] = array($g['id'], diconv($g['name'], 'UTF-8', CHARSET) . "[{$g['count']}]");
     }
     showsetting(lang('plugin/wechat', 'mass_group_id'), $select, '', 'select');
     showsubmit('addsubmit');
     showtablefooter();
     showformfooter();
 } else {
     if ($ac == 'del') {
         $massid = intval($_GET['id']);
         $msg = C::t('#wechat#mobile_wechat_masssend')->fetch($massid);
         if (!$msg) {
             cpmsg_error('wechat:mass_not_exist');
         }
         if (!$msg['res_finish_at'] && $msg['msg_id']) {
             cpmsg('wechat:mass_del_tips_1', PMODURL . '&massid=' . $_GET['id'] . '&delsubmit=yes', 'form');
         }
            $title[$value['fieldid']] = $value['title'];
        }
    }
    foreach ($title as $k => $v) {
        $subject .= ($v ? $v : $k) . ",";
    }
    $detail = "UID," . $lang['username'] . "," . $subject . "\n" . $detail;
    $filename = date('Ymd', TIMESTAMP) . '.csv';
    ob_end_clean();
    header('Content-Encoding: none');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename=' . $filename);
    header('Pragma: no-cache');
    header('Expires: 0');
    if ($_G['charset'] != 'gbk') {
        $detail = diconv($detail, $_G['charset'], 'GBK');
    }
    echo $detail;
    exit;
} elseif ($operation == 'repeat') {
    if (empty($_GET['uid']) && empty($_GET['username']) && empty($_GET['ip'])) {
        shownav('user', 'nav_members');
        showsubmenu('nav_members', array(array('search', 'members&operation=search', 0), array('clean', 'members&operation=clean', 0), array('nav_repeat', 'members&operation=repeat', 1)));
        showformheader("members&operation=repeat");
        showtableheader();
        showsetting('members_search_repeatuser', 'username', '', 'text');
        showsetting('members_search_uid', 'uid', '', 'text');
        showsetting('members_search_repeatip', 'ip', $_GET['inputip'], 'text');
        showsubmit('submit', 'submit');
        showtablefooter();
        showformfooter();
Exemple #26
0
                    if (strpos($menu['keyurl'], 'http://') === false) {
                        $menu['keyurl'] = $_G['siteurl'] . $menu['keyurl'];
                    }
                }
                $jsonmenu['button'][$i]['sub_button'][] = array('type' => $menu['type'], 'name' => urlencode(diconv($menu['name'], CHARSET, 'UTF-8')), $keyurl => urlencode(diconv($menu['keyurl'], CHARSET, 'UTF-8')));
            }
        } else {
            if ($m['type'] == 'click') {
                $keyurl = 'key';
            } else {
                $keyurl = 'url';
                if (strpos($m['keyurl'], 'http://') === false) {
                    $m['keyurl'] = $_G['siteurl'] . $m['keyurl'];
                }
            }
            $jsonmenu['button'][$i] = array('type' => $m['type'], 'name' => urlencode(diconv($m['name'], CHARSET, 'UTF-8')), $keyurl => urlencode(diconv($m['keyurl'], CHARSET, 'UTF-8')));
        }
        $i++;
    }
    $jsonmenu = stripslashes(urldecode(json_encode($jsonmenu)));
    $url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" . $access_token;
    $result = https_request($url, $jsonmenu);
    $result = (array) json_decode($result);
    if ($result['errmsg'] == 'ok') {
        cpmsg(lang('plugin/aljwsq', 'menu1'), 'action=plugins&operation=config&do=' . $_GET['do'] . '&identifier=aljwsq&pmod=menu', 'succeed');
    } else {
        cpmsg(lang('plugin/aljwsq', 'menu2') . $result['errmsg']);
    }
} else {
    if ($_GET['act'] == 'add') {
        if (file_exists('source/plugin/aljwsq/com/menu.php')) {
        if (strlen($apply['message']) > 11 && is_numeric($apply['message'])) {
            $apply['message'] = '[' . $apply['message'] . ']';
        }
        $applylist[] = $apply;
    }
    $filename = "activity_{$_G[tid]}.csv";
    include template('forum/activity_export');
    $csvstr = ob_get_contents();
    ob_end_clean();
    header('Content-Encoding: none');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename=' . $filename);
    header('Pragma: no-cache');
    header('Expires: 0');
    if ($_G['charset'] != 'gbk') {
        $csvstr = diconv($csvstr, $_G['charset'], 'GBK');
    }
    echo $csvstr;
} elseif ($_GET['action'] == 'tradeorder') {
    $trades = array();
    $query = C::t('forum_trade')->fetch_all_thread_goods($_G['tid']);
    if ($thread['authorid'] != $_G['uid'] && !$_G['group']['allowedittrade']) {
        showmessage('no_privilege_tradeorder');
    }
    if (!submitcheck('tradesubmit')) {
        $stickcount = 0;
        $trades = $tradesstick = array();
        foreach ($query as $trade) {
            $stickcount = $trade['displayorder'] > 0 ? $stickcount + 1 : $stickcount;
            $trade['displayorderview'] = $trade['displayorder'] < 0 ? 128 + $trade['displayorder'] : $trade['displayorder'];
            if ($trade['expiration']) {
Exemple #28
0
 private function u2g($a)
 {
     return is_array($a) ? array_map('u2g', $a) : diconv($a, 'UTF-8', CHARSET);
 }
Exemple #29
0
function convertname($str)
{
    return urlencode(diconv($str, CHARSET, 'UTF-8'));
}
Exemple #30
0
                 $common = "\t";
             }
             $verifylist .= $str . "\n";
             $showtitle = false;
         }
         $verifylist = $title . "\n" . $verifylist;
         $filename = date('Ymd', TIMESTAMP) . '.xls';
         define('FOOTERDISABLED', true);
         ob_end_clean();
         header("Content-type:application/vnd.ms-excel");
         header('Content-Encoding: none');
         header('Content-Disposition: attachment; filename=' . $filename);
         header('Pragma: no-cache');
         header('Expires: 0');
         if ($_G['charset'] != 'gbk') {
             $verifylist = diconv($verifylist, $_G['charset'], 'GBK');
         }
         echo $verifylist;
         exit;
     } else {
         cpmsg('members_verify_succeed', 'action=verify&operation=verify&do=' . $vid . '&anchor=pass', 'succeed');
     }
 } else {
     $vids = array();
     $single = intval($_GET['singleverify']);
     $verifyflag = empty($_GET['verify']) ? false : true;
     if ($verifyflag) {
         if ($single) {
             $_GET['verify'] = array($single => $_GET['verify'][$single]);
         }
         foreach ($_GET['verify'] as $id => $type) {