public function init() { parent::init(); if (zmf::config('closeSite')) { header("Content-type: text/html; charset=utf-8"); exit(zmf::config('closeSiteReason')); } $this->layout = '//layouts/wedding'; $this->currentModule = 'wedding'; // Yii::app()->theme = 'web'; // if (isset($_GET['lang']) && in_array($_GET['lang'], array('zh_cn', 'zh_tw', 'en'))) { // Yii::app()->language = $_GET['lang']; // zmf::delCookie('lang'); // zmf::setCookie('lang', $_GET['lang']); // } // $lang = zmf::getCookie('lang'); // if ($lang != '') { // Yii::app()->language = $lang; // } else { // $countryCode = zmf::getCountryByIp(); // $countryCode = strtoupper($countryCode); // if ($countryCode == 'CN') { // Yii::app()->language = 'zh_cn'; // } elseif (in_array($countryCode, array('HK', 'MO', 'TW'))) { // Yii::app()->language = 'zh_tw'; // } elseif ($countryCode == 'IANA') { // Yii::app()->language = 'zh_cn'; // } else { // Yii::app()->language = 'en'; // } // zmf::setCookie('lang', Yii::app()->language); // } }
public function init() { parent::init(); $passwdErrorTimes = zmf::getCookie('checkWithCaptcha'); $time = zmf::config('adminErrorTimes'); if ($time > 0) { if ($passwdErrorTimes >= $time) { header('Content-Type: text/html; charset=utf-8'); echo '您暂时已被禁止访问'; Yii::app()->end(); } } $uid = zmf::uid(); if ($uid) { // $randKey_cookie = zmf::getCookie('adminRandKey' . $uid); // $randKey_cache = zmf::getFCache('adminRandKey' . $uid); // if (!$randKey_cookie || ($randKey_cache != $randKey_cookie)) { // Yii::app()->user->logout(); // $this->message(0, '登录已过期,请重新登录', Yii::app()->createUrl('admin/site/login')); // } $this->userInfo = Users::getOne($uid); $this->uid = $uid; } else { $currentUrl = Yii::app()->request->url; if (strpos($currentUrl, '/site/') === false) { $this->message(0, '请先登录', Yii::app()->createUrl('/site/login')); } } }
public function loadCssJs($type = 'web') { $_staticUrl = zmf::config('cssJsStaticUrl'); $staticUrl = $_staticUrl ? $_staticUrl : zmf::config('baseurl'); $cs = Yii::app()->clientScript; if ($type == 'wedding') { $cs->registerCssFile($staticUrl . 'common/css/bootstrap.min.css'); $cs->registerCssFile($staticUrl . 'common/css/font-awesome.min.css'); $cs->registerCssFile($staticUrl . 'common/css/wedding.css'); $cs->registerCoreScript('jquery'); $cs->registerScriptFile($staticUrl . "common/js/bootstrap.min.js", CClientScript::POS_END); $cs->registerScriptFile($staticUrl . "common/js/wedding.js", CClientScript::POS_END); } elseif ($type == 'user') { $cs->registerCssFile($staticUrl . 'common/css/bootstrap.min.css'); $cs->registerCssFile($staticUrl . 'common/css/font-awesome.min.css'); $cs->registerCssFile($staticUrl . 'common/css/user.css'); $cs->registerCoreScript('jquery'); $cs->registerScriptFile($staticUrl . "common/js/bootstrap.min.js", CClientScript::POS_END); $cs->registerScriptFile($staticUrl . "common/js/wedding.js", CClientScript::POS_END); } elseif ($type == 'group') { $cs->registerCssFile($staticUrl . 'common/css/bootstrap.min.css'); $cs->registerCssFile($staticUrl . 'common/css/font-awesome.min.css'); $cs->registerCssFile($staticUrl . 'common/css/group.css'); $cs->registerCoreScript('jquery'); $cs->registerScriptFile($staticUrl . "common/js/bootstrap.min.js", CClientScript::POS_END); $cs->registerScriptFile($staticUrl . "common/js/wedding.js", CClientScript::POS_END); } }
public function init() { if (!zmf::uid()) { $this->redirect(zmf::config('baseurl')); } Users::checkPower('admin'); Yii::app()->language = 'zh_cn'; }
public function init() { if (zmf::config('mobile')) { if (tools::checkmobile($this->platform)) { Yii::app()->theme = 'mobile'; $this->isMobile = 'yes'; } } }
public function actionNotice() { $sql = "SELECT * FROM {{notification}} WHERE uid='{$this->uid}' ORDER BY cTime DESC"; Posts::getAll(array('sql' => $sql), $pages, $comLists); Notification::model()->updateAll(array('new' => 0), 'uid=:uid', array(':uid' => $this->uid)); $data = array('posts' => $comLists, 'pages' => $pages); $this->pageTitle = $this->userInfo['truename'] . '的提醒 - ' . zmf::config('sitename'); $this->render('notice', $data); }
public static function getTops() { $keys = zmf::config('hotsearchs'); if ($keys) { $arr = explode('#', $keys); return $arr; } else { return false; } }
public static function checkWeixin() { $wxId = zmf::config('weixin_app_id'); $wxSecret = zmf::config('weixin_app_key'); $callback = zmf::config('weixin_app_callback'); if (!$wxId || !$wxSecret || !$callback) { return false; } return TRUE; }
public function init() { //zh_tw\en_us Yii::app()->language = 'zh_cn'; if (zmf::config('mobile')) { if (tools::checkmobile($this->platform)) { $this->isMobile = 'yes'; } } }
public function init() { parent::init(); $this->WB_AKEY = zmf::config('weibo_app_id'); $this->WB_SKEY = zmf::config('weibo_app_key'); $this->WB_CALLBACK_URL = zmf::config('weibo_app_callback'); if (!$this->WB_AKEY || !$this->WB_SKEY || !$this->WB_CALLBACK_URL) { throw new CHttpException(403, '暂未开放'); } $this->weiboService = new SinaWeibo($this->WB_AKEY, $this->WB_SKEY); }
public function loadCssJs($type = 'web', $action = '') { if (YII_DEBUG) { $staticUrl = Yii::app()->baseUrl . '/'; } else { $_staticUrl = zmf::config('cssJsStaticUrl'); $staticUrl = $_staticUrl ? $_staticUrl : zmf::config('baseurl'); } $cs = Yii::app()->clientScript; $c = Yii::app()->getController()->id; $a = Yii::app()->getController()->getAction()->id; $cssDir = Yii::app()->basePath . '/../common/css'; $jsDir = Yii::app()->basePath . '/../common/js'; $cssArr = array(); $jsArr = array(); if ($type == 'web') { $cssArr = array('bootstrap', 'font-awesome', 'zmf'); $jsArr = array('bootstrap', 'zmf'); $cs->registerCoreScript('jquery'); } elseif ($type == 'mobile') { $cssArr = array('frozen', 'font-awesome'); $jsArr = array('zepto', 'frozen'); $cssArr[] = 'mobile'; $jsArr[] = 'mobile'; } elseif ($type == 'admin') { $cssArr = array('frozen'); $jsArr = array('zepto', 'frozen'); $cssArr[] = 'mobile'; $jsArr[] = 'mobile'; } $cssDirArr = zmf::readDir($cssDir, false); $jsDirArr = zmf::readDir($jsDir, false); foreach ($cssArr as $cssFileName) { foreach ($cssDirArr as $cssfile) { if (strpos($cssfile, $type . '-' . $cssFileName) !== false) { $cs->registerCssFile($staticUrl . 'common/css/' . $cssfile); } } } foreach ($jsArr as $jsFileName) { foreach ($jsDirArr as $jsfile) { if (strpos($jsfile, $type . '-' . $jsFileName) !== false) { if (strpos($jsfile, 'head') !== false) { $pos = CClientScript::POS_HEAD; } else { $pos = CClientScript::POS_END; } $cs->registerScriptFile($staticUrl . 'common/js/' . $jsfile, $pos); } } } }
public function actionView($code) { $code = zmf::filterInput($code, 't', 1); $info = SiteInfo::model()->find('code=:code', array(':code' => $code)); if (!$info) { throw new CHttpException(404, '您所查看的页面不存在'); } $allInfos = SiteInfo::model()->findAll(array('select' => 'code,title', 'condition' => 'status=' . Posts::STATUS_PASSED)); //更新访问统计 Posts::updateCount($info['id'], 'SiteInfo'); $data = array('info' => $info, 'allInfos' => $allInfos, 'code' => $code); $this->pageTitle = $info['title'] . ' - ' . zmf::config('sitename'); $this->render('/site/siteinfo', $data); }
public function actionIndex() { $areas = Area::getTops(); $flashArr = Ads::getAllByPo('twindex', 'flash', '', 5); if (!empty($flashArr)) { foreach ($flashArr as $k => $val) { $_imgurl = zmf::uploadDirs($val['cTime'], 'site', $val['classify'], 600) . $val['filePath']; $flashArr[$k]['imgurl'] = $_imgurl; } } $this->pageTitle = zmf::config('sitename'); $data = array('areas' => $areas, 'flashs' => $flashArr, 'posts' => $posts); $this->render('/index/index', $data); }
public function actionMap() { $this->layout = 'common'; $sql = "SELECT id,title,lat,`long`,comments,favorite,cTime FROM {{posts}} WHERE lat!='' AND `long`!='' AND `status`=1 ORDER BY cTime ASC"; Posts::getAll(array('sql' => $sql, 'pageSize' => 100), $pages, $posts); foreach ($posts as $k => $val) { $posts[$k]['href'] = Yii::app()->createUrl('posts/view', array('id' => $val['id'])); $posts[$k]['cTime'] = zmf::formatTime($val['cTime']); } $posts = !empty($posts) ? $posts : array(); $data = array('postJson' => CJSON::encode($posts), 'loadMap' => empty($posts) ? false : true); $this->pageTitle = '足迹 - ' . zmf::config('sitename'); $this->selectNav = 'map'; $this->render('/index/map', $data); }
function init() { parent::init(); Yii::app()->theme = 'web'; if (zmf::config('mobile')) { if (zmf::checkmobile($this->platform)) { Yii::app()->theme = 'mobile'; $this->isMobile = true; } } $uid = zmf::uid(); if ($uid) { $this->uid = $uid; $this->userInfo = Users::getOne($uid); } self::_referer(); }
function init() { parent::init(); if (zmf::config('closeSite')) { header("Content-type: text/html; charset=utf-8"); exit(zmf::config('closeSiteReason')); } $this->uid = zmf::uid(); if (!Yii::app()->user->isGuest) { $uid = Yii::app()->user->id; $userInfo = Users::getUserInfo($uid); $this->truename = $userInfo['username']; $this->userInfo = $userInfo; } $this->pageTitle = zmf::config('sitename'); self::_referer(); $this->mobileTitle = zmf::config('sitename'); }
public function init() { Yii::app()->language = 'zh_cn'; if (zmf::config('mobile')) { if (tools::checkmobile($this->platform)) { Yii::app()->theme = 'frozen'; $this->isMobile = 'yes'; $this->layout = '//layouts/mobile'; $this->currentModule = 'frozen'; } } if (zmf::uid()) { $this->uid = zmf::uid(); $userInfo = Users::getUserInfo($this->uid); $this->truename = $userInfo['truename']; $this->userInfo = $userInfo; } self::_referer(); }
public function loadCssJs($type = 'web') { $_staticUrl = zmf::config('cssJsStaticUrl'); $staticUrl = $_staticUrl ? $_staticUrl : zmf::config('baseurl'); $cs = Yii::app()->clientScript; if ($type == 'web') { $cs->registerCssFile($staticUrl . 'common/css/bootstrap.min.css'); $cs->registerCssFile($staticUrl . 'common/css/font-awesome.min.css'); $cs->registerCssFile($staticUrl . 'common/css/font-awesome-ie7.min.css'); $cs->registerCssFile($staticUrl . 'common/css/newsoul.css'); $cs->registerCoreScript('jquery'); $cs->registerScriptFile($staticUrl . "common/js/zmf.js", CClientScript::POS_END); } elseif ($type == 'mobile') { $cs->registerCssFile($staticUrl . 'common/css/frozen.css'); $cs->registerCssFile($staticUrl . 'common/css/mobile.css'); $cs->registerScriptFile($staticUrl . "common/js/zepto.min.js", CClientScript::POS_HEAD); $cs->registerScriptFile($staticUrl . "common/js/frozen.js", CClientScript::POS_END); } }
/** * Find AND Add * @param type $url * @return boolean|\Urls */ public static function FAA($url) { $url = trim(htmlspecialchars_decode($url)); if (!$url) { return false; } if (substr($url, -1) == '/') { $url = substr($url, 0, -1); } $hash = md5($url); $info = Urls::model()->find('hash=:hash', array(':hash' => $hash)); if ($info) { return $info; } $code = ''; $len = zmf::config('shortUrlsLen'); $len = intval($len); if (!$len) { $len = 4; } for ($i = 0; $i < 10; $i++) { $code = tools::randMykeys($len); $codeInfo = Urls::model()->find('code=:code', array(':code' => $code)); if (!$codeInfo) { break; } } if (!$code) { return false; } $attr = array('code' => $code, 'url' => $url, 'hash' => $hash); $model = new Urls(); $model->attributes = $attr; if ($model->save()) { return $model; } else { return false; } }
function init() { parent::init(); if (zmf::config('closeSite')) { header("Content-type: text/html; charset=utf-8"); exit(zmf::config('closeSiteReason')); } $this->uid = zmf::uid(); if ($this->uid) { $uid = $this->uid; $userInfo = Users::getUserInfo($uid); $this->truename = $userInfo['truename']; $this->userInfo = $userInfo; $this->userCode = zmf::jiaMi('zmf#' . $this->uid); } $this->pageTitle = zmf::config('sitename'); $this->mobileTitle = zmf::config('sitename'); if ($this->isMobile == 'yes') { Yii::app()->theme = 'mobile'; } else { Yii::app()->theme = 'naodong'; } self::_referer(); }
<div class="col-xs-4 col-sm-4 text-center"> <a href="<?php echo Yii::app()->createUrl('index/media', array('id' => $this->uid)); ?> " title="<?php echo $this->userInfo['hits']; ?> 次访问"> <p style="font-size: 48px;"><span class="icon-bar-chart"></span></p> <h2><?php echo $this->userInfo['hits']; ?> </h2> </a> </div> <div class="col-xs-4 col-sm-4 text-center" title="152次贡献"> <p style="font-size: 48px;"><span class="icon-group"></span></p> <h2>152</h2> </div> </div> <hr/> <div class="input-group"> <span class="input-group-addon" id="basic-addon1">我的链接</span> <input type="text" class="form-control" placeholder="分享链接,增加贡献" value="<?php echo zmf::config('domain') . zmf::url('', 'index/media', array('id' => $this->uid, 'zmf' => zmf::jiaMi($this->uid)), 'l'); ?> "> <span class="input-group-btn"> <button class="btn btn-default" type="button">分享给好友</button> </span> </div><!-- /input-group -->
/** * 验证用户具体发帖权限,并不影响其他权限 * @param type $uid 验证的用户 * @param type $type 验证的类型 * @param type $field 是否检查总数 * @return type */ public static function check($type, $field = false, $uid = '') { if (!$uid) { $uid = Yii::app()->user->id; } if (!$uid) { if (zmf::config('officalUid')) { return array('status' => 1, 'msg' => ''); } return array('status' => 0, 'msg' => '用户不存在'); } $uinfo = Users::getUserInfo($uid); if (!$uinfo) { return array('status' => 0, 'msg' => '用户不存在'); } if (!$uinfo['groupid']) { return array('status' => 0, 'msg' => '无组织用户'); } $groupInfo = UserPower::model()->find('groupid=:gid', array(':gid' => $uinfo['groupid'])); if (!$groupInfo) { return array('status' => 0, 'msg' => '无组织用户'); } $num = $groupInfo->getAttribute($type); if ($num === null) { return array('status' => 0, 'msg' => '无法完成验证的type:' . $type); } elseif ($num === 0) { return array('status' => 0, 'msg' => '不允许'); } elseif ($field) { switch ($field) { case 'addPost': $totalNum = $groupInfo['postNum']; $hasNum = Posts::model()->count('uid=:uid AND cTime>=:cTime', array(':uid' => $uid, ':cTime' => $ctime)); break; case 'addQuestion': $totalNum = $groupInfo['questionNum']; $hasNum = Question::model()->count('uid=:uid AND cTime>=:cTime', array(':uid' => $uid, ':cTime' => $ctime)); break; case 'addAnswer': $totalNum = $groupInfo['answerNum']; $hasNum = Answer::model()->count('uid=:uid AND cTime>=:cTime', array(':uid' => $uid, ':cTime' => $ctime)); break; case 'addPoiPost': $totalNum = $groupInfo['poiPostNum']; $hasNum = PoiPost::model()->count('uid=:uid AND cTime>=:cTime', array(':uid' => $uid, ':cTime' => $ctime)); break; case 'addPoiTips': $totalNum = $groupInfo['poiTipsNum']; $hasNum = PoiTips::model()->count('uid=:uid AND cTime>=:cTime', array(':uid' => $uid, ':cTime' => $ctime)); break; case 'addImage': $totalNum = $groupInfo['imageNum']; $hasNum = Attachments::model()->count('uid=:uid AND cTime>=:cTime', array(':uid' => $uid, ':cTime' => $ctime)); break; case 'addComment': $totalNum = $groupInfo['commentNum']; $hasNum = Comments::model()->count('uid=:uid AND cTime>=:cTime', array(':uid' => $uid, ':cTime' => $ctime)); break; case 'addPlan': $totalNum = $groupInfo['planNum']; $hasNum = Plans::model()->count('uid=:uid AND cTime>=:cTime', array(':uid' => $uid, ':cTime' => $ctime)); break; case 'yueban': $totalNum = $groupInfo['yuebanNum']; $hasNum = Posts::model()->count('uid=:uid AND cTime>=:cTime', array(':uid' => $uid, ':cTime' => $ctime)); break; } if (!$totalNum) { return array('status' => 1, 'msg' => '无限制'); } else { if ($hasNum >= $totalNum) { return array('status' => 0, 'msg' => '已超出限制:' . $totalNum); } else { return array('status' => 1, 'msg' => ''); } } } else { return array('status' => 1, 'msg' => ''); } }
public static function checkRegTimes() { if (!zmf::config('limitReg')) { return false; } $ip = ip2long(Yii::app()->request->userHostAddress); $times = zmf::getFCache("regTimes-{$ip}"); if ($times >= zmf::config('limitRegTimes')) { return true; } else { zmf::setFCache("regTimes-{$ip}", intval($times) + 1, 86400); return false; } }
<div class="header-ppt"> <div class="header-bg"> <img id="backdrop" class="lazy" data-original="<?php echo zmf::attachBase('site'); ?> daodao/bg.jpg" src="<?php echo zmf::lazyImg(); ?> " width="100%" /> </div> <div class="header-search-bg"></div> <div class="header-search"> <div class="search-login" id="main-search-holder"> <h1 class="logo-title text-center">完美你的旅行计划</h1> <form role="form" action="<?php echo zmf::config("domain") . Yii::app()->createUrl("posts/search"); ?> " method="GET"> <div class="input-group"> <input type="text" class="form-control" placeholder="<?php echo zmf::t('search_placeholder'); ?> " onkeyup="searchKeyup(event)" onblur="hideSearch();" name="keyword" id="keyword" value="<?php echo isset($this->searchKeywords) ? $this->searchKeywords : ''; ?> " autocomplete="off" disableautocomplete> <span class="input-group-btn"> <button type="button" class="btn btn-success" id="search-btn"><?php echo zmf::t('search'); ?> </button>
echo zmf::imgurl($data['logid'], $data['filePath'], 600, $data['classify']); ?> " alt="<?php echo $data['fileDesc']; ?> " width="550px"/></p> <div class="photo_desc"> <p></p> </div> <div class="photo_info"> <span> <?php echo CHtml::link(Users::getUserInfo($data['uid'], 'truename'), array('users/index', 'id' => $data['uid'])); ?> 上传于<?php echo date(zmf::config('dateFormat'), $data['cTime']); ?> ,<a href="<?php echo zmf::imgurl($data['logid'], $data['filePath'], 'origin', $data['classify']); ?> " target="_blank">查看原图</a> </span> <span style="float:right"> <?php if ($data['uid'] == Yii::app()->user->id || Users::checkPower('delattachment', false, true)) { ?> <?php echo CHtml::link('删除', 'javascript:', array('onclick' => 'deletePost("' . $data['id'] . '","attachments","' . Yii::app()->createUrl('posts/index', array('id' => $data['logid'])) . '")', 'confirm' => Yii::t('default', 'deleteConfirm'))); ?> <?php
/** * 如果是本网站的链接就不再短链接 * @param type $url * @return boolean */ public static function checkUrlDomain($url) { $config = zmf::config('notShortUrls'); if (!$config) { return false; } $arr = array_filter(explode('#', $config)); if (empty($arr)) { return false; } $url = strtolower($url); foreach ($arr as $v) { if (strpos($url, $v) !== false) { return true; } } return false; }
public function actionConfig() { $keyid = zmf::uid(); if (!$keyid) { $this->redirect(array('site/login')); } $type = zmf::filterInput($_GET['type'], 't', 1); if (!$type || !in_array($type, array('info', 'third', 'avatar'))) { $type = 'info'; } $this->userInfo = Users::getUserInfo($keyid); if (!$this->userInfo) { $this->message(0, '该用户不存在,请核实'); } $data = array('info' => $this->userInfo, 'type' => $type); $this->pageTitle = '个人设置 - ' . zmf::config('sitename'); $this->render('config', $data); }
<?php $uploadurl = Yii::app()->createUrl('attachments/upload', array('type' => 'post', 'imgsize' => 600)); $this->breadcrumbs = array(CHtml::link('首页', zmf::config('baseurl')), '脑洞大开' => array('index/index')); ?> <div class="mod-header">小提示</div> <div class="wrap-container"> <div class="wrap-content"> <ul> <li>为你发表的作品拟一个吸引人的标题;</li> <li>如果为非原创,请务必添加来源;</li> <li>请遵循法律法规。</li> </ul> </div> </div> <?php if (Yii::app()->user->hasFlash('publishSuccess')) { ?> <div class="ui-tooltips ui-tooltips-guide"> <div class="ui-tooltips-cnt ui-border-b"> <i></i><?php echo Yii::app()->user->getFlash('publishSuccess'); ?> <a class="ui-icon-close"></a> </div> </div> <?php } ?> <div class="mod-header">发布作品</div> <div class="wrap-container">
<?php $this->beginContent('/layouts/common'); $_btnclass = $this->favored ? 'default' : 'default'; $_btntitle = $this->favored ? '<span class="icon-ok"></span>已关注' : '<span class="icon-plus"></span> 关注他'; ?> <div class="user-fixed-topbar"> <?php echo CHtml::link('全站首页', zmf::config('baseurl')); $uid = zmf::uid(); if ($uid) { echo CHtml::link('我的首页', array('users/index', 'id' => $uid)); } else { echo CHtml::link('登录', array('site/login')); echo CHtml::link('注册', array('site/reg')); } ?> </div> <div class="user-fixed-toolbar"> <ul> <li class="<?php echo !$_GET['type'] && Yii::app()->getController()->getAction()->id == 'index' ? 'active' : ''; ?> "><?php echo CHtml::link('<i class="icon-home"></i> 首页', array('users/index', 'id' => $this->uid)); ?> </li> <li><?php echo CHtml::link('<i class="icon-group"></i> 团队', array('users/group', 'id' => $this->uid)); ?> </li>
"/> <script> var tipImgUploadUrl="<?php echo $upurl; ?> "; var allowImgTypes="<?php echo zmf::config('imgAllowTypes'); ?> "; var allowImgPerSize="<?php echo tools::formatBytes(zmf::config('imgMaxSize')); ?> "; var perAddImgNum="<?php echo zmf::config('imgUploadNum'); ?> "; $(function(){ myeditor=UM.getEditor('<?php echo CHtml::activeId($model, $attri); ?> ', { //UMEDITOR_HOME_URL : URL, toolbar: ["bold","italic","underline","link","unlink","image"], lang:'zh-cn', //语言 wordCount:false, //关闭字数统计 initialFrameWidth:500, //宽度 initialFrameHeight:200, //高度 zIndex:0, focus:true,