⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 back_private_function.php

📁 一个文章管理系统,很不错的,php语言开发,运行平台:windows和linux
💻 PHP
字号:
<?php
if(!defined('ISELOOK')) exit('Access denied.Sorry, you can not access this file directly.');

//检查管理员权限
function check_admin_purview($min_flag){
	global $el,$db,$lang,$doaction;
	global $sys_rs_admin;
	if ($sys_rs_admin['a_flag']>$min_flag) {
		show_msg($lang['sys_info'],$lang['admin_err_str1'],0,'','',$lang['his_back'],$lang['cmdback']);//'index.php?action=index_main'
	}
}

//获取网站设置
function get_site_info(){
	global $el,$db,$lang,$doaction;
	global $settings,$uploadsetting,$s_version;
	if (($ss=get_settings_rs()) || exit('Settings data is not existed!')) {
		$s_setting = explode('|||',$ss['s_setting']);
		$site_info = explode('|',$s_setting[0]);
		$settings=get_settings_arr($ss,0);
		for ($i=0;$i<count($site_info);$i++) {
			$settings[$i]=$site_info[$i];
		}
		$uploadsetting = explode('|',$s_setting[1]);
		$s_version=explode('|',$ss['s_version']);	//$s_version:http://www.elook.net.cn/|Elook Article System.PHP|V1.0.0|E路文章系统PHP
	}
}

function page_info($pagesize){
	global $page_size,$page,$total,$page_count,$offset,$p;
	$page_size=$pagesize;
	if ($page=="" or $page<1)
		$page=1;
	 $page_count=ceil($total/$page_size);
	if ($page>$page_count)
		$page=$page_count;
	$offset=$page;
	if( $offset < 1 ) $offset = 1;
}

//checklogin 判断是否已登录
function checklogin(){
	global $islogin;
	if ( $islogin == 0 ){
		header("Location:login.php");
		exit;
	}
}

//show_msg 返回成功或失败信息.
//参数说明:title 标题,messanger信息内容,suc 0 失败,1 成功
//link显示链接地址,text 链接文字,url 按钮点击进入的地址,button按钮文字
function show_msg($title,$messanger,$suc=0,$link='',$text='',$url='',$button='',$dispfooter=true){
	global $lang;
	$showmsg = $messanger;
	if ($button==''){
		$button=$lang['comback'];
	}
	if ($suc==0){
		$suc_tyle=$lang['fail'];
		}else{
		$suc_tyle=$lang['suc'];
	}
	if ($link!='' && $text!=''){
		$link='<a href="'.$link.'" target="_blank">'.$text.'</a>';
	}
	require_once printout('show_msg');
	if ($dispfooter==true) {
		footer();
	}elseif($db){
		$db->close();
	}
	exit;
}

//更新所有版面层次结构。
function forum_board_init($parentid){
	global $db,$lang,$el,$int_orders;
	if($parentid==0){
		$int_orders=1;
		$db->query("update {$el}class set c_depth=0,c_parentstr='0' where c_parentid=0");
	}
	$query=$db->query('select c_id,c_rootid,c_parentstr,c_depth,c_child,c_name from '.$el.'class where c_parentid='.$parentid.' order by c_rootid,c_orders');
	while($forum = $db->fetch_array($query)) {
		if($forum['c_parentstr']!='0'){
			$parentstr=$forum['c_parentstr'].','.$forum['c_id'];
		}else{
			$parentstr=$forum['c_id'];
		}
		$db->query("update ".$el."class set c_depth=".(intval($forum['c_depth'])+1).",c_parentstr='".$parentstr."',c_rootid=".intval($forum['c_rootid'])."  where c_parentid=".intval($forum['c_id']));
		$res=$db->query("select count(*) from ".$el."class where c_parentid=".intval($forum['c_id']));
		$child=@mysql_result($res, 0,0);
		$db->query("update ".$el."class set c_child=".intval($child).",c_orders=".intval($int_orders)."  where c_id=".intval($forum['c_id']));
		$int_orders+=1;
		forum_board_init(intval($forum['c_id']));
	}	
}

//更新版面排序模块
//新建栏目板面,取一个没使用的最小编号做栏目c_id
function get_newboardid(){
	global $db,$el;
	$boardid = array();
	$query=$db->query('select c_id from '.$el.'class order by c_id');
	while($board = $db->fetch_array($query)){
		$boardid[]=$board['c_id'];
	}
	$init_boardid=end($boardid)+1;
	/*
	if ($init_boardid==444 || $init_boardid==777){
		$init_boardid+=1;
	}
	*/
	for($i=1; $i < end($boardid); $i++){
		if (!in_array($i,$boardid)){// && $i !=444 && $i!=777){
			$init_boardid=$i;
			break;
		}
	}
	return $init_boardid;
}

//新建栏目顶级分类的时候,获取一个没使用的最小编号c_rootid
function get_newrootid(){
	global $db,$el;
	$rootid = array();
	$query=$db->query('select c_rootid from '.$el.'class order by c_rootid');
	while($board = $db->fetch_array($query)){
		$rootid[]=$board['c_rootid'];
	}
	$init_root=end($rootid)+1;
	for($i=1; $i < end($rootid); $i++){
		if (!in_array($i,$rootid)){
			$init_root=$i;
			break;
		}
	}
	return $init_root;
}
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -