예제 #1
0
<?php

/** Gives access to the FOGCore variables. */
require_once '../commons/base.inc.php';
//$FOGCore = $GLOBALS['FOGCore'];
/** Get's the active plugin set during load up. */
$plugin = unserialize($_SESSION["fogactiveplugin"]);
/** If it can't get anything from it, fail out. */
if ($plugin == null) {
    die("Unable to determine plugin details");
}
/** Print the information you want to the screen. */
//Set's the title
$FOGCore->title = _('Plugin') . ': ' . $plugin->getName();
/** Print the description. */
print "\n\t\t\t<p>" . _('Plugin Description') . ': ' . $plugin->getDesc() . '</p>';
// If the plugin is installed run these items. Only if there's anything to do.
if ($_REQUEST['basics'] == 1) {
    $FOGCore->setSetting('FOG_PLUGIN_CAPONE_DMI', $_REQUEST['dmifield']);
    $FOGCore->setSetting('FOG_PLUGIN_CAPONE_SHUTDOWN', $_REQUEST['shutdown']);
}
if ($_REQUEST['addass'] == 1) {
    $Capone = new Capone(array('imageID' => $_REQUEST['image'], 'osID' => $FOGCore->getClass('Image', $_REQUEST['image'])->get('osID'), 'key' => $_REQUEST['key']));
    $Capone->save();
}
if ($_REQUEST['kill'] !== null) {
    $Capone = new Capone($_REQUEST['kill']);
    $Capone->destroy();
}
print "\n\t\t\t" . '<p>This is just an example of information pushed out if the plugin is installed!</p>';
 public function installed_post()
 {
     $plugin = unserialize($_SESSION['fogactiveplugin']);
     if ($_REQUEST['install'] == 1) {
         if ($this->getClass(ucfirst($plugin->getName()) . 'Manager')->install($plugin->getName())) {
             $Plugin = current($this->getClass('PluginManager')->find(array('name' => $plugin->getName())));
             $Plugin->set('installed', 1)->set('version', 1);
             if ($Plugin->save()) {
                 $this->FOGCore->setMessage(_('Plugin Installed!'));
             } else {
                 $this->FOGCore->setMessage(_('Plugin Installation Failed!'));
             }
         } else {
             $this->FOGCore->setMessage(_('Failed to install Plugin!'));
         }
         if ($_REQUEST['sub'] == 'install') {
             $_REQUEST['sub'] = 'installed';
         }
         $this->FOGCore->redirect('?node=' . $_REQUEST['node'] . '&sub=' . $_REQUEST['sub'] . '&run=' . $_REQUEST['run']);
     }
     if ($_REQUEST['basics']) {
         $this->FOGCore->setSetting('FOG_PLUGIN_CAPONE_DMI', $_REQUEST['dmifield']);
         $this->FOGCore->setSetting('FOG_PLUGIN_CAPONE_SHUTDOWN', $_REQUEST['shutdown']);
     }
     if ($_REQUEST['addass']) {
         $Capone = new Capone(array('imageID' => $_REQUEST['image'], 'osID' => $this->getClass('Image', $_REQUEST['image'])->get('osID'), 'key' => $_REQUEST['key']));
         $Capone->save();
     }
     if ($_REQUEST['kill']) {
         $Capone = new Capone($_REQUEST['kill']);
         $Capone->destroy();
     }
     $this->FOGCore->setMessage('Plugin updated!');
     $this->FOGCore->redirect($this->formAction);
 }