/**
  * @covers Rcm\Plugin\PluginInterface::saveInstance
  * @covers RcmSocialButtons\Controller\PluginController::saveInstance
  */
 function testSaveAction()
 {
     $em = $this->getEmMock();
     $em->expects($this->once())->method('persist');
     $em->expects($this->once())->method('flush');
     $this->unit->setEm($em);
     $this->unit->saveInstance(42, '<p>hi</p>');
 }
Example #2
0
 public function __construct()
 {
     if (!function_exists('gd_info')) {
         if (!$this->_isInternal()) {
             page_not_found();
         } else {
             // TODO: improve this
             Flash::set('error', 'Image - ' . __('GD Library is either not installed or not enabled, check your phpinfo().'));
         }
         exit;
     }
     parent::__construct();
     if ($this->_isInternal()) {
         $this->setLayout('backend');
         $this->assignToLayout('sidebar', new View('../../plugins/image/views/sidebar'));
     }
     // get setting from db
     $src = Plugin::getSetting('path', 'image');
     if ($src !== '/') {
         $src = '/' . $src;
     }
     if (substr($src, strlen($src) - 1) !== '/') {
         $src = $src . '/';
     }
     $this->_image_root = CMS_ROOT . $src;
 }
Example #3
0
 function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     if (FleximportConfig::get("MAXIMUM_EXECUTION_TIME")) {
         set_time_limit(FleximportConfig::get("MAXIMUM_EXECUTION_TIME"));
     }
 }
Example #4
0
 public function getPortalTemplate()
 {
     // include and show votes and tests
     if (get_config('VOTE_ENABLE')) {
         $controller = new PluginController(new StudipDispatcher());
         $response = $controller->relay('questionnaire/widget/start')->body;
         $template = $GLOBALS['template_factory']->open('shared/string');
         $template->content = $response;
         if ($GLOBALS['perm']->have_perm('root')) {
             $navigation = new Navigation('', 'admin_vote.php', array('page' => 'overview', 'showrangeID' => 'studip'));
             $navigation->setImage(Icon::create('admin', 'clickable', ["title" => _('Umfragen bearbeiten')]));
             $template->icons = array($navigation);
         }
         return $template;
     }
 }
Example #5
0
 function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     Navigation::activateItem("/admin/config/lernmarktplatz");
     if (!$GLOBALS['perm']->have_perm("root")) {
         throw new AccessDeniedException();
     }
 }
Example #6
0
 function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     if (!$GLOBALS['perm']->have_perm("root")) {
         throw new AccessDeniedException();
     }
     Navigation::activateItem("/fleximport/config");
 }
Example #7
0
 function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     if (!$GLOBALS['perm']->have_perm("root")) {
         throw new AccessDeniedException();
     }
     PageLayout::addScript($this->plugin->getPluginURL() . "/assets/fleximport.js");
     Navigation::activateItem("/fleximport/config");
 }
Example #8
0
 public function __construct(GitPlugin $plugin)
 {
     parent::__construct();
     $this->userManager = UserManager::instance();
     $this->projectManager = ProjectManager::instance();
     $this->factory = new GitRepositoryFactory(new GitDao(), $this->projectManager);
     $matches = array();
     if (preg_match_all('/^\\/plugins\\/git\\/index.php\\/(\\d+)\\/([^\\/][a-zA-Z]+)\\/([a-zA-Z\\-\\_0-9]+)\\/\\?{0,1}.*/', $_SERVER['REQUEST_URI'], $matches)) {
         $this->request->set('group_id', $matches[1][0]);
         $this->request->set('action', $matches[2][0]);
         $repo_id = 0;
         //repository id is passed
         if (preg_match('/^([0-9]+)$/', $matches[3][0]) === 1) {
             $repo_id = $matches[3][0];
         } else {
             //get repository by name and group id to retrieve repo id
             $repo = new GitRepository();
             $repo->setName($matches[3][0]);
             $repo->setProject($this->projectManager->getProject($matches[1][0]));
             try {
                 $repo->load();
             } catch (Exception $e) {
                 $this->addError('Bad request');
                 $this->redirect('/');
             }
             $repo_id = $repo->getId();
         }
         $this->request->set('repo_id', $repo_id);
     }
     $this->plugin = $plugin;
     $valid = new Valid_GroupId('group_id');
     $valid->required();
     if ($this->request->valid($valid)) {
         $this->groupId = (int) $this->request->get('group_id');
     }
     $valid = new Valid_String('action');
     $valid->required();
     if ($this->request->valid($valid)) {
         $this->action = $this->request->get('action');
     }
     if (empty($this->action)) {
         $this->action = 'index';
     }
     if (empty($this->groupId)) {
         $this->addError('Bad request');
         $this->redirect('/');
     }
     $this->projectName = $this->projectManager->getProject($this->groupId)->getUnixName();
     if (!PluginManager::instance()->isPluginAllowedForProject($this->plugin, $this->groupId)) {
         $this->addError($this->getText('project_service_not_available'));
         $this->redirect('/projects/' . $this->projectName . '/');
     }
     $this->permittedActions = array();
 }
Example #9
0
 function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     if (!$GLOBALS['perm']->have_perm("root")) {
         throw new AccessDeniedException();
     }
     if (FleximportConfig::get("MAXIMUM_EXECUTION_TIME")) {
         set_time_limit(FleximportConfig::get("MAXIMUM_EXECUTION_TIME"));
     }
     PageLayout::addScript($this->plugin->getPluginURL() . "/assets/fleximport.js");
     Navigation::activateItem("/fleximport");
 }
Example #10
0
 function plugin_details($plugin_id)
 {
     if (isset($plugin_id)) {
         $table = DB_PLUGINS;
         //set variable value to retrieve all columns
         $column = '*';
         $where = 'plugin_id';
         $field = array($plugin_id);
         //build single query from BuildQuery class
         $db_results = BuildQuery::single_field_query($table, $column, $where, $field);
         self::$db_plugin_details = $db_results;
     }
 }
 /**
  * Blocker method
  * @param PluginController $Sender 
  */
 public function Controller_Index($Sender)
 {
     $Sender->Title('Website Blocked');
     $Sender->AddCssFile('stopsopa.css', 'plugins/StopSOPA');
     $Sender->RemoveCssFile('style.css');
     $Sender->RemoveCssFile('admin.css');
     $Sender->MasterView = 'empty';
     $Sender->Render('block', '', 'plugins/StopSOPA');
 }
 /**
  *
  *
  * @param PluginController $Sender
  * @throws Exception
  */
 public function pluginController_fileUpload_create($Sender)
 {
     $Sender->title('FileUpload');
     $Sender->addSideMenu('plugin/fileupload');
     Gdn_Theme::section('Dashboard');
     $Sender->Form = new Gdn_Form();
     $this->enableSlicing($Sender);
     $this->dispatch($Sender, $Sender->RequestArgs);
 }
Example #13
0
define("CONSOLE_MODE", true);
define("PLUGIN_MANAGER_CONSOLE", true);
if (!defined('PUBLIC_FOLDER')) {
    define('PUBLIC_FOLDER', 'public');
}
require_once 'init.php';
if (!isset($argv) || !is_array($argv)) {
    die("There is no input arguments\n");
}
// if
$command = array_var($argv, 1);
$arg1 = array_var($argv, 2);
$usr = Contacts::findOne(array("conditions" => "user_type = (SELECT id FROM " . TABLE_PREFIX . "permission_groups WHERE name='Super Administrator')"));
$usr or die("Super Administrator user not found\n");
CompanyWebsite::instance()->logUserIn($usr);
$ctrl = new PluginController();
trim($command) or die("Command is required \n" . $usage);
if ($command == 'list') {
    foreach ($ctrl->index() as $plg) {
        /* @var $plg Plugin */
        echo "---------------------------------------------\n";
        echo "NAME: \t\t" . $plg->getSystemName() . "\n";
        echo "VERSION: \t" . $plg->getVersion() . "\n";
        echo "STATUS: \t" . ($plg->isInstalled() ? 'Installed ' : 'Uninstalled ') . ($plg->isActive() ? 'Activated ' : 'Inactive ') . "\n";
        if ($plg->updateAvailable()) {
            echo "*** There is a new version of this plugin *** \n";
        }
    }
} else {
    if ($command == 'update_all') {
        $ctrl->updateAll();
Example #14
0
<?php 
$path_origin = "../";
$plugin = new PluginController($path_origin);
$modules = $plugin->GetAllModules();
$count = count($modules);
/*echo "<pre>";
 print_r($modules);
 echo "</pre>";*/
?>

<div class="row">
        <div class="col-md-12">
        <div class="panel panel-success">
						<div class="panel-heading">
							<h3 class="panel-title">Instala un Nuevo Modulo</h3>
						</div>
						<div  class="panel-body">
                                            <form id="fileupload" action="UploadPlugin.php" method="POST" enctype="multipart/form-data">
						<div class="row fileupload-buttonbar">
							<div class="col-lg-7">
								<!-- The fileinput-button span is used to style the file input field as button -->
								<span class="btn green fileinput-button">
								<i class="fa fa-plus"></i>
								<span>
                                                                    Buscar Modulo </span>
                                                                <input type="file" name="plugin" id="plugin" multiple="">
								</span>
								<button type="submit" class="btn blue start">
								<i class="fa fa-upload"></i>
								<span>
 public function render($view, $vars = array())
 {
     $views_path = PLUGINS_ROOT . DS . 'ckeditor' . DS . 'views' . DS . 'filter';
     if (defined('CMS_BACKEND')) {
         $views_path .= DS . 'admin';
         if (!empty($this->layout)) {
             // We assign our Views as content already rendered
             $this->assignToLayout('content_for_layout', new View($views_path . DS . $view, $vars));
             // and render the backend layout as usual
             return new View('../layouts/' . $this->layout, $this->layout_vars);
         } else {
             return new View($views_path . DS . $view, $vars);
         }
     } else {
         $views_path .= DS . 'public';
         return parent::render($views_path . DS . $view, $vars);
     }
 }
Example #16
0
 public function __construct(GitPlugin $plugin, Git_RemoteServer_GerritServerFactory $gerrit_server_factory, Git_Driver_Gerrit_GerritDriverFactory $driver_factory, GitRepositoryManager $repository_manager, Git_SystemEventManager $system_event_manager, Git_Driver_Gerrit_UserAccountManager $gerrit_usermanager, GitRepositoryFactory $git_repository_factory, UserManager $user_manager, ProjectManager $project_manager, PluginManager $plugin_manager, Codendi_Request $request, Git_Driver_Gerrit_ProjectCreator $project_creator, Git_Driver_Gerrit_Template_TemplateFactory $template_factory, GitPermissionsManager $permissions_manager, Git_GitRepositoryUrlManager $url_manager, Logger $logger, Git_Backend_Gitolite $backend_gitolite, Git_Mirror_MirrorDataMapper $mirror_data_mapper)
 {
     parent::__construct($user_manager, $request);
     $this->userManager = $user_manager;
     $this->projectManager = $project_manager;
     $this->factory = $git_repository_factory;
     $this->gerrit_server_factory = $gerrit_server_factory;
     $this->driver_factory = $driver_factory;
     $this->repository_manager = $repository_manager;
     $this->git_system_event_manager = $system_event_manager;
     $this->gerrit_usermanager = $gerrit_usermanager;
     $this->plugin_manager = $plugin_manager;
     $this->project_creator = $project_creator;
     $this->template_factory = $template_factory;
     $this->permissions_manager = $permissions_manager;
     $this->plugin = $plugin;
     $this->url_manager = $url_manager;
     $this->logger = $logger;
     $this->backend_gitolite = $backend_gitolite;
     $this->mirror_data_mapper = $mirror_data_mapper;
     $url = new Git_URL($this->projectManager, $this->factory, $_SERVER['REQUEST_URI']);
     $this->routeGitSmartHTTP($url);
     $this->routeUsingFriendlyURLs($url);
     $this->routeUsingStandardURLs($url);
     $valid = new Valid_GroupId('group_id');
     $valid->required();
     if ($this->request->valid($valid)) {
         $this->groupId = (int) $this->request->get('group_id');
     }
     $valid = new Valid_String('action');
     $valid->required();
     if ($this->request->valid($valid)) {
         $this->action = $this->request->get('action');
     }
     if (empty($this->action)) {
         $this->action = 'index';
     }
     if (empty($this->groupId)) {
         $this->addError('Bad request');
         $this->redirect('/');
     }
     $this->project = $this->projectManager->getProject($this->groupId);
     $this->projectName = $this->project->getUnixName();
     if (!$this->plugin_manager->isPluginAllowedForProject($this->plugin, $this->groupId)) {
         $this->addError($this->getText('project_service_not_available'));
         $this->redirect('/projects/' . $this->projectName . '/');
     }
     $this->permittedActions = array();
 }
 public function render($view, $vars = array())
 {
     $vars = array_merge($this->get_default_view_vars(), $vars);
     /* We only render views for this plugin. So add the prefix of the view folder to every view file. */
     return parent::render(self::VIEW_FOLDER . $view, $vars);
 }
Example #18
0
 public function getData()
 {
     return $this->controller->getData();
 }
Example #19
0
$target_dir = "../plugins/files/";
//ARCHIVO DONDE SE ENCUENTRA EL PLUGIN
$target_file = $target_dir . basename($_FILES["plugin"]["name"]);
//VERIFICAMOS EL TIPO DE ARCHIVO DEBE SER .ZIP
$FileType = pathinfo($target_file, PATHINFO_EXTENSION);
//VERIFICAMOS EL NOMBRE
$name = $_FILES["plugin"]["name"];
//INSTANCIAMOS EL HEADER
$header = new \Http\Header();
//VERIFICAMOS SI EXISTE EL ARCHIVO ANTERIORMENTE ANTES DE SUBIRLO
if (file_exists($target_file)) {
    unlink($target_file);
}
//VERIFICAMOS EL TIPO DE ARCHIVO
if ($FileType != "zip") {
    $header->redirect("dashboard_index.php?error=nofile");
    exit;
}
//PROCEDEREMOS A SUBIR EL ARCHIVO
$result = move_uploaded_file($_FILES["plugin"]["tmp_name"], $target_file);
echo $result . $_FILES["plugin"]["tmp_name"];
if (!$result) {
    $header->redirect("dashboard_index.php?error=noupload");
    exit;
}
//DESCOMPRESION DEL ARCHIVO
$plugin = new PluginController("../", "../plugins/files/" . $name);
//DESCOMPRIMIMOS
$plugin->UnZipPlugin();
//REDIRECCIONAMOS AL DASHBOARD DEL MODULO
$header->redirect("dashboard_index.php");
if (!defined('PUBLIC_FOLDER')) {
    define('PUBLIC_FOLDER', 'public');
}
require_once 'init.php';
$success_message = "";
try {
    if (!isset($argv) || !is_array($argv)) {
        die("There is no input arguments\n");
    }
    // if
    $command = array_var($argv, 1);
    $arg1 = array_var($argv, 2);
    $usr = Contacts::findOne(array("conditions" => "user_type > 0", "order" => "user_type"));
    $usr or die("No users found\n");
    CompanyWebsite::instance()->logUserIn($usr);
    $ctrl = new PluginController();
    trim($command) or die("Command is required \n" . $usage);
    $plugins = $ctrl->index();
    if ($command == 'list') {
        foreach ($plugins as $plg) {
            /* @var $plg Plugin */
            echo "---------------------------------------------\n";
            echo "NAME: \t\t" . $plg->getSystemName() . "\n";
            echo "VERSION: \t" . $plg->getVersion() . "\n";
            echo "STATUS: \t" . ($plg->isInstalled() ? 'Installed ' : 'Uninstalled ') . ($plg->isActive() ? 'Activated ' : 'Inactive ') . "\n";
            if ($plg->updateAvailable()) {
                echo "*** There is a new version of this plugin *** \n";
            }
        }
    } else {
        if ($command == 'update_all') {
Example #21
0
 function before_filter($action, $args)
 {
     parent::before_filter($action, $args);
     $this->assets_url = $this->plugin->getPluginURL() . '/assets/';
     PageLayout::setHelpKeyword("Basis/InteraktionBlubber");
 }
Example #22
0
 function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     PageLayout::setTitle(_("Lernmaterialien"));
 }