/** * Getter for the $aNavigationSites array - either from hook, TopBarMenu title or cache * @global string $wgSitename * @return array */ public static function getNavigationSites() { if (!is_null(self::$aNavigationSites)) { return self::$aNavigationSites; } $sKey = BsExtensionManager::getExtension('TopMenuBarCustomizer')->getCacheKey('NavigationSitesData'); self::$aNavigationSites = BsCacheHelper::get($sKey); if (self::$aNavigationSites !== false) { return self::$aNavigationSites; } self::$aNavigationSites = array(); $oTopBarMenuTitle = Title::makeTitle(NS_MEDIAWIKI, 'TopBarMenu'); if (!is_null($oTopBarMenuTitle) && $oTopBarMenuTitle->exists()) { $sContent = BsPageContentProvider::getInstance()->getContentFromTitle($oTopBarMenuTitle); // Force unset of all menu items by creating an empty page if (!empty($sContent)) { self::$aNavigationSites = TopMenuBarCustomizerParser::getNavigationSites(); } BsCacheHelper::set($sKey, self::$aNavigationSites, 60 * 1440); //max cache time 24h return self::$aNavigationSites; } global $wgSitename; $oCurrentTitle = RequestContext::getMain()->getTitle(); $oMainPage = Title::newMainPage(); self::$aNavigationSites[] = array('id' => 'wiki', 'href' => $oMainPage->getFullURL(), 'text' => $wgSitename, 'active' => $oCurrentTitle->equals($oMainPage), 'level' => 1, 'containsactive' => false, 'external' => false, 'children' => array()); wfRunHooks('BSTopMenuBarCustomizerRegisterNavigationSites', array(&self::$aNavigationSites)); BsCacheHelper::set($sKey, self::$aNavigationSites, 60 * 1440); //max cache time 24h return self::$aNavigationSites; }
public function getForm() { $oViewExtensionInfoTable = new ViewExtensionInfoTable(); $aInfos = BsExtensionManager::getExtensionInformation(); ksort($aInfos); $oViewExtensionInfoTable->setExtensions($aInfos); return $oViewExtensionInfoTable->execute(); }
public static function ajaxGetPossibleEditors($iArticleId = -1) { $aResult = array('users' => array()); if ($iArticleId == -1) { return FormatJson::encode($aResult); } $oResponsibleEditors = BsExtensionManager::getExtension('ResponsibleEditors'); $aResult['users'] = $aEditors = $oResponsibleEditors->getListOfResponsibleEditorsForArticle($iArticleId); return FormatJson::encode($aResult); }
/** * Renders the main form. Called by WikiAdmin * @return string rendered HTML */ public function getForm() { $this->getOutput()->addModuleStyles('ext.bluespice.extensioninfo.styles'); $this->getOutput()->addModules('ext.bluespice.extensioninfo'); BsExtensionManager::setContext('MW::ExtensionInfoShow'); $oViewExtensionInfoTable = new ViewExtensionInfoTable(); $aInfos = BsExtensionManager::getExtensionInformation(); ksort($aInfos); $oViewExtensionInfoTable->setExtensions($aInfos); return $oViewExtensionInfoTable->execute(); }
/** * This method actually generates the output * @param mixed $params Comes from base class definition. Not used in this implementation. * @return string HTML output */ public function execute($params = false) { $this->initFields(); wfRunHooks('BsAuthorPageProfileImageAfterInitFields', array(&$this, $this->oUser)); // CR RBV (03.06.11 08:39): Hook/Event! if (BsExtensionManager::isContextActive('MW::SecureFileStore::Active')) { $this->sImagePath = SecureFileStore::secureStuff($this->sImagePath, true); } $aOut = array(); $aOut[] = '<div id="bs-authors-imageform" class="bs-userpagesettings-item">'; $aOut[] = $this->renderLink(array('href' => htmlspecialchars($this->sImageUploadPath), 'title' => wfMessage('bs-authors-profileimage-change')->plain()), '<img src="' . $this->sImagePath . '" alt="' . $this->sUserDisplayName . '" width="64" title="' . wfMessage('bs-authors-profileimage')->plain() . '" />' . '<div class="bs-user-label">' . wfMessage('bs-authors-profileimage-change')->plain() . '</div>'); $aOut[] = '</div>'; return implode("\n", $aOut); }
/** * Initialization of ExtendedEditBar extension */ protected function initExt() { wfProfileIn('BS::' . __METHOD__); BsExtensionManager::setContext('MW::SecureFileStore::Active'); BsConfig::registerVar('MW::SecureFileStore::Active', true, BsConfig::LEVEL_PRIVATE | BsConfig::TYPE_BOOL | BsConfig::RENDER_AS_JAVASCRIPT); BsConfig::registerVar('MW::SecureFileStore::DefaultDisposition', 'inline', BsConfig::LEVEL_PUBLIC | BsConfig::TYPE_STRING | BsConfig::USE_PLUGIN_FOR_PREFS, 'bs-securefilestore-pref-defaultdisposition', 'select'); BsConfig::registerVar('MW::SecureFileStore::DispositionInline', array('pdf'), BsConfig::LEVEL_PUBLIC | BsConfig::TYPE_ARRAY_STRING, 'bs-securefilestore-pref-dispositioninline', 'multiselectplusadd'); BsConfig::registerVar('MW::SecureFileStore::DispositionAttachment', array('doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'), BsConfig::LEVEL_PUBLIC | BsConfig::TYPE_ARRAY_STRING, 'bs-securefilestore-pref-dispositionattachment', 'multiselectplusadd'); BsConfig::registerVar('MW::SecureFileStore::FileExtensionWhitelist', array(), BsConfig::LEVEL_PUBLIC | BsConfig::TYPE_ARRAY_STRING | BsConfig::RENDER_AS_JAVASCRIPT, 'bs-securefilestore-pref-fileextensionwhitelist', 'multiselectplusadd'); $this->setHook('SkinTemplateOutputPageBeforeExec', 'secureImages'); $this->setHook('ExtendedSearchBeforeAjaxResponse', 'secureImages'); $this->setHook('SiteNoticeAfter', 'onSiteNoticeAfter'); $this->mCore->registerPermission('viewfiles', array('user'), array('type' => 'global')); wfProfileOut('BS::' . __METHOD__); }
public function execute($sParameter) { parent::execute($sParameter); $oRequestedTitle = null; $oOut = $this->getOutput(); if (!empty($sParameter)) { $oRequestedTitle = Title::newFromText($sParameter); if ($oRequestedTitle->exists() && ($oRequestedTitle->getNamespace() !== NS_USER || $oRequestedTitle->isSubpage() === true)) { $sOut = $this->renderReadersGrid(); $oOut->addModules('ext.bluespice.readers.specialreaders'); $oOut->setPageTitle(wfMessage('readers', $oRequestedTitle->getFullText())->text()); $oOut->addHtml('<script type="text/javascript"> bsReadersTitle = "' . $oRequestedTitle->getPrefixedText() . '"; </script>'); } elseif ($oRequestedTitle->getNamespace() === NS_USER) { $sOut = $this->renderReaderspathGrid(); $oOut->addModules('ext.bluespice.readers.specialreaderspath'); $oUser = User::newFromName($oRequestedTitle->getText()); $oOut->setPageTitle(wfMessage('readers-user', $oUser->getName())->text()); $oOut->addHtml('<script type="text/javascript"> bsReadersUserID = "' . $oUser->getId() . '"; </script>'); } else { $oErrorView = new ViewTagErrorList(); $oErrorView->addItem(new ViewTagError(wfMessage('bs-readers-pagenotexists')->plain())); $sOut = $oErrorView->execute(); } } else { $oErrorView = new ViewTagErrorList(BsExtensionManager::getExtension('Readers')); $oErrorView->addItem(new ViewTagError(wfMessage('bs-readers-emptyinput')->plain())); $sOut = $oErrorView->execute(); } if ($oRequestedTitle === null) { $oOut->setPageTitle($oOut->getPageTitle()); } $oOut->addHTML($sOut); }
<?php BsExtensionManager::registerExtension('InsertFile', BsRUNLEVEL::FULL | BsRUNLEVEL::REMOTE, BsACTION::LOAD_ON_API); $wgMessagesDirs['InsertFile'] = __DIR__ . '/i18n'; $wgExtensionMessagesFiles['InsertFile'] = __DIR__ . '/languages/InsertFile.i18n.php'; $GLOBALS['wgAutoloadClasses']['InsertFile'] = __DIR__ . '/InsertFile.class.php'; $wgAutoloadClasses['JsonLicenses'] = __DIR__ . '/includes/JsonLicenses.php'; $wgAjaxExportList[] = 'InsertFile::getLicenses'; $aResourceModuleTemplate = array('localBasePath' => __DIR__ . '/resources', 'remoteExtPath' => 'BlueSpiceExtensions/InsertFile/resources'); $wgResourceModules['ext.bluespice.insertFile'] = array('scripts' => 'bluespice.insertFile.js', 'messages' => array('bs-insertfile-button-image-title', 'bs-insertfile-button-file-title', 'bs-insertfile-uploadsdisabled', 'bs-insertfile-nomatch', 'bs-insertfile-labelsort', 'bs-insertfile-labelfilter', 'bs-insertfile-filename', 'bs-insertfile-filesize', 'bs-insertfile-lastmodified', 'bs-insertfile-labelupload', 'bs-insertfile-details-title', 'bs-insertfile-labeldimensions', 'bs-insertfile-labelalt', 'bs-insertfile-labelalign', 'bs-insertfile-labellink', 'bs-insertfile-alignnone', 'bs-insertfile-alignleft', 'bs-insertfile-aligncenter', 'bs-insertfile-alignright', 'bs-insertfile-labeltype', 'bs-insertfile-typenone', 'bs-insertfile-typethumb', 'bs-insertfile-typeframe', 'bs-insertfile-typeborder', 'bs-insertfile-uploadbuttontext', 'bs-insertfile-uploadimageemptytext', 'bs-insertfile-uploadimagefieldlabel', 'bs-insertfile-uploadfileemptytext', 'bs-insertfile-uploadfilefieldlabel', 'bs-insertfile-uploaddestfilelabel', 'bs-insertfile-uploaddescfilelabel', 'bs-insertfile-uploadwatchthislabel', 'bs-insertfile-uploadignorewarningslabel', 'bs-insertfile-uploadsubmitvalue', 'bs-insertfile-errorloading', 'bs-insertfile-warning', 'bs-insertfile-warningupload', 'bs-insertfile-allowedfiletypesare', 'bs-insertfile-success', 'bs-insertfile-error', 'bs-insertfile-errornofileextensiononupload', 'bs-insertfile-errornofileextensionondestination', 'bs-insertfile-errorWrongFileExtensionOnUpload', 'bs-insertfile-errorWrongImageTypeOnUpload', 'bs-insertfile-errorWrongFileTypeOnUpload', 'bs-insertfile-errorWrongFileExtensionOnDestination', 'bs-insertfile-errorwrongimagetypeondestination', 'bs-insertfile-errorwrongfiletypeondestination', 'bs-insertfile-uploadcomplete', 'bs-insertfile-titlefile', 'bs-insertfile-titleimage', 'bs-insertfile-tipkeepratio', 'bs-insertfile-pagingtoolbarposition', 'bs-insertfile-select-a-link', 'bs-insertfile-license', 'bs-insertfile-categories', 'bs-insertfile-upload-waitmessage', 'bs-insertfile-linktext', 'bs-insertfile-no-link', 'bs-insertfile-error-no-imagelink', 'bs-insertfile-error-no-medialink', 'windows-nonascii-filename')) + $aResourceModuleTemplate; $wgResourceModules['ext.bluespice.insertFile.styles'] = array('styles' => 'bluespice.insertFile.css') + $aResourceModuleTemplate; unset($aResourceModuleTemplate);
<?php BsExtensionManager::registerExtension('Authors', BsRUNLEVEL::FULL | BsRUNLEVEL::REMOTE); $wgMessagesDirs['Authors'] = __DIR__ . '/i18n'; $wgExtensionMessagesFiles['Authors'] = __DIR__ . '/languages/Authors.i18n.php'; $wgExtensionMessagesFiles['AuthorsMagic'] = __DIR__ . '/languages/Authors.i18n.magic.php'; $wgResourceModules['ext.bluespice.authors.styles'] = array('styles' => 'extensions/BlueSpiceExtensions/Authors/resources/bluespice.authors.css', 'position' => 'top', 'localBasePath' => $IP, 'remoteBasePath' => &$GLOBALS['wgScriptPath']); $GLOBALS['wgAutoloadClasses']['Authors'] = __DIR__ . '/Authors.class.php'; $wgAutoloadClasses['ViewAuthors'] = __DIR__ . '/views/view.Authors.php'; $wgAutoloadClasses['ViewAuthorsUserPageProfileImageSetting'] = __DIR__ . '/views/view.AuthorsUserPageProfileImageSetting.php';
<?php // Register the extension with BlueSpice BsExtensionManager::registerExtension('BoilerPlate', BsRUNLEVEL::FULL | BsRUNLEVEL::REMOTE, BsACTION::LOAD_ON_API | BsACTION::LOAD_SPECIALPAGE, __DIR__); // Path to message files $wgMessagesDirs['BoilerPlate'] = __DIR__ . '/i18n'; // Add extension class to autoloader $GLOBALS['wgAutoloadClasses']['BoilerPlate'] = __DIR__ . '/BoilerPlate.class.php'; // Commonly used settings for resource loader (in scripts and styles) $aResourceModuleTemplate = array('localBasePath' => __DIR__ . '/resources', 'remoteExtPath' => 'BlueSpiceExtensions/examples/BoilerPlate/resources'); // Styles to be embedded by resource loader $wgResourceModules['ext.bluespice.boilerPlate.styles'] = array('styles' => 'bluespice.boilerPlate.less') + $aResourceModuleTemplate; // Scripts to be embedded by resource loader $wgResourceModules['ext.bluespice.boilerPlate.scripts'] = array('scripts' => 'bluespice.boilerPlate.js', 'messages' => array('bs-boilerplate-somekey'), 'dependencies' => 'ext.bluespice') + $aResourceModuleTemplate; unset($aResourceModuleTemplate);
<?php BsExtensionManager::registerExtension('WidgetBar', BsRUNLEVEL::FULL | BsRUNLEVEL::REMOTE); $GLOBALS['wgAutoloadClasses']['WidgetBar'] = __DIR__ . '/WidgetBar.class.php'; $wgMessagesDirs['WidgetBar'] = __DIR__ . '/i18n'; $wgExtensionMessagesFiles['WidgetBar'] = __DIR__ . '/languages/WidgetBar.i18n.php'; $aResourceModuleTemplate = array('localBasePath' => 'extensions/BlueSpiceExtensions/WidgetBar/resources/', 'remoteExtPath' => 'BlueSpiceExtensions/WidgetBar/resources'); $wgResourceModules['ext.bluespice.widgetbar.style'] = array('styles' => 'bluespice.widgetBar.css') + $aResourceModuleTemplate; $wgResourceModules['ext.bluespice.widgetbar'] = array('scripts' => 'bluespice.widgetBar.js', 'dependencies' => array('jquery.cookie'), 'position' => 'bottom') + $aResourceModuleTemplate; unset($aResourceModuleTemplate); $wgAutoloadClasses['ViewWidgetError'] = __DIR__ . '/views/view.WidgetError.php'; $wgAutoloadClasses['ViewWidgetErrorList'] = __DIR__ . '/views/view.WidgetErrorList.php'; $wgAutoloadClasses['ViewWidgetList'] = __DIR__ . '/views/view.WidgetList.php';
<?php BsExtensionManager::registerExtension('WantedArticle', BsRUNLEVEL::FULL | BsRUNLEVEL::REMOTE); $GLOBALS['wgAutoloadClasses']['WantedArticle'] = __DIR__ . '/WantedArticle.class.php'; $wgMessagesDirs['WantedArticle'] = __DIR__ . '/i18n'; $wgExtensionMessagesFiles['WantedArticle'] = __DIR__ . '/languages/WantedArticle.i18n.php'; $wgResourceModules['ext.bluespice.wantedarticle'] = array('scripts' => 'bluespice.wantedArticle.js', 'messages' => array('bs-wantedarticle-info-nothing-entered', 'bs-wantedarticle-title-invalid-chars'), 'position' => 'top', 'localBasePath' => $IP . '/extensions/BlueSpiceExtensions/WantedArticle/resources', 'remoteExtPath' => 'BlueSpiceExtensions/WantedArticle/resources'); $wgAjaxExportList[] = 'WantedArticle::ajaxAddWantedArticle'; $wgAjaxExportList[] = 'WantedArticle::ajaxGetWantedArticles'; $wgAutoloadClasses['ViewWantedArticleForm'] = __DIR__ . '/includes/ViewWantedArticleForm.php'; $wgAutoloadClasses['ViewWantedArticleTag'] = __DIR__ . '/includes/ViewWantedArticleTag.php';
/** * Hook-Handler for Hook 'BSStateBarBeforeBodyViewAdd' * @param StateBar $oStateBar * @param array $aBodyViews * @return boolean Always true to keep hook running */ public function onStateBarBeforeBodyViewAdd($oStateBar, &$aBodyViews, $oUser, $oTitle) { if (BsExtensionManager::isContextActive('MW::ArticleInfo::Hide')) { return true; } wfProfileIn('BS::' . __METHOD__); $aBodyElements = array('statebarbodysubpages' => $this->makeStateBarBodySubPages($oTitle), 'statebarbodycategories' => $this->makeStateBarBodyCategories($oTitle), 'statebarbodytemplates' => $this->makeStateBarBodyTemplates($oTitle)); foreach ($aBodyElements as $sKey => $oBodyView) { if (!$oBodyView) { continue; } $aBodyViews[$sKey] = $oBodyView; } wfProfileOut('BS::' . __METHOD__); return true; }
<?php BsExtensionManager::registerExtension('Flexiskin', BsRUNLEVEL::FULL | BsRUNLEVEL::REMOTE); $wgMessagesDirs['Flexiskin'] = __DIR__ . '/i18n'; $wgExtensionMessagesFiles['Flexiskin'] = __DIR__ . '/languages/Flexiskin.i18n.php'; $wgExtensionMessagesFiles['FlexiskinAlias'] = __DIR__ . '/languages/Flexiskin.alias.php'; $GLOBALS['wgAutoloadClasses']['Flexiskin'] = __DIR__ . '/Flexiskin.class.php'; $wgHooks['SkinTemplateOutputPageBeforeExec'][] = "Flexiskin::onSkinTemplateOutputPageBeforeExec"; $wgResourceModules['ext.bluespice.flexiskin'] = array('scripts' => array('extensions/BlueSpiceExtensions/Flexiskin/resources/bluespice.flexiskin.js'), 'styles' => array('extensions/BlueSpiceExtensions/Flexiskin/resources/bluespice.flexiskin.css'), 'dependencies' => array('ext.bluespice.extjs'), 'messages' => array('bs-flexiskin-labelname', 'bs-flexiskin-labeldesc', 'bs-flexiskin-headergeneral', 'bs-flexiskin-dialogclose', 'bs-flexiskin-dialogreset', 'bs-flexiskin-confirmdeleteskin', 'bs-flexiskin-titleaddskin', 'bs-flexiskin-labelskins', 'bs-flexiskin-defaultname', 'bs-flexiskin-defaultdesc', 'bs-flexiskin-headeractive', 'bs-flexiskin-labelbgcolor', 'bs-flexiskin-headerheader', 'bs-flexiskin-labellogoupload', 'bs-flexiskin-labelbackgroundupload', 'bs-flexiskin-labelrepeatbackground', 'bs-flexiskin-no-repeat', 'bs-flexiskin-repeat-x', 'bs-flexiskin-repeat-y', 'bs-flexiskin-repeat', 'bs-flexiskin-labelcustombgcolor', 'bs-flexiskin-labelnavigation', 'bs-flexiskin-headerposition', 'bs-flexiskin-labelcontent', 'bs-flexiskin-left', 'bs-flexiskin-right', 'bs-flexiskin-center', 'bs-flexiskin-labelwidth', 'bs-flexiskin-labelfullwidth', 'bs-flexiskin-error-nameempty', 'bs-flexiskin-error-templatenotexists'), 'localBasePath' => $IP, 'remoteBasePath' => &$GLOBALS['wgScriptPath']); $wgAutoloadClasses['FlexiskinApi'] = __DIR__ . '/includes/FlexiskinApi.class.php'; $wgAPIModules['flexiskin'] = 'FlexiskinApi'; $wgAutoloadClasses['FlexiskinFormatter'] = __DIR__ . '/includes/FlexiskinFormatter.class.php'; $wgEditPageFrameOptions = "SAMEORIGIN"; $wgForeignFileRepos[] = array('class' => 'FSRepo', 'name' => 'Flexiskin', 'directory' => BS_DATA_DIR . '/Flexiskin/', 'hashLevels' => 0, 'url' => BS_DATA_PATH . '/Flexiskin');
/** * returns the formular for Preferences * @return string the formular string */ public function getForm() { if (wfReadOnly()) { throw new ReadOnlyError(); } $this->getOutput()->addModuleScripts('ext.bluespice.preferences'); $this->getOutput()->addHTML('<br />'); $oRequest = $this->getRequest(); if ($this->getRequest()->getVal('success') == true) { $this->getOutput()->wrapWikiMsg('<div class="successbox"><strong>$1</strong></div><div id="mw-pref-clear"></div>' . "\n", 'savedprefs'); } $orig_deliver = BsConfig::deliverUsersSettings(false); BsConfig::loadSettings(); BsExtensionManager::getExtensionInformation(); $vars = BsConfig::getRegisteredVars(); $bShowall = $oRequest->getFuzzyBool('showall'); if ($bShowall) { $out = ''; foreach ($vars as $var) { $out .= $var->getAdapter() . "::"; if ($var->getExtension() !== null) { $out .= $var->getExtension() . "::"; } $out .= $var->getName() . "<br>"; } return $out; } $preferences = array(); $aSortedVariables = array(); foreach ($vars as $var) { $options = $var->getOptions(); if (!($options & (BsConfig::LEVEL_PUBLIC | BsConfig::LEVEL_USER))) { continue; } if ($options & BsConfig::NO_DEFAULT) { continue; } $extension = $var->getI18nExtension() ? $var->getI18nExtension() : 'BASE'; $aSortedVariables[$extension][] = $var; } foreach ($aSortedVariables as $sExtensionName => $aExtensions) { if (!count($aExtensions)) { continue; } foreach ($aExtensions as $oVariable) { // if continue, then $oAdapterSetView is not added to output if (!count($oVariable)) { continue; } $sSection = $sExtensionName; $oExtension = BsExtensionManager::getExtension($sExtensionName); $field = $oVariable->getFieldDefinition($sSection); if ($oVariable->getOptions() & BsConfig::USE_PLUGIN_FOR_PREFS) { $oExtension = BsExtensionManager::getExtension($sExtensionName); $tmp = $oExtension->runPreferencePlugin('MW', $oVariable); $field = array_merge($field, $tmp); } $preferences[$oVariable->generateFieldId()] = $field; } } BsConfig::deliverUsersSettings($orig_deliver); $oForm = new HTMLFormEx($preferences, 'prefs'); $oForm->setTitle($this->getTitle()); $oForm->addHiddenField('mode', 'Preferences'); $oForm->setSubmitText(wfMessage('bs-extjs-save')->plain()); $oForm->setSubmitName('WikiAdminPreferencesSubmit'); $oForm->setSubmitCallback(array($this, 'savePreferences')); $oForm->show(); $this->getOutput()->addHTML('<br />'); return ''; }
<?php BsExtensionManager::registerExtension('ArticleInfo', BsRUNLEVEL::FULL | BsRUNLEVEL::REMOTE); $GLOBALS['wgAutoloadClasses']['ArticleInfo'] = __DIR__ . '/ArticleInfo.class.php'; $wgMessagesDirs['ArticleInfo'] = __DIR__ . '/i18n'; $wgExtensionMessagesFiles['ArticleInfo'] = __DIR__ . '/languages/ArticleInfo.i18n.php'; $wgResourceModules['ext.bluespice.articleinfo'] = array('scripts' => 'extensions/BlueSpiceExtensions/ArticleInfo/resources/bluespice.articleInfo.js', 'position' => 'bottom', 'localBasePath' => $IP, 'remoteBasePath' => &$GLOBALS['wgScriptPath']); $wgAutoloadClasses['ViewStateBarTopElementCategoryShortList'] = __DIR__ . '/views/view.StateBarTopElementCategoryShortList.php';
<?php BsExtensionManager::registerExtension('ResponsibleEditors', BsRUNLEVEL::FULL | BsRUNLEVEL::REMOTE, BsACTION::LOAD_SPECIALPAGE); $wgMessagesDirs['ResponsibleEditors'] = __DIR__ . '/i18n'; $wgExtensionMessagesFiles['ResponsibleEditors'] = __DIR__ . '/languages/ResponsibleEditors.i18n.php'; $wgExtensionMessagesFiles['ResponsibleEditorsAlias'] = __DIR__ . '/languages/SpecialResponsibleEditors.alias.php'; // Specialpage and messages $GLOBALS['wgAutoloadClasses']['ResponsibleEditors'] = __DIR__ . '/ResponsibleEditors.class.php'; $wgAutoloadClasses['BsResponsibleEditor'] = __DIR__ . '/includes/BsResponsibleEditor.php'; $wgAutoloadClasses['SpecialResponsibleEditors'] = __DIR__ . '/includes/specials/SpecialResponsibleEditors.class.php'; $wgAutoloadClasses['ApiResponsibleEditorsStore'] = __DIR__ . '/includes/api/ApiResponsibleEditorsStore.class.php'; $wgAutoloadClasses['ApiResponsibleEditorsTasks'] = __DIR__ . '/includes/api/ApiResponsibleEditorsTasks.class.php'; $wgSpecialPages['ResponsibleEditors'] = 'SpecialResponsibleEditors'; $aResourceModuleTemplate = array('dependencies' => 'ext.bluespice', 'localBasePath' => $IP . '/extensions/BlueSpiceExtensions/ResponsibleEditors/resources', 'remoteExtPath' => 'BlueSpiceExtensions/ResponsibleEditors/resources'); $wgResourceModules['ext.bluespice.responsibleEditors.styles'] = array('styles' => 'bluespice.responsibleEditors.css') + $aResourceModuleTemplate; $wgResourceModules['ext.bluespice.responsibleEditors'] = array('scripts' => 'bluespice.responsibleEditors.js', 'messages' => array('bs-responsibleeditors-availableeditors', 'bs-responsibleeditors-assignededitors', 'bs-responsibleeditors-title')) + $aResourceModuleTemplate; $wgResourceModules['ext.bluespice.responsibleEditors.manager'] = array('scripts' => 'bluespice.responsibleEditors.manager.js', 'dependencies' => array('ext.bluespice.responsibleEditors', 'ext.bluespice.extjs'), 'messages' => array('bs-responsibleeditors-cbLabelEditorList', 'bs-responsibleeditors-cbEmptyText', 'bs-responsibleeditors-loadMaskMessage', 'bs-responsibleeditors-columnpage', 'bs-responsibleeditors-columnresponsibleeditor', 'bs-responsibleeditors-columnnamespace', 'bs-responsibleeditors-tipEditAssignment', 'bs-responsibleeditors-tipRemoveAssignement', 'bs-responsibleeditors-btnDisplayModeText', 'bs-responsibleeditors-rbdisplaymodeonlyassignedtext', 'bs-responsibleeditors-rbdisplaymodeonlynotassigned', 'bs-responsibleeditors-rbdisplaymodeall', 'bs-responsibleeditors-cbnamespacesemptytext', 'bs-responsibleeditors-confirmNavigationTitle', 'bs-responsibleeditors-confirmNavigationText', 'bs-responsibleeditors-columneesponsibleeditornotset')) + $aResourceModuleTemplate; $wgResourceModules['ext.bluespice.responsibleEditors.bookshelfPlugin'] = array('scripts' => array('bluespice.responsibleEditors.BookshelfPlugin.js'), 'dependencies' => 'ext.bluespice.responsibleEditors', 'messages' => array('bs-responsibleeditors-titleeditors', 'bs-responsibleeditors-cmchangerespeditors')) + $aResourceModuleTemplate; $wgResourceModules['ext.bluespice.responsibleEditors.superList'] = array('scripts' => array('bluespice.responsibleEditors.SuperList.js'), 'dependencies' => array('ext.bluespice.responsibleEditors')) + $aResourceModuleTemplate; $wgAjaxExportList[] = 'SpecialResponsibleEditors::ajaxGetResponsibleEditors'; $wgAjaxExportList[] = 'SpecialResponsibleEditors::ajaxSetResponsibleEditors'; $wgAjaxExportList[] = 'SpecialResponsibleEditors::ajaxGetPossibleEditors'; $wgAjaxExportList[] = 'ResponsibleEditors::ajaxGetActivatedNamespacesForCombobox'; $wgAjaxExportList[] = 'ResponsibleEditors::ajaxGetResponsibleEditorsByArticleId'; $wgAjaxExportList[] = 'ResponsibleEditors::ajaxGetArticlesByNamespaceId'; $wgAjaxExportList[] = 'ResponsibleEditors::ajaxGetListOfResponsibleEditorsForArticle'; $wgAjaxExportList[] = 'ResponsibleEditors::ajaxDeleteResponsibleEditorsForArticle'; $wgAjaxExportList[] = 'ResponsibleEditors::getResponsibleEditorsPortletData'; $wgLogTypes[] = 'bs-responsibleeditors'; $wgFilterLogTypes['bs-responsibleeditors'] = true; $wgHooks['LoadExtensionSchemaUpdates'][] = 'ResponsibleEditors::getSchemaUpdates';
public static function ajaxGetArticlesByNamespaceId() { if (BsCore::checkAccessAdmission('edit') === false) { return true; } global $wgOut, $wgRequest; $wgOut->disable(); $oParams = BsExtJSStoreParams::newFromRequest(); $iStart = $wgRequest->getInt('start', 0); $sSort = $oParams->getSort('page_title'); $sDirection = $oParams->getDirection(); $iLimit = $wgRequest->getInt('limit', 25); $sDisplayMode = $wgRequest->getVal('displayMode', 'only-assigned'); $iNamespaceId = $wgRequest->getInt('namespaceId', -99); $aActivatedNamespaces = BsConfig::get('MW::ResponsibleEditors::ActivatedNamespaces'); $oResult = new stdClass(); $aTables = array('bs_responsible_editors', 'user', 'page'); $aVariables = array('page_id', 'page_title', 'page_namespace'); $aConditions = array('page_namespace' => $aActivatedNamespaces); if ($sDisplayMode == 'only-assigned') { $aConditions[] = 're_user_id IS NOT NULL '; } else { if ($sDisplayMode == 'only-not-assigned') { $aConditions[] = 're_user_id IS NULL '; } } if ($iNamespaceId != -99) { $aConditions['page_namespace'] = $iNamespaceId; } $aOptions = array('ORDER BY' => $sSort . ' ' . $sDirection, 'LIMIT' => $iLimit, 'OFFSET' => $iStart, 'GROUP BY' => 'page_id'); if ($sSort == 'user_displayname') { $aOptions['ORDER BY'] = 'user_real_name, user_name ' . $sDirection; } $aJoinOptions = array('user' => array('JOIN', 'user_id = re_user_id'), 'page' => array('RIGHT JOIN', 'page_id = re_page_id')); $dbr = wfGetDB(DB_SLAVE); //TODO: Rework "total" calculation. This seems very complicated but it //should be as easy as excuting the main query without LIMIT/OFFSET. if ($sDisplayMode == 'only-assigned' || $sDisplayMode == 'only-not-assigned') { $row = $dbr->select(array('page', 'bs_responsible_editors'), 'page_id AS cnt', $aConditions, __METHOD__, array('GROUP BY' => 'page_id'), array('page' => array('RIGHT JOIN', 'page_id = re_page_id'))); $oResult->total = $row->numRows(); } if ($sDisplayMode == 'all') { $aConditionsWithoutRePageID = $aConditions; unset($aConditionsWithoutRePageID[0]); $row = $dbr->selectRow('page', 'COUNT( page_id ) AS cnt', $aConditionsWithoutRePageID); $oResult->total = $row->cnt; } $res = $dbr->select($aTables, $aVariables, $aConditions, __METHOD__, $aOptions, $aJoinOptions); $oResult->pages = array(); foreach ($res as $row) { $oTitle = Title::newFromId($row->page_id); $iPageId = $row->page_id; $sPageNsId = !empty($row->page_namespace) ? $row->page_namespace : 0; $sPageTitle = $row->page_title; $oPage = new stdClass(); $oPage->page_id = $iPageId; $oPage->page_namespace = $sPageNsId; $oPage->page_title = $sPageTitle; $oPage->page_prefixedtext = $oTitle->getPrefixedText(); $oPage->users = array(); $aEditorIDs = BsExtensionManager::getExtension('ResponsibleEditors')->getResponsibleEditorIdsByArticleId($row->page_id); $aEditorIDs = array_unique($aEditorIDs); foreach ($aEditorIDs as $iEditorID) { $oUser = User::newFromId($iEditorID); if ($oUser == null) { continue; } $oPage->users[] = array('user_id' => $iEditorID, 'user_page_link_url' => $oUser->getUserPage()->getFullUrl(), 'user_displayname' => BsCore::getUserDisplayName($oUser)); } $oResult->pages[] = $oPage; } return FormatJson::encode($oResult); }
<?php BsExtensionManager::registerExtension('SmartList', BsRUNLEVEL::FULL | BsRUNLEVEL::REMOTE); $wgMessagesDirs['SmartList'] = __DIR__ . '/i18n'; $wgExtensionMessagesFiles['SmartList'] = __DIR__ . '/languages/SmartList.i18n.php'; $GLOBALS['wgAutoloadClasses']['SmartList'] = __DIR__ . '/SmartList.class.php'; $GLOBALS['wgHooks']['LoadExtensionSchemaUpdates'][] = 'SmartList::getSchemaUpdates'; $wgAjaxExportList[] = 'SmartList::getMostVisitedPages'; $wgAjaxExportList[] = 'SmartList::getMostEditedPages'; $wgAjaxExportList[] = 'SmartList::getMostActivePortlet'; $wgAjaxExportList[] = 'SmartList::getYourEditsPortlet';
/** * Renders the blog. Called by parser function for bs:blog tag and also from Blog::onUnknownAction. * @param string $input Inner HTML of bs:blog tag. Not used. * @param array $args List of tag attributes. * @param Parser $parser MediaWiki parser object * @return string HTML output that is to be displayed. */ public function onBlog($input, $args, $parser) { $oTitle = null; if ($parser instanceof Parser) { $oTitle = $parser->getTitle(); $parser->disableCache(); } else { $oTitle = $this->getTitle(); } $sKey = BsCacheHelper::getCacheKey('BlueSpice', 'Blog', $oTitle->getArticleID()); $aData = BsCacheHelper::get($sKey); if ($aData !== false) { return $aData; } // initialize local variables $oErrorListView = new ViewTagErrorList($this); BsExtensionManager::setContext('MW::Blog::ShowBlog'); // get all config options $iShowLimit = BsConfig::get('MW::Blog::ShowLimit'); //$blogShowTrackback = BsConfig::get('MW::Blog::ShowTrackback'); // see comment below $bShowPermalink = BsConfig::get('MW::Blog::ShowPermalink'); $bShowInfo = BsConfig::get('MW::Blog::ShowInfo'); $sSortBy = BsConfig::get('MW::Blog::SortBy'); $bMoreInNewWindow = BsConfig::get('MW::Blog::MoreInNewWindow'); $bShowAll = BsConfig::get('MW::Blog::ShowAll'); $bMoreAtEndOfEntry = BsConfig::get('MW::Blog::MoreAtEndOfEntry'); $bShowNewEntryField = BsConfig::get('MW::Blog::ShowNewEntryField'); $bNewEntryFieldPosition = BsConfig::get('MW::Blog::NewEntryFieldPosition'); $sImageRenderMode = BsConfig::get('MW::Blog::ImageRenderMode'); $sImageFloatDirection = BsConfig::get('MW::Blog::ThumbFloatDirection'); $iMaxEntryCharacters = BsConfig::get('MW::Blog::MaxEntryCharacters'); // Trackbacks are not supported the way we intend it to be. From http://www.mediawiki.org/wiki/Manual:$wgUseTrackbacks // When MediaWiki receives a trackback ping, a box will show up at the bottom of the article containing a link to the originating page //if (!$wgUseTrackbacks) $bShowTrackback = false; // get tag attributes $argsIShowLimit = BsCore::sanitizeArrayEntry($args, 'count', $iShowLimit, BsPARAMTYPE::NUMERIC | BsPARAMOPTION::DEFAULT_ON_ERROR); $argsSCategory = BsCore::sanitizeArrayEntry($args, 'cat', false, BsPARAMTYPE::STRING); $argsINamespace = BsNamespaceHelper::getNamespaceIndex(BsCore::sanitizeArrayEntry($args, 'ns', NS_BLOG, BsPARAMTYPE::STRING)); $argsBNewEntryField = BsCore::sanitizeArrayEntry($args, 'newentryfield', $bShowNewEntryField, BsPARAMTYPE::BOOL); $argsSNewEntryFieldPosition = BsCore::sanitizeArrayEntry($args, 'newentryfieldposition', $bNewEntryFieldPosition, BsPARAMTYPE::STRING); $argsSImageRenderMode = BsCore::sanitizeArrayEntry($args, 'imagerendermode', $sImageRenderMode, BsPARAMTYPE::STRING); $argsSImageFloatDirection = BsCore::sanitizeArrayEntry($args, 'imagefloatdirection', $sImageFloatDirection, BsPARAMTYPE::STRING); $argsIMaxEntryCharacters = BsCore::sanitizeArrayEntry($args, 'maxchars', $iMaxEntryCharacters, BsPARAMTYPE::INT); $argsSSortBy = BsCore::sanitizeArrayEntry($args, 'sort', $sSortBy, BsPARAMTYPE::STRING); $argsBShowInfo = BsCore::sanitizeArrayEntry($args, 'showinfo', $bShowInfo, BsPARAMTYPE::BOOL); $argsBMoreInNewWindow = BsCore::sanitizeArrayEntry($args, 'moreinnewwindow', $bMoreInNewWindow, BsPARAMTYPE::BOOL); $argsBShowPermalink = BsCore::sanitizeArrayEntry($args, 'showpermalink', $bShowPermalink, BsPARAMTYPE::BOOL); $argsModeNamespace = BsCore::sanitizeArrayEntry($args, 'mode', null, BsPARAMTYPE::STRING); if ($argsModeNamespace === 'ns' && is_object($oTitle)) { $argsINamespace = $oTitle->getNamespace(); } // validate tag attributes $validateIShowLimit = BsValidator::isValid('ArgCount', $argsIShowLimit, array('fullResponse' => true)); if ($validateIShowLimit->getErrorCode()) { $oErrorListView->addItem(new ViewTagError($validateIShowLimit->getI18N())); } if ($argsSCategory) { $validateSCategory = BsValidator::isValid('Category', $argsSCategory, array('fullResponse' => true)); if ($validateSCategory->getErrorCode()) { $oErrorListView->addItem(new ViewTagError($validateSCategory->getI18N())); } } $oValidationResult = BsValidator::isValid('SetItem', $argsSImageRenderMode, array('fullResponse' => true, 'setname' => 'imagerendermode', 'set' => array('full', 'thumb', 'none'))); if ($oValidationResult->getErrorCode()) { $oErrorListView->addItem(new ViewTagError($oValidationResult->getI18N())); } $oValidationResult = BsValidator::isValid('SetItem', $argsSImageFloatDirection, array('fullResponse' => true, 'setname' => 'imagefloatdirection', 'set' => array('left', 'right', 'none'))); if ($oValidationResult->getErrorCode()) { $oErrorListView->addItem(new ViewTagError($oValidationResult->getI18N())); } $oValidationResult = BsValidator::isValid('SetItem', $argsSSortBy, array('fullResponse' => true, 'setname' => 'sort', 'set' => array('title', 'creation'))); if ($oValidationResult->getErrorCode()) { $oErrorListView->addItem(new ViewTagError($oValidationResult->getI18N())); } // if there are errors, abort with a message if ($oErrorListView->hasEntries()) { return $oErrorListView->execute(); } if (BsConfig::get('MW::Blog::ShowTagFormWhenNotLoggedIn') != true) { $oPermissionTest = Title::newFromText('PermissionTest', $argsINamespace); if (!$oPermissionTest->userCan('edit')) { $argsBNewEntryField = false; } } // get array of article ids from Blog/subpages $oBlogTitle = Title::makeTitleSafe($oTitle->getNamespace(), 'Blog'); $aSubpages = $oBlogTitle->getSubpages(); $iLimit = 0; // for later use $aArticleIds = array(); foreach ($aSubpages as $oSubpage) { $aArticleIds[] = $oSubpage->getArticleID(); $iLimit++; // for later use } if (count($aArticleIds) < 1) { $aArticleIds = 0; } $aTables = array('page'); $aFields = array('entry_page_id' => 'page_id'); $aConditions = array(); $aOptions = array(); $aJoins = array(); $dbr = wfGetDB(DB_SLAVE); // get blog entries if ($argsSSortBy == 'title') { $aOptions['ORDER BY'] = 'page_title ASC'; } else { //Creation: Also fetch possible custom timestamps from page_props table $aOptions['ORDER BY'] = 'entry_timestamp DESC'; $aOptions['GROUP BY'] = 'page_id'; global $wgDBtype; switch ($wgDBtype) { case 'oracle': $aFields['entry_timestamp'] = "NVL( pp_value, rev_timestamp )"; $aConditions[] = "NVL( pp_value, rev_timestamp ) < " . wfTimestampNow(); break; case 'mssql': $aFields['entry_timestamp'] = "ISNULL( pp_value, rev_timestamp )"; $aConditions[] = "ISNULL( pp_value, rev_timestamp ) < " . wfTimestampNow(); break; case 'postgres': $aFields['entry_timestamp'] = "NULLIF( pp_value, rev_timestamp )"; $aConditions[] = "NULLIF( pp_value, rev_timestamp ) < " . wfTimestampNow(); break; default: //MySQL, SQLite //use pp_value if exists $aFields['entry_timestamp'] = "IFNULL( pp_value, rev_timestamp )"; //also do not list future entries $aConditions[] = "IFNULL( pp_value, rev_timestamp ) < " . wfTimestampNow(); } $aTables[] = 'revision'; $aTables[] = 'page_props'; $aConditions[] = 'rev_page = page_id'; $aJoins['page_props'] = array('LEFT JOIN', "pp_page = rev_page AND pp_propname = 'blogtime'"); } if ($argsSCategory) { $aTables[] = 'categorylinks'; $aConditions['cl_to'] = $argsSCategory; $aConditions[] = 'cl_from = page_id'; } else { if ($argsModeNamespace === 'ns') { $aConditions['page_id'] = $aArticleIds; } $aConditions['page_namespace'] = $argsINamespace; } $res = $dbr->select($aTables, $aFields, $aConditions, __METHOD__, $aOptions, $aJoins); $iNumberOfEntries = $dbr->numRows($res); $iLimit = $iNumberOfEntries; //All // Sole importance is the existence of param 'showall' $paramBShowAll = $this->getRequest()->getFuzzyBool('showall', false); if ($paramBShowAll == false) { $iLimit = $argsIShowLimit; } // abort if there are no entries if ($iNumberOfEntries < 1) { $oBlogView = new ViewBlog(); $oBlogView->setOption('shownewentryfield', $argsBNewEntryField); $oBlogView->setOption('newentryfieldposition', $argsSNewEntryFieldPosition); $oBlogView->setOption('namespace', BsNamespaceHelper::getNamespaceName($argsINamespace)); if ($argsSCategory) { $oBlogView->setOption('blogcat', $argsSCategory); } // actually create blog output $sOut = $oBlogView->execute(); $sOut .= wfMessage('bs-blog-no-entries')->plain(); return $sOut; } $oBlogView = new ViewBlog(); // prepare views per blog item $iLoop = 0; foreach ($res as $row) { // prepare data for view class $oEntryTitle = Title::newFromID($row->entry_page_id); if (!$oEntryTitle->userCan('read')) { $iNumberOfEntries--; continue; } $bMore = false; $aContent = preg_split('#<(bs:blog:)?more */>#', BsPageContentProvider::getInstance()->getContentFromTitle($oEntryTitle)); if (sizeof($aContent) > 1) { $bMore = true; } $aContent = trim($aContent[0]); // Prevent recursive rendering of blog tag $aContent = preg_replace('/<(bs:)blog[^>]*?>/', '', $aContent); // Thumbnail images $sNamespaceRegEx = implode('|', BsNamespaceHelper::getNamespaceNamesAndAliases(NS_IMAGE)); switch ($argsSImageRenderMode) { case 'none': $aContent = preg_replace('/(\\[\\[(' . $sNamespaceRegEx . '):[^\\|\\]]*)(\\|)?(.*?)(\\]\\])/', '', $aContent); break; case 'full': // do nothing break; case 'thumb': default: $aContent = preg_replace('/(\\[\\[(' . $sNamespaceRegEx . '):[^\\|\\]]*)(\\|)?(.*?)(\\]\\])/', "\$1|thumb|{$argsSImageFloatDirection}\$3\$4|150px\$5", $aContent); break; } if (strlen($aContent) > $argsIMaxEntryCharacters) { $bMore = true; } $aContent = BsStringHelper::shorten($aContent, array('max-length' => $argsIMaxEntryCharacters, 'ignore-word-borders' => false, 'position' => 'end')); $resComment = $dbr->selectRow('revision', 'COUNT( rev_id ) AS cnt', array('rev_page' => $oEntryTitle->getTalkPage()->getArticleID())); $iCount = $resComment->cnt; // set data for view class $oBlogItemView = new ViewBlogItem(); // use magic set $oBlogItemView->setOption('showInfo', $argsBShowInfo); $oBlogItemView->setOption('showLimit', $argsIShowLimit); $oBlogItemView->setOption('showTrackback', $bShowTrackback); $oBlogItemView->setOption('showPermalink', $argsBShowPermalink); $oBlogItemView->setOption('moreInNewWindow', $argsBMoreInNewWindow); $oBlogItemView->setOption('showAll', $bShowAll); $oBlogItemView->setOption('moreAtEndOfEntry', $bMoreAtEndOfEntry); $oBlogItemView->setOption('more', $bMore); //TODO: magic_call? if ($argsModeNamespace === 'ns') { $sTitle = substr($oEntryTitle->getText(), 5); } else { $sTitle = $oEntryTitle->getText(); } $aTalkParams = array(); if (!$oEntryTitle->getTalkPage()->exists()) { $aTalkParams = array('action' => 'edit'); } $oRevision = Revision::newFromTitle($oEntryTitle); $oBlogItemView->setTitle($sTitle); $oBlogItemView->setRevId($oRevision->getId()); $oBlogItemView->setURL($oEntryTitle->getLocalURL()); $oBlogItemView->setTalkURL($oEntryTitle->getTalkPage()->getLocalURL($aTalkParams)); $oBlogItemView->setTalkCount($iCount); $oBlogItemView->setTrackbackUrl($oEntryTitle->getLocalURL()); if ($bShowInfo) { $oFirstRevision = $oEntryTitle->getFirstRevision(); $sTimestamp = $oFirstRevision->getTimestamp(); $sLocalDateTimeString = BsFormatConverter::timestampToAgeString(wfTimestamp(TS_UNIX, $sTimestamp)); $oBlogItemView->setEntryDate($sLocalDateTimeString); $iUserId = $oFirstRevision->getUser(); if ($iUserId != 0) { $oAuthorUser = User::newFromId($iUserId); $oBlogItemView->setAuthorPage($oAuthorUser->getUserPage()->getPrefixedText()); $oBlogItemView->setAuthorName($this->mCore->getUserDisplayName($oAuthorUser)); } else { $oBlogItemView->setAuthorName($oFirstRevision->getUserText()); } } $oBlogItemView->setContent($aContent); $oBlogView->addItem($oBlogItemView); $iLoop++; if ($iLoop >= $iLimit) { break; } } $dbr->freeResult($res); // prepare complete blog output if ($bShowAll && !$paramBShowAll && $iNumberOfEntries > $argsIShowLimit) { $oBlogView->setOption('showall', true); } $oBlogView->setOption('shownewentryfield', $argsBNewEntryField); $oBlogView->setOption('newentryfieldposition', $argsSNewEntryFieldPosition); $oBlogView->setOption('namespace', BsNamespaceHelper::getNamespaceName($argsINamespace, false)); $oBlogView->setOption('blogcat', $argsSCategory); if ($argsModeNamespace === 'ns') { $oBlogView->setOption('parentpage', 'Blog/'); } // actually create blog output $sOut = $oBlogView->execute(); //Use cache only in NS_BLOG - there is curently no functionality to //figure out in what type of blog tag a entry is showen and why //(coditions). Possible blog by categories or subpages... //Needs rework. if (in_array($oTitle->getNamespace(), array(NS_BLOG, NS_BLOG_TALK))) { $aKey = array($sKey); $sTagsKey = BsCacheHelper::getCacheKey('BlueSpice', 'Blog', 'Tags'); $aTagsData = BsCacheHelper::get($sTagsKey); if ($aTagsData !== false) { if (!in_array($sKey, $aTagsData)) { $aTagsData = array_merge($aTagsData, $aKey); } } else { $aTagsData = $aKey; } BsCacheHelper::set($sTagsKey, $aTagsData, 60 * 1440); // one day BsCacheHelper::set($sKey, $sOut, 60 * 1440); // one day } return $sOut; }
/** * Notification for Shoutbox messages * @param int $iArticleId ID of the article the message was posted to. * @param int $iUserId ID of the user that posted the message. * @param string $sNick Nickname of the user that posted the message. * @param string $sMessage The message posted. * @param string $sTimestamp Time when the message was posted. * @return boolean Allow other binds to this hook to be executed. Always true. */ public function onBSShoutBoxAfterInsertShout($iArticleId, $iUserId, $sNick, $sMessage, $sTimestamp) { wfProfileIn('BS::' . __METHOD__); global $wgUser; // TODO SW: use user id if ($wgUser->isAllowed('bot')) { return true; } #check if users are mentioned in post $oShoutbox = BsExtensionManager::getExtension("ShoutBox"); $aUsers = $oShoutbox::getUsersMentioned($sMessage); $bNotify = false; #if there is any user in the post mentioned that is not the poster himself #trigger the watched article notification foreach ($aUsers as $oUser) { if ($oUser->getId() !== $iUserId) { $bNotify = true; break; } } if ($bNotify === false) { return true; } EchoEvent::create(array('type' => 'bs-shoutbox', 'title' => Title::newFromID($iArticleId), 'agent' => $wgUser, 'extra' => array('shoutmsg' => $sMessage, 'realname' => BsCore::getUserDisplayName($wgUser)))); wfProfileOut('BS::' . __METHOD__); return true; }
<?php BsExtensionManager::registerExtension('SecureFileStore', BsRUNLEVEL::FULL | BsRUNLEVEL::REMOTE); $GLOBALS['wgAutoloadClasses']['SecureFileStore'] = __DIR__ . '/SecureFileStore.class.php'; $wgMessagesDirs['SecureFileStore'] = __DIR__ . '/i18n'; $wgExtensionMessagesFiles['SecureFileStore'] = __DIR__ . '/languages/SecureFileStore.i18n.php'; $wgAjaxExportList[] = 'SecureFileStore::getFile';
<?php BsExtensionManager::registerExtension('ExtensionInfo', BsRUNLEVEL::FULL | BsRUNLEVEL::REMOTE, BsACTION::LOAD_SPECIALPAGE); $GLOBALS['wgAutoloadClasses']['ExtensionInfo'] = __DIR__ . '/ExtensionInfo.class.php'; $wgMessagesDirs['ExtensionInfo'] = __DIR__ . '/i18n'; $wgExtensionMessagesFiles['ExtensionInfo'] = __DIR__ . '/languages/ExtensionInfo.i18n.php'; $wgExtensionMessagesFiles['ExtensionInfoAlias'] = __DIR__ . '/languages/SpecialExtensionInfo.alias.php'; $wgAutoloadClasses['SpecialExtensionInfo'] = __DIR__ . '/includes/specials/SpecialExtensionInfo.class.php'; $wgAutoloadClasses['ViewExtensionInfoTable'] = __DIR__ . '/includes/ViewExtensionInfoTable.php'; $wgSpecialPages['ExtensionInfo'] = 'SpecialExtensionInfo'; $wgResourceModules['ext.bluespice.extensioninfo.styles'] = array('styles' => 'bluespice.extensionInfo.css', 'localBasePath' => $IP . '/extensions/BlueSpiceExtensions/ExtensionInfo/resources', 'remoteExtPath' => 'BlueSpiceExtensions/ExtensionInfo/resources'); $wgResourceModules['ext.bluespice.extensioninfo'] = array('scripts' => 'bluespice.extensionInfo.js', 'messages' => array('bs-extensioninfo-headerextname', 'bs-extensioninfo-headerversion', 'bs-extensioninfo-headerdesc', 'bs-extensioninfo-headerstatus', 'bs-extensioninfo-headerpackage', 'bs-extensioninfo-groupingtemplateviewtext'), 'dependencies' => array('mediawiki.jqueryMsg'), 'localBasePath' => $IP . '/extensions/BlueSpiceExtensions/ExtensionInfo/resources', 'remoteExtPath' => 'BlueSpiceExtensions/ExtensionInfo/resources');
<?php BsExtensionManager::registerExtension('InterWikiLinks', BsRUNLEVEL::FULL | BsRUNLEVEL::REMOTE, BsACTION::LOAD_SPECIALPAGE); $GLOBALS['wgAutoloadClasses']['InterWikiLinks'] = __DIR__ . '/InterWikiLinks.class.php'; $wgMessagesDirs['InterWikiLinks'] = __DIR__ . '/i18n'; $wgExtensionMessagesFiles['InterWikiLinks'] = __DIR__ . '/languages/InterWikiLinks.i18n.php'; $wgResourceModules['ext.bluespice.interWikiLinks'] = array('scripts' => 'extensions/BlueSpiceExtensions/InterWikiLinks/resources/bluespice.interWikiLinks.js', 'dependencies' => 'ext.bluespice.extjs', 'messages' => array('bs-interwikilinks-headerprefix', 'bs-interwikilinks-headerurl', 'bs-interwikilinks-titleaddinterwikilink', 'bs-interwikilinks-titleeditinterwikilink', 'bs-interwikilinks-labelprefix', 'bs-interwikilinks-labelurl', 'bs-interwikilinks-titledeleteinterwikilink', 'bs-interwikilinks-confirmdeleteinterwikilink'), 'localBasePath' => $IP, 'remoteBasePath' => &$GLOBALS['wgScriptPath']); $wgResourceModules['bluespice.insertLink.interWikiLinks'] = array('scripts' => 'extensions/BlueSpiceExtensions/InterWikiLinks/resources/bluespice.insertLink.interWikiLinks.js', 'dependencies' => 'ext.bluespice.extjs', 'messages' => array('bs-interwikilinks-insertlink-tabtitle', 'bs-interwikilinks-insertlink-labelprefix', 'bs-interwikilink-select-a-prefix'), 'localBasePath' => $IP, 'remoteBasePath' => &$GLOBALS['wgScriptPath']); $wgAjaxExportList[] = 'InterWikiLinks::getInterWikiLinks'; $wgAjaxExportList[] = 'InterWikiLinks::doEditInterWikiLink'; $wgAjaxExportList[] = 'InterWikiLinks::doDeleteInterWikiLink';
<?php BsExtensionManager::registerExtension('HideTitle', BsRUNLEVEL::FULL | BsRUNLEVEL::REMOTE); $GLOBALS['wgAutoloadClasses']['HideTitle'] = __DIR__ . '/HideTitle.class.php'; $wgMessagesDirs['HideTitle'] = __DIR__ . '/i18n'; $wgExtensionMessagesFiles['HideTitle'] = __DIR__ . '/languages/HideTitle.i18n.php'; $wgExtensionMessagesFiles['HideTitleMagic'] = __DIR__ . '/languages/HideTitle.i18n.magic.php';
<?php BsExtensionManager::registerExtension('Emoticons', BsRUNLEVEL::FULL | BsRUNLEVEL::REMOTE); $GLOBALS['wgAutoloadClasses']['Emoticons'] = __DIR__ . '/Emoticons.class.php'; $wgMessagesDirs['Emoticons'] = __DIR__ . '/i18n'; $wgExtensionMessagesFiles['Emoticons'] = __DIR__ . '/languages/Emoticons.i18n.php';
<?php BsExtensionManager::registerExtension('Dashboards', BsRUNLEVEL::FULL | BsRUNLEVEL::REMOTE); $wgMessagesDirs['Dashboards'] = __DIR__ . '/i18n'; $wgExtensionMessagesFiles['Dashboards'] = __DIR__ . '/languages/Dashboards.i18n.php'; $wgExtensionMessagesFiles['DashboardsAlias'] = __DIR__ . '/languages/Dashboards.alias.php'; $GLOBALS['wgAutoloadClasses']['Dashboards'] = __DIR__ . '/Dashboards.class.php'; $wgAutoloadClasses['Dashboards'] = __DIR__ . '/Dashboards.class.php'; $wgAutoloadClasses['SpecialAdminDashboard'] = __DIR__ . '/includes/specials/SpecialAdminDashboard.php'; $wgAutoloadClasses['SpecialUserDashboard'] = __DIR__ . '/includes/specials/SpecialUserDashboard.php'; $wgAutoloadClasses['DashboardConfigRow'] = __DIR__ . '/includes/DashboardConfigRow.php'; $wgAutoloadClasses['DashboardConfigTable'] = __DIR__ . '/includes/DashboardConfigTable.php'; $wgSpecialPages['AdminDashboard'] = 'SpecialAdminDashboard'; $wgSpecialPages['UserDashboard'] = 'SpecialUserDashboard'; $wgAjaxExportList[] = 'Dashboards::saveAdminDashboardConfig'; $wgAjaxExportList[] = 'Dashboards::saveUserDashboardConfig'; $wgAjaxExportList[] = 'Dashboards::saveTagDashboardConfig'; $wgAjaxExportList[] = 'Dashboards::getPortlets'; $wgAjaxExportList[] = 'Dashboards::getAdminDashboardConfig'; $wgAjaxExportList[] = 'Dashboards::getUserDashboardConfig'; $wgHooks['LoadExtensionSchemaUpdates'][] = 'Dashboards::getSchemaUpdates'; $aResourceModuleTemplate = array('localBasePath' => $IP . '/extensions/BlueSpiceExtensions/Dashboards/resources', 'remoteExtPath' => 'BlueSpiceExtensions/Dashboards/resources'); $wgResourceModules['ext.bluespice.dashboards'] = array('scripts' => array('bluespice.dashboards.js'), 'styles' => array('bluespice.dashboards.css'), 'messages' => array('tooltip-p-logo', 'bs-dashboards-addportlet', 'bs-dashboards-portlets', 'bs-extjs-rssfeeder-rss-title'), 'dependencies' => array('ext.bluespice.extjs.BS.portal')) + $aResourceModuleTemplate; $wgResourceModules['ext.bluespice.dashboards.userDashboard'] = array('scripts' => array('bluespice.dashboards.userDashboard.js'), 'styles' => array(), 'dependencies' => array('ext.bluespice.dashboards'), 'messages' => array('bs-dashboard-userportlet-calendar-title', 'bs-dashboard-userportlet-calendar-description')) + $aResourceModuleTemplate; $wgResourceModules['ext.bluespice.dashboards.adminDashboard'] = array('scripts' => array('bluespice.dashboards.adminDashboard.js'), 'styles' => array(), 'dependencies' => array('ext.bluespice.dashboards'), 'messages' => array()) + $aResourceModuleTemplate; unset($aResourceModuleTemplate);
<?php BsExtensionManager::registerExtension('FormattingHelp', BsRUNLEVEL::FULL | BsRUNLEVEL::REMOTE); $GLOBALS['wgAutoloadClasses']['FormattingHelp'] = __DIR__ . '/FormattingHelp.class.php'; $wgMessagesDirs['FormattingHelp'] = __DIR__ . '/i18n'; $wgExtensionMessagesFiles['FormattingHelp'] = __DIR__ . '/languages/FormattingHelp.i18n.php'; $aResourceModuleTemplate = array('localBasePath' => __DIR__ . '/resources', 'remoteExtPath' => 'BlueSpiceExtensions/FormattingHelp/resources'); $wgResourceModules['ext.bluespice.formattinghelp'] = array('scripts' => 'bluespice.formattinghelp.js', 'messages' => array('bs-formattinghelp-formatting', 'bs-formattinghelp-help-text'), 'dependencies' => 'mediawiki.action.edit') + $aResourceModuleTemplate; $wgResourceModules['ext.bluespice.formattinghelp.styles'] = array('styles' => 'bluespice.formattinghelp.css') + $aResourceModuleTemplate; unset($aResourceModuleTemplate); $wgAjaxExportList[] = 'FormattingHelp::getFormattingHelp';
<?php BsExtensionManager::registerExtension('BlueSpiceProjectFeedbackHelper', BsRUNLEVEL::FULL | BsRUNLEVEL::REMOTE, BsACTION::LOAD_SPECIALPAGE); $wgMessagesDirs['BlueSpiceProjectFeedbackHelper'] = __DIR__ . '/i18n'; $wgExtensionMessagesFiles['BlueSpiceProjectFeedbackHelper'] = __DIR__ . '/languages/BlueSpiceProjectFeedbackHelper.i18n.php'; $wgResourceModules['ext.bluespice.blueSpiceprojectfeedbackhelper'] = array('styles' => 'extensions/BlueSpiceExtensions/BlueSpiceProjectFeedbackHelper/resources/bluespice.blueSpiceProjectFeedbackHelper.css', 'scripts' => 'extensions/BlueSpiceExtensions/BlueSpiceProjectFeedbackHelper/resources/bluespice.blueSpiceProjectFeedbackHelper.js', 'dependencies' => array('jquery.cookie'), 'localBasePath' => $IP, 'remoteBasePath' => &$GLOBALS['wgScriptPath']); $wgAjaxExportList[] = 'BlueSpiceProjectFeedbackHelper::disableFeedback'; $GLOBALS['wgAutoloadClasses']['BlueSpiceProjectFeedbackHelper'] = __DIR__ . '/BlueSpiceProjectFeedbackHelper.class.php'; $wgAutoloadClasses['ViewBlueSpiceProjectFeedbackHelperPanel'] = __DIR__ . '/views/view.BlueSpiceProjectFeedbackHelperPanel.php';
<?php BsExtensionManager::registerExtension('UserPreferences', BsRUNLEVEL::FULL | BsRUNLEVEL::REMOTE, BsACTION::LOAD_SPECIALPAGE | BsACTION::LOAD_ON_API); $GLOBALS['wgAutoloadClasses']['UserPreferences'] = __DIR__ . '/UserPreferences.class.php'; $wgMessagesDirs['UserPreferences'] = __DIR__ . '/i18n'; $wgExtensionMessagesFiles['UserPreferences'] = __DIR__ . '/languages/UserPreferences.i18n.php'; $wgHooks['UserLoadOptions'][] = 'UserPreferences::onUserLoadOptions'; $wgResourceModules['ext.bluespice.userpreferences'] = array('styles' => 'bluespice.userpreferences.css', 'localBasePath' => __DIR__ . '/resources', 'remoteExtPath' => 'BlueSpiceExtensions/UserPreferences/resources');