示例#1
0
 /**
  * @copydoc Form::execute()
  */
 function execute($request)
 {
     parent::execute($request);
     // Retrieve the temporary file.
     $user = $request->getUser();
     $temporaryFileId = $this->getData('temporaryFileId');
     $temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO');
     $temporaryFile = $temporaryFileDao->getTemporaryFile($temporaryFileId, $user->getId());
     $pluginHelper = new PluginHelper();
     $errorMsg = null;
     $pluginDir = $pluginHelper->extractPlugin($temporaryFile->getFilePath(), $temporaryFile->getOriginalFileName(), $errorMsg);
     $notificationMgr = new NotificationManager();
     if ($pluginDir) {
         if ($this->_function == PLUGIN_ACTION_UPLOAD) {
             $pluginVersion = $pluginHelper->installPlugin($pluginDir, $errorMsg);
             if ($pluginVersion) {
                 $notificationMgr->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('manager.plugins.installSuccessful', array('versionNumber' => $pluginVersion->getVersionString(false)))));
             }
         } else {
             if ($this->_function == PLUGIN_ACTION_UPGRADE) {
                 $pluginVersion = $pluginHelper->upgradePlugin($request->getUserVar('category'), $request->getUserVar('plugin'), $pluginDir, $errorMsg);
                 if ($pluginVersion) {
                     $notificationMgr->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('manager.plugins.upgradeSuccessful', array('versionString' => $pluginVersion->getVersionString(false)))));
                 }
             }
         }
     } else {
         $errorMsg = __('manager.plugins.invalidPluginArchive');
     }
     if ($errorMsg) {
         $notificationMgr->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_ERROR, array('contents' => $errorMsg));
         return false;
     }
     return true;
 }
示例#2
0
 function display($tpl = null)
 {
     $this->order_id = JFactory::$application->input->getInt('order_id');
     $orderModel = new BookProModelOrder();
     $this->orderComplex = $orderModel->getComplexItem($this->order_id);
     $this->order = $this->orderComplex->order;
     $this->customer = $this->orderComplex->customer;
     $this->orderinfo = $this->orderComplex->orderinfo;
     $this->passengers = $this->orderComplex->passengers;
     $this->tour = $this->orderComplex->tour;
     $doc = JFactory::getDocument();
     $doc->setTitle("Payment Step");
     $dispatcher = JDispatcher::getInstance();
     require_once JPATH_SITE . '/administrator/components/com_bookpro/helpers/plugin.php';
     $payment_plugins = PluginHelper::getPluginsWithEvent('onBookproGetPaymentPlugins');
     $plugins = array();
     if ($payment_plugins) {
         foreach ($payment_plugins as $plugin) {
             $results = $dispatcher->trigger("onBookproGetPaymentOptions", array($plugin->element, $this->order));
             if (in_array(true, $results, true)) {
                 $plugins[] = $plugin;
             }
         }
     }
     if (count($plugins) == 1) {
         $plugins[0]->checked = true;
         ob_start();
         $this->getPaymentForm($plugins[0]->element);
         $html = json_decode(ob_get_contents());
         ob_end_clean();
         $this->assign('payment_form_div', $html->msg);
     }
     $this->assign('plugins', $plugins);
     parent::display($tpl);
 }
示例#3
0
 /**
  * Adds all necessary navigation items.
  * This also calls plugins to add additional items where needed.
  */
 protected static function initNavigation()
 {
     $items = array('Start' => './index.php', 'Forums' => './forums.php');
     foreach ($items as $title => $url) {
         $item = new NavigationItem($title, $url);
         self::addNavigationItem($item);
     }
     $pluginItems = PluginHelper::delegate('__onCreateNavigation');
     foreach ($pluginItems as $package => $item) {
         if ($item instanceof NavigationItem) {
             self::addNavigationItem($item);
         } else {
             if (is_array($item)) {
                 foreach ($item as $i) {
                     if ($i instanceof NavigationItem) {
                         self::addNavigationItem($i);
                     } else {
                         Functions::log(Functions::LOG_WARNING, 'Plugin ' . $package . ' supplied invalid navigation item.');
                     }
                 }
             } else {
                 Functions::log(Functions::LOG_WARNING, 'Plugin ' . $package . ' supplied invalid navigation item.');
             }
         }
     }
 }
示例#4
0
 /**
  * Only returns plugins that have a specific event
  * 
  * @param $eventName
  * @param $folder
  * @return array of JTable objects
  */
 static function getPluginsWithEvent($eventName, $folder = 'bookpro')
 {
     $return = array();
     if ($plugins = PluginHelper::getPlugins($folder)) {
         foreach ($plugins as $plugin) {
             if (PluginHelper::hasEvent($plugin, $eventName)) {
                 $return[] = $plugin;
             }
         }
     }
     return $return;
 }
 protected function getCellText($data, $isAlternate)
 {
     $volumeControl = $this->configuration->isVolumeControl();
     $width = $volumeControl ? "240" : "220";
     $playerFile = $volumeControl ? "dewplayer-vol.swf" : "dewplayer.swf";
     $playerPath = PluginHelper::getPluginBaseUrl() . "dewplayer/" . $playerFile;
     $bgColor = $isAlternate ? $this->configuration->getAltRowColor() : $this->configuration->getPrimaryRowColor();
     $playerCode = $this->configuration->getPlayerCode();
     $playerCode = str_replace("%1", $width, $playerCode);
     $playerCode = str_replace("%2", $bgColor, $playerCode);
     $playerCode = str_replace("%3", $data->getUrlPath(), $playerCode);
     $playerCode = str_replace("%4", $playerPath, $playerCode);
     return $playerCode . "<br/>";
 }
 protected function getCellText($data, $isAlternate)
 {
     $html = "<span>";
     $html .= "<a href=\"" . $data->getUrlPath() . "\" title=\"Download Audio File\" target=\"_blank\" class=\"jce_file_custom\">";
     $html .= "<img src=\"" . PluginHelper::getPluginBaseUrl();
     if ($isAlternate) {
         $html .= $this->configuration->getAltDownloadImage();
     } else {
         $html .= $this->configuration->getDownloadImage();
     }
     $html .= "\" alt=\"download\" />";
     $html .= "</a>";
     $html .= "</span>";
     return $html;
 }
示例#7
0
 private function getPlugins()
 {
     $dispatcher = JDispatcher::getInstance();
     AImporter::helper('plugin');
     $payment_plugins = PluginHelper::getPluginsWithEvent('onBookproGetPaymentPlugins');
     $plugins = array();
     if ($payment_plugins) {
         foreach ($payment_plugins as $plugin) {
             $results = $dispatcher->trigger("onBookproGetPaymentOptions", array($plugin->element, ''));
             if (in_array(true, $results, true)) {
                 $plugins[] = $plugin;
             }
         }
     }
     if (count($plugins) == 1) {
         $plugins[0]->checked = true;
         ob_start();
         $this->getPaymentForm($plugins[0]->element);
         $html = json_decode(ob_get_contents());
         ob_end_clean();
         $this->assign('payment_form_div', $html->msg);
     }
     $this->assign('plugins', $plugins);
 }
示例#8
0
<?php

require 'base.php';
$categories = ForumCategory::getAllCategories();
Templates::assign('categories', $categories);
PluginHelper::delegate('__onPageDisplay', array($page));
Templates::display('forums');
示例#9
0
<?php

require '../base.php';
ob_start();
function __autoload($c)
{
    require LIB . 'acp/' . basename($c) . '.php';
}
if (!$userManager->loggedIn() || !$user->isAdmin()) {
    echo ErrorMessage::setText('You are not allowed to view this page.', true);
}
$plugin = PluginHelper::getPluginByPackage($_GET['package']);
if (!$plugin instanceof Plugin) {
    echo AdminErrorMessage::setText('Plugin does not exist.', true);
}
include 'template/header.php';
echo '
		<h1>' . $plugin->getTitle() . ' Settings</h1>
	';
$pluginSettings = $plugin->__onCreateSettings();
if (!$pluginSettings instanceof SettingsContainer) {
    echo InfoMessage::setText('This plugin does not have any settings.');
} else {
    $pluginSettingsPreferences = $pluginSettings->__onCreate($plugin, $db);
    if (!is_array($pluginSettingsPreferences) || count($pluginSettingsPreferences) < 1) {
        echo InfoMessage::setText('This plugin does not have any settings.');
    } else {
        if (isset($_POST['submit'])) {
            if ($pluginSettings->__onSave()) {
                echo SuccessMessage::setText('Settings saved.');
            } else {
 /**
  * Install or upgrade a plugin
  */
 function installPlugin($args, $request, $isUpgrade = false)
 {
     $plugin = $this->_getSpecifiedPlugin($request);
     $notificationMgr = new NotificationManager();
     $user = $request->getUser();
     $dispatcher = $request->getDispatcher();
     // Download the file and ensure the MD5 sum
     $fileManager = new FileManager();
     $destPath = tempnam(sys_get_temp_dir(), 'plugin');
     $fileManager->copyFile($plugin->getReleasePackage(), $destPath);
     if (md5_file($destPath) !== $plugin->getReleaseMD5()) {
         fatalError('Incorrect MD5 checksum!');
     }
     // Extract the plugin
     import('lib.pkp.classes.plugins.PluginHelper');
     $pluginHelper = new PluginHelper();
     $errorMsg = null;
     if (!($pluginDir = $pluginHelper->extractPlugin($destPath, $plugin->getProduct() . '-' . $plugin->getVersion(), $errorMsg))) {
         $notificationMgr->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_ERROR, array('contents' => $errorMsg));
     }
     // Install the plugin
     if (!$isUpgrade) {
         if (!($pluginVersion = $pluginHelper->installPlugin($pluginDir, $errorMsg))) {
             $notificationMgr->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_ERROR, array('contents' => $errorMsg));
         }
     } else {
         if (!($pluginVersion = $pluginHelper->upgradePlugin($plugin->getCategory(), $plugin->getProduct(), $pluginDir, $errorMsg))) {
             $notificationMgr->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_ERROR, array('contents' => $errorMsg));
         }
     }
     if (!$errorMsg) {
         $notificationMgr->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('manager.plugins.upgradeSuccessful', array('versionString' => $pluginVersion->getVersionString(false)))));
     }
     return $request->redirectUrlJson($dispatcher->url($request, ROUTE_PAGE, null, 'management', 'settings', array('website'), null, 'plugins'));
 }
示例#11
0
<?php

$pageName = htmlspecialchars(basename($_GET['page']));
unset($_GET['page']);
include 'base.php';
// If custom page
if (substr($pageName, -4) == '.php') {
    unset($_GET[$token->getTokenName()]);
    unset($_POST[$token->getTokenName()]);
    $pageCreators = PluginHelper::delegate('__onCreatePage', array(substr($pageName, 0, strlen($pageName) - 4), $_GET));
    if (count($pageCreators) == 1) {
        // Get single page creator
        foreach ($pageCreators as $p) {
            $pageCreator = $p;
        }
        // Does it implement PageCreator?
        if (!$pageCreator instanceof PageCreator) {
            Functions::log(Functions::LOG_ERROR, get_class($pageCreator) . ' does not implement interface PageCreator');
        } else {
            Templates::assign('pageTitle', $pageCreator->getTitle());
            Templates::assign('customContent', $pageCreator->getContent());
            Templates::display('custom');
        }
        exit;
    } else {
        if (count($pageCreators) > 1) {
            // CLASH OF PLUGINS!!
            $errorMessage = 'Page Creator conflict for page ' . $pageName . ':<br /><br /><ul>';
            foreach ($pageCreators as $package => $pageCreator) {
                $errorMessage .= '<b>' . $package . '</b>: ' . get_class($pageCreator);
            }
示例#12
0
文件: base.php 项目: GIDIX/quicktalk
// Classes
require LIB . 'base/InfoMessage.php';
require LIB . 'base/AdminInfoMessage.php';
require LIB . 'themes/scss/scss.inc.php';
// Auto-Loader
require LIB . 'common/ClassLoader.php';
// Connect to database
$db = new Database($DBCRED['host'], $DBCRED['username'], $DBCRED['password'], $DBCRED['database']);
// Unset $DBCRED for security reasons
unset($DBCRED);
$userManager = new UserManager();
$user = $userManager->getUser();
// Tokens
$token = new Token();
$token->_('user.php', 'GET', RANK_USER);
$token->_('viewforum.php', 'GET', RANK_USER);
$token->_('viewtopic.php', 'GET', RANK_USER);
if (isset($disableTokenHere) && is_array($disableTokenHere)) {
    foreach ($disableTokenHere as $ex) {
        $token->_($ex, 'GET, POST', RANK_USER);
        $token->_($ex, 'GET, POST', RANK_ADMIN);
    }
}
// Plugins
$activePlugins = array();
PluginHelper::loadActivePlugins();
PluginHelper::delegate('__onCreate', array($db, $user));
Templates::init();
Templates::assignVars(array('pageTitle' => Config::get('page_title')));
$token->check('POST', $_POST);
$token->check('GET', $_GET);
示例#13
0
    ?>
class="active"<?php 
}
?>
><?php 
echo ACPHeaderT::get('plugins');
?>
</a></li>

						<li class="heading"><?php 
echo ACPHeaderT::get('plugin_settings');
?>
</li>

						<?php 
$installedPlugins = PluginHelper::getListedPlugins();
if (count($installedPlugins) < 1) {
    echo '<li class="nothing">' . ACPHeaderT::get('no_plugins_active') . '</li>';
} else {
    foreach ($installedPlugins as $installedPlugin) {
        echo '
										<li>
											<a href="./pluginSettings.php?package=' . $installedPlugin->getPackageName() . '" ' . ($page == 'pluginSettings.php' && $_GET['package'] == $installedPlugin->getPackageName() ? 'class="active"' : '') . '>
												' . $installedPlugin->getTitle() . '
											</a>
										</li>
									';
    }
}
?>
						
示例#14
0
			</div>
		';
}
if (count($installedPlugins) < 1) {
    echo InfoMessage::setText(ACPPluginsT::get('no_plugins_active'));
}
echo '
		</div>

		<br />
		
		<h1>' . ACPPluginsT::get('available_plugins') . '</h1>

		<div class="plugins">
	';
$availablePlugins = PluginHelper::getAvailablePlugins();
foreach ($availablePlugins as $plugin) {
    $parsedURL = parse_url($plugin->getURL());
    $url = is_array($parsedURL) ? $plugin->getURL() : '#';
    echo '
			<div class="item">
				<div class="meta">
					<h2>' . htmlspecialchars($plugin->getTitle()) . ' <small>' . GeneralT::getFormat('by', '<a href="' . $url . '" target="_blank">' . htmlspecialchars($plugin->getAuthor()) . '</a>') . '</small></h2>

					<p>
						' . htmlspecialchars($plugin->getDescription()) . '
					</p>
				</div>

				<div class="actions">
					<a href="./plugins.php?install=' . htmlspecialchars($plugin->getPackageName()) . '" class="button greenB">' . ACPPluginsT::get('install') . '</a>
                if (isset($options['ignorePattern']) && preg_match($options['ignorePattern'], $filename)) {
                    $this->perror("\nignored {$filename}");
                    $it->next();
                    continue;
                }
                $targetDir = preg_replace('#.+LibraryProject/(.+?)/[^/]+$#', '$1', $filename);
                echo "\n{$options['indent']}<source-file src=\"{$filename}\" target-dir=\"{$targetDir}\"/>";
            }
            $it->next();
        }
        echo "\n";
        //exit;
    }
}
// init
$pluginHelper = new PluginHelper();
ob_start();
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
    xmlns:android="http://schemas.android.com/apk/res/android"
    id="com.phonegap.plugins.barcodescanner"
    version="0.5.3">

    <name>BarcodeScanner</name>
    
    <description>Scans Barcodes.</description>

    <engines>
        <engine name="cordova" version=">=2.0.0" />
    </engines>    
示例#16
0
 /**
  * Load plugins that are marked as active.
  * This also checks for the implementation of PluginInterface in the main class of the plugin.
  */
 public static function loadActivePlugins()
 {
     $plugins = self::getActivePlugins();
     foreach ($plugins as $plugin) {
         try {
             $pluginClass = self::getEntryPointClassForPlugin($plugin);
             // Load class
             include_once PATH . 'plugins/' . $plugin->getPackageName() . '/Plugin.php';
             // Finally, start plugin
             $p = new $pluginClass($plugin->getPackageName(), $plugin->getTitle(), $plugin->getDescription(), $plugin->getAuthor(), $plugin->getURL(), 1, $plugin->getID());
             if (!$p instanceof PluginInterface) {
                 throw new InvalidManifestException('Plugin ' . $plugin->getPackageName() . ' does not implement PluginInterface.', 42);
             }
             $plugins[$plugin->getPackageName()] = $p;
         } catch (InvalidManifestException $e) {
             Functions::log(Functions::LOG_ERROR, $e->getMessage());
         } catch (InvalidPluginException $e) {
             Functions::log(Functions::LOG_ERROR, $e->getMessage());
         }
     }
     self::$loadedPlugins = $plugins;
 }
示例#17
0
 private function createHtmlTable($musicTag)
 {
     $configuration = $musicTag->getConfiguration();
     switch ($configuration->getTableStrategy()) {
         case Configuration::TABLE_STRATEGY_DIV:
             return new HtmlDivTable($configuration);
             break;
         case Configuration::TABLE_STRATEGY_SWITCH:
             $templateId = $configuration->getTableStrategySwitchTemplate();
             if (PluginHelper::isCurrentTemplate($templateId)) {
                 return new HtmlDivTable($configuration);
             }
         case Configuration::TABLE_STRATEGY_TABLE:
         default:
             return new HtmlTable($configuration);
             break;
     }
 }