Exemplo n.º 1
0
function displayPluginContent()
{
    $curPlugin = new Plugins($_GET['pluginID']);
    if (file_exists($curPlugin->get_filename())) {
        include_once $curPlugin->get_filename();
        $className = $curPlugin->get_class_name();
        $pluginClass = new $className();
        return $pluginClass->get_content();
    } else {
        return "The file does not exist.";
    }
    /*$phpFile = $curPlugin->get_filename();
    	$fh = fopen($phpFile, 'r');
    	$data = fread($fh, filesize($phpFile));
    	fclose($fh);
    	
    	if (!preg_match("/echo/i", $data) && !preg_match("/print/i", $data) )
    	{
    		if (class_exists($className))
    		{
    			$pluginClass = new $className();
    		}
    		else {return "Your class, \"".$className."\", taken from the database does not exist in your php file.";}
    		
    		if(method_exists($pluginClass, 'get_content')) {
    		
    			if($pluginClass->get_content() !='')
    			{
    				return $pluginClass->get_content();
    			}
    		}
    		else{return "No Content to retrieve";}
    	}
    	else {return "You cannot echo or print your content out, you must return a value";}*/
}
Exemplo n.º 2
0
function updatePluginConfig()
{
    global $tool, $propertyForm;
    if (!isset($_POST['id'])) {
        echo "The configuration must contain the hidden input type, 'id' with values {$id}. <input type='hidden' name='id' value=\".{$id}.\"></input>";
        return false;
    } else {
        $curPlugin = new Plugins($_POST['id']);
        include_once $curPlugin->get_filename();
        $className = $curPlugin->get_class_name();
        $pluginClass = new $className();
        $postValues = $_POST;
        $values = array();
        foreach ($postValues as $id => $value) {
            $pos = strpos($id, "Plugin_");
            if ($pos === 0) {
                $values = $postValues;
            }
        }
        if ($pluginClass->update_config($values)) {
            $status = "success";
            echo "<script language='javascript'>LoadPage(\"configurations.php?action=plugins&mode=edit&update=" . $status . "\", 'settingsInfo');</script>";
        } else {
            $propertyForm->error("Warning: Failed to update plugins. Reason: plugin update is not returning a true value");
        }
    }
}