Ejemplo n.º 1
0
 public function run($params = null)
 {
     $dbconf = \fpcm\classes\baseconfig::getDatabaseConfig();
     $view = new \fpcm\model\view\module(\fpcm\model\abstracts\module::getModuleKeyByFolder(__DIR__), 'acp', 'main');
     $view->assign('dbconfig', $dbconf);
     $view->render();
 }
Ejemplo n.º 2
0
 /**
  * wird ausgeführt, wenn im Artikel-Editor die Liste vorhandener Upload geladen wird
  * @param array $data
  * @return array
  */
 public function run($data = null)
 {
     $eventClasses = $this->getEventClasses();
     if (!count($eventClasses)) {
         return $data;
     }
     $mdata = $data;
     foreach ($eventClasses as $eventClass) {
         $classkey = $this->getModuleKeyByEvent($eventClass);
         $eventClass = \fpcm\model\abstracts\module::getModuleEventNamespace($classkey, 'editorGetFileList');
         /**
          * @var \fpcm\model\abstracts\event
          */
         $module = new $eventClass();
         if (!$this->is_a($module)) {
             continue;
         }
         $mdata = $module->run($mdata);
     }
     array_shift($mdata);
     if (!isset($mdata['files'])) {
         return $data;
     }
     return $mdata;
 }
Ejemplo n.º 3
0
 public function request()
 {
     if (!$this->getRequestVar('id')) {
         return false;
     }
     $id = $this->getRequestVar('id', array(7, 9));
     $this->message = new \fpcm\modules\nkorg\inactivity_manager\model\message($id);
     if ($this->buttonClicked('msgSave')) {
         $newmessage = $this->getRequestVar('msg');
         $this->message->setText($newmessage['text']);
         $starttime = strtotime($newmessage['start']);
         $this->message->setStarttime($starttime);
         $stoptime = strtotime($newmessage['stop']);
         $this->message->setStoptime($stoptime);
         $commentsDiabled = isset($newmessage['nocomments']) ? true : false;
         $this->message->setNocomments($commentsDiabled);
         $res = $this->message->update();
         if ($res) {
             $this->redirect('modules/config', array('key' => \fpcm\model\abstracts\module::getModuleKeyByFolder(__DIR__), 'added' => 1));
             return true;
         }
         $this->view->addErrorMessage('NKORGINACTIVITY_MANAGER_SAVED_FAILED');
     }
     return parent::request();
 }
Ejemplo n.º 4
0
 /**
  * wird ausgeführt, wenn Cache über "Cache leeren" Button geleert wird
  * @param array $data
  * @return mixed
  */
 public function run($data = null)
 {
     $functionData = explode('_', $data['name'], 3);
     if (!isset($functionData[0]) || !isset($functionData[1]) || !isset($functionData[2])) {
         trigger_error('Malformed function name data given: "' . $data['name'] . '"');
         return false;
     }
     $vendorKey = $functionData[0];
     $moduleKey = $functionData[1];
     $functionName = $functionData[2];
     $classFile = \fpcm\classes\baseconfig::$moduleDir . $vendorKey . '/' . $moduleKey . '/events/apiCallFunction.php';
     if (!file_exists($classFile)) {
         trigger_error('Event class "apiCallFunction" not found in ' . \fpcm\model\files\ops::removeBaseDir($classFile, true));
         return false;
     }
     $classkey = $vendorKey . '/' . $moduleKey;
     $eventClass = \fpcm\model\abstracts\module::getModuleEventNamespace($classkey, 'apiCallFunction');
     /**
      * @var \fpcm\model\abstracts\event
      */
     $module = new $eventClass();
     if (!$this->is_a($module)) {
         return false;
     }
     $data['name'] = $functionName;
     return $module->run($data);
 }
 /**
  * wird ausgeführt, wenn Spam-Captcha in Kommentar-Formular initialisiert werden soll
  * @param void $data
  * @return \model\abstracts\spamCaptcha
  */
 public function run($data = null)
 {
     $eventClasses = $this->getEventClasses();
     if (!count($eventClasses)) {
         return false;
     }
     $eventClass = array_shift($eventClasses);
     $classkey = $this->getModuleKeyByEvent($eventClass);
     if (!in_array($classkey, $this->activeModules)) {
         return false;
     }
     $eventClass = \fpcm\model\abstracts\module::getModuleEventNamespace($classkey, 'publicReplaceSpamCaptcha');
     /**
      * @var \fpcm\model\abstracts\event
      */
     $module = new $eventClass();
     if (!$this->is_a($module)) {
         return false;
     }
     $data = $module->run();
     if (!is_object($data)) {
         return false;
     }
     return $data;
 }
Ejemplo n.º 6
0
 public function run($params = null)
 {
     if (!\fpcm\classes\baseconfig::$fpcmSession->getCurrentUser()->isAdmin()) {
         return $params;
     }
     $params['after'][] = array('url' => 'modules/config&key=' . \fpcm\model\abstracts\module::getModuleKeyByFolder(__FILE__), 'permission' => array('system' => 'options'), 'description' => $this->lang->translate('NKORG_LANGEDITOR_HEADLINE'), 'icon' => 'fa fa-language fa-fw', 'class' => '', 'id' => '');
     return $params;
 }
Ejemplo n.º 7
0
 public function run($params = null)
 {
     if ($params !== 'nkorgexample') {
         return false;
     }
     $view = new \fpcm\model\view\module(\fpcm\model\abstracts\module::getModuleKeyByFolder(__FILE__), 'ajax', 'logview');
     $view->assign('logfiledata', \fpcm\modules\nkorg\example\model\logfile::getLog());
     $view->render();
 }
Ejemplo n.º 8
0
 public function run($params = null)
 {
     if (\fpcm\classes\http::postOnly('btnClearLog') !== null) {
         \fpcm\modules\nkorg\example\model\logfile::cleanup();
     }
     $view = new \fpcm\model\view\module(\fpcm\model\abstracts\module::getModuleKeyByFolder(__FILE__), 'acp', 'main');
     $view->addMessage('FPCM_EXAMPLE_HEADLINE');
     $view->addNoticeMessage('FPCM_EXAMPLE_HEADLINE');
     $view->addErrorMessage('FPCM_EXAMPLE_HEADLINE');
     $view->assign('logfiledata', \fpcm\modules\nkorg\example\model\logfile::getLog());
     $view->render();
 }
Ejemplo n.º 9
0
 public function request()
 {
     if ($this->buttonClicked('termSave')) {
         $newterm = $this->getRequestVar('term');
         $this->term->setSearchterm($newterm['search']);
         $this->term->setReplaceterm($newterm['replace']);
         $res = $this->term->save();
         if ($res) {
             $this->redirect('modules/config', array('key' => \fpcm\model\abstracts\module::getModuleKeyByFolder(__DIR__), 'added' => 1));
             return true;
         }
         $this->view->addErrorMessage('NKORG_TWEETENTENDER_SAVED_FAILED');
     }
     return parent::request();
 }
Ejemplo n.º 10
0
 public function run($params = null)
 {
     $view = new \fpcm\model\view\module(\fpcm\model\abstracts\module::getModuleKeyByFolder(__DIR__), 'acp', 'main');
     $messages = new \fpcm\modules\nkorg\inactivity_manager\model\messages();
     if (!is_null(\fpcm\classes\http::get('added'))) {
         $view->addNoticeMessage('NKORGINACTIVITY_MANAGER_SAVED_OK');
     }
     if (!is_null(\fpcm\classes\http::get('btnDeleteTerms')) && !is_null(\fpcm\classes\http::get('ids'))) {
         $ids = \fpcm\classes\http::get('ids');
         if ($messages->deleteMessage($ids)) {
             $view->addNoticeMessage('NKORGINACTIVITY_MANAGER_DELETE_OK');
         } else {
             $view->addErrorMessage('NKORGINACTIVITY_MANAGER_DELETE_FAILED');
         }
     }
     $view->assign('messages', $messages->getMessages());
     $view->render();
 }
Ejemplo n.º 11
0
 /**
  * wird ausgeführt, wenn Cache über "Cache leeren" Button geleert wird
  * @param void $data
  * @return void
  */
 public function run($data = null)
 {
     $eventClasses = $this->getEventClasses();
     if (!count($eventClasses)) {
         return;
     }
     foreach ($eventClasses as $eventClass) {
         $classkey = $this->getModuleKeyByEvent($eventClass);
         $eventClass = \fpcm\model\abstracts\module::getModuleEventNamespace($classkey, 'clearCache');
         /**
          * @var \fpcm\model\abstracts\event
          */
         $module = new $eventClass();
         if (!$this->is_a($module)) {
             continue;
         }
         $module->run();
     }
 }
Ejemplo n.º 12
0
 public function run($params = null)
 {
     $view = new \fpcm\model\view\module(\fpcm\model\abstracts\module::getModuleKeyByFolder(__DIR__), 'acp', 'main');
     $termlist = new \fpcm\modules\nkorg\tweetextender\model\termlist();
     if (!is_null(\fpcm\classes\http::get('added'))) {
         $view->addNoticeMessage('NKORG_TWEETENTENDER_SAVED_OK');
     }
     if (!is_null(\fpcm\classes\http::get('btnDeleteTerms')) && !is_null(\fpcm\classes\http::get('ids'))) {
         $ids = \fpcm\classes\http::get('ids');
         if ($termlist->deleteTerms($ids)) {
             $view->addNoticeMessage('NKORG_TWEETENTENDER_DELETE_OK');
         } else {
             $view->addErrorMessage('NKORG_TWEETENTENDER_DELETE_FAILED');
         }
     }
     $terms = $termlist->getTerms();
     $view->assign('terms', $terms);
     $view->render();
 }
Ejemplo n.º 13
0
 /**
  * wird ausgeführt, wenn wenn Benutzer in Modulmanager auf "Modul konfigurieren" klickt
  * @param string $module
  * @return boolean
  */
 public function run($module = null)
 {
     if (!in_array($module, $this->activeModules)) {
         trigger_error("Request for acpConfig event of disabled module '{$module}'!");
         $view = new \fpcm\model\view\error();
         $view->setMessage("The module '{$module}' is not enabled for execution!");
         $view->render();
         die;
     }
     $className = \fpcm\model\abstracts\module::getModuleEventNamespace($module, 'acpConfig');
     /**
      * @var \fpcm\model\abstracts\event
      */
     $module = new $className();
     if ($this->is_a($module)) {
         $module->run(null);
         return true;
     }
     return false;
 }
Ejemplo n.º 14
0
 /**
  * wird ausgeführt, wenn in publicController-View die Liste mit Javascript-Dateien geladen wird
  * @param array $data
  * @return array
  */
 public function run($data = null)
 {
     $eventClasses = $this->getEventClasses();
     if (!count($eventClasses)) {
         return array();
     }
     $mdata = array();
     foreach ($eventClasses as $eventClass) {
         $classkey = $this->getModuleKeyByEvent($eventClass);
         $eventClass = \fpcm\model\abstracts\module::getModuleEventNamespace($classkey, 'publicAddJsFiles');
         /**
          * @var \fpcm\model\abstracts\event
          */
         $module = new $eventClass();
         if (!$this->is_a($module)) {
             continue;
         }
         $mdata = $module->run($mdata);
     }
     return $mdata;
 }
Ejemplo n.º 15
0
 /**
  * wird ausgeführt, wenn im Artikel-Editor die Link-Liste für den "Link einfügen"-Dialog geladen wird
  * @param void $data
  * @return array
  */
 public function run($data = null)
 {
     $eventClasses = $this->getEventClasses();
     if (!count($eventClasses)) {
         return array();
     }
     $mdata = array(array('label' => '', 'value' => ''));
     foreach ($eventClasses as $eventClass) {
         $classkey = $this->getModuleKeyByEvent($eventClass);
         $eventClass = \fpcm\model\abstracts\module::getModuleEventNamespace($classkey, 'editorAddLinks');
         /**
          * @var \fpcm\model\abstracts\event
          */
         $module = new $eventClass();
         if (!$this->is_a($module)) {
             continue;
         }
         $mdata = $module->run($mdata);
     }
     array_shift($mdata);
     return $mdata;
 }
Ejemplo n.º 16
0
 public function run($params = null)
 {
     $moduleKey = \fpcm\model\abstracts\module::getModuleKeyByFolder(__DIR__);
     $view = new \fpcm\model\view\module($moduleKey, 'acp', 'main', '');
     $chapters = array();
     if ($this->config->system_mode) {
         $chapters['NKORG_INTEGRATION_PHPINCLUDE'] = 'phpinclude';
     }
     $chapters['NKORG_INTEGRATION_CSSCLASSES'] = 'cssclasses';
     $chapters['NKORG_INTEGRATION_SHOWARTICLES'] = 'showarticles';
     $chapters['NKORG_INTEGRATION_SHOWLATEST'] = 'showlatest';
     if ($this->config->system_mode) {
         $chapters['NKORG_INTEGRATION_SHOWPAGETITEL'] = 'showpagetitle';
         $chapters['NKORG_INTEGRATION_SHOWARTICLETITLE'] = 'showarticletitle';
         $chapters['NKORG_INTEGRATION_UTF8OUTPUT'] = 'utf8output';
     }
     $chapters['NKORG_INTEGRATION_RSSFEED'] = 'rssfeed';
     $view->assign('chapters', $chapters);
     $view->assign('sysmode', $this->config->system_mode);
     $view->assign('sysurl', $this->config->system_url);
     $view->render();
 }
Ejemplo n.º 17
0
 public function run($params = null)
 {
     $view = new \fpcm\model\view\module(\fpcm\model\abstracts\module::getModuleKeyByFolder(__DIR__), 'acp', 'main');
     $cfgKey = \fpcm\modules\nkorg\sitemaplinklist\nkorgsitemaplinklist::NKORG_SITEMAPLINKLIST_CONFIGKEY;
     if ($this->config->{$cfgKey}) {
         $savedpath = $this->config->{$cfgKey};
         $listcontent = array();
         $xmlObject = new \SimpleXMLElement(file_get_contents($savedpath));
         foreach ($xmlObject->children() as $child) {
             $listcontent[base64_encode($child->loc->__toString())] = $child->loc->__toString();
         }
     } else {
         $savedpath = '/';
         $listcontent = false;
     }
     $acfile = new \fpcm\modules\nkorg\sitemaplinklist\model\activelinkfile();
     $activeLinks = array_map('base64_encode', $acfile->loadData());
     $view->assign('savedpath', $savedpath);
     $view->assign('listcontent', $listcontent);
     $view->assign('activeLinks', $activeLinks);
     $view->render();
 }
 /**
  * wird ausgeführt, wenn Spam-Captcha in Kommentar-Formular initialisiert werden soll
  * @param void $data
  * @return \model\abstracts\spamCaptcha
  */
 public function run($data = null)
 {
     $eventClasses = $this->getEventClasses();
     if (!count($eventClasses)) {
         return false;
     }
     $eventClass = array_shift($eventClasses);
     $classkey = $this->getModuleKeyByEvent($eventClass);
     $eventClass = \fpcm\model\abstracts\module::getModuleEventNamespace($classkey, 'articleReplaceEditorPlugin');
     /**
      * @var \fpcm\model\abstracts\articleEditor
      */
     $module = new $eventClass();
     if (!$this->is_a($module)) {
         return false;
     }
     $data = $module->run();
     if (!is_object($data)) {
         return false;
     }
     return $data;
 }
Ejemplo n.º 19
0
 /**
  * wird ausgeführt, wenn Artikel gespeichert wird
  * @param array $data
  * @return array
  */
 public function run($data = null)
 {
     $eventClasses = $this->getEventClasses();
     if (!count($eventClasses)) {
         return $data;
     }
     $mdata = $data;
     foreach ($eventClasses as $eventClass) {
         $classkey = $this->getModuleKeyByEvent($eventClass);
         $eventClass = \fpcm\model\abstracts\module::getModuleEventNamespace($classkey, 'articleCreateTweet');
         /**
          * @var \fpcm\model\abstracts\event
          */
         $module = new $eventClass();
         if (!$this->is_a($module)) {
             continue;
         }
         $mdata = $module->run($mdata);
     }
     if (!is_a($mdata, '\\fpcm\\model\\articles\\article')) {
         return $data;
     }
     return $mdata;
 }
Ejemplo n.º 20
0
 /**
  * wird ausgeführt, wenn Artikel gespeichert wird
  * @param array $data
  * @return array
  */
 public function run($data = null)
 {
     $eventClasses = $this->getEventClasses();
     if (!count($eventClasses)) {
         return $data;
     }
     $mdata = $data;
     foreach ($eventClasses as $eventClass) {
         $classkey = $this->getModuleKeyByEvent($eventClass);
         $eventClass = \fpcm\model\abstracts\module::getModuleEventNamespace($classkey, 'articlePrepareDataSave');
         /**
          * @var \fpcm\model\abstracts\event
          */
         $module = new $eventClass();
         if (!$this->is_a($module)) {
             continue;
         }
         $mdata = $module->run($mdata);
     }
     if (!$mdata || !is_array($mdata) || !isset($eventData['content']) || !isset($eventData['searchParams']) || !is_array($eventData['searchParams'])) {
         return $data;
     }
     return $mdata;
 }
Ejemplo n.º 21
0
 /**
  * wird ausgeführt, wenn RSS-Feed-Struktur aufgebaut wird
  * @param array $data
  * @return array
  */
 public function run($data = null)
 {
     $eventClasses = $this->getEventClasses();
     if (!count($eventClasses)) {
         return $data;
     }
     $mdata = $data;
     foreach ($eventClasses as $eventClass) {
         $classkey = $this->getModuleKeyByEvent($eventClass);
         $eventClass = \fpcm\model\abstracts\module::getModuleEventNamespace($classkey, 'prepareRssFeed');
         /**
          * @var \fpcm\model\abstracts\event
          */
         $module = new $eventClass();
         if (!$this->is_a($module)) {
             continue;
         }
         $mdata = $module->run($mdata);
     }
     if (!$mdata || is_a($mdata, '\\DOMDocument')) {
         return $data;
     }
     return $mdata;
 }
Ejemplo n.º 22
0
 /**
  * wird ausgeführt, wenn über fpcm\classes\email-Klasse eine E-mail versendet wird
  * @param array $data
  * @return array
  */
 public function run($data = null)
 {
     $eventClasses = $this->getEventClasses();
     if (!count($eventClasses)) {
         return $data;
     }
     $mdata = $data;
     foreach ($eventClasses as $eventClass) {
         $classkey = $this->getModuleKeyByEvent($eventClass);
         $eventClass = \fpcm\model\abstracts\module::getModuleEventNamespace($classkey, 'emailSubmit');
         /**
          * @var \fpcm\model\abstracts\event
          */
         $module = new $eventClass();
         if (!$this->is_a($module)) {
             continue;
         }
         $mdata = $module->run($mdata);
     }
     if (!$mdata || !isset($mdata['maildata']) || !isset($mdata['headers'])) {
         return $data;
     }
     return $mdata;
 }
 /**
  * wird ausgeführt, wenn Liste von Dashboard-Container-Klassen geladen wird
  * @param array $data
  * @return array
  */
 public function run($data = null)
 {
     $eventClasses = $this->getEventClasses();
     if (!count($eventClasses)) {
         return $data;
     }
     $mdata = $data;
     foreach ($eventClasses as $eventClass) {
         $classkey = $this->getModuleKeyByEvent($eventClass);
         $eventClass = \fpcm\model\abstracts\module::getModuleEventNamespace($classkey, 'dashboardContainersLoad');
         /**
          * @var \fpcm\model\abstracts\event
          */
         $module = new $eventClass();
         if (!$this->is_a($module)) {
             continue;
         }
         $mdata = $module->run($mdata);
     }
     if (!isset($mdata)) {
         return $data;
     }
     return $mdata;
 }
Ejemplo n.º 24
0
 public function run($params = null)
 {
     $params['after'][] = array('url' => 'modules/config&key=' . \fpcm\model\abstracts\module::getModuleKeyByFolder(__FILE__), 'permission' => array('system' => 'options', 'modules' => 'configure', 'modules' => 'install', 'modules' => 'enable'), 'description' => $this->lang->translate('NKORG_MODULECREATOR_HEADLINE'), 'icon' => 'fa fa-truck fa-fw', 'class' => '', 'id' => '');
     return $params;
 }
Ejemplo n.º 25
0
 /**
  * Controller-Processing
  */
 public function process()
 {
     if (!parent::process()) {
         return false;
     }
     if ($this->canConnect) {
         $keyData = \fpcm\model\packages\package::explodeModuleFileName($this->key);
         $pkg = new \fpcm\model\packages\module('module', $keyData[0], $keyData[1]);
     }
     if (!isset($keyData[0]) || !isset($keyData[1])) {
         $this->returnCode = $this->step . '_0';
         $this->getResponse();
     }
     $this->returnData['current'] = $this->step;
     switch ($this->step) {
         case 1:
             $res = $pkg->download();
             $from = $pkg->getRemoteFile();
             if ($res === true) {
                 \fpcm\classes\logs::syslogWrite('Downloaded module package successfully from ' . $from);
                 $this->returnData['nextstep'] = 2;
             } else {
                 \fpcm\classes\logs::syslogWrite('Error while downloading module package from' . $from);
                 $this->returnData['nextstep'] = 5;
             }
             break;
         case 2:
             $res = $pkg->extract();
             $from = \fpcm\model\files\ops::removeBaseDir($pkg->getLocalFile());
             if ($res === true) {
                 \fpcm\classes\logs::syslogWrite('Extracted module package successfully from ' . $from);
                 $this->returnData['nextstep'] = 3;
             } else {
                 \fpcm\classes\logs::syslogWrite('Error while extracting module package from ' . $from);
                 $this->returnData['nextstep'] = 5;
             }
             break;
         case 3:
             $res = $pkg->copy();
             $dest = \fpcm\model\files\ops::removeBaseDir(\fpcm\classes\baseconfig::$baseDir) . $pkg->getCopyDestination() . $pkg->getKey();
             $from = \fpcm\model\files\ops::removeBaseDir($pkg->getExtractPath() . basename($pkg->getKey()));
             if ($res === true) {
                 \fpcm\classes\logs::syslogWrite('Moved module package content successfully from ' . $from . ' to ' . $dest);
                 $this->returnData['nextstep'] = 4;
             } else {
                 \fpcm\classes\logs::syslogWrite('Error while moving module package content from ' . $from . ' to ' . $dest);
                 \fpcm\classes\logs::syslogWrite(implode('<br>', $pkg->getCopyErrorPaths()));
                 $this->returnData['nextstep'] = 5;
             }
             break;
         case 4:
             $moduleClass = \fpcm\model\abstracts\module::getModuleClassName($keyData[0]);
             $res = class_exists($moduleClass);
             $moduleClassPath = \fpcm\classes\baseconfig::$moduleDir . $keyData[0] . '/' . str_replace(array('\\', '/'), '', $keyData[0]) . '.php';
             if (!file_exists($moduleClassPath)) {
                 $res = false;
                 trigger_error('Module class ' . $moduleClass . ' not found in "' . $moduleClassPath . '"!');
                 $this->returnData['nextstep'] = 5;
                 break;
             }
             if ($res) {
                 $modObj = new $moduleClass($keyData[0], '', $keyData[1]);
                 if (!is_a($modObj, '\\fpcm\\model\\abstracts\\module')) {
                     $res = false;
                     trigger_error('Module class ' . $moduleClass . ' must be an instance of "\\fpcm\\model\\abstracts\\module"!');
                     break;
                 }
                 $res = $modObj->runInstall();
             }
             $this->returnData['nextstep'] = 5;
             if ($res === true) {
                 \fpcm\classes\logs::syslogWrite('Run final module install steps successfully for ' . $pkg->getKey());
             } else {
                 \fpcm\classes\logs::syslogWrite('Error while running final module install steps for ' . $pkg->getKey());
             }
             break;
         case 5:
             if ($this->canConnect) {
                 $pkg->loadPackageFileListFromTemp();
                 \fpcm\classes\logs::pkglogWrite($pkg->getKey() . ' ' . $pkg->getVersion(), $pkg->getFiles());
                 $pkg->cleanup();
             }
             \fpcm\classes\baseconfig::enableAsyncCronjobs(true);
             $this->cache->cleanup();
             $res = true;
             break;
         default:
             $res = false;
             break;
     }
     $this->returnCode = $this->step . '_' . (int) $res;
     $this->getResponse();
 }
Ejemplo n.º 26
0
 public function run($params = null)
 {
     $params['after'][] = array('url' => 'modules/config&key=' . \fpcm\model\abstracts\module::getModuleKeyByFolder(__FILE__), 'permission' => array('system' => 'options'), 'description' => $this->lang->translate('FPCM_EXAMPLE_HEADLINE'), 'icon' => 'fa fa-check-square-o fa-fw', 'class' => '', 'id' => '');
     return $params;
 }
Ejemplo n.º 27
0
 /**
  * Führt Upload von Module-Package via HTML-Form + PHP sowie Installation aus Modulmanager durch
  * @return boolean
  */
 public function processModuleUpload()
 {
     $tempNames = $this->uploader['tmp_name'];
     $fileNames = $this->uploader['name'];
     $fileTypes = $this->uploader['type'];
     foreach ($tempNames as $key => $value) {
         if (!is_uploaded_file($value) || !isset($fileNames[$key]) || !isset($fileTypes[$key])) {
             continue;
         }
         $ext = pathinfo($fileNames[$key], PATHINFO_EXTENSION);
         $ext = $ext ? strtolower($ext) : '';
         if ($ext != 'zip') {
             return false;
         }
         $fileName = \fpcm\classes\baseconfig::$tempDir . $fileNames[$key];
         if (!move_uploaded_file($value, $fileName)) {
             return false;
         }
         $data = \fpcm\model\packages\package::explodeModuleFileName(basename($fileNames[$key], '.zip'));
         $package = new \fpcm\model\packages\module('module', $data[0], $data[1]);
         $res = $package->extract();
         $extractPath = $package->getExtractPath();
         $modulelisteConfigFile = realpath($extractPath . $data[0] . '/config/modulelist.yml');
         if (!file_exists($modulelisteConfigFile)) {
             return $res;
         }
         include_once \fpcm\classes\loader::libGetFilePath('spyc', 'Spyc.php');
         $modulelisteConfig = \Spyc::YAMLLoad($modulelisteConfigFile);
         if ($res !== true) {
             return $res;
         }
         $package->setCopyDestination($modulelisteConfig['vendor'] . '/');
         $res = $package->copy();
         if ($res !== true) {
             return $res;
         }
         $package->cleanup();
         $moduleClass = \fpcm\model\abstracts\module::getModuleClassName($modulelisteConfig['vendor'] . '/' . $modulelisteConfig['key']);
         if (class_exists($moduleClass)) {
             $modObj = new $moduleClass($modulelisteConfig['vendor'] . $modulelisteConfig['key'], '', $data[1]);
             $res = $modObj->isInstalled() ? $modObj->runUpdate() : $modObj->runInstall();
             if ($res !== true) {
                 return $res;
             }
         }
     }
     return true;
 }
Ejemplo n.º 28
0
 /**
  * Module deinstallieren, nur wenn deaktiviert
  * @param array $keys
  * @return boolean
  */
 public function uninstallModules(array $keys)
 {
     $this->cache->cleanup();
     $keys = array_intersect($keys, $this->getDisabledInstalledModules());
     if (!count($keys)) {
         return false;
     }
     $res = true;
     foreach ($keys as $key) {
         $moduleClass = \fpcm\model\abstracts\module::getModuleClassName($key);
         if (!class_exists($moduleClass)) {
             continue;
         }
         $modObj = new $moduleClass($key, '', '');
         if (!is_a($modObj, '\\fpcm\\model\\abstracts\\module')) {
             continue;
         }
         $res = $res && $modObj->runUninstall();
     }
     $res = $res && $this->dbcon->delete($this->table, "(modkey = '" . implode("' OR modkey = '", $keys) . "') AND status = 0");
     $lastKey = false;
     foreach ($keys as $key) {
         $res = $res && \fpcm\model\files\ops::deleteRecursive(\fpcm\classes\baseconfig::$moduleDir . $key);
         $lastKey = $key;
     }
     if (!$lastKey) {
         return $res;
     }
     $folders = glob(\fpcm\classes\baseconfig::$moduleDir . dirname($lastKey) . '/*', GLOB_ONLYDIR);
     if (!count($folders)) {
         $res = $res && \fpcm\model\files\ops::deleteRecursive(\fpcm\classes\baseconfig::$moduleDir . dirname($lastKey));
     }
     return $res;
 }
Ejemplo n.º 29
0
 /**
  * wird ausgeführt, wenn Artikel gespeichert wird
  * @param array $data
  * @return array
  */
 public function run($data = null)
 {
     $eventClasses = $this->getEventClasses();
     if (!count($eventClasses)) {
         return $data;
     }
     $mdata = $data;
     foreach ($eventClasses as $eventClass) {
         $classkey = $this->getModuleKeyByEvent($eventClass);
         $eventClass = \fpcm\model\abstracts\module::getModuleEventNamespace($classkey, $this->getEventClassBase());
         /**
          * @var \fpcm\model\abstracts\event
          */
         $module = new $eventClass();
         if (!$this->is_a($module)) {
             continue;
         }
         $mdata = $module->run($mdata);
     }
     if (!$mdata) {
         return $data;
     }
     if ($this->returnDataType === self::FPCM_MODULE_EVENT_RETURNTYPE_ARRAY && !is_array($mdata)) {
         trigger_error('Invalid data type. Returned data type must be an array');
         return $data;
     } elseif ($this->returnDataType === self::FPCM_MODULE_EVENT_RETURNTYPE_OBJ && !is_object($mdata)) {
         trigger_error('Invalid data type. Returned data type must be an object');
         return $data;
     } elseif ($this->returnDataType !== false && !is_array($mdata) && !is_a($mdata, $this->returnDataType)) {
         trigger_error('Invalid data type. Returned data type must be instance of ' . $this->returnDataType);
         return $data;
     }
     return $mdata;
 }
Ejemplo n.º 30
0
 public function run($params = null)
 {
     $params['after'][] = array('url' => 'modules/config&key=' . \fpcm\model\abstracts\module::getModuleKeyByFolder(__FILE__), 'permission' => array('system' => 'options'), 'description' => $this->lang->translate('NKORGINACTIVITY_MANAGER_HEADLINE'), 'icon' => 'fa fa-calendar fa-fw', 'class' => '', 'id' => '');
     return $params;
 }