k' => $rank)); return $r; } /* * @param int $page 页数 * @param int $pagesize 每页显示数量 * @param bool $desc 排序TRUE倒序 FALSE升序 * @return mixed * 遍历所有主题tid */ function page_find($page = 1, $pagesize = 20, $desc = TRUE) { $orderby = TRUE == $desc ? -1 : 1; $arrlist = page__find($cond = array(), array('tid' => $orderby), $page, $pagesize, 'tid', array('tid','rank')); return $arrlist; } /* * @param $fid 版块fid 支持数组 $fid = array(1,2,3) * @param int $page 页数 * @param int $pagesize 每页显示数量 * @param bool $desc 排序TRUE降序 FALSE升序 * @return mixed 返回遍历tid数据 */ function page_find_by_fid($fid, $page = 1, $pagesize = 1000, $desc = TRUE) { $orderby = TRUE == $desc ? -1 : 1; $arrlist = page__find($cond = array('fid' => $fid), array('rank' => $orderby), $page, $pagesize, 'tid', array('tid','rank')); return $arrlist; } /* * @param $tid 主题tid * @return bool 返回FALSE失败 TRUE成功 */ function page_delete($tid) { if (empty($tid)) return FALSE; $r = page__delete(array('tid' => $tid)); return $r; } function page_count() { $n = page__count(); return $n; } /* * @param $fid 版块fid * @return mixed 返回版块下主题数量 */ function page_fid_count($fid) { $n = page__count(array('fid' => $fid)); return $n; } ?>tpw_complete': // 重置密码 $pre .= $default_pre .= 'user_resetpw_complete.htm'; break; case 'user_comment': // 我的首页评论 $pre .= $default_pre .= 'user_comment.htm'; break; case 'single_page': // 单页 $pre .= $default_pre .= 'single_page.htm'; break; case 'search': // 搜索 $pre .= $default_pre .= 'search.htm'; break; case 'operate_sticky': // 置顶 $pre .= $default_pre .= 'operate_sticky.htm'; break; case 'operate_close': // 关闭 $pre .= $default_pre .= 'operate_close.htm'; break; case 'operate_delete': // 删除 $pre .= $default_pre .= 'operate_delete.htm'; break; case 'operate_move': // 移动 $pre .= $default_pre .= 'operate_move.htm'; break; case '404': $pre .= $default_pre .= '404.htm'; break; case 'read_404': $pre .= $default_pre .= 'read_404.htm'; break; case 'list_404': $pre .= $default_pre .= 'list_404.htm'; break; default: // 首页 $pre .= $default_pre .= theme_mode_pre(); break; } if ($config['theme']) { $conffile = APP_PATH . 'view/template/' . $config['theme'] . '/conf.json'; $json = is_file($conffile) ? xn_json_decode(file_get_contents($conffile)) : array(); } // 加载绑定ID安装风格 !empty($json['installed']) and $path_file = APP_PATH . 'view/template/' . $config['theme'] . '/htm/' . ($id ? $id . '_' : '') . $pre; // 加载安装风格 (empty($path_file) || !is_file($path_file)) and $path_file = APP_PATH . 'view/template/' . $config['theme'] . '/htm/' . $pre; // 主风格下可安装多个子风格 if (!empty($config['theme_child']) && is_array($config['theme_child'])) { foreach ($config['theme_child'] as $theme) { if (empty($theme) || is_array($theme)) continue; // 加载绑定ID安装风格 $path_file = APP_PATH . 'view/template/' . $theme . '/htm/' . ($id ? $id . '_' : '') . $pre; // 加载安装风格 !is_file($path_file) and $path_file = APP_PATH . 'view/template/' . $theme . '/htm/' . $pre; } } // 风格不存在加载适配端 !is_file($path_file) and $path_file = APP_PATH . ($dir ? 'plugin/' . $dir . '/view/htm/' : 'view/htm/') . $default_pre; return $path_file; } // 依据模式返回适配文件 function theme_mode_pre($type = 0) { global $config; // 网站模式 $mode = $config['setting']['website_mode']; $pre = ''; // 首页文件前缀 if (1 == $mode) { // 门户模式 $pre .= 2 == $type ? 'portal_category.htm' : 'portal.htm'; } elseif (2 == $mode) { // 扁平模式 $pre .= 2 == $type ? 'flat_category.htm' : 'flat.htm'; } else { // 自定义模式 $pre .= 2 == $type ? 'index_category.htm' : 'index.htm'; } return $pre; } ?>