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

📄 pluginsql.php

📁 一款基于PHP的网络日记程序。WikyBlog支持:多用户的 BLOG
💻 PHP
字号:
<?php//	Thing I'd like this script to do..//		1)	Create the SQL array.. similar to installSQL.php ..this would be used for installing and updating//		2)	defined('WikyBlog') or die("Not an entry point...");global $page,$pageOwner,$dbObject;$dbObject->links['Plugins'] = '/Admin/'.$pageOwner['username'].'/Plugins';$dbObject->links['Plugin SQL'] = $page->formAction = '/Admin/'.$pageOwner['username'].'/PluginSQL';$dbObject->links['?'] = 'Plugin SQL';$page->displayTitle = 'Plugin SQL';if( $_SESSION['userlevel'] !== 4){	$page->contentA[$page->displayTitle] = 'You must be an administrator to access this page.';	return;}if( !defined('wbDebug') || wbDebug !== true){	message('This installation is not set up for development and some features may be disabled for security reasons.				To enable these features, open your wiki.php file and uncomment or add the line <pre>	"define(\'wbDebug\',true);"</pre>				<b>Note:</b> This should not be done in systems accessible via the internet.');} class adminDevPlugins{		function adminDevPlugins(){		global $page,$dbInfo,$rootDir;				ob_start();						switch( $page->userCmd ){			case 'create sql data':				$this->getData();			break;			default:				$this->start();			break;		}						$page->contentA['Plugin SQL'] = wb::get_clean();	}		function start(){		global $wbTablePrefix;				//skip tables that are already part of wikyblog				$skipTables = array('all_files'=>1,'all_search'=>1,'all_history'=>1,'comments'=>1,'config'=>1,'help'=>1,'maps'=>1,'pages'=>1,'templates'=>1,'users'=>1,'workgroup'=>1);				$query = 'SHOW TABLE STATUS ';		if( !empty($wbTablePrefix) ){			$query .= ' LIKE "'.wbDB::like($wbTablePrefix).'%"';		}		$result = wbDB::runQuery($query);		//showRows($result);		while($row = mysql_fetch_assoc($result)){			$table = $row['Name'];			if( strlen($wbTablePrefix) > 0 ){				$pos = strpos($table,$wbTablePrefix);				if( $pos === 0){					$table = substr($table,strlen($wbTablePrefix));				}			}			if( isset($skipTables[$table]) ){				continue;			}						$tables[] = $table;		}				echo '<p>';		echo 'This feature should be used by plugin developers to create the required installSQL.php file.';		echo '</p>';				echo '<table cellpadding="7"><tr><td>';			echo '<p>Table Creation and Maintenance</p>';			echo '<p>Select the table(s) from the list that are integral to your plugin.</p>';		echo '</td><td>';			echo '<select name="tables[]" multiple="multiple">';			if( count($tables) === 0){				message('All of the tables found in this database are already in use by the WikyBlog software. You must first create a table for your plugin.');				echo '<option value="" > ---- ';			}else{				foreach( $tables as $table){					echo '<option value="'.htmlspecialchars($table).'" >'.htmlspecialchars($table);				}			}			echo '</select>';			echo '<p>';			echo '<input type="submit" name="cmd" value="Create SQL Data" />';			echo '</p>';		echo '</td></tr></table>';			}		//	//	Database Info functions	//	function getData(){		global $wbTablePrefix,$packageVersion;				if( !isset($_POST['tables']) || !is_array($_POST['tables']) ){			message('Please select table(s).');			return false;		}				includeFile('installDB.php');		$dbData = getDatabaseArray($wbTablePrefix,false,$_POST['tables']);				$text = '<'.'?'."php\n";		$text .= "//\n";		$text .= "//\t\tWikyBlog Generated File\n";		$text .= "//\t\tpackage version ".$packageVersion."\n";		$text .= "//\t\tadminPluginSQL.php\n";				$text .= "//\t\t********************************************************************************************************\n";		$text .= "//\t\tThis file contains a serialized array used to create/alter database tables used by the WikyBlog software\n";		$text .= "//\t\tDon't edit anything in this file!\n";		$text .= "//\n\n";		$text .= 'defined(\'WikyBlog\') or die(\'Not an entry point...\');';		$text .= "\n\n";		$text .= '$dbData = \'';		$text .= addcslashes(serialize($dbData),"\'");		$text .= '\';';		$text .= "\n\n\n";				echo '<p>Save this data in your plugin\'s <tt>installSQL.php</tt> file.</p>';		echo '<textarea style="width:100%" rows="15" wrap="off">';		echo htmlspecialchars($text);		echo '</textarea>';				return false;	}}new adminDevPLugins();

⌨️ 快捷键说明

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