pluginupdate.php

来自「一款基于PHP的网络日记程序。WikyBlog支持:多用户的 BLOG」· PHP 代码 · 共 100 行

PHP
100
字号
<?phpdefined('WikyBlog') or die("Not an entry point...");global $page,$dbInfo,$pageOwner,$jsNum,$dbObject;$dbObject->links['Create Plugin'] = '/Admin/'.$pageOwner['username'].'/CreatePlugin';$dbObject->links['Data Types'] = '/Admin/'.$pageOwner['username'].'/ManageTypes';$page->displayTitle = 'Update Plugin';if( $_SESSION['userlevel'] !== 4){	$page->contentA[$page->displayTitle] = 'You must be an administrator to access this page.';	return;}includeFile('admin/PluginCreateTool.php');class updatePlugin extends createPluginTool{	var $pluginClass;		function updatePlugin(){		global $page;				$this->createPluginTool();				switch($page->userCmd){			case 'update':				$this->doUpdate();			break;						case 'check':				if( $this->checkAll(false) ){					message('Your plugin is ready for update.');				}			default:				$this->editForm();			break;		}	}			function initiateEdit(){		$this->pluginClass = wbData::getClass($_GET['plugin'],true);		$methods = get_class_methods($this->pluginClass);		$methods = array_flip($methods);				if( isset($methods['creationvalues']) || isset($methods['creationValues']) ){			$eval = '$temp = '.$this->pluginClass.'::creationValues();';			eval($eval);			return $temp;		}		message('Sorry, the creation values were not saved for this data type.');	}		function editForm(){		global $page,$dbObject,$dbInfo,$pageOwner;				if( isset($_POST['plugin']) ){			$args =& $_POST;		}else{			$args = $this->initiateEdit();		}		$dbObject->links['Update Plugin'] = $page->formAction = '/Admin/'.$pageOwner['username'].'/UpdatePlugin?plugin='.$args['plugin'];				ob_start();				echo '<table style="width:100%" cellspacing="0" border="0" class="tableRows">';		echo '<tr>';			echo '<td>';			echo 'Plugin Name: ';			echo '</td>';			echo '<td>';			echo '<input type="text" name="plugin" value="'.$args['plugin'].'" readonly="readonly" /> &nbsp; ';			echo '</td>';		echo '</tr>';				$this->form($args);				echo '<div style="text-align:right">';		echo ' <input type="submit" name="cmd" value="Check" />';		echo ' &nbsp; ';		echo ' <input type="submit" name="cmd" value="Update" />';		echo '</div>';				$this->formFooter();		$page->contentA['Update Plugin'] = wb::get_clean();	}		function doUpdate(){				if( !$this->checkAll(false) ){			return;		}		$plugin = parent::createScripts();		$this->addToDB($plugin);	}}new updatePlugin();

⌨️ 快捷键说明

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