Overview

Namespaces

  • None
  • Xmf
    • Database
    • Module
      • Helper
    • Template
  • Xoops
    • Auth
    • Core
      • Cache
      • Database
        • Logging
        • Schema
      • Exception
      • Handler
        • Scheme
      • Kernel
        • Dtype
        • Handlers
        • Model
      • Lists
      • Locale
        • Punic
      • Service
        • Contract
      • Session
      • Text
        • Sanitizer
          • Extensions
      • Theme
        • Plugins
    • Form
    • Html
    • Locale
    • Module
      • Helper
      • Plugin

Classes

  • ArtObject
  • ArtObjectHandler
  • Avatars
  • AvatarsAvatar
  • AvatarsAvatar_userForm
  • AvatarsAvatarForm
  • AvatarsAvatarHandler
  • AvatarsLocale
  • AvatarsLocaleEn_US
  • AvatarsPreload
  • AvatarsProvider
  • AvatarsUserlink
  • AvatarsUserlinkHandler
  • AwesomeButton
  • BannerRender
  • Banners
  • BannersBanner
  • BannersBannerclient
  • BannersBannerclientForm
  • BannersBannerclientHandler
  • BannersBannerForm
  • BannersBannerHandler
  • BannersPreload
  • BloggerApi
  • CodexMenusPlugin
  • CodexSearchPlugin
  • CodexSystemPlugin
  • CodexUserconfigsPlugin
  • Comments
  • CommentsComment
  • CommentsCommentForm
  • CommentsCommentHandler
  • CommentsCommentRenderer
  • CommentsPreload
  • CommentsSystemPlugin
  • CommentsUserconfigsPlugin
  • Cookie
  • CountryFlagProvider
  • Criteria
  • CriteriaCompo
  • CriteriaElement
  • DebugbarLogger
  • DebugbarPreload
  • DebugbarUserconfigsPlugin
  • DefaultThemeLocale
  • DefaultThemeLocaleEn_US
  • FormDhtmlTextArea
  • FormTextArea
  • GravatarsPreload
  • GravatarsProvider
  • htmLawed
  • HtmlToPdfProvider
  • imageLib
  • Images
  • ImagesCategory
  • ImagesCategory_imagemanagerForm
  • ImagesCategoryForm
  • ImagesCategoryHandler
  • ImagesCategoryselectForm
  • ImagesImage
  • ImagesImage_Body
  • ImagesImage_imagemanagerForm
  • ImagesImagebody
  • ImagesImagebodyHandler
  • ImagesImageForm
  • ImagesImageHandler
  • ImagesPreload
  • JUpload
  • LegacyLogger
  • LoggerPreload
  • LoggerUserconfigsPlugin
  • Maintenance
  • MaintenanceMaintenanceForm
  • Menus
  • MenusBuilder
  • MenusConstantDecorator
  • MenusDecorator
  • MenusDecoratorAbstract
  • MenusDefaultDecorator
  • MenusDynamicDecorator
  • MenusMenu
  • MenusMenuHandler
  • MenusMenus
  • MenusMenus_menuForm
  • MenusMenus_menusForm
  • MenusMenusHandler
  • MenusPreload
  • MenusSmartyDecorator
  • MetaWeblogApi
  • MonologLogger
  • MonologPreload
  • MonologUserconfigsPlugin
  • MovableTypeApi
  • MyTextSanitizer
  • MyTextSanitizerExtended
  • Notifications
  • NotificationsNotification
  • NotificationsNotificationHandler
  • NotificationsPreload
  • NotificationsSystemPlugin
  • Page
  • PageCommentsPlugin
  • PageGroupPermHandler
  • PageLocale
  • PageLocaleEn_US
  • PageNotificationsPlugin
  • PagePage_content
  • PagePage_contentForm
  • PagePage_contentHandler
  • PagePage_rating
  • PagePage_ratingHandler
  • PagePage_related
  • PagePage_related_link
  • PagePage_related_linkHandler
  • PagePage_relatedForm
  • PagePage_relatedHandler
  • PagePreload
  • PageSearchPlugin
  • PageSystemPlugin
  • PdfPreload
  • PmMessage
  • PmMessageHandler
  • PmPreload
  • ProfileCategory
  • ProfileCategoryForm
  • ProfileCategoryHandler
  • ProfileCorePreload
  • ProfileField
  • ProfileFieldForm
  • ProfileFieldHandler
  • ProfileMenusPlugin
  • ProfileProfile
  • ProfileProfileHandler
  • ProfileRegstep
  • ProfileRegstepForm
  • ProfileRegstepHandler
  • ProfileVisibility
  • ProfileVisibilityHandler
  • Protector
  • protector_bruteforce_overrun_message
  • protector_crawler_overrun_message
  • protector_f5attack_overrun_message
  • protector_postcommon_post_deny_by_httpbl
  • protector_postcommon_post_deny_by_rbl
  • protector_postcommon_post_htmlpurify4everyone
  • protector_postcommon_post_htmlpurify4guest
  • protector_postcommon_post_need_multibyte
  • protector_postcommon_post_register_moratorium
  • protector_postcommon_register_insert_js_check
  • protector_precommon_badip_errorlog
  • protector_precommon_badip_message
  • protector_precommon_badip_redirection
  • protector_precommon_bwlimit_errorlog
  • protector_precommon_bwlimit_message
  • protector_prepurge_exit_message
  • protector_spamcheck_overrun_message
  • ProtectorCenterForm
  • ProtectorCorePreload
  • ProtectorFilterAbstract
  • ProtectorFilterHandler
  • ProtectorMySQLDatabase
  • Publisher
  • PublisherBlockForm
  • PublisherCategory
  • PublisherCategoryForm
  • PublisherCategoryHandler
  • PublisherCommentsPlugin
  • PublisherFile
  • PublisherFileForm
  • PublisherFileHandler
  • PublisherFormDateTime
  • PublisherGroupPermHandler
  • PublisherItem
  • PublisherItemForm
  • PublisherItemHandler
  • PublisherMenusPlugin
  • PublisherMetagen
  • PublisherMimetype
  • PublisherMimetypeHandler
  • PublisherNotificationsPlugin
  • PublisherPermissionHandler
  • PublisherPreload
  • PublisherRating
  • PublisherRatingHandler
  • PublisherSearchPlugin
  • PublisherSystemPlugin
  • PublisherUtils
  • QrcodePreload
  • QrcodeProvider
  • ReCaptchaResponse
  • RpcArrayHandler
  • RpcBase64Handler
  • RpcBooleanHandler
  • RpcDateTimeHandler
  • RpcDoubleHandler
  • RpcIntHandler
  • RpcMemberHandler
  • RpcMethodNameHandler
  • RpcNameHandler
  • RpcStringHandler
  • RpcStructHandler
  • RpcValueHandler
  • RssAuthorHandler
  • RssCategoryHandler
  • RssChannelHandler
  • RssCommentsHandler
  • RssCopyrightHandler
  • RssDescriptionHandler
  • RssDocsHandler
  • RssGeneratorHandler
  • RssGuidHandler
  • RssHeightHandler
  • RssImageHandler
  • RssItemHandler
  • RssLanguageHandler
  • RssLastBuildDateHandler
  • RssLinkHandler
  • RssManagingEditorHandler
  • RssNameHandler
  • RssPubDateHandler
  • RssSourceHandler
  • RssTextInputHandler
  • RssTitleHandler
  • RssTtlHandler
  • RssUrlHandler
  • RssWebMasterHandler
  • RssWidthHandler
  • SaxParser
  • Search
  • SearchPreload
  • SearchSearchForm
  • Smarty_Resource_Admin
  • Smarty_Resource_Block
  • Smarty_Resource_Db
  • Smarty_Resource_Module
  • Smilies
  • SmiliesPreload
  • SmiliesProvider
  • SmiliesSmiley
  • SmiliesSmileyHandler
  • SmiliesSmiliesForm
  • Snoopy
  • SqlUtility
  • System
  • SystemBlockForm
  • SystemBreadcrumb
  • SystemExtension
  • SystemGroupForm
  • SystemLocale
  • SystemLocaleEn_US
  • SystemMenuHandler
  • SystemModule
  • SystemPreferencesForm
  • SystemPreload
  • SystemUserForm
  • tar
  • ThemeSetAuthorHandler
  • ThemeSetDateCreatedHandler
  • ThemeSetDescriptionHandler
  • ThemeSetEmailHandler
  • ThemeSetFileTypeHandler
  • ThemeSetGeneratorHandler
  • ThemeSetImageHandler
  • ThemeSetLinkHandler
  • ThemeSetModuleHandler
  • ThemeSetNameHandler
  • ThemeSetTagHandler
  • ThemeSetTemplateHandler
  • Thumbs
  • ThumbsPreload
  • ThumbsProvider
  • TinyMCE
  • Userconfigs
  • UserconfigsConfigHandler
  • UserconfigsConfigsForm
  • UserconfigsItem
  • UserconfigsItemHandler
  • UserconfigsMenusPlugin
  • UserconfigsModulesForm
  • UserconfigsOption
  • UserconfigsOptionHandler
  • UserconfigsPreload
  • UserconfigsSystemPlugin
  • UserrankPreload
  • UserRankProvider
  • UserrankRank
  • UserrankRankHandler
  • UserrankRanksForm
  • Xcaptcha
  • XcaptchaCaptchaForm
  • XcaptchaImage
  • XcaptchaImageForm
  • XcaptchaRecaptcha
  • XcaptchaRecaptchaForm
  • XcaptchaText
  • XcaptchaTextForm
  • Xlanguage
  • XlanguageLanguage
  • XlanguageLanguageForm
  • XlanguagePreload
  • XlanguageTinymceForm
  • XlanguageXlanguageHandler
  • Xmf\Database\TableLoad
  • Xmf\Database\Tables
  • Xmf\Debug
  • Xmf\FilterInput
  • Xmf\Highlighter
  • Xmf\Language
  • Xmf\Loader
  • Xmf\Metagen
  • Xmf\Module\Admin
  • Xmf\Module\Cache
  • Xmf\Module\Helper
  • Xmf\Module\Helper\AbstractHelper
  • Xmf\Module\Helper\GenericHelper
  • Xmf\Module\Permission
  • Xmf\Module\Session
  • Xmf\Request
  • Xmf\Template\AbstractTemplate
  • Xmf\Template\Breadcrumb
  • Xmf\Template\Buttonbox
  • Xmf\Template\Feed
  • Xmf\Template\PrintContent
  • Xmf\Utilities
  • Xmf\Yaml
  • XmfPreload
  • XmlTagHandler
  • Xoops
  • Xoops\Auth\Ads
  • Xoops\Auth\AuthAbstract
  • Xoops\Auth\Factory
  • Xoops\Auth\Ldap
  • Xoops\Auth\Provisioning
  • Xoops\Auth\Xoops
  • Xoops\Cache
  • Xoops\Core\Assets
  • Xoops\Core\Cache\Access
  • Xoops\Core\Cache\CacheManager
  • Xoops\Core\Cache\DriverList
  • Xoops\Core\Cache\Legacy
  • Xoops\Core\ComposerUtility
  • Xoops\Core\Database\Connection
  • Xoops\Core\Database\Factory
  • Xoops\Core\Database\Logging\XoopsDebugStack
  • Xoops\Core\Database\QueryBuilder
  • Xoops\Core\Database\Schema\ExportVisitor
  • Xoops\Core\Database\Schema\ImportSchema
  • Xoops\Core\Database\Schema\PrefixStripper
  • Xoops\Core\Database\Schema\RemovePrefixes
  • Xoops\Core\Events
  • Xoops\Core\FilterInput
  • Xoops\Core\FixedGroups
  • Xoops\Core\Handler\Factory
  • Xoops\Core\Handler\FactorySpec
  • Xoops\Core\Handler\Scheme\FQN
  • Xoops\Core\Handler\Scheme\Kernel
  • Xoops\Core\Handler\Scheme\LegacyModule
  • Xoops\Core\HttpRequest
  • Xoops\Core\Kernel\Criteria
  • Xoops\Core\Kernel\CriteriaCompo
  • Xoops\Core\Kernel\CriteriaElement
  • Xoops\Core\Kernel\Dtype
  • Xoops\Core\Kernel\Dtype\DtypeAbstract
  • Xoops\Core\Kernel\Dtype\DtypeArray
  • Xoops\Core\Kernel\Dtype\DtypeDateTime
  • Xoops\Core\Kernel\Dtype\DtypeDecimal
  • Xoops\Core\Kernel\Dtype\DtypeEmail
  • Xoops\Core\Kernel\Dtype\DtypeEnumeration
  • Xoops\Core\Kernel\Dtype\DtypeFloat
  • Xoops\Core\Kernel\Dtype\DtypeInt
  • Xoops\Core\Kernel\Dtype\DtypeJson
  • Xoops\Core\Kernel\Dtype\DtypeMoney
  • Xoops\Core\Kernel\Dtype\DtypeOther
  • Xoops\Core\Kernel\Dtype\DtypeSimpleTime
  • Xoops\Core\Kernel\Dtype\DtypeSource
  • Xoops\Core\Kernel\Dtype\DtypeTextArea
  • Xoops\Core\Kernel\Dtype\DtypeTextBox
  • Xoops\Core\Kernel\Dtype\DtypeTimeZone
  • Xoops\Core\Kernel\Dtype\DtypeUrl
  • Xoops\Core\Kernel\Handlers\XoopsBlock
  • Xoops\Core\Kernel\Handlers\XoopsBlockHandler
  • Xoops\Core\Kernel\Handlers\XoopsBlockModuleLink
  • Xoops\Core\Kernel\Handlers\XoopsBlockModuleLinkHandler
  • Xoops\Core\Kernel\Handlers\XoopsConfigHandler
  • Xoops\Core\Kernel\Handlers\XoopsConfigItem
  • Xoops\Core\Kernel\Handlers\XoopsConfigItemHandler
  • Xoops\Core\Kernel\Handlers\XoopsConfigOption
  • Xoops\Core\Kernel\Handlers\XoopsConfigOptionHandler
  • Xoops\Core\Kernel\Handlers\XoopsGroup
  • Xoops\Core\Kernel\Handlers\XoopsGroupHandler
  • Xoops\Core\Kernel\Handlers\XoopsGroupPerm
  • Xoops\Core\Kernel\Handlers\XoopsGroupPermHandler
  • Xoops\Core\Kernel\Handlers\XoopsMemberHandler
  • Xoops\Core\Kernel\Handlers\XoopsMembership
  • Xoops\Core\Kernel\Handlers\XoopsMembershipHandler
  • Xoops\Core\Kernel\Handlers\XoopsModule
  • Xoops\Core\Kernel\Handlers\XoopsModuleHandler
  • Xoops\Core\Kernel\Handlers\XoopsOnline
  • Xoops\Core\Kernel\Handlers\XoopsOnlineHandler
  • Xoops\Core\Kernel\Handlers\XoopsPrivateMessage
  • Xoops\Core\Kernel\Handlers\XoopsPrivateMessageHandler
  • Xoops\Core\Kernel\Handlers\XoopsTplFile
  • Xoops\Core\Kernel\Handlers\XoopsTplFileHandler
  • Xoops\Core\Kernel\Handlers\XoopsTplSet
  • Xoops\Core\Kernel\Handlers\XoopsTplSetHandler
  • Xoops\Core\Kernel\Handlers\XoopsUser
  • Xoops\Core\Kernel\Handlers\XoopsUserHandler
  • Xoops\Core\Kernel\Model\Joint
  • Xoops\Core\Kernel\Model\Read
  • Xoops\Core\Kernel\Model\Stats
  • Xoops\Core\Kernel\Model\Sync
  • Xoops\Core\Kernel\Model\Write
  • Xoops\Core\Kernel\XoopsModelAbstract
  • Xoops\Core\Kernel\XoopsModelFactory
  • Xoops\Core\Kernel\XoopsObject
  • Xoops\Core\Kernel\XoopsObjectHandler
  • Xoops\Core\Kernel\XoopsPersistableObjectHandler
  • Xoops\Core\Lists\Country
  • Xoops\Core\Lists\Directory
  • Xoops\Core\Lists\Editor
  • Xoops\Core\Lists\File
  • Xoops\Core\Lists\HtmlFile
  • Xoops\Core\Lists\ImageFile
  • Xoops\Core\Lists\ListAbstract
  • Xoops\Core\Lists\Locale
  • Xoops\Core\Lists\Module
  • Xoops\Core\Lists\Month
  • Xoops\Core\Lists\SubjectIcon
  • Xoops\Core\Lists\SubSet
  • Xoops\Core\Lists\Theme
  • Xoops\Core\Lists\Time
  • Xoops\Core\Lists\TimeZone
  • Xoops\Core\Locale\LegacyCodes
  • Xoops\Core\Locale\Punic\Calendar
  • Xoops\Core\Locale\Time
  • Xoops\Core\Logger
  • Xoops\Core\MediaUploader
  • Xoops\Core\MimeTypes
  • Xoops\Core\PreloadItem
  • Xoops\Core\Psr0ClassLoader
  • Xoops\Core\Psr4ClassLoader
  • Xoops\Core\Random
  • Xoops\Core\Registry
  • Xoops\Core\Request
  • Xoops\Core\Security
  • Xoops\Core\Service\AbstractContract
  • Xoops\Core\Service\Manager
  • Xoops\Core\Service\NullProvider
  • Xoops\Core\Service\Provider
  • Xoops\Core\Service\Response
  • Xoops\Core\Session\Fingerprint
  • Xoops\Core\Session\Handler
  • Xoops\Core\Session\Manager
  • Xoops\Core\Session\RememberMe
  • Xoops\Core\Session\SessionUser
  • Xoops\Core\Text\Sanitizer
  • Xoops\Core\Text\Sanitizer\Configuration
  • Xoops\Core\Text\Sanitizer\ConfigurationAbstract
  • Xoops\Core\Text\Sanitizer\DefaultConfiguration
  • Xoops\Core\Text\Sanitizer\ExtensionAbstract
  • Xoops\Core\Text\Sanitizer\Extensions\Censor
  • Xoops\Core\Text\Sanitizer\Extensions\Clickable
  • Xoops\Core\Text\Sanitizer\Extensions\Embed
  • Xoops\Core\Text\Sanitizer\Extensions\Flash
  • Xoops\Core\Text\Sanitizer\Extensions\Iframe
  • Xoops\Core\Text\Sanitizer\Extensions\Image
  • Xoops\Core\Text\Sanitizer\Extensions\Mms
  • Xoops\Core\Text\Sanitizer\Extensions\Mp3
  • Xoops\Core\Text\Sanitizer\Extensions\Quote
  • Xoops\Core\Text\Sanitizer\Extensions\Rtsp
  • Xoops\Core\Text\Sanitizer\Extensions\SoundCloud
  • Xoops\Core\Text\Sanitizer\Extensions\SyntaxHighlight
  • Xoops\Core\Text\Sanitizer\Extensions\TextFilter
  • Xoops\Core\Text\Sanitizer\Extensions\UnorderedList
  • Xoops\Core\Text\Sanitizer\Extensions\Wiki
  • Xoops\Core\Text\Sanitizer\Extensions\Wmp
  • Xoops\Core\Text\Sanitizer\Extensions\XoopsCode
  • Xoops\Core\Text\Sanitizer\Extensions\Xss
  • Xoops\Core\Text\Sanitizer\Extensions\YouTube
  • Xoops\Core\Text\Sanitizer\FilterAbstract
  • Xoops\Core\Text\Sanitizer\NullExtension
  • Xoops\Core\Text\Sanitizer\NullFilter
  • Xoops\Core\Text\Sanitizer\SanitizerComponent
  • Xoops\Core\Text\Sanitizer\SanitizerConfigurable
  • Xoops\Core\Text\ShortCodes
  • Xoops\Core\Theme\AdminFactory
  • Xoops\Core\Theme\Factory
  • Xoops\Core\Theme\NullTheme
  • Xoops\Core\Theme\PluginAbstract
  • Xoops\Core\Theme\Plugins\Blocks
  • Xoops\Core\Theme\XoopsTheme
  • Xoops\Core\XoopsTpl
  • Xoops\Core\Yaml
  • Xoops\Form\BlockForm
  • Xoops\Form\Button
  • Xoops\Form\ButtonTray
  • Xoops\Form\Captcha
  • Xoops\Form\Checkbox
  • Xoops\Form\ColorPicker
  • Xoops\Form\DateSelect
  • Xoops\Form\DateTime
  • Xoops\Form\DhtmlTextArea
  • Xoops\Form\Editor
  • Xoops\Form\Element
  • Xoops\Form\ElementFactory
  • Xoops\Form\ElementTray
  • Xoops\Form\File
  • Xoops\Form\Form
  • Xoops\Form\GroupCheckbox
  • Xoops\Form\GroupFormCheckbox
  • Xoops\Form\GroupPermissionForm
  • Xoops\Form\Hidden
  • Xoops\Form\Label
  • Xoops\Form\Mail
  • Xoops\Form\OptionElement
  • Xoops\Form\Password
  • Xoops\Form\Radio
  • Xoops\Form\RadioYesNo
  • Xoops\Form\Raw
  • Xoops\Form\Select
  • Xoops\Form\SelectCountry
  • Xoops\Form\SelectEditor
  • Xoops\Form\SelectGroup
  • Xoops\Form\SelectLanguage
  • Xoops\Form\SelectLocale
  • Xoops\Form\SelectMatchOption
  • Xoops\Form\SelectTheme
  • Xoops\Form\SelectTimeZone
  • Xoops\Form\SelectUser
  • Xoops\Form\SimpleForm
  • Xoops\Form\Tab
  • Xoops\Form\TableForm
  • Xoops\Form\TabTray
  • Xoops\Form\Text
  • Xoops\Form\TextArea
  • Xoops\Form\ThemeForm
  • Xoops\Form\Token
  • Xoops\Form\Url
  • Xoops\Html\Attributes
  • Xoops\Html\Img
  • Xoops\Locale
  • Xoops\Locale\AbstractLocale
  • Xoops\Module\Admin
  • Xoops\Module\Helper
  • Xoops\Module\Helper\Dummy
  • Xoops\Module\Helper\HelperAbstract
  • Xoops\Module\Plugin
  • Xoops\Module\Plugin\ConfigCollector
  • Xoops\Module\Plugin\PluginAbstract
  • Xoops\Utils
  • Xoops_Locale_Mailer_Abstract
  • XoopsAdminThemeFactory
  • XoopsApi
  • XoopsArt
  • XoopsBaseConfig
  • XoopsBlock
  • XoopsBlockHandler
  • XoopsBlockmodulelink
  • XoopsBlockmodulelinkHandler
  • XoopsCache
  • XoopsCaptcha
  • XoopsCaptchaImage
  • XoopsCaptchaImageHandler
  • XoopsCaptchaMethod
  • XoopsCaptchaRecaptcha
  • XoopsCaptchaText
  • XoopsConfigHandler
  • XoopsConfigItem
  • XoopsConfigItemHandler
  • XoopsConfigOption
  • XoopsConfigOptionHandler
  • XoopsDatabase
  • XoopsDatabaseFactory
  • XoopsDatabaseManager
  • XoopsDownloader
  • XoopsEditor
  • XoopsEditorHandler
  • XoopsFile
  • XoopsFileHandler
  • XoopsFilterInput
  • XoopsFolderHandler
  • XoopsForm
  • XoopsFormButton
  • XoopsFormButtonTray
  • XoopsFormCaptcha
  • XoopsFormCheckBox
  • XoopsFormColorPicker
  • XoopsFormDateTime
  • XoopsFormDhtmlTextArea
  • XoopsFormEditor
  • XoopsFormElement
  • XoopsFormElementTray
  • XoopsFormFile
  • XoopsFormHidden
  • XoopsFormHiddenToken
  • XoopsFormLabel
  • XoopsFormPassword
  • XoopsFormRadio
  • XoopsFormRadioYN
  • XoopsFormSelect
  • XoopsFormSelectCheckGroup
  • XoopsFormSelectCountry
  • XoopsFormSelectEditor
  • XoopsFormSelectGroup
  • XoopsFormSelectLang
  • XoopsFormSelectMatchOption
  • XoopsFormSelectTheme
  • XoopsFormSelectTimezone
  • XoopsFormSelectUser
  • XoopsFormText
  • XoopsFormTextArea
  • XoopsFormTextDateSelect
  • XoopsFormTinymce
  • XoopsFormTinymce4
  • XoopsGroup
  • XoopsGroupHandler
  • XoopsGroupPerm
  • XoopsGroupPermForm
  • XoopsGroupPermHandler
  • XoopsGTicket
  • XoopsGuiDefault
  • XoopsInstallWizard
  • XoopsLists
  • XoopsLoad
  • XoopsLocal
  • XoopsLocale
  • XoopsLocaleEn_US
  • XoopsLogger
  • XoopsMailer
  • XoopsMailerLocal
  • XoopsMailerLocale
  • XoopsMediaUploader
  • XoopsMemberHandler
  • XoopsMembership
  • XoopsMembershipHandler
  • XoopsModule
  • XoopsModuleHandler
  • XoopsMultiMailer
  • XoopsMySQLDatabase
  • XoopsMySQLDatabaseProxy
  • XoopsMySQLDatabaseSafe
  • XoopsObject
  • XoopsObjectHandler
  • XoopsObjectTree
  • XoopsOnline
  • XoopsOnlineHandler
  • XoopsPageNav
  • XoopsPathController
  • XoopsPersistableObjectHandler
  • XoopsPreload
  • XoopsPreloadItem
  • XoopsPrivmessage
  • XoopsPrivmessageHandler
  • XoopsRequest
  • XoopsSecurity
  • XoopsSimpleForm
  • XoopsTableForm
  • XoopsTarDownloader
  • XoopsTheme
  • XoopsThemeBlocksPlugin
  • XoopsThemeFactory
  • XoopsThemeForm
  • XoopsThemePlugin
  • XoopsThemeSetParser
  • XoopsTpl
  • XoopsTplfile
  • XoopsTplfileHandler
  • XoopsTplset
  • XoopsTplsetHandler
  • XoopsUser
  • XoopsUserHandler
  • XoopsUserUtility
  • XoopsUtility
  • XoopsXmlRpcApi
  • XoopsXmlRpcArray
  • XoopsXmlRpcBase64
  • XoopsXmlRpcBoolean
  • XoopsXmlRpcDatetime
  • XoopsXmlRpcDocument
  • XoopsXmlRpcDouble
  • XoopsXmlRpcFault
  • XoopsXmlRpcInt
  • XoopsXmlRpcParser
  • XoopsXmlRpcRequest
  • XoopsXmlRpcResponse
  • XoopsXmlRpcString
  • XoopsXmlRpcStruct
  • XoopsXmlRpcTag
  • XoopsXmlRss2Parser
  • XoopsZipDownloader
  • zipfile

Interfaces

  • CommentsPluginInterface
  • MenusDecoratorInterface
  • MenusPluginInterface
  • NotificationsPluginInterface
  • SearchPluginInterface
  • SystemPluginInterface
  • UserconfigsPluginInterface
  • Xoops\Core\AttributeInterface
  • Xoops\Core\Handler\Scheme\SchemeInterface
  • Xoops\Core\Service\Contract\AvatarInterface
  • Xoops\Core\Service\Contract\CountryflagInterface
  • Xoops\Core\Service\Contract\EmojiInterface
  • Xoops\Core\Service\Contract\HtmlToPdfInterface
  • Xoops\Core\Service\Contract\QrcodeInterface
  • Xoops\Core\Service\Contract\ThumbnailInterface
  • Xoops\Core\Service\Contract\UserRankInterface
  • Xoops\Core\Session\FingerprintInterface
  • Xoops\Form\ContainerInterface

Exceptions

  • Xoops\Core\Exception\InvalidHandlerSpecException
  • Xoops\Core\Exception\NoHandlerException

Functions

  • _changeMimeValue
  • _clearAddSessionVars
  • _clearEditSessionVars
  • _ee
  • _recaptcha_aes_encrypt
  • _recaptcha_aes_pad
  • _recaptcha_http_post
  • _recaptcha_mailhide_email_parts
  • _recaptcha_mailhide_urlbase64
  • _recaptcha_qsencode
  • _tt
  • add
  • addCriteria
  • admin_refcheck
  • b_comments_edit
  • b_comments_show
  • b_notification_show
  • b_search_show
  • b_system_info_edit
  • b_system_info_show
  • b_system_login_show
  • b_system_main_edit
  • b_system_main_show
  • b_system_newmembers_edit
  • b_system_newmembers_show
  • b_system_online_show
  • b_system_themes_edit
  • b_system_themes_show
  • b_system_topposters_edit
  • b_system_topposters_show
  • b_system_user_show
  • b_system_waiting_show
  • b_xlanguage_select_edit
  • b_xlanguage_select_show
  • banners_blocks_edit
  • banners_blocks_show
  • base_url
  • buildRssFeedCache
  • buildTable
  • check_files_extensions_on_path
  • check_files_extensions_on_phar
  • checkEmail
  • clearAddSession
  • clearEditSession
  • config_loading
  • create_folder
  • create_img
  • create_img_gd
  • createConfigform
  • createDir
  • createThemeform
  • dateSort
  • debugger
  • delete
  • deleteDir
  • duplicate_file
  • edit
  • endsWith
  • exception_handler
  • extensionSort
  • file_put_contents
  • filenameSort
  • filescount
  • fix_dirname
  • fix_filename
  • fix_get_params
  • fix_path
  • fix_strtolower
  • fix_strtoupper
  • foldersize
  • formatTimestamp
  • formatURL
  • genPathCheckHtml
  • get_file_by_url
  • get_writeoks_from_protector
  • getBrightness
  • getDbConnection
  • getDbConnectionParams
  • getDirList
  • handle_uploaded_files
  • http_response_code
  • image_check_memory_usage
  • install_acceptUser
  • install_finalize
  • installHtmlSpecialCharacters
  • is_function_callable
  • is_really_writable
  • load_functions
  • load_object
  • load_objectHandler
  • loadModuleAdminMenu
  • makeSize
  • manage
  • menus_block_edit
  • menus_block_show
  • menus_mainmenu_show
  • mod_clearCacheFile
  • mod_clearConfg
  • mod_clearConfig
  • mod_clearFile
  • mod_clearSmartyCache
  • mod_constant
  • mod_createCacheFile
  • mod_createCacheFile_byGroup
  • mod_createFile
  • mod_DB_prefix
  • mod_fetchConfg
  • mod_fetchConfig
  • mod_generateCacheId
  • mod_generateCacheId_byGroup
  • mod_getDirname
  • mod_getMysqlVersion
  • mod_isModuleAction
  • mod_loadCacheFile
  • mod_loadCacheFile_byGroup
  • mod_loadConfg
  • mod_loadConfig
  • mod_loadFile
  • mod_loadFunctions
  • mod_loadRenderer
  • mod_message
  • modify_chmod
  • new_thumbnails_creation
  • normalizeColor
  • page_blocks_edit
  • page_blocks_show
  • profile_getRegisterForm
  • profile_getUserForm
  • profile_install_addCategory
  • profile_install_addField
  • profile_install_addStep
  • profile_install_initializeProfiles
  • profile_install_setPermissions
  • protector_ip_cmp
  • protector_postcheck
  • protector_precheck
  • publisher_category_items_sel_edit
  • publisher_category_items_sel_show
  • publisher_cloneFileFolder
  • publisher_createLogo
  • publisher_date_to_date_edit
  • publisher_date_to_date_show
  • publisher_displayCategory
  • publisher_editCat
  • publisher_editFile
  • publisher_editItem
  • publisher_items_columns_edit
  • publisher_items_columns_show
  • publisher_items_menu_edit
  • publisher_items_menu_show
  • publisher_items_new_edit
  • publisher_items_new_show
  • publisher_items_random_item_show
  • publisher_items_recent_edit
  • publisher_items_recent_show
  • publisher_items_spot_edit
  • publisher_items_spot_show
  • publisher_latest_files_edit
  • publisher_latest_files_show
  • publisher_latest_news_edit
  • publisher_latest_news_show
  • publisher_mk_chkbox
  • publisher_mk_select
  • publisher_pagewrap_upload
  • publisher_search
  • publisher_search_show
  • publisher_tag_iteminfo
  • publisher_tag_synchronization
  • rcopy
  • recaptcha_check_answer
  • recaptcha_get_html
  • recaptcha_get_signup_url
  • recaptcha_mailhide_html
  • recaptcha_mailhide_url
  • redirect_header
  • rename_file
  • rename_folder
  • rrename
  • rrename_after_cleaner
  • search
  • sizeSort
  • smarty_block_assets
  • smarty_block_noshortcodes
  • smarty_compiler_xoAdminIcons
  • smarty_compiler_xoAdminNav
  • smarty_compiler_xoAppUrl
  • smarty_compiler_xoImgUrl
  • smarty_compiler_xoModuleIcons16
  • smarty_compiler_xoModuleIcons32
  • smarty_compiler_xoModuleIconsBookmarks
  • smarty_function_addBaseScript
  • smarty_function_addBaseStylesheet
  • smarty_function_securityToken
  • smarty_function_thumbnail
  • smarty_function_translate
  • smarty_function_translateTheme
  • smarty_function_xoblock
  • smarty_function_xoInboxCount
  • smarty_function_xoMemberInfo
  • smarty_function_xoops_link
  • smarty_function_xoPageNav
  • smarty_modifier_datetime
  • smarty_modifier_debug_print_var
  • smarty_outputfilter_shortcodes
  • synchronize
  • system_AdminIcons
  • system_adminVersion
  • system_cleanVars
  • system_loadLanguage
  • system_loadTemplate
  • updateMimeValue
  • userTimeToServerTime
  • xhtmlspecialchars
  • xlanguage_convert_encoding
  • xlanguage_convert_item
  • xlanguage_copyfile
  • xlanguage_detectLang
  • xlanguage_encoding
  • xlanguage_lang_detect
  • xlanguage_mkdirs
  • xlanguage_ml
  • xlanguage_ml_escape_bracket
  • xlanguage_select_show
  • xoBoolField
  • xoDiag
  • xoDiagBoolSetting
  • xoDiagIfWritable
  • xoFormField
  • xoops_comment_count
  • xoops_comment_delete
  • xoops_confirm
  • xoops_convert_encoding
  • xoops_cp_footer
  • xoops_cp_header
  • xoops_error
  • xoops_footer
  • xoops_getActiveModules
  • xoops_getbanner
  • xoops_getBaseDomain
  • xoops_getConfigOption
  • xoops_getcss
  • xoops_getenv
  • xoops_getHandler
  • xoops_getMailer
  • xoops_getModuleHandler
  • xoops_getModuleOption
  • xoops_getOption
  • xoops_getrank
  • xoops_getUrlDomain
  • xoops_getUserTimestamp
  • xoops_groupperm_deletebymoditem
  • xoops_header
  • xoops_isActiveModule
  • xoops_load
  • xoops_loadLanguage
  • xoops_makepass
  • xoops_message
  • xoops_module_install_avatars
  • xoops_module_install_banners
  • xoops_module_install_comments
  • xoops_module_install_debugbar
  • xoops_module_install_notifications
  • xoops_module_install_page
  • xoops_module_install_pm
  • xoops_module_install_profile
  • xoops_module_install_publisher
  • xoops_module_install_smilies
  • xoops_module_install_system
  • xoops_module_install_userrank
  • xoops_module_install_xlanguage
  • xoops_module_pre_uninstall_comments
  • xoops_module_pre_uninstall_notifications
  • xoops_module_update_comments
  • xoops_module_update_debugbar
  • xoops_module_update_notifications
  • xoops_module_update_pm
  • xoops_module_update_profile
  • xoops_module_update_publisher
  • xoops_module_update_search
  • xoops_module_update_system
  • xoops_module_update_xlanguage
  • xoops_notification_deletebyitem
  • xoops_notification_deletebymodule
  • xoops_notification_deletebyuser
  • xoops_result
  • xoops_setActiveModules
  • xoops_setConfigOption
  • xoops_substr
  • xoops_template_clear_module_cache
  • xoops_template_touch
  • xoops_trim
  • xoops_utf8_encode
  • xoopseditor_get_rootpath
  • xoPassField
  • xoPhpVersion
  • Overview
  • Namespace
  • Class
  • Tree
   1: <?php
   2: /*
   3:  You may not change or alter any portion of this comment or credits
   4:  of supporting developers from this source code or any supporting source code
   5:  which is considered copyrighted (c) material of the original comment or credit authors.
   6: 
   7:  This program is distributed in the hope that it will be useful,
   8:  but WITHOUT ANY WARRANTY; without even the implied warranty of
   9:  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10: */
  11: 
  12: use Xoops\Core\Database\Schema\ImportSchema;
  13: use Xoops\Core\FixedGroups;
  14: use Xoops\Core\Kernel\Criteria;
  15: use Xoops\Core\Kernel\CriteriaCompo;
  16: use Xoops\Core\Kernel\Handlers\XoopsBlock;
  17: use Xoops\Core\Kernel\Handlers\XoopsModule;
  18: use Xoops\Core\Yaml;
  19: use Xoops\Module\Plugin\ConfigCollector;
  20: use Doctrine\DBAL\DBALException;
  21: use Doctrine\DBAL\Schema\Synchronizer\SingleDatabaseSynchronizer;
  22: 
  23: /**
  24:  * System Module
  25:  *
  26:  * @category  SystemModule
  27:  * @package   SystemModule
  28:  * @author    Andricq Nicolas (AKA MusS)
  29:  * @copyright 2000-2015 XOOPS Project (http://xoops.org)
  30:  * @license   GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
  31:  * @link      http://xoops.org
  32:  */
  33: class SystemModule
  34: {
  35:     public $error = array();
  36:     public $trace = array();
  37:     protected $modulesList = array();
  38:     protected $modulesDirnames = array();
  39:     protected $config_delng = array();
  40:     protected $template_delng = array();
  41:     protected $config_old = array();
  42:     protected $reservedTables = array(
  43:         'system_blockmodule',
  44:         'system_config',
  45:         'system_configoption',
  46:         'system_group',
  47:         'system_usergroup',
  48:         'system_permission',
  49:         'system_module',
  50:         'system_block',
  51:         'system_online',
  52:         'system_privatemessage',
  53:         'system_session',
  54:         'system_tplfile',
  55:         'system_tplset',
  56:         'system_tplsource',
  57:         'system_user',
  58:     );
  59: 
  60:     /**
  61:      * Constructor
  62:      */
  63:     public function __construct()
  64:     {
  65:         // Get main instance
  66:         $xoops = Xoops::getInstance();
  67:         $module_handler = $xoops->getHandlerModule();
  68: 
  69:         $this->modulesList = XoopsLists::getModulesList();
  70: 
  71:         $modules = $module_handler->getObjectsArray();
  72:         /* @var $module XoopsModule */
  73:         foreach ($modules as $module) {
  74:             $this->modulesDirnames[] = $module->getInfo('dirname');
  75:         }
  76:     }
  77: 
  78:     /**
  79:      * getModuleList
  80:      *
  81:      * @return array of modules
  82:      */
  83:     public function getModuleList()
  84:     {
  85:         // Get main instance
  86:         $xoops = Xoops::getInstance();
  87:         $module_handler = $xoops->getHandlerModule();
  88:         $moduleperm_handler = $xoops->getHandlerGroupPermission();
  89: 
  90:         $criteria = new CriteriaCompo();
  91:         $criteria->setSort('weight');
  92:         // Get all installed modules
  93:         $modules = $module_handler->getObjects($criteria, true);
  94:         $list = array();
  95:         /* @var $module XoopsModule */
  96:         foreach ($modules as $module) {
  97:             if (!$module->getInfo('extension')) {
  98:                 if ($module->getInfo('dirname') === 'system') {
  99:                     $module->setInfo('can_delete', false);
 100:                     $module->setInfo('can_disable', false);
 101:                 } else {
 102:                     $module->setInfo('can_delete', true);
 103:                     $module->setInfo('can_disable', true);
 104:                 }
 105:                 if (round($module->getInfo('version'), 2) != $module->getVar('version')) {
 106:                     $module->setInfo('warning_update', true);
 107:                 }
 108:                 if (XoopsLoad::fileExists(
 109:                     \XoopsBaseConfig::get('root-path') . '/modules/' . $module->getVar('dirname') . '/icons/logo_small.png'
 110:                 )) {
 111:                     $module->setInfo(
 112:                         'logo_small',
 113:                         \XoopsBaseConfig::get('url') . '/modules/' . $module->getVar('dirname') . '/icons/logo_small.png'
 114:                     );
 115:                 } else {
 116:                     $module->setInfo('logo_small', \XoopsBaseConfig::get('url') . '/media/xoops/images/icons/16/default.png');
 117:                 }
 118:                 $module->setInfo('version', round($module->getVar('version') / 100, 2));
 119:                 $module->setInfo('update', XoopsLocale::formatTimestamp($module->getVar('last_update'), 's'));
 120:                 $module->setInfo(
 121:                     'link_admin',
 122:                     \XoopsBaseConfig::get('url') . '/modules/' . $module->getVar('dirname') . '/' . $module->getInfo('adminindex')
 123:                 );
 124: 
 125:                 if ($module->getVar('isactive')) {
 126:                     $module->setInfo('options', $module->getAdminMenu());
 127:                 }
 128: 
 129:                 $groups = array();
 130:                 if (is_object($xoops->user)) {
 131:                     $groups = $xoops->user->getGroups();
 132:                 }
 133: 
 134:                 $sadmin = $moduleperm_handler->checkRight(
 135:                     'module_admin',
 136:                     $module->getVar('mid'),
 137:                     $groups
 138:                 );
 139:                 if ($sadmin && ($module->getVar('hasnotification')
 140:                     || is_array($module->getInfo('config')) || is_array($module->getInfo('comments')))
 141:                 ) {
 142:                     $module->setInfo(
 143:                         'link_pref',
 144:                         \XoopsBaseConfig::get('url') . '/modules/system/admin.php?fct=preferences&amp;op=showmod&amp;mod='
 145:                         . $module->getVar('mid')
 146:                     );
 147:                 }
 148: 
 149:                 $list[] = $module;
 150:             }
 151:         }
 152:         return $list;
 153:     }
 154: 
 155:     /**
 156:      * getInstalledModules
 157:      *
 158:      * @return array of installed modules
 159:      */
 160:     public function getInstalledModules()
 161:     {
 162:         // Get main instance
 163:         $xoops = Xoops::getInstance();
 164:         $module_handler = $xoops->getHandlerModule();
 165: 
 166:         $ret = array();
 167:         $i = 0;
 168:         foreach ($this->modulesList as $file) {
 169:             if (XoopsLoad::fileExists(\XoopsBaseConfig::get('root-path') . '/modules/' . $file . '/xoops_version.php')) {
 170:                 clearstatcache();
 171:                 $file = trim($file);
 172:                 if (!in_array($file, $this->modulesDirnames)) {
 173:                     /* @var $module XoopsModule */
 174:                     $module = $module_handler->create();
 175:                     $module->loadInfo($file);
 176:                     if (!$module->getInfo('extension')) {
 177:                         $module->setInfo('mid', $i);
 178:                         $module->setInfo('version', round($module->getInfo('version'), 2));
 179:                         $ret[] = $module;
 180:                         unset($module);
 181:                         ++$i;
 182:                     }
 183:                 }
 184:             }
 185:         }
 186:         return $ret;
 187:     }
 188: 
 189:     /**
 190:      * install a module
 191:      *
 192:      * @param string  $mod   module dirname
 193:      * @param boolean $force force query
 194:      *
 195:      * @return bool|XoopsModule|XoopsObject
 196:      */
 197:     public function install($mod = '', $force = false)
 198:     {
 199:         $xoops = Xoops::getInstance();
 200:         $module_handler = $xoops->getHandlerModule();
 201:         $mod = trim($mod);
 202:         try {
 203:             $cnt = $module_handler->getCount(new Criteria('dirname', $mod));
 204:         } catch (DBALException $e) {
 205:             $cnt = 0;
 206:         }
 207:         if ($cnt == 0) {
 208:             /* @var $module XoopsModule */
 209:             $module = $module_handler->create();
 210:             $module->loadInfoAsVar($mod);
 211:             $module->setVar('weight', 1);
 212:             $module->setVar('isactive', 1);
 213:             $module->setVar('last_update', time());
 214:             $install_script = $module->getInfo('onInstall');
 215:             if ($install_script && trim($install_script) != '') {
 216:                 XoopsLoad::loadFile($xoops->path('modules/' . $mod . '/' . trim($install_script)));
 217:             }
 218:             $func = "xoops_module_pre_install_{$mod}";
 219:             // If pre install function is defined, execute
 220:             if (function_exists($func)) {
 221:                 $result = $func($module);
 222:                 if (!$result) {
 223:                     $this->error[] = sprintf(XoopsLocale::EF_NOT_EXECUTED, $func);
 224:                     $this->error = array_merge($this->error, $module->getErrors());
 225:                     return false;
 226:                 } else {
 227:                     $this->trace[] = sprintf(XoopsLocale::SF_EXECUTED, "<strong>{$func}</strong>");
 228:                     $this->trace = array_merge($this->trace, $module->getMessages());
 229:                 }
 230:             }
 231:             // Create tables
 232:             $created_tables = array();
 233:             if (count($this->error) == 0) {
 234:                 $schema_file = $module->getInfo('schema');
 235:                 $sql_file = $module->getInfo('sqlfile');
 236:                 if (!empty($schema_file)) {
 237:                     $schema_file_path = \XoopsBaseConfig::get('root-path') . '/modules/' . $mod . '/' . $schema_file;
 238:                     if (!XoopsLoad::fileExists($schema_file_path)) {
 239:                         $this->error[] =
 240:                             sprintf(SystemLocale::EF_SQL_FILE_NOT_FOUND, "<strong>{$schema_file}</strong>");
 241:                         return false;
 242:                     }
 243:                     $importer = new ImportSchema;
 244:                     $importSchema = $importer->importSchemaArray(Yaml::read($schema_file_path));
 245:                     $synchronizer = new SingleDatabaseSynchronizer($xoops->db());
 246:                     $synchronizer->updateSchema($importSchema, true);
 247:                 } elseif (is_array($sql_file) && !empty($sql_file[\XoopsBaseConfig::get('db-type')])) {
 248:                     $xoops->deprecated('Install SQL files are deprecated since 2.6.0. Convert to portable Schemas');
 249: 
 250:                     $sql_file_path = \XoopsBaseConfig::get('root-path') . '/modules/' . $mod . '/' . $sql_file[\XoopsBaseConfig::get('db-type')];
 251:                     if (!XoopsLoad::fileExists($sql_file_path)) {
 252:                         $this->error[] =
 253:                             sprintf(SystemLocale::EF_SQL_FILE_NOT_FOUND, "<strong>{$sql_file_path}</strong>");
 254:                         return false;
 255:                     } else {
 256:                         $this->trace[] = sprintf(SystemLocale::SF_SQL_FILE_FOUND, "<strong>{$sql_file_path}</strong>");
 257:                         $this->trace[] = SystemLocale::MANAGING_TABLES;
 258: 
 259:                         $sql_query = fread(fopen($sql_file_path, 'r'), filesize($sql_file_path));
 260:                         $sql_query = trim($sql_query);
 261:                         SqlUtility::splitMySqlFile($pieces, $sql_query);
 262:                         foreach ($pieces as $piece) {
 263:                             // [0] contains the prefixed query
 264:                             // [4] contains unprefixed table name
 265:                             $prefixed_query = SqlUtility::prefixQuery($piece, $xoops->db()->prefix());
 266:                             if (!$prefixed_query) {
 267:                                 $this->error[]['sub'] = '<span class="red">' . sprintf(
 268:                                     XoopsLocale::EF_INVALID_SQL,
 269:                                     '<strong>' . $piece . '</strong>'
 270:                                 ) . '</span>';
 271:                                 break;
 272:                             }
 273:                             // check if the table name is reserved
 274:                             if (!in_array($prefixed_query[4], $this->reservedTables) || $mod === 'system') {
 275:                                 // not reserved, so try to create one
 276:                                 try {
 277:                                     $result = $xoops->db()->query($prefixed_query[0]);
 278:                                 } catch (Exception $e) {
 279:                                     $xoops->events()->triggerEvent('core.exception', $e);
 280:                                     $result=false;
 281:                                 }
 282: 
 283:                                 if (!$result) {
 284:                                     $this->error[] = $xoops->db()->errorInfo();
 285:                                     break;
 286:                                 } else {
 287:                                     if (!in_array($prefixed_query[4], $created_tables)) {
 288:                                         $this->trace[]['sub'] = sprintf(
 289:                                             XoopsLocale::SF_TABLE_CREATED,
 290:                                             '<strong>' . $xoops->db()->prefix($prefixed_query[4]) . '</strong>'
 291:                                         );
 292:                                         $created_tables[] = $prefixed_query[4];
 293:                                     } else {
 294:                                         $this->trace[]['sub'] = sprintf(
 295:                                             XoopsLocale::SF_DATA_INSERTED_TO_TABLE,
 296:                                             '<strong>' . $xoops->db()->prefix($prefixed_query[4]) . '</strong>'
 297:                                         );
 298:                                     }
 299:                                 }
 300:                             } else {
 301:                                 // the table name is reserved, so halt the installation
 302:                                 $this->error[]['sub'] = sprintf(
 303:                                     SystemLocale::EF_TABLE_IS_RESERVED,
 304:                                     '<strong>' . $prefixed_query[4] . '</strong>'
 305:                                 );
 306:                                 break;
 307:                             }
 308:                         }
 309:                         // if there was an error, delete the tables created so far,
 310:                         // so the next installation will not fail
 311:                         if (count($this->error) > 0) {
 312:                             foreach ($created_tables as $table) {
 313:                                 try {
 314:                                     $xoops->db()->query('DROP TABLE ' . $xoops->db()->prefix($table));
 315:                                 } catch (Exception $e) {
 316:                                     $xoops->events()->triggerEvent('core.exception', $e);
 317:                                 }
 318:                             }
 319:                             return false;
 320:                         }
 321:                     }
 322:                 }
 323:             }
 324:             // Save module info, blocks, templates and perms
 325:             if (count($this->error) == 0) {
 326:                 if (!$module_handler->insertModule($module)) {
 327:                     $this->error[] = sprintf(
 328:                         XoopsLocale::EF_NOT_INSERTED_TO_DATABASE,
 329:                         '<strong>' . $module->getVar('name') . '</strong>'
 330:                     );
 331:                     foreach ($created_tables as $ct) {
 332:                         try {
 333:                             $xoops->db()->query('DROP TABLE ' . $xoops->db()->prefix($ct));
 334:                         } catch (Exception $e) {
 335:                             $xoops->events()->triggerEvent('core.exception', $e);
 336:                         }
 337:                     }
 338:                     $this->error[] = sprintf(XoopsLocale::EF_NOT_INSTALLED, "<strong>" . $module->name() . "</strong>");
 339:                     $this->error[] = XoopsLocale::C_ERRORS;
 340:                     unset($module);
 341:                     unset($created_tables);
 342:                     return false;
 343:                 }
 344:                 unset($created_tables);
 345:                 $this->trace[] = XoopsLocale::S_DATA_INSERTED . sprintf(
 346:                     SystemLocale::F_MODULE_ID,
 347:                     '<strong>' . $module->getVar('mid') . '</strong>'
 348:                 );
 349:                 $xoops->db()->beginTransaction();
 350:                 // install Templates
 351:                 $this->installTemplates($module);
 352: 
 353:                 $xoops->templateClearModuleCache($module->getVar('mid'));
 354: 
 355:                 // install blocks
 356:                 $this->installBlocks($module);
 357: 
 358:                 // Install Configs
 359:                 $this->installConfigs($module);
 360: 
 361:                 if ($module->getInfo('hasMain')) {
 362:                     $groups = array(FixedGroups::ADMIN, FixedGroups::USERS, FixedGroups::ANONYMOUS);
 363:                 } else {
 364:                     $groups = array(FixedGroups::ADMIN);
 365:                 }
 366:                 // retrieve all block ids for this module
 367:                 $block_handler = $xoops->getHandlerBlock();
 368:                 $blocks = $block_handler->getByModule($module->getVar('mid'), false);
 369:                 $this->trace[] = SystemLocale::MANAGING_PERMISSIONS;
 370:                 $gperm_handler = $xoops->getHandlerGroupPermission();
 371:                 foreach ($groups as $mygroup) {
 372:                     if ($gperm_handler->checkRight('module_admin', 0, $mygroup)) {
 373:                         $mperm = $gperm_handler->create();
 374:                         $mperm->setVar('gperm_groupid', $mygroup);
 375:                         $mperm->setVar('gperm_itemid', $module->getVar('mid'));
 376:                         $mperm->setVar('gperm_name', 'module_admin');
 377:                         $mperm->setVar('gperm_modid', 1);
 378:                         if (!$gperm_handler->insert($mperm)) {
 379:                             $this->trace[]['sub'] = '<span class="red">' . sprintf(
 380:                                 SystemLocale::EF_GROUP_ID_ADMIN_ACCESS_RIGHT_NOT_ADDED,
 381:                                 '<strong>' . $mygroup . '</strong>'
 382:                             ) . '</span>';
 383:                         } else {
 384:                             $this->trace[]['sub'] = sprintf(
 385:                                 SystemLocale::SF_GROUP_ID_ADMIN_ACCESS_RIGHT_ADDED,
 386:                                 '<strong>' . $mygroup . '</strong>'
 387:                             );
 388:                         }
 389:                         unset($mperm);
 390:                     }
 391:                     $mperm = $gperm_handler->create();
 392:                     $mperm->setVar('gperm_groupid', $mygroup);
 393:                     $mperm->setVar('gperm_itemid', $module->getVar('mid'));
 394:                     $mperm->setVar('gperm_name', 'module_read');
 395:                     $mperm->setVar('gperm_modid', 1);
 396:                     if (!$gperm_handler->insert($mperm)) {
 397:                         $this->trace[]['sub'] = '<span class="red">' . sprintf(
 398:                             SystemLocale::EF_GROUP_ID_USER_ACCESS_RIGHT_NOT_ADDED,
 399:                             '<strong>' . $mygroup . '</strong>'
 400:                         ) . '</span>';
 401:                     } else {
 402:                         $this->trace[]['sub'] = sprintf(
 403:                             SystemLocale::SF_GROUP_ID_USER_ACCESS_RIGHT_ADDED,
 404:                             '<strong>' . $mygroup . '</strong>'
 405:                         );
 406:                     }
 407:                     unset($mperm);
 408:                     foreach ($blocks as $blc) {
 409:                         $bperm = $gperm_handler->create();
 410:                         $bperm->setVar('gperm_groupid', $mygroup);
 411:                         $bperm->setVar('gperm_itemid', $blc);
 412:                         $bperm->setVar('gperm_name', 'block_read');
 413:                         $bperm->setVar('gperm_modid', 1);
 414:                         if (!$gperm_handler->insert($bperm)) {
 415:                             $this->trace[]['sub'] = '<span class="red">'
 416:                             . SystemLocale::E_BLOCK_ACCESS_NOT_ADDED . ' Block ID: <strong>'
 417:                             . $blc . '</strong> Group ID: <strong>' . $mygroup . '</strong></span>';
 418:                         } else {
 419:                             $this->trace[]['sub'] = SystemLocale::S_BLOCK_ACCESS_ADDED
 420:                                 . sprintf(SystemLocale::F_BLOCK_ID, "<strong>" . $blc . "</strong>")
 421:                                 . sprintf(SystemLocale::F_GROUP_ID, "<strong>" . $mygroup . "</strong>");
 422:                         }
 423:                         unset($bperm);
 424:                     }
 425:                 }
 426:                 unset($blocks);
 427:                 unset($groups);
 428: 
 429:                 // execute module specific install script if any
 430:                 // If pre install function is defined, execute
 431:                 $func = "xoops_module_install_{$mod}";
 432:                 if (function_exists($func)) {
 433:                     $result = $func($module);
 434:                     if (!$result) {
 435:                         $this->trace[] = sprintf(XoopsLocale::EF_NOT_EXECUTED, $func);
 436:                         $this->trace = array_merge($this->trace, $module->getErrors());
 437:                     } else {
 438:                         $this->trace[] = sprintf(XoopsLocale::SF_EXECUTED, "<strong>{$func}</strong>");
 439:                         $this->trace = array_merge($this->trace, $module->getMessages());
 440:                     }
 441:                 }
 442: 
 443:                 $this->trace[] = sprintf(
 444:                     XoopsLocale::SF_INSTALLED,
 445:                     '<strong>' . $module->getVar('name', 's') . '</strong>'
 446:                 );
 447:                 unset($blocks);
 448: 
 449:                 $xoops->db()->commit();
 450: 
 451:                 $xoops->events()->triggerEvent('system.module.install', $module);
 452:                 return $module;
 453:             }
 454:         } else {
 455:             $this->error[] = sprintf(
 456:                 XoopsLocale::EF_NOT_INSTALLED,
 457:                 '<strong>' . $mod . '</strong>'
 458:             ) . "&nbsp;" . XoopsLocale::C_ERRORS;
 459:             return false;
 460:         }
 461:         return false;
 462:     }
 463: 
 464:     /**
 465:      * uninstall
 466:      *
 467:      * @param string $mod module dirname
 468:      *
 469:      * @return bool|XoopsModule false on failure, module context on success
 470:      */
 471:     public function uninstall($mod = '')
 472:     {
 473:         $xoops = Xoops::getInstance();
 474:         $module_handler = $xoops->getHandlerModule();
 475:         $module = $module_handler->getByDirname($mod);
 476:         $xoops->templateClearModuleCache($module->getVar('mid'));
 477: 
 478:         if ($module->getVar('dirname') === 'system') {
 479:             $this->error[] = sprintf(
 480:                 XoopsLocale::EF_NOT_UNINSTALLED,
 481:                 '<strong>' . $module->getVar('name') . '</strong>'
 482:             ) . "&nbsp;" . XoopsLocale::C_ERRORS;
 483:             $this->error[] = " - " . SystemLocale::E_SYSTEM_MODULE_CANNOT_BE_DEACTIVATED;
 484:             return false;
 485:         } elseif ($module->getVar('dirname') == $xoops->getConfig('startpage')) {
 486:             $this->error[] = sprintf(
 487:                 XoopsLocale::EF_NOT_UNINSTALLED,
 488:                 '<strong>' . $module->getVar('name') . '</strong>'
 489:             ) . "&nbsp;" . XoopsLocale::C_ERRORS;
 490:             $this->error[] = " - " . SystemLocale::E_THIS_MODULE_IS_SET_AS_DEFAULT_START_PAGE;
 491:             return false;
 492:         } else {
 493:             // Load module specific install script if any
 494:             $uninstall_script = $module->getInfo('onUninstall');
 495:             if ($uninstall_script && trim($uninstall_script) != '') {
 496:                 XoopsLoad::loadFile($xoops->path('modules/' . $mod . '/' . trim($uninstall_script)));
 497:             }
 498:             $func = "xoops_module_pre_uninstall_{$mod}";
 499:             // If pre uninstall function is defined, execute
 500:             if (function_exists($func)) {
 501:                 $result = $func($module);
 502:                 if (!$result) {
 503:                     $this->error[] = sprintf(XoopsLocale::EF_NOT_EXECUTED, $func);
 504:                     $this->error[] = sprintf(
 505:                         XoopsLocale::EF_NOT_UNINSTALLED,
 506:                         '<strong>' . $module->getVar('name') . '</strong>'
 507:                     ) . "&nbsp;" . XoopsLocale::C_ERRORS;
 508:                     $this->error = array_merge($this->error, $module->getErrors());
 509:                     return false;
 510:                 } else {
 511:                     $this->trace[] = sprintf(XoopsLocale::SF_EXECUTED, "<strong>{$func}</strong>");
 512:                     $this->trace = array_merge($this->trace, $module->getMessages());
 513:                 }
 514:             }
 515: 
 516:             if (false === $module_handler->deleteModule($module)) {
 517:                 $this->error[] = sprintf(XoopsLocale::EF_NOT_DELETED, $module->getVar('name'));
 518:                 return false;
 519:             } else {
 520:                 // delete templates
 521:                 $this->deleteTemplates($module);
 522: 
 523:                 // Delete blocks and block template files
 524:                 $this->deleteBlocks($module);
 525: 
 526:                 // Delete tables used by this module
 527:                 $modtables = $module->getInfo('tables');
 528:                 if ($modtables != false && is_array($modtables)) {
 529:                     // get a schema manager
 530:                     $schemaManager = $xoops->db()->getSchemaManager();
 531:                     // create schema from the current database
 532:                     $toSchema = $schemaManager->createSchema();
 533: 
 534:                     $this->trace[] = SystemLocale::MANAGING_TABLES;
 535:                     foreach ($modtables as $table) {
 536:                         // prevent deletion of reserved core tables!
 537:                         if (!in_array($table, $this->reservedTables)) {
 538:                             $toSchema->dropTable($xoops->db()->prefix($table));
 539:                             $this->trace[]['sub'] = sprintf(
 540:                                 XoopsLocale::SF_TABLE_DROPPED,
 541:                                 '<strong>' . $xoops->db()->prefix($table) . '</strong>'
 542:                             );
 543:                         } else {
 544:                             $this->trace[]['sub'] = '<span class="red">' . sprintf(
 545:                                 XoopsLocale::EF_TABLE_DROP_NOT_ALLOWED,
 546:                                 '<strong>' . $xoops->db()->prefix($table) . '</strong>'
 547:                             ) . '</span>';
 548:                         }
 549:                     }
 550:                     $synchronizer = new SingleDatabaseSynchronizer($xoops->db());
 551:                     $synchronizer->updateSchema($toSchema, false);
 552:                 }
 553: 
 554:                 // delete permissions if any
 555:                 $gperm_handler = $xoops->getHandlerGroupPermission();
 556:                 if (false === $gperm_handler->deleteByModule($module->getVar('mid'))) {
 557:                     $this->trace[] = '<span class="red">' . SystemLocale::E_GROUP_PERMISSIONS_NOT_DELETED . '</span>';
 558:                 } else {
 559:                     $this->trace[] = SystemLocale::S_GROUP_PERMISSIONS_DELETED;
 560:                 }
 561: 
 562:                 // delete module config options if any
 563:                 $this->deleteConfigs($module);
 564: 
 565:                 // execute module specific install script if any
 566:                 $func = 'xoops_module_uninstall_' . $mod;
 567:                 if (function_exists($func)) {
 568:                     $result = $func($module);
 569:                     if (!$result) {
 570:                         $this->trace[] = sprintf(XoopsLocale::EF_NOT_EXECUTED, $func);
 571:                         $this->trace = array_merge($this->error, $module->getErrors());
 572:                     } else {
 573:                         $this->trace[] = sprintf(XoopsLocale::SF_EXECUTED, "<strong>{$func}</strong>");
 574:                         $this->trace = array_merge($this->trace, $module->getMessages());
 575:                     }
 576:                 }
 577:                 $this->trace[] = sprintf(
 578:                     XoopsLocale::SF_UNINSTALLED,
 579:                     '<strong>' . $module->getVar('name') . '</strong>'
 580:                 );
 581:                 $xoops->events()->triggerEvent('system.module.uninstall', $module);
 582:                 return $module;
 583:             }
 584:         }
 585:     }
 586: 
 587:     /**
 588:      * update
 589:      *
 590:      * @param string $mod module dirname
 591:      *
 592:      * @return mixed boolean false if failed, XoopsModule if success
 593:      */
 594:     public function update($mod = '')
 595:     {
 596:         $xoops = Xoops::getInstance();
 597:         $module_handler = $xoops->getHandlerModule();
 598:         $module = $module_handler->getByDirname($mod);
 599:         $xoops->templateClearModuleCache($module->getVar('mid'));
 600:         // Save current version for use in the update function
 601:         $prev_version = $module->getVar('version');
 602:         // we don't want to change the module name set by admin
 603:         $temp_name = $module->getVar('name');
 604:         $module->loadInfoAsVar($module->getVar('dirname'));
 605:         $module->setVar('name', $temp_name);
 606:         $module->setVar('last_update', time());
 607: 
 608:         if (!$module_handler->insertModule($module)) {
 609:             $this->error[] = sprintf(XoopsLocale::EF_NOT_UPDATED, "<strong>" . $module->getVar('name') . "</strong>");
 610:             return false;
 611:         } else {
 612:             // execute module specific preupdate script if any
 613:             $update_script = $module->getInfo('onUpdate');
 614:             if (false != $update_script && trim($update_script) != '') {
 615:                 XoopsLoad::loadFile($xoops->path('modules/' . $mod . '/' . trim($update_script)));
 616:                 $func = 'xoops_module_preupdate_' . $mod;
 617:                 if (function_exists($func)) {
 618:                     $result = $func($module, $prev_version);
 619:                     if (!$result) {
 620:                         $this->trace[] = sprintf(XoopsLocale::EF_NOT_EXECUTED, $func);
 621:                         $this->trace = array_merge($this->error, $module->getErrors());
 622:                     } else {
 623:                         $this->trace[] = sprintf(XoopsLocale::SF_EXECUTED, "<strong>{$func}</strong>");
 624:                         $this->trace = array_merge($this->trace, $module->getMessages());
 625:                     }
 626:                 }
 627:             }
 628: 
 629:             // update schema
 630:             $schema_file = $module->getInfo('schema');
 631:             if (!empty($schema_file)) {
 632:                 $schema_file_path = \XoopsBaseConfig::get('root-path') . '/modules/' . $mod . '/' . $schema_file;
 633:                 if (!XoopsLoad::fileExists($schema_file_path)) {
 634:                     $this->error[] =
 635:                         sprintf(SystemLocale::EF_SQL_FILE_NOT_FOUND, "<strong>{$schema_file}</strong>");
 636:                     return false;
 637:                 }
 638:                 $importer = new ImportSchema;
 639:                 $importSchema = $importer->importSchemaArray(Yaml::read($schema_file_path));
 640:                 $synchronizer = new SingleDatabaseSynchronizer($xoops->db());
 641:                 $synchronizer->updateSchema($importSchema, true);
 642:             }
 643: 
 644:             // delete templates
 645:             $this->deleteTemplates($module);
 646: 
 647:             // install templates
 648:             $this->installTemplates($module);
 649: 
 650:             // install blocks
 651:             $this->installBlocks($module);
 652: 
 653:             // reset compile_id
 654:             $xoops->tpl()->setCompileId();
 655: 
 656:             // first delete all config entries
 657:             $this->deleteConfigs($module);
 658: 
 659:             // Install Configs
 660:             $this->installConfigs($module);
 661: 
 662:             // execute module specific update script if any
 663:             $update_script = $module->getInfo('onUpdate');
 664:             if (false != $update_script && trim($update_script) != '') {
 665:                 XoopsLoad::loadFile($xoops->path('modules/' . $mod . '/' . trim($update_script)));
 666:                 $func = 'xoops_module_update_' . $mod;
 667:                 if (function_exists($func)) {
 668:                     $result = $func($module, $prev_version);
 669:                     if (!$result) {
 670:                         $this->trace[] = sprintf(XoopsLocale::EF_NOT_EXECUTED, $func);
 671:                         $this->trace = array_merge($this->error, $module->getErrors());
 672:                     } else {
 673:                         $this->trace[] = sprintf(XoopsLocale::SF_EXECUTED, "<strong>{$func}</strong>");
 674:                         $this->trace = array_merge($this->trace, $module->getMessages());
 675:                     }
 676:                 }
 677:             }
 678:             $this->trace[] = sprintf(XoopsLocale::SF_UPDATED, '<strong>' . $module->getVar('name', 's') . '</strong>');
 679:             return $module;
 680:         }
 681:     }
 682: 
 683:     /**
 684:      * getTemplate
 685:      *
 686:      * @param string $dirname  module directory
 687:      * @param string $template template name
 688:      * @param string $type     template type - blocks, admin
 689:      *
 690:      * @return string
 691:      */
 692:     public function getTemplate($dirname, $template, $type = '')
 693:     {
 694:         $xoops = Xoops::getInstance();
 695:         $ret = '';
 696:         switch ($type) {
 697:             case 'blocks':
 698:             case 'admin':
 699:                 $path = $xoops->path('modules/' . $dirname . '/templates/' . $type . '/' . $template);
 700:                 break;
 701:             default:
 702:                 $path = $xoops->path('modules/' . $dirname . '/templates/' . $template);
 703:                 break;
 704:         }
 705:         if (!XoopsLoad::fileExists($path)) {
 706:             return $ret;
 707:         } else {
 708:             $lines = file($path);
 709:         }
 710:         if (!$lines) {
 711:             return $ret;
 712:         }
 713:         $count = count($lines);
 714:         for ($i = 0; $i < $count; ++$i) {
 715:             $ret .= str_replace("\n", "\r\n", str_replace("\r\n", "\n", $lines[$i]));
 716:         }
 717:         return $ret;
 718:     }
 719: 
 720:     /**
 721:      * installTemplates
 722:      *
 723:      * @param XoopsModule $module module context
 724:      *
 725:      * @return void
 726:      */
 727:     public function installTemplates(XoopsModule $module)
 728:     {
 729:         $xoops = Xoops::getInstance();
 730:         $templates = $module->getInfo('templates');
 731:         if (is_array($templates) && count($templates) > 0) {
 732:             $this->trace[] = SystemLocale::MANAGING_TEMPLATES;
 733:             $tplfile_handler = $xoops->getHandlerTplFile();
 734:             foreach ($templates as $tpl) {
 735:                 $tpl['file'] = trim($tpl['file']);
 736:                 if (!in_array($tpl['file'], $this->template_delng)) {
 737:                     $type = (isset($tpl['type']) ? $tpl['type'] : 'module');
 738:                     $tpldata = $this->getTemplate($module->getVar('dirname'), $tpl['file'], $type);
 739:                     $tplfile = $tplfile_handler->create();
 740:                     $tplfile->setVar('tpl_refid', $module->getVar('mid'));
 741:                     $tplfile->setVar('tpl_lastimported', 0);
 742:                     $tplfile->setVar('tpl_lastmodified', time());
 743: 
 744:                     if (preg_match("/\.css$/i", $tpl['file'])) {
 745:                         $tplfile->setVar('tpl_type', 'css');
 746:                     } else {
 747:                         $tplfile->setVar('tpl_type', $type);
 748:                     }
 749:                     $tplfile->setVar('tpl_source', $tpldata);
 750:                     $tplfile->setVar('tpl_module', $module->getVar('dirname'));
 751:                     $tplfile->setVar('tpl_tplset', 'default');
 752:                     $tplfile->setVar('tpl_file', $tpl['file']);
 753:                     $tplfile->setVar('tpl_desc', $tpl['description']);
 754:                     if (!$tplfile_handler->insertTpl($tplfile)) {
 755:                         $this->trace[]['sub'] = '<span class="red">' . sprintf(
 756:                             SystemLocale::EF_TEMPLATE_NOT_ADDED_TO_DATABASE,
 757:                             '<strong>' . $tpl['file'] . '</strong>'
 758:                         ) . '</span>';
 759:                     } else {
 760:                         $newid = $tplfile->getVar('tpl_id');
 761:                         $this->trace[]['sub'] = sprintf(
 762:                             SystemLocale::SF_TEMPLATE_ADDED,
 763:                             '<strong>' . $tpl['file'] . '</strong>'
 764:                         );
 765:                         if ($module->getVar('dirname') === 'system') {
 766:                             if (!$xoops->templateTouch($newid)) {
 767:                                 $this->trace[]['sub'] = '<span class="red">' . sprintf(
 768:                                     SystemLocale::EF_TEMPLATE_NOT_RECOMPILED,
 769:                                     '<strong>' . $tpl['file'] . '</strong>'
 770:                                 ) . '</span>';
 771:                             } else {
 772:                                 $this->trace[]['sub'] = sprintf(
 773:                                     SystemLocale::SF_TEMPLATE_RECOMPILED,
 774:                                     '<strong>' . $tpl['file'] . '</strong>'
 775:                                 );
 776:                             }
 777:                         } else {
 778:                             if ($xoops->config['template_set'] === 'default') {
 779:                                 if (!$xoops->templateTouch($newid)) {
 780:                                     $this->trace[]['sub'] = '<span class="red">' . sprintf(
 781:                                         SystemLocale::EF_TEMPLATE_NOT_RECOMPILED,
 782:                                         '<strong>' . $tpl['file'] . '</strong>'
 783:                                     ) . '</span>';
 784:                                 } else {
 785:                                     $this->trace[]['sub'] = sprintf(
 786:                                         SystemLocale::SF_TEMPLATE_RECOMPILED,
 787:                                         '<strong>' . $tpl['file'] . '</strong>'
 788:                                     );
 789:                                 }
 790:                             }
 791:                         }
 792:                     }
 793:                     unset($tpldata);
 794:                 } else {
 795:                     $this->trace[]['sub'] = '<span class="red">' . sprintf(
 796:                         SystemLocale::EF_TEMPLATE_NOT_DELETED,
 797:                         '<strong>' . $tpl['file'] . '</strong>'
 798:                     ) . '</span>';
 799:                 }
 800:             }
 801:         }
 802:     }
 803: 
 804:     /**
 805:      * deleteTemplates
 806:      *
 807:      * @param XoopsModule $module module context
 808:      *
 809:      * @return void
 810:      */
 811:     public function deleteTemplates(XoopsModule $module)
 812:     {
 813:         $xoops = Xoops::getInstance();
 814:         $tplfile_handler = $xoops->getHandlerTplFile();
 815:         $templates = $tplfile_handler->find('default', 'module', $module->getVar('mid'));
 816:         if (is_array($templates) && count($templates) > 0) {
 817:             $this->trace[] = SystemLocale::MANAGING_TEMPLATES;
 818:             // delete template file entry in db
 819:             /* @var $template XoopsTplFile */
 820:             foreach ($templates as $template) {
 821:                 if (!$tplfile_handler->deleteTpl($template)) {
 822:                     $this->template_delng[] = $template->getVar('tpl_file');
 823:                 }
 824:             }
 825:         }
 826:     }
 827: 
 828:     /**
 829:      * installBlocks
 830:      *
 831:      * @param XoopsModule $module module context
 832:      *
 833:      * @return void
 834:      */
 835:     public function installBlocks(XoopsModule $module)
 836:     {
 837:         $xoops = Xoops::getInstance();
 838:         $blocks = $module->getInfo('blocks');
 839:         $this->trace[] = SystemLocale::MANAGING_BLOCKS;
 840:         $block_handler = $xoops->getHandlerBlock();
 841:         $blockmodulelink_handler = $xoops->getHandlerBlockModuleLink();
 842:         $tplfile_handler = $xoops->getHandlerTplFile();
 843:         $showfuncs = array();
 844:         $funcfiles = array();
 845:         if (is_array($blocks) && count($blocks) > 0) {
 846:             foreach ($blocks as $i => $block) {
 847:                 if (isset($block['show_func']) && $block['show_func'] != ''
 848:                     && isset($block['file']) && $block['file'] != ''
 849:                 ) {
 850:                     $showfuncs[] = $block['show_func'];
 851:                     $funcfiles[] = $block['file'];
 852: 
 853:                     $criteria = new CriteriaCompo();
 854:                     $criteria->add(new Criteria('mid', $module->getVar('mid')));
 855:                     $criteria->add(new Criteria('func_num', $i));
 856: 
 857:                     $block_obj = $block_handler->getObjects($criteria);
 858:                     if (count($block_obj) == 0) {
 859:                         $block_obj[0] = $block_handler->create();
 860:                         $block_obj[0]->setVar('func_num', $i);
 861:                         $block_obj[0]->setVar('mid', $module->getVar('mid'));
 862:                         $block_obj[0]->setVar('name', addslashes($block['name']));
 863:                         $block_obj[0]->setVar('title', addslashes($block['name']));
 864:                         $block_obj[0]->setVar('side', 0);
 865:                         $block_obj[0]->setVar('weight', 0);
 866:                         $block_obj[0]->setVar('visible', 0);
 867:                         $block_obj[0]->setVar(
 868:                             'block_type',
 869:                             ($module->getVar('dirname') === 'system')
 870:                                 ? XoopsBlock::BLOCK_TYPE_SYSTEM
 871:                                 : XoopsBlock::BLOCK_TYPE_MODULE
 872:                         );
 873:                         $block_obj[0]->setVar('isactive', 1);
 874:                         $block_obj[0]->setVar('content', '');
 875:                         $block_obj[0]->setVar('c_type', XoopsBlock::CUSTOM_HTML);
 876:                         $block_obj[0]->setVar('dirname', $module->getVar('dirname'));
 877:                         $block_obj[0]->setVar('options', isset($block['options']) ? $block['options'] : '');
 878:                     }
 879:                     $block_obj[0]->setVar('func_file', $block['file']);
 880:                     $block_obj[0]->setVar('show_func', isset($block['show_func']) ? $block['show_func'] : '');
 881:                     $block_obj[0]->setVar('edit_func', isset($block['edit_func']) ? $block['edit_func'] : '');
 882:                     $template = $this->getTemplate($module->getVar('dirname'), $block['template'], 'blocks');
 883:                     $block_obj[0]->setVar('template', !empty($template) ? $block['template'] : '');
 884:                     $block_obj[0]->setVar('last_modified', time());
 885: 
 886:                     if (!$block_handler->insert($block_obj[0])) {
 887:                         $this->trace[]['sub'] = '<span class="red">' . sprintf(
 888:                             XoopsLocale::EF_NOT_UPDATED,
 889:                             $block_obj[0]->getVar('name')
 890:                         ) . '</span>';
 891:                     } else {
 892:                         $this->trace[]['sub'] = sprintf(
 893:                             SystemLocale::SF_BLOCK_UPDATED,
 894:                             '<strong>' . $block_obj[0]->getVar('name')
 895:                         ) . '</strong>' . sprintf(
 896:                             SystemLocale::F_BLOCK_ID,
 897:                             '<strong>' . $block_obj[0]->getVar('bid') . '</strong>'
 898:                         );
 899: 
 900:                         if (0 == $blockmodulelink_handler->getCount(new Criteria('block_id', $block_obj[0]->getVar('bid')))) {
 901:                             $blockmodulelink = $blockmodulelink_handler->create();
 902:                             $blockmodulelink->setVar('block_id', $block_obj[0]->getVar('bid'));
 903:                             $blockmodulelink->setVar('module_id', 0); //show on all pages
 904:                             $blockmodulelink_handler->insert($blockmodulelink);
 905:                         }
 906: 
 907:                         if ($template != '') {
 908:                             $tplfile = $tplfile_handler->find('default', 'block', $block_obj[0]->getVar('bid'));
 909:                             if (count($tplfile) == 0) {
 910:                                 $tplfile_new = $tplfile_handler->create();
 911:                                 $tplfile_new->setVar('tpl_module', $module->getVar('dirname'));
 912:                                 $tplfile_new->setVar('tpl_refid', $block_obj[0]->getVar('bid'));
 913:                                 $tplfile_new->setVar('tpl_tplset', 'default');
 914:                                 $tplfile_new->setVar('tpl_file', $block_obj[0]->getVar('template'));
 915:                                 $tplfile_new->setVar('tpl_type', 'block');
 916:                             } else {
 917:                                 /* @var $tplfile_new XoopsTplFile */
 918:                                 $tplfile_new = $tplfile[0];
 919:                                 $tplfile_new->setVars($tplfile_new->getValues());
 920:                             }
 921:                             $tplfile_new->setVar('tpl_source', $template);
 922:                             $tplfile_new->setVar('tpl_desc', $block['description']);
 923:                             $tplfile_new->setVar('tpl_lastmodified', time());
 924:                             $tplfile_new->setVar('tpl_lastimported', 0);
 925:                             if (!$tplfile_handler->insertTpl($tplfile_new)) {
 926:                                 $this->trace[]['sub'] = '<span class="red">' . sprintf(
 927:                                     SystemLocale::EF_TEMPLATE_NOT_UPDATED,
 928:                                     '<strong>' . $block['template'] . '</strong>'
 929:                                 ) . '</span>';
 930:                             } else {
 931:                                 $this->trace[]['sub'] = sprintf(
 932:                                     SystemLocale::SF_TEMPLATE_UPDATED,
 933:                                     '<strong>' . $block['template'] . '</strong>'
 934:                                 );
 935:                                 if ($module->getVar('dirname') === 'system') {
 936:                                     if (!$xoops->templateTouch($tplfile_new->getVar('tpl_id'))) {
 937:                                         $this->trace[]['sub'] = '<span class="red">' . sprintf(
 938:                                             SystemLocale::EF_TEMPLATE_NOT_RECOMPILED,
 939:                                             '<strong>' . $block['template'] . '</strong>'
 940:                                         ) . '</span>';
 941:                                     } else {
 942:                                         $this->trace[]['sub'] = sprintf(
 943:                                             SystemLocale::SF_TEMPLATE_RECOMPILED,
 944:                                             '<strong>' . $block['template'] . '</strong>'
 945:                                         );
 946:                                     }
 947:                                 } else {
 948:                                     if ($xoops->config['template_set'] === 'default') {
 949:                                         if (!$xoops->templateTouch($tplfile_new->getVar('tpl_id'))) {
 950:                                             $this->trace[]['sub'] = '<span class="red">' . sprintf(
 951:                                                 SystemLocale::EF_TEMPLATE_NOT_RECOMPILED,
 952:                                                 '<strong>' . $block['template'] . '</strong>'
 953:                                             ) . '</span>';
 954:                                         } else {
 955:                                             $this->trace[]['sub'] = sprintf(
 956:                                                 SystemLocale::SF_TEMPLATE_RECOMPILED,
 957:                                                 '<strong>' . $block['template'] . '</strong>'
 958:                                             );
 959:                                         }
 960:                                     }
 961:                                 }
 962:                             }
 963:                         }
 964:                     }
 965:                 }
 966:             }
 967:         }
 968:         $blocks = $block_handler->getByModule($module->getVar('mid'));
 969:         foreach ($blocks as $block) {
 970:             /* @var $block XoopsBlock */
 971:             if (!in_array($block->getVar('show_func'), $showfuncs)
 972:                 || !in_array($block->getVar('func_file'), $funcfiles)
 973:             ) {
 974:                 if (!$block_handler->delete($block)) {
 975:                     $this->trace[]['sub'] = '<span class="red">' . sprintf(
 976:                         SystemLocale::EF_BLOCK_NOT_DELETED,
 977:                         "<strong>" . $block->getVar('name') . "</strong>"
 978:                     ) . sprintf(
 979:                         SystemLocale::F_BLOCK_ID,
 980:                         "<strong>" . $block->getVar('bid') . "</strong>"
 981:                     ) . '</span>';
 982:                 } else {
 983:                     $this->trace[]['sub'] = sprintf(
 984:                         SystemLocale::SF_BLOCK_DELETED,
 985:                         '<strong>' . $block->getVar('name') . '</strong>'
 986:                     ) . '&nbsp;' . sprintf(
 987:                         SystemLocale::F_BLOCK_ID,
 988:                         '<strong>' . $block->getVar('bid') . '</strong>'
 989:                     );
 990:                     if ($block->getVar('template') != '') {
 991:                         $tplfiles = $tplfile_handler->find(null, 'block', $block->getVar('bid'));
 992:                         if (is_array($tplfiles)) {
 993:                             /* @var $tplfile XoopsTplFile */
 994:                             foreach ($tplfiles as $tplfile) {
 995:                                 if (!$tplfile_handler->deleteTpl($tplfile)) {
 996:                                     $this->trace[]['sub'] = '<span class="red">'
 997:                                         . SystemLocale::E_BLOCK_TEMPLATE_DEPRECATED_NOT_REMOVED
 998:                                         . '(ID: <strong>' . $tplfile->getVar('tpl_id') . '</strong>)</span>';
 999:                                 } else {
1000:                                     $this->trace[]['sub'] = sprintf(
1001:                                         SystemLocale::SF_BLOCK_TEMPLATE_DEPRECATED,
1002:                                         "<strong>" . $tplfile->getVar('tpl_file') . "</strong>"
1003:                                     );
1004:                                 }
1005:                             }
1006:                         }
1007:                     }
1008:                 }
1009:             }
1010:         }
1011:     }
1012: 
1013:     /**
1014:      * deleteBlocks
1015:      *
1016:      * @param XoopsModule $module module
1017:      *
1018:      * @return void
1019:      */
1020:     public function deleteBlocks(XoopsModule $module)
1021:     {
1022:         $xoops = Xoops::getInstance();
1023:         $block_handler = $xoops->getHandlerBlock();
1024:         $blocks = $block_handler->getByModule($module->getVar('mid'));
1025:         if (is_array($blocks) && count($blocks) > 0) {
1026:             $tplfile_handler = $xoops->getHandlerTplFile();
1027:             $this->trace[] = SystemLocale::MANAGING_BLOCKS;
1028:             /* @var $block XoopsBlock */
1029:             foreach ($blocks as $block) {
1030:                 if (false === $block_handler->deleteBlock($block)) {
1031:                     $this->trace[]['sub'] = '<span class="red">' . sprintf(
1032:                         SystemLocale::EF_BLOCK_NOT_DELETED,
1033:                         "<strong>" . $block->getVar('name') . "</strong>"
1034:                     ) . sprintf(
1035:                         SystemLocale::F_BLOCK_ID,
1036:                         "<strong>" . $block->getVar('bid') . "</strong>"
1037:                     ) . '</span>';
1038:                 } else {
1039:                     $this->trace[]['sub'] = sprintf(
1040:                         SystemLocale::SF_BLOCK_DELETED,
1041:                         "<strong>" . $block->getVar('name') . "</strong>"
1042:                     ) . sprintf(
1043:                         SystemLocale::F_BLOCK_ID,
1044:                         "<strong>" . $block->getVar('bid') . "</strong>"
1045:                     );
1046:                 }
1047:                 if ($block->getVar('template') != '') {
1048:                     $templates = $tplfile_handler->find(null, 'block', $block->getVar('bid'));
1049:                     /* @var $template XoopsTplFile */
1050:                     foreach ($templates as $template) {
1051:                         if (!$tplfile_handler->delete($template)) {
1052:                             $this->trace[]['sub'] = '<span class="red">' . sprintf(
1053:                                 SystemLocale::EF_BLOCK_TEMPLATE_NOT_DELETED,
1054:                                 $template->getVar('tpl_file')
1055:                             ) . sprintf(
1056:                                 SystemLocale::F_TEMPLATE_ID,
1057:                                 "<strong>" . $template->getVar('tpl_id') . "</strong>"
1058:                             ) . '</span>';
1059:                         } else {
1060:                             $this->trace[]['sub'] = sprintf(
1061:                                 SystemLocale::SF_BLOCK_TEMPLATE_DELETED,
1062:                                 "<strong>" . $template->getVar('tpl_file') . "</strong>"
1063:                             ) . sprintf(
1064:                                 SystemLocale::F_TEMPLATE_ID,
1065:                                 "<strong>" . $template->getVar('tpl_id') . "</strong>"
1066:                             );
1067:                         }
1068:                     }
1069:                     unset($templates);
1070:                 }
1071:             }
1072:         }
1073:     }
1074: 
1075:     /**
1076:      * deleteConfigs
1077:      *
1078:      * @param XoopsModule $module module
1079:      *
1080:      * @return void
1081:      */
1082:     public function deleteConfigs(XoopsModule $module)
1083:     {
1084:         $xoops = Xoops::getInstance();
1085: 
1086:         $config_handler = $xoops->getHandlerConfig();
1087:         $configs = $config_handler->getConfigs(new Criteria('conf_modid', $module->getVar('mid')));
1088:         if (is_array($configs) && count($configs) > 0) {
1089:             $this->trace[] = SystemLocale::MANAGING_PREFERENCES;
1090:             /* @var $config XoopsConfigItem */
1091:             foreach ($configs as $config) {
1092:                 if (!$config_handler->deleteConfig($config)) {
1093:                     $this->trace[]['sub'] = '<span class="red">'
1094:                         . SystemLocale::E_CONFIG_DATA_NOT_DELETED
1095:                         . sprintf(SystemLocale::F_CONFIG_ID, "<strong>" . $config->getVar('conf_id') . "</strong>")
1096:                         . '</span>';
1097:                     // save the name of config failed to delete for later use
1098:                     $this->config_delng[] = $config->getVar('conf_name');
1099:                 } else {
1100:                     $this->config_old[$config->getVar('conf_name')]['value'] = $config->getVar('conf_value', 'N');
1101:                     $this->config_old[$config->getVar('conf_name')]['formtype'] = $config->getVar('conf_formtype');
1102:                     $this->config_old[$config->getVar('conf_name')]['valuetype'] = $config->getVar('conf_valuetype');
1103:                     $this->trace[]['sub'] = SystemLocale::S_CONFIG_DATA_DELETED
1104:                         . sprintf(SystemLocale::F_CONFIG_ID, "<strong>" . $config->getVar('conf_id') . "</strong>");
1105:                 }
1106:             }
1107:         }
1108:     }
1109: 
1110:     /**
1111:      * installconfigs
1112:      *
1113:      * @param XoopsModule $module module being installed
1114:      *
1115:      * @return void
1116:      */
1117:     public function installConfigs(XoopsModule $module)
1118:     {
1119:         $xoops = Xoops::getInstance();
1120:         // now reinsert them with the new settings
1121:         $configs = $module->getInfo('config');
1122:         if (!is_array($configs)) {
1123:             $configs = array();
1124:         }
1125: 
1126:         $collector = new ConfigCollector($module, $configs);
1127:         $xoops->events()->triggerEvent('system.module.update.configs', $collector);
1128: 
1129:         if (is_array($configs) && count($configs) > 0) {
1130:             $this->trace[] = SystemLocale::MANAGING_PREFERENCES;
1131:             $config_handler = $xoops->getHandlerConfig();
1132:             $order = 0;
1133:             foreach ($configs as $config) {
1134:                 // only insert ones that have been deleted previously with success
1135:                 if (!in_array($config['name'], $this->config_delng)) {
1136:                     $confobj = $config_handler->createConfig();
1137:                     $confobj->setVar('conf_modid', $module->getVar('mid'));
1138:                     $confobj->setVar('conf_catid', 0);
1139:                     $confobj->setVar('conf_name', $config['name']);
1140:                     $confobj->setVar('conf_title', $config['title']);
1141:                     $confobj->setVar('conf_desc', $config['description']);
1142:                     $confobj->setVar('conf_formtype', $config['formtype']);
1143:                     $confobj->setVar('conf_valuetype', $config['valuetype']);
1144:                     if (isset($this->config_old[$config['name']]['value'])
1145:                         && $this->config_old[$config['name']]['formtype'] == $config['formtype']
1146:                         && $this->config_old[$config['name']]['valuetype'] == $config['valuetype']
1147:                     ) {
1148:                         // preserver the old value if any
1149:                         // form type and value type must be the same
1150:                         $confobj->setVar('conf_value', $this->config_old[$config['name']]['value']);
1151:                     } else {
1152:                         $confobj->setConfValueForInput($config['default']);
1153:                         //$confobj->setVar('conf_value', $config['default']);
1154:                     }
1155:                     $confobj->setVar('conf_order', $order);
1156:                     $confop_msgs = '';
1157:                     if (isset($config['options']) && is_array($config['options'])) {
1158:                         foreach ($config['options'] as $key => $value) {
1159:                             $confop = $config_handler->createConfigOption();
1160:                             $confop->setVar('confop_name', $key);
1161:                             $confop->setVar('confop_value', $value);
1162:                             $confobj->setConfOptions($confop);
1163:                             $confop_msgs .= '<br />&nbsp;&nbsp;&nbsp;&nbsp;';
1164:                             $confop_msgs .= SystemLocale::S_CONFIG_OPTION_ADDED;
1165:                             $confop_msgs .= '&nbsp;';
1166:                             $confop_msgs .= XoopsLocale::C_NAME;
1167:                             $confop_msgs .= ' <strong>'
1168:                                 . \Xoops\Locale::translate($key, $module->getVar('dirname'))
1169:                                 . '</strong> ';
1170:                             $confop_msgs .= XoopsLocale::C_VALUE . ' <strong>' . $value . '</strong> ';
1171:                             unset($confop);
1172:                         }
1173:                     }
1174:                     ++$order;
1175:                     if (false != $config_handler->insertConfig($confobj)) {
1176:                         $this->trace[]['sub'] = sprintf(
1177:                             SystemLocale::SF_CONFIG_ADDED,
1178:                             "<strong>" . $config['name'] . "</strong>"
1179:                         ) . $confop_msgs;
1180:                     } else {
1181:                         $this->trace[]['sub'] = '<span class="red">'
1182:                             . sprintf(SystemLocale::EF_CONFIG_NOT_ADDED, "<strong>" . $config['name'] . "</strong>")
1183:                             . '</span>';
1184:                     }
1185:                     unset($confobj);
1186:                 }
1187:             }
1188:             unset($configs);
1189:         }
1190:     }
1191: }
1192: 
API documentation generated by ApiGen