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

📄 postnukemodcms.php

📁 flashget43的源代码 一个比较常用的下载程序
💻 PHP
字号:
<?php
	$old = ini_get('include_path');

	ini_set('include_path', realpath(dirname(__FILE__) . '/../../../../'));

	include_once('includes/pnAPI.php');
	pnInit();

	ini_set('include_path', $old);

	class PNUsersRS {
		var $result;
		var $numRows = 0;
		var $currRow = 0;

		function PNUsersRS($result = null) {
			$this->result = array_values($result);
			if($result) $this->numRows = sizeof($result);
		}

		function hasNext() {
			return ($this->result && ($this->numRows) > $this->currRow);
		}

		function next() {
			if($this->hasNext()) {
				return array(
					'id' => $this->result[$this->currRow]['uid'],
					'login' => $this->result[$this->currRow++]['uname']
				);
			} else {
				return null;
			}
		}
	}

	class PostNukeCMS {
		function PostNukeCMS() {
		}

		function isLoggedIn() {
			return pnUserLoggedIn()?pnUserGetVar('uid'):null;
		}

		function login($login, $password) {
		    if(pnUserLogIn($login, $password, 0)) return pnUserGetVar('uid');

			return null;
		}

		function logout(){
			//pnUserLogOut();
		}
	
		function getUser($userid) {
			$u = null;

		    if(pnUserGetVar('uid', $userid)) {
				$u = array(
					'id' => $userid,
					'login' => pnUserGetVar('uname', $userid)
				);

				$u['roles'] = $GLOBALS['fc_config']['liveSupportMode']?ROLE_CUSTOMER:ROLE_USER;
			    if(pnSecAuthAction(0, 'Modules::', '::', ACCESS_ADMIN)) $u['roles'] = ROLE_ADMIN;
			}

			return $u;
		}

		function getUsers() {
			return new PNUsersRS(pnUserGetAll());
		}

		function getUserProfile($userid) {
			if($userid == SPY_USERID) return null;

			if($user = $this->getUser($userid)) {
				return (($id = $this->isLoggedIn()) && ($id == $userid))?"../../user.php?op=edituser":"../../user.php?op=userinfo&uname={$user['login']}";
			} else {
				return null;
			} 
		}

		function userInRole($userid, $role) {
			if($user = $this->getUser($userid)) {
				return ($user['roles'] & $role) != 0;
			}
			return false;
		}
		
		function getGender($userid) {
     		// 'M' for Male, 'F' for Female, NULL for undefined
	    	return NULL;        
    	}
	}

	$GLOBALS['fc_config']['cms'] = new PostNukeCMS();

	$GLOBALS['fc_config']['base'] = 'modules/FlashChat/';

	//clear 'if moderator' message
	foreach($GLOBALS['fc_config']['languages'] as $k => $v) {
		$GLOBALS['fc_config']['languages'][$k]['dialog']['login']['moderator'] = '';
	}
?>

⌨️ 快捷键说明

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