/** * 判断用户是否已经登陆 */ public final function check_member() { $yuncms_auth = cookie('auth'); if (APP == 'member' && CONTROLLER == 'Passport') { return true; } else { // 判断是否存在auth cookie if (!empty($yuncms_auth)) { $yuncms_auth = String::authcode($yuncms_auth, 'DECODE', $this->auth_key); list($userid, $password) = explode("\t", $yuncms_auth); // 验证用户,获取用户信息 $this->memberinfo = $this->db->getby_userid($userid); // 获取用户模型信息 $this->db->set_model($this->memberinfo['modelid']); $_member_modelinfo = $this->db->getby_userid($userid); $_member_modelinfo = $_member_modelinfo ? $_member_modelinfo : array(); $this->db->set_model(); if (is_array($this->memberinfo)) { $this->memberinfo = array_merge($this->memberinfo, $_member_modelinfo); } if ($this->memberinfo && $this->memberinfo['password'] === $password) { if ($this->memberinfo['groupid'] == 2) { cookie('auth', ''); cookie('_userid', ''); cookie('_username', ''); cookie('_groupid', ''); showmessage(L('userid_banned_by_administrator', '', 'member'), U('member/passport/verify', array('t' => 1)), 301); } elseif ($this->memberinfo['groupid'] == 3) { cookie('auth', ''); cookie('_userid', ''); cookie('_groupid', ''); // 设置当前登录待验证账号COOKIE,为重发邮件所用 cookie('_regusername', $this->memberinfo['username']); cookie('_reguserid', $this->memberinfo['userid']); cookie('_reguseruid', $this->memberinfo['phpssouid']); cookie('email', $this->memberinfo['email']); showmessage(L('need_emial_authentication', '', 'member'), U('member/passport/register', array('t' => 2))); } $this->avatar = get_memberavatar($userid, false); } else { cookie('auth', ''); cookie('_userid', ''); cookie('_username', ''); cookie('_groupid', ''); } unset($userid, $password, $phpcms_auth, $auth_key); } else { $forward = isset($_GET['forward']) ? urlencode($_GET['forward']) : urlencode(Base_Request::get_url()); showmessage(L('please_login', '', 'member'), U('member/passport/login', array('forward' => $forward)), 301); } } }
/** * 栏目列表页 */ public function lists() { $catid = intval($_GET['catid']); $_priv_data = $this->_category_priv($catid); if ($_priv_data == '-1') { $forward = urlencode(Base_Request::get_url()); showmessage(L('login_website'), SITE_URL . 'index.php?app=member&controller=index&action=login&forward=' . $forward); } elseif ($_priv_data == '-2') { showmessage(L('no_priv')); } $_userid = $this->_userid; $_username = $this->_username; $_groupid = $this->_groupid; if (!$catid) { showmessage(L('category_not_exists'), 'blank'); } $CATEGORYS = S('common/category_content'); if (!isset($CATEGORYS[$catid])) { showmessage(L('category_not_exists'), 'blank'); } $CAT = $CATEGORYS[$catid]; extract($CAT); $setting = string2array($setting); // SEO if (!$setting['meta_title']) { $setting['meta_title'] = $catname; } $SEO = seo('', $setting['meta_title'], $setting['meta_description'], $setting['meta_keywords']); define('STYLE', $setting['template_list']); $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $template = isset($setting['category_template']) ? $setting['category_template'] : 'category'; $template_list = isset($setting['list_template']) ? $setting['list_template'] : 'list'; if ($type == 0) { $template = $child ? $template : $template_list; $arrparentid = explode(',', $arrparentid); $top_parentid = isset($arrparentid[1]) ? $arrparentid[1] : $catid; $array_child = array(); $self_array = explode(',', $arrchildid); // 获取一级栏目ids foreach ($self_array as $arr) { if ($arr != $catid && $CATEGORYS[$arr]['parentid'] == $catid) { $array_child[] = $arr; } } $arrchildid = implode(',', $array_child); // URL规则 $urlrules = S('common/urlrule'); $urlrules = str_replace('|', '~', $urlrules[$category_ruleid]); $tmp_urls = explode('~', $urlrules); $tmp_urls = isset($tmp_urls[1]) ? $tmp_urls[1] : $tmp_urls[0]; preg_match_all('/{\\$([a-z0-9_]+)}/i', $tmp_urls, $_urls); if (!empty($_urls[1])) { foreach ($_urls[1] as $_v) { $GLOBALS['URL_ARRAY'][$_v] = isset($_GET[$_v]) ? $_GET[$_v] : ''; } } define('URLRULE', $urlrules); $GLOBALS['URL_ARRAY']['categorydir'] = isset($categorydir) ? $categorydir : ''; $GLOBALS['URL_ARRAY']['catdir'] = isset($catdir) ? $catdir : ''; $GLOBALS['URL_ARRAY']['catid'] = isset($catid) ? $catid : ''; include template('content', $template); } else { // 单网页 $this->page_db = Loader::model('page_model'); $r = $this->page_db->getby_catid($catid); if ($r) { extract($r); } $template = isset($setting['page_template']) ? $setting['page_template'] : 'page'; $arrchild_arr = $CATEGORYS[$parentid]['arrchildid']; if ($arrchild_arr == '') { $arrchild_arr = $CATEGORYS[$catid]['arrchildid']; } $arrchild_arr = explode(',', $arrchild_arr); array_shift($arrchild_arr); $keywords = isset($keywords) ? $keywords : $setting['meta_keywords']; $SEO = seo(0, $title, $setting['meta_description'], $keywords); include template('content', $template); } }
?> ')" <?php if (isset($_GET['isurl']) && $_GET['isurl'] == 1) { echo 'checked'; } ?> > <?php echo L('yes'); ?> <input type="radio" name="info[isurl]" value="0" <?php if (!isset($_GET['isurl']) || isset($_GET['isurl']) && $_GET['isurl'] == 0) { echo 'checked'; } ?> onclick="redirect('<?php echo Base_Request::get_url() . '&isurl=0'; ?> ')"> <?php echo L('no'); ?> </td> </tr> <?php if (isset($_GET['isurl']) && $_GET['isurl'] == 1) { ?> <tr> <th><?php echo L('url'); ?> :</th> <td><input type="text" name="info[url]" class="input-text" size=80></td>
*/ @set_time_limit(1000); if (phpversion() < '5.2.0') { exit('您的php版本过低,不能安装本软件,请升级到5.2.0或更高版本再安装,谢谢!'); } defined('BASE_PATH') or define('BASE_PATH', dirname(dirname($_SERVER['SCRIPT_FILENAME'])) . DIRECTORY_SEPARATOR); require_once '../src/wekit.php'; define('INS_PATH', BASE_PATH . 'install' . DIRECTORY_SEPARATOR); if (file_exists(DATA_PATH . 'install.lock')) { exit('您已经安装过YUNCMS,如果需要重新安装,请删除 ' . DATA_PATH . 'install.lock 文件!'); } require_once INS_PATH . 'global.php'; $steps = (include INS_PATH . 'conf/step.php'); $step = isset($_REQUEST['step']) ? trim($_REQUEST['step']) : 1; $pos = strpos(Base_Request::get_url(), 'install/'); $siteurl = substr(Base_Request::get_url(), 0, $pos); if (strrpos(strtolower(PHP_OS), "win") === FALSE) { define('ISUNIX', TRUE); } else { define('ISUNIX', FALSE); } switch ($step) { case '1': // 安装许可协议 $license = file_get_contents(INS_PATH . "resource/license.txt"); include INS_PATH . "step/step_" . $step . ".tpl.php"; break; case '2': // 环境检测 (FTP帐号设置) $PHP_GD = ''; if (extension_loaded('gd')) {
public function init() { $a_k = trim($_GET['a_k']); if (!isset($a_k)) { showmessage(L('illegal_parameters')); } $a_k = String::authcode($a_k, 'DECODE', $this->auth_key); if (empty($a_k)) { showmessage(L('illegal_parameters')); } unset($i, $m, $f); parse_str($a_k); if (isset($i)) { $i = $id = intval($i); } if (!isset($m)) { showmessage(L('illegal_parameters')); } if (!isset($modelid) || !isset($catid)) { showmessage(L('illegal_parameters')); } if (empty($f)) { showmessage(L('url_invalid')); } $allow_visitor = 1; $MODEL = S('common/model'); $tablename = $this->db->table_name = $this->db->get_prefix() . $MODEL[$modelid]['tablename']; $this->db->table_name = $tablename . '_data'; $rs = $this->db->getby_id($id); $CATEGORYS = S('common/category_content'); $this->category = $CATEGORYS[$catid]; $this->category_setting = string2array($this->category['setting']); //检查文章会员组权限 $groupids_view = ''; if (isset($rs['groupids_view']) && !empty($rs['groupids_view'])) { $groupids_view = explode(',', $rs['groupids_view']); } if ($groupids_view && is_array($groupids_view)) { $_groupid = cookie('_groupid'); $_groupid = intval($_groupid); if (!$_groupid) { $forward = urlencode(Base_Request::get_url()); showmessage(L('login_website'), SITE_URL . 'index.php?app=member&controller=index&action=login&forward=' . $forward); } if (!in_array($_groupid, $groupids_view)) { showmessage(L('no_priv')); } } else { //根据栏目访问权限判断权限 $_priv_data = $this->_category_priv($catid); if ($_priv_data == '-1') { $forward = urlencode(Base_Request::get_url()); showmessage(L('login_website'), SITE_URL . 'index.php?app=member&controller=index&action=login&forward=' . $forward); } elseif ($_priv_data == '-2') { showmessage(L('no_priv')); } } //阅读收费 类型 $paytype = !empty($rs['paytype']) ? $rs['paytype'] : '0'; $readpoint = !empty($rs['readpoint']) ? $rs['readpoint'] : '0'; if ($readpoint || $this->category_setting['defaultchargepoint']) { if (!$readpoint) { $readpoint = $this->category_setting['defaultchargepoint']; $paytype = $this->category_setting['paytype']; } //检查是否支付过 $allow_visitor = self::_check_payment($catid . '_' . $id, $paytype, $catid); if (!$allow_visitor) { $http_referer = urlencode(Base_Request::get_url()); $allow_visitor = String::authcode($catid . '_' . $id . '|' . $readpoint . '|' . $paytype) . '&http_referer=' . $http_referer; } else { $allow_visitor = 1; } } if (preg_match('/(php|phtml|php3|php4|jsp|dll|asp|cer|asa|shtml|shtm|aspx|asax|cgi|fcgi|pl)(\\.|$)/i', $f) || strpos($f, ":\\") !== FALSE || strpos($f, '..') !== FALSE) { showmessage(L('url_error')); } if (strpos($f, 'http://') !== FALSE || strpos($f, 'ftp://') !== FALSE || strpos($f, '://') === FALSE) { $yun_auth_key = md5($this->auth_key . $_SERVER['HTTP_USER_AGENT']); $a_k = urlencode(String::authcode("i={$i}&d={$d}&s={$s}&t=" . TIME . "&ip=" . IP . "&m=" . $m . "&f={$f}&modelid=" . $modelid, 'ENCODE', $yun_auth_key)); $downurl = '?app=content&controller=down&action=download&a_k=' . $a_k; } else { $downurl = $f; } header('HTTP/1.1 301 Moved Permanently'); //发出301头部 header('Location: ' . $downurl); //跳转到你希望的地址格式 }
?> "}).inputValidator({min:1, onerror:'<?php echo L('please_select_model'); ?> '});});</script></td> </tr> <?php if ($application) { ?> <tr> <th><?php echo L('selectingoperation'); ?> :</th> <td class="y-bg"><?php echo Form::radio($html['do'], $do, 'name="do" onclick="location.href=\'' . Base_Request::get_url() . '&do=\'+this.value"'); ?> </td> </tr> <?php } ?> <?php if (isset($html[$do]) && is_array($html[$do]) && $do) { foreach ($html[$do] as $k => $v) { ?> <tr> <th><?php echo $v['name']; ?> :</th>
/** * 生成内容页 */ public function show() { if (isset($_POST['dosubmit'])) { extract($_POST, EXTR_SKIP); $this->html = Loader::lib('content:html'); $modelid = intval($_POST['modelid']); if ($modelid) { // 设置模型数据表名 $this->db->set_model($modelid); $table_name = $this->db->table_name; if ($type == 'lastinput') { $offset = 0; } else { $page = max(intval($page), 1); $offset = $pagesize * ($page - 1); } $where = array('status' => 99); $order = 'ASC'; if (!isset($first) && is_array($catids) && $catids[0] > 0) { S('content/html_show_' . $_SESSION['userid'], $catids); $catids = implode(',', $catids); $where['catid'] = array('in', $catids); $first = 1; } elseif ($first) { $catids = S('content/html_show_' . $_SESSION['userid']); $catids = implode(',', $catids); $where['catid'] = array('in', $catids); } else { $first = 0; } if (count($catids) == 1 && $catids[0] == 0) { $message = L('create_update_success'); $forward = '?app=content&controller=create_html&action=show'; showmessage($message, $forward); } if ($type == 'lastinput' && $number) { $offset = 0; $pagesize = $number; $order = 'DESC'; } elseif ($type == 'date') { if ($fromdate) { $fromtime = strtotime($fromdate . ' 00:00:00'); $where['inputtime'] = array('egt', $fromtime); } if ($todate) { $totime = strtotime($todate . ' 23:59:59'); $where['inputtime'] = array('elt', $totime); } } elseif ($type == 'id') { $fromid = intval($fromid); $toid = intval($toid); if ($fromid) { $where['id'] = array('egt', $fromid); } if ($toid) { $where['id'] = array('elt', $toid); } } if (!isset($total) && $type != 'lastinput') { $total = $this->db->where($where)->count(); $pages = ceil($total / $pagesize); $start = 1; } $data = $this->db->where($where)->order(`id ` . $order)->limit($offset, $pagesize)->select(); $tablename = $this->db->table_name . '_data'; $this->url = Loader::lib('content:url'); foreach ($data as $r) { if ($r['islink']) { continue; } $this->db->table_name = $tablename; $r2 = $this->db->getby_id($r['id']); if ($r) { $r = array_merge($r, $r2); } if ($r['upgrade']) { $urls[1] = $r['url']; } else { $urls = $this->url->show($r['id'], '', $r['catid'], $r['inputtime']); } $this->html->show($urls[1], $r, 0, 'edit', $r['upgrade']); } if ($pages > $page) { $page++; $http_url = Base_Request::get_url(); $creatednum = $offset + count($data); $percent = round($creatednum / $total, 2) * 100; $message = L('need_update_items', array('total' => $total, 'creatednum' => $creatednum, 'percent' => $percent)); $forward = $start ? "?app=content&controller=create_html&action=show&type={$type}&dosubmit=1&first={$first}&fromid={$fromid}&toid={$toid}&fromdate={$fromdate}&todate={$todate}&pagesize={$pagesize}&page={$page}&pages={$pages}&total={$total}&modelid={$modelid}" : preg_replace("/&page=([0-9]+)&pages=([0-9]+)&total=([0-9]+)/", "&page={$page}&pages={$pages}&total={$total}", $http_url); } else { S('content/html_show_' . $_SESSION['userid'], ''); $message = L('create_update_success'); $forward = '?app=content&controller=create_html&action=show'; } showmessage($message, $forward, 200); } else { // 当没有选择模型时,需要按照栏目来更新 if (!isset($set_catid)) { if ($catids[0] != 0) { $update_url_catids = $catids; } else { foreach ($this->categorys as $catid => $cat) { if ($cat['child'] || $cat['type'] != 0) { continue; } $setting = string2array($cat['setting']); if (!$setting['content_ishtml']) { continue; } $update_url_catids[] = $catid; } } S('content/update_html_catid' . '-' . $_SESSION['userid'], $update_url_catids); $message = L('start_update'); $forward = "?app=content&controller=create_html&action=show&set_catid=1&pagesize={$pagesize}&dosubmit=1"; showmessage($message, $forward, 200); } if (count($catids) == 1 && $catids[0] == 0) { $message = L('create_update_success'); $forward = '?app=content&controller=create_html&action=show'; showmessage($message, $forward, 200); } $catid_arr = S('content/update_html_catid' . '-' . $_SESSION['userid']); $autoid = $autoid ? intval($autoid) : 0; if (!isset($catid_arr[$autoid])) { showmessage(L('create_update_success'), '?app=content&controller=create_html&action=show', 200); } $catid = $catid_arr[$autoid]; $modelid = $this->categorys[$catid]['modelid']; // 设置模型数据表名 $this->db->set_model($modelid); $table_name = $this->db->table_name; $page = max(intval($page), 1); $offset = $pagesize * ($page - 1); $where = array('status' => 99, 'catid' => $catid); $order = 'ASC'; if (!isset($total)) { $total = $this->db->where($where)->count(); $pages = ceil($total / $pagesize); $start = 1; } $data = $this->db->where($where)->order(`id ` . $order)->limit($offset, $pagesize)->select(); $tablename = $this->db->table_name . '_data'; $this->url = Loader::lib('content:url'); foreach ($data as $r) { if ($r['islink']) { continue; } // 写入文件 $this->db->table_name = $tablename; $r2 = $this->db->getby_id($r['id']); if ($r2) { $r = array_merge($r, $r2); } if ($r['upgrade']) { $urls[1] = $r['url']; } else { $urls = $this->url->show($r['id'], '', $r['catid'], $r['inputtime']); } $this->html->show($urls[1], $r, 0, 'edit', $r['upgrade']); } if ($pages > $page) { $page++; $http_url = Base_Request::get_url(); $creatednum = $offset + count($data); $percent = round($creatednum / $total, 2) * 100; $message = '【' . $this->categorys[$catid]['catname'] . '】 ' . L('have_update_items', array('total' => $total, 'creatednum' => $creatednum, 'percent' => $percent)); $forward = $start ? "?app=content&controller=create_html&action=show&type={$type}&dosubmit=1&first={$first}&fromid={$fromid}&toid={$toid}&fromdate={$fromdate}&todate={$todate}&pagesize={$pagesize}&page={$page}&pages={$pages}&total={$total}&autoid={$autoid}&set_catid=1" : preg_replace("/&page=([0-9]+)&pages=([0-9]+)&total=([0-9]+)/", "&page={$page}&pages={$pages}&total={$total}", $http_url); } else { $autoid++; $message = L('start_update') . $this->categorys[$catid]['catname'] . " ..."; $forward = "?app=content&controller=create_html&action=show&set_catid=1&pagesize={$pagesize}&dosubmit=1&autoid={$autoid}"; } showmessage($message, $forward, 200); } } else { $show_header = $show_dialog = ''; $admin_username = cookie('admin_username'); $modelid = isset($_GET['modelid']) ? intval($_GET['modelid']) : 0; $tree = Loader::lib('Tree'); $tree->icon = array(' │ ', ' ├─ ', ' └─ '); $tree->nbsp = ' '; $categorys = array(); if (!empty($this->categorys)) { foreach ($this->categorys as $catid => $r) { if ($r['type'] != 0 && $r['child'] == 0) { continue; } if ($modelid && $modelid != $r['modelid']) { continue; } if ($r['child'] == 0) { $setting = string2array($r['setting']); if (!$setting['content_ishtml']) { continue; } } $r['disabled'] = $r['child'] ? 'disabled' : ''; $categorys[$catid] = $r; } } $str = "<option value='\$catid' \$selected \$disabled>\$spacer \$catname</option>"; $tree->init($categorys); $string .= $tree->get_tree(0, $str); include $this->view('create_html_show'); } }