Overview

Namespaces

  • Composer
    • Autoload
  • Geekwright
    • RegDom
  • League
    • OAuth2
      • Client
        • Provider
  • None
  • Xmf
    • Database
    • Jwt
    • Key
    • Module
      • Helper

Classes

  • ArtObject
  • ArtObjectHandler
  • BloggerApi
  • CGIF
  • CGIFCOLORTABLE
  • CGIFFILEHEADER
  • CGIFIMAGE
  • CGIFIMAGEHEADER
  • CGIFLZW
  • Composer\Autoload\ClassLoader
  • Composer\Autoload\ComposerStaticInit274e5fff219a4f27a346e611b0580d6a
  • ComposerAutoloaderInit274e5fff219a4f27a346e611b0580d6a
  • Config_File
  • Cookie
  • Criteria
  • CriteriaCompo
  • CriteriaElement
  • Database
  • Db_manager
  • ErrorHandler
  • FormDhtmlTextArea
  • FormTextArea
  • Geekwright\RegDom\PublicSuffixList
  • Geekwright\RegDom\RegisteredDomain
  • HTMLPurifier
  • League\OAuth2\Client\Provider\Google
  • MetaWeblogApi
  • ModuleAdmin
  • MovableTypeApi
  • MyTextSanitizer
  • MyTextSanitizerExtended
  • MyTextSanitizerExtension
  • MytsCensor
  • MytsFlash
  • MytsIframe
  • MytsImage
  • MytsLi
  • MytsMms
  • MytsMp3
  • MytsRtsp
  • MytsSoundcloud
  • MytsSyntaxhighlight
  • MytsTextfilter
  • MytsUl
  • MytsWiki
  • MytsWmp
  • MytsYoutube
  • PathStuffController
  • PHPMailer
  • PHPMailerOAuth
  • PHPMailerOAuthGoogle
  • phpthumb
  • phpthumb_bmp
  • phpthumb_filters
  • phpthumb_functions
  • phpthumb_ico
  • phpUnsharpMask
  • PmCorePreload
  • PmMessage
  • PmMessageHandler
  • PmSystemPreload
  • POP3
  • ProfileCategory
  • ProfileCategoryHandler
  • ProfileCorePreload
  • ProfileField
  • ProfileFieldHandler
  • ProfileProfile
  • ProfileProfileHandler
  • ProfileRegstep
  • 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_language_match
  • Protector_postcommon_post_need_multibyte
  • Protector_postcommon_post_register_moratorium
  • Protector_postcommon_post_stopforumspam
  • Protector_postcommon_register_insert_js_check
  • Protector_postcommon_register_stopforumspam
  • 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
  • ProtectorCorePreload
  • ProtectorFilterAbstract
  • ProtectorFilterHandler
  • ProtectorMySQLDatabase
  • ProtectorRegistry
  • 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
  • Smarty
  • Smarty_Compiler
  • SMTP
  • Snoopy
  • SqlUtility
  • SystemAvatar
  • SystemAvatarHandler
  • SystemBanner
  • SystemBannerclient
  • SystemBannerclientHandler
  • SystemBannerFinish
  • SystemBannerfinishHandler
  • SystemBannerHandler
  • SystemBlock
  • SystemBlockHandler
  • SystemBlockLinkModule
  • SystemBlockLinkModuleHandler
  • SystemBreadcrumb
  • SystemCorePreload
  • SystemFineAvatarUploadHandler
  • SystemFineImUploadHandler
  • SystemFineUploadHandler
  • SystemGroup
  • SystemGroupHandler
  • SystemMaintenance
  • SystemMenuHandler
  • SystemSmilies
  • SystemsmiliesHandler
  • SystemUserrank
  • SystemuserrankHandler
  • SystemUsers
  • SystemUsersHandler
  • Tar
  • ThemeSetAuthorHandler
  • ThemeSetDateCreatedHandler
  • ThemeSetDescriptionHandler
  • ThemeSetEmailHandler
  • ThemeSetFileTypeHandler
  • ThemeSetGeneratorHandler
  • ThemeSetImageHandler
  • ThemeSetLinkHandler
  • ThemeSetModuleHandler
  • ThemeSetNameHandler
  • ThemeSetTagHandler
  • ThemeSetTemplateHandler
  • TinyMCE
  • Xmf\Assert
  • Xmf\Database\Migrate
  • Xmf\Database\TableLoad
  • Xmf\Database\Tables
  • Xmf\Debug
  • Xmf\FilterInput
  • Xmf\Highlighter
  • Xmf\IPAddress
  • Xmf\Jwt\JsonWebToken
  • Xmf\Jwt\KeyFactory
  • Xmf\Jwt\TokenFactory
  • Xmf\Jwt\TokenReader
  • Xmf\Key\ArrayStorage
  • Xmf\Key\Basic
  • Xmf\Key\FileStorage
  • Xmf\Key\KeyAbstract
  • Xmf\Language
  • Xmf\Metagen
  • Xmf\Module\Admin
  • Xmf\Module\Helper
  • Xmf\Module\Helper\AbstractHelper
  • Xmf\Module\Helper\Cache
  • Xmf\Module\Helper\GenericHelper
  • Xmf\Module\Helper\Permission
  • Xmf\Module\Helper\Session
  • Xmf\Random
  • Xmf\Request
  • Xmf\StopWords
  • Xmf\Yaml
  • XmlTagHandler
  • XoopsApi
  • xoopsart
  • XoopsAuth
  • XoopsAuthAds
  • XoopsAuthFactory
  • XoopsAuthLdap
  • XoopsAuthProvisionning
  • XoopsAuthXoops
  • XoopsAvatar
  • XoopsAvatarHandler
  • XoopsBlock
  • XoopsBlockHandler
  • XoopsBlockInstance
  • XoopsBlockInstanceHandler
  • XoopsCache
  • XoopsCacheApc
  • XoopsCacheEngine
  • XoopsCacheFile
  • XoopsCacheMemcache
  • XoopsCacheModel
  • XoopsCacheModelHandler
  • XoopsCacheModelObject
  • XoopsCacheXcache
  • XoopsCaptcha
  • XoopsCaptchaImage
  • XoopsCaptchaImageHandler
  • XoopsCaptchaMethod
  • XoopsCaptchaRecaptcha
  • XoopsCaptchaRecaptcha2
  • XoopsCaptchaText
  • XoopsComment
  • XoopsCommentHandler
  • XoopsCommentRenderer
  • XoopsComments
  • XoopsConfigCategory
  • XoopsConfigCategoryHandler
  • XoopsConfigHandler
  • XoopsConfigItem
  • XoopsConfigItemHandler
  • XoopsConfigOption
  • XoopsConfigOptionHandler
  • XoopsDatabase
  • XoopsDatabaseFactory
  • XoopsDownloader
  • XoopsEditor
  • XoopsEditorHandler
  • XoopsErrorHandler
  • XoopsFile
  • XoopsFileHandler
  • XoopsFilterInput
  • XoopsFolderHandler
  • XoopsForm
  • XoopsFormButton
  • XoopsFormButtonTray
  • XoopsFormCaptcha
  • XoopsFormCheckBox
  • XoopsFormColorPicker
  • XoopsFormDateTime
  • XoopsFormDhtmlTextArea
  • XoopsFormEditor
  • XoopsFormElement
  • XoopsFormElementTray
  • XoopsFormFile
  • XoopsFormHidden
  • XoopsFormHiddenToken
  • XoopsFormLabel
  • XoopsFormPassword
  • XoopsFormRadio
  • XoopsFormRadioYN
  • XoopsFormRenderer
  • XoopsFormRendererBootstrap3
  • XoopsFormRendererLegacy
  • XoopsFormSelect
  • XoopsFormSelectCheckGroup
  • XoopsFormSelectCountry
  • XoopsFormSelectEditor
  • XoopsFormSelectGroup
  • XoopsFormSelectLang
  • XoopsFormSelectMatchOption
  • XoopsFormSelectTheme
  • XoopsFormSelectTimezone
  • XoopsFormSelectUser
  • XoopsFormText
  • XoopsFormTextArea
  • XoopsFormTextDateSelect
  • XoopsFormTinymce
  • XoopsGroup
  • XoopsGroupFormCheckBox
  • XoopsGroupHandler
  • XoopsGroupPerm
  • XoopsGroupPermForm
  • XoopsGroupPermHandler
  • XoopsGTicket
  • XoopsGuestUser
  • XoopsGuiDefault
  • XoopsGuiThadmin
  • XoopsGuiTransition
  • XoopsGuiZetadigme
  • XoopsHandlerRegistry
  • XoopsImage
  • XoopsImagecategory
  • XoopsImagecategoryHandler
  • XoopsImageHandler
  • XoopsImageSet
  • XoopsImagesetHandler
  • XoopsImagesetimg
  • XoopsImagesetimgHandler
  • XoopsInstallWizard
  • XoopsLists
  • XoopsLoad
  • XoopsLocal
  • XoopsLocalAbstract
  • XoopsLocalWrapper
  • XoopsLogger
  • XoopsMailer
  • XoopsMailerLocal
  • XoopsMediaUploader
  • XoopsMemberHandler
  • XoopsMembership
  • XoopsMembershipHandler
  • XoopsModelAbstract
  • XoopsModelFactory
  • XoopsModelJoint
  • XoopsModelRead
  • XoopsModelStats
  • XoopsModelSync
  • XoopsModelWrite
  • XoopsModule
  • XoopsModuleHandler
  • XoopsMultiMailer
  • XoopsMySQLDatabase
  • XoopsMySQLDatabaseProxy
  • XoopsMySQLDatabaseSafe
  • XoopsNotification
  • XoopsNotificationHandler
  • XoopsObject
  • XoopsObjectHandler
  • XoopsObjectTree
  • XoopsOnlineHandler
  • XoopsPageNav
  • XoopsPersistableObjectHandler
  • XoopsPreload
  • XoopsPreloadItem
  • XoopsPrivmessage
  • XoopsPrivmessageHandler
  • XoopsRank
  • XoopsRankHandler
  • XoopsRequest
  • XoopsSecurity
  • XoopsSessionHandler
  • XoopsSimpleForm
  • XoopsStory
  • XoopsSystemCpanel
  • XoopsSystemGui
  • XoopsTableForm
  • XoopsTarDownloader
  • XoopsThemeForm
  • XoopsThemeSetParser
  • XoopsTopic
  • XoopsTpl
  • XoopsTplfile
  • XoopsTplfileHandler
  • XoopsTplset
  • XoopsTplsetHandler
  • XoopsTree
  • XoopsUser
  • XoopsUserHandler
  • XoopsUserUtility
  • XoopsUtility
  • XoopsXmlRpcApi
  • XoopsXmlRpcArray
  • XoopsXmlRpcBase64
  • XoopsXmlRpcBoolean
  • XoopsXmlRpcDatetime
  • XoopsXmlRpcDocument
  • XoopsXmlRpcDouble
  • XoopsXmlRpcFault
  • XoopsXmlRpcInt
  • XoopsXmlRpcParser
  • XoopsXmlRpcRequest
  • XoopsXmlRpcResponse
  • XoopsXmlRpcString
  • XoopsXmlRpcStruct
  • XoopsXmlRpcTag
  • XoopsXmlRss2Parser
  • XoopsZipDownloader
  • xos_kernel_Xoops2
  • xos_logos_PageBuilder
  • xos_opal_AdminThemeFactory
  • xos_opal_Theme
  • xos_opal_ThemeFactory
  • XoUser
  • XoUserHandler
  • Zipfile

Interfaces

  • Xmf\Key\StorageInterface
  • XoopsFormRendererInterface

Exceptions

  • phpmailerException

Functions

  • __autoload
  • _recaptcha_aes_encrypt
  • _recaptcha_aes_pad
  • _recaptcha_http_post
  • _recaptcha_mailhide_email_parts
  • _recaptcha_mailhide_urlbase64
  • _recaptcha_qsencode
  • _smarty_regex_replace_check
  • _smarty_sort_length
  • admin_refcheck
  • b_system_comments_edit
  • b_system_comments_show
  • b_system_info_edit
  • b_system_info_show
  • b_system_login_show
  • b_system_main_show
  • b_system_newmembers_edit
  • b_system_newmembers_show
  • b_system_notification_show
  • b_system_online_show
  • b_system_search_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
  • bannerstats
  • change_banner_url_by_client
  • checkEmail
  • clickbanner
  • clientlogin
  • closeTable
  • closeThread
  • CloseWaitBox
  • Composer\Autoload\includeFile
  • composerRequire274e5fff219a4f27a346e611b0580d6a
  • createConfigform
  • createThemeform
  • doConditionalGet
  • emailStats
  • exit404BadReq
  • fatalPhpErrorHandler
  • file_get_contents
  • file_put_contents
  • findSharp
  • form_user
  • formatTimestamp
  • formatURL
  • gd_info
  • genPathCheckHtml
  • get_request_method
  • get_writeoks_from_protector
  • getcss
  • getDbCharsets
  • getDbCollations
  • getDirList
  • getMailer
  • getTheme
  • gif_getSize
  • gif_loadFile
  • gif_loadFileToGDimageResource
  • gif_outputAsBmp
  • gif_outputAsJpeg
  • gif_outputAsPng
  • HTMLPurifier
  • imagealphablending
  • imageBrowser
  • imageCreateCorners
  • imageFilenameCheck
  • imagesavealpha
  • install_acceptUser
  • install_finalize
  • is_executable
  • kses
  • langDropdown
  • load_functions
  • load_object
  • load_objectHandler
  • loadModuleAdminMenu
  • make_cblock
  • make_data
  • make_groups
  • make_sidebar
  • 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_getIP
  • mod_getMysqlVersion
  • mod_getUnameFromId
  • mod_getUnameFromIds
  • mod_isModuleAction
  • mod_loadCacheFile
  • mod_loadCacheFile_byGroup
  • mod_loadConfg
  • mod_loadConfig
  • mod_loadFile
  • mod_loadFunctions
  • mod_loadRenderer
  • mod_message
  • modify_chmod
  • myTextForm
  • notificationCategoryInfo
  • notificationCommentCategoryInfo
  • notificationEnabled
  • notificationEventEnabled
  • notificationEventInfo
  • notificationEvents
  • notificationGenerateConfig
  • notificationSubscribableCategoryInfo
  • openTable
  • openThread
  • OpenWaitBox
  • PHPMailerAutoload
  • phpThumbURL
  • preg_quote
  • profile_getFieldForm
  • profile_getRegisterForm
  • profile_getStepForm
  • profile_getUserForm
  • profile_install_addCategory
  • profile_install_addField
  • profile_install_addStep
  • profile_install_initializeProfiles
  • profile_install_setPermissions
  • protector_message_append_oninstall
  • protector_message_append_onuninstall
  • protector_message_append_onupdate
  • protector_notify_base
  • protector_oninstall_base
  • protector_onuninstall_base
  • protector_onupdate_base
  • protector_postcommon
  • protector_prepare
  • recaptcha_check_answer
  • recaptcha_get_html
  • recaptcha_get_signup_url
  • recaptcha_mailhide_html
  • recaptcha_mailhide_url
  • redirect_header
  • RedirectToCachedFile
  • SendSaveAsFileHeaderIfNeeded
  • showbanner
  • showThread
  • smarty_block_textformat
  • smarty_compiler_assign
  • smarty_compiler_foreachq
  • smarty_compiler_includeq
  • smarty_compiler_xoAdminIcons
  • smarty_compiler_xoAdminNav
  • smarty_compiler_xoAppUrl
  • smarty_compiler_xoImgUrl
  • smarty_compiler_xoModuleIcons16
  • smarty_compiler_xoModuleIcons32
  • smarty_compiler_xoModuleIconsBookmarks
  • smarty_core_assemble_plugin_filepath
  • smarty_core_assign_smarty_interface
  • smarty_core_create_dir_structure
  • smarty_core_display_debug_console
  • smarty_core_get_include_path
  • smarty_core_get_microtime
  • smarty_core_get_php_resource
  • smarty_core_is_secure
  • smarty_core_is_trusted
  • smarty_core_load_plugins
  • smarty_core_load_resource_plugin
  • smarty_core_process_cached_inserts
  • smarty_core_process_compiled_include
  • smarty_core_read_cache_file
  • smarty_core_rm_auto
  • smarty_core_rmdir
  • smarty_core_run_insert_handler
  • smarty_core_smarty_include_php
  • smarty_core_write_cache_file
  • smarty_core_write_compiled_include
  • smarty_core_write_compiled_resource
  • smarty_core_write_file
  • smarty_function_assign_debug_info
  • smarty_function_block
  • smarty_function_config_load
  • smarty_function_counter
  • smarty_function_cycle
  • smarty_function_debug
  • smarty_function_escape_special_chars
  • smarty_function_eval
  • smarty_function_fetch
  • smarty_function_html_checkboxes
  • smarty_function_html_checkboxes_output
  • smarty_function_html_image
  • smarty_function_html_options
  • smarty_function_html_options_optgroup
  • smarty_function_html_options_optoutput
  • smarty_function_html_radios
  • smarty_function_html_radios_output
  • smarty_function_html_select_date
  • smarty_function_html_select_time
  • smarty_function_html_table
  • smarty_function_html_table_cycle
  • smarty_function_mailto
  • smarty_function_math
  • smarty_function_popup
  • smarty_function_popup_init
  • smarty_function_securityToken
  • smarty_function_xoInboxCount
  • smarty_function_xoMemberInfo
  • smarty_function_xoops_link
  • smarty_function_xoPageNav
  • smarty_make_timestamp
  • smarty_modifier_capitalize
  • smarty_modifier_capitalize_ucfirst
  • smarty_modifier_cat
  • smarty_modifier_count_characters
  • smarty_modifier_count_paragraphs
  • smarty_modifier_count_sentences
  • smarty_modifier_count_words
  • smarty_modifier_date_format
  • smarty_modifier_debug_print_var
  • smarty_modifier_default
  • smarty_modifier_escape
  • smarty_modifier_indent
  • smarty_modifier_lower
  • smarty_modifier_nl2br
  • smarty_modifier_regex_replace
  • smarty_modifier_replace
  • smarty_modifier_spacify
  • smarty_modifier_string_format
  • smarty_modifier_strip
  • smarty_modifier_strip_tags
  • smarty_modifier_truncate
  • smarty_modifier_upper
  • smarty_modifier_wordwrap
  • smarty_outputfilter_trimwhitespace
  • smarty_outputfilter_trimwhitespace_replace
  • smarty_resource_db_secure
  • smarty_resource_db_source
  • smarty_resource_db_timestamp
  • smarty_resource_db_tplinfo
  • smarty_resource_db_trusted
  • synchronize
  • system_AdminIcons
  • system_adminVersion
  • system_CleanVars
  • system_loadLanguage
  • system_loadTemplate
  • themecenterposts
  • update_system_v211
  • userCheck
  • userTimeToServerTime
  • validateDbCharset
  • writeLicenseKey
  • xoBuildLicenceKey
  • xoDiag
  • xoDiagBoolSetting
  • xoDiagIfWritable
  • xoFormBlockCollation
  • xoFormField
  • xoFormFieldCharset
  • xoFormFieldCollation
  • xoFormSelect
  • xoops_aw_decode
  • xoops_aw_encode
  • xoops_bin2hex
  • xoops_comment_count
  • xoops_comment_delete
  • xoops_confirm
  • xoops_convert_decode
  • xoops_convert_encode
  • 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_getLinkedUnameFromId
  • xoops_getMailer
  • xoops_getModuleHandler
  • xoops_getModuleOption
  • xoops_getOption
  • xoops_getrank
  • xoops_getUrlDomain
  • xoops_getUserTimestamp
  • xoops_groupperm_deletebymoditem
  • xoops_header
  • xoops_hex2bin
  • xoops_isActiveModule
  • xoops_ishexstr
  • xoops_load
  • xoops_load_lang_file
  • xoops_loadLanguage
  • xoops_local
  • xoops_makepass
  • xoops_message
  • xoops_module_activate
  • xoops_module_change
  • xoops_module_deactivate
  • xoops_module_delayed_clean_cache
  • xoops_module_get_admin_menu
  • xoops_module_gettemplate
  • xoops_module_install
  • xoops_module_install_pm
  • xoops_module_install_profile
  • xoops_module_log_header
  • xoops_module_uninstall
  • xoops_module_update
  • xoops_module_update_pm
  • xoops_module_update_profile
  • xoops_module_update_system
  • xoops_module_write_admin_menu
  • xoops_notification_deletebyitem
  • xoops_notification_deletebymodule
  • xoops_notification_deletebyuser
  • xoops_refcheck
  • xoops_result
  • xoops_setActiveModules
  • xoops_setConfigOption
  • xoops_substr
  • xoops_template_clear_module_cache
  • xoops_template_touch
  • xoops_trim
  • xoops_utf8_encode
  • xoops_write_index_file
  • xoopsCodeTarea
  • xoopseditor_get_rootpath
  • XoopsErrorHandler_HandleError
  • xoopsfwrite
  • xoopsSmilies
  • xoPassField
  • xoPhpVersion
  • xoPutLicenseKey
  • xoStripeKey
  • Overview
  • Namespace
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * XOOPS Kernel Class
  4:  *
  5:  * You may not change or alter any portion of this comment or credits
  6:  * of supporting developers from this source code or any supporting source code
  7:  * which is considered copyrighted (c) material of the original comment or credit authors.
  8:  * This program is distributed in the hope that it will be useful,
  9:  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 10:  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 11:  *
 12:  * @copyright       (c) 2000-2016 XOOPS Project (www.xoops.org)
 13:  * @license             GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html)
 14:  * @package             kernel
 15:  * @since               2.0.0
 16:  */
 17: defined('XOOPS_ROOT_PATH') || exit('Restricted access');
 18: 
 19: /**
 20:  * A Module
 21:  *
 22:  * @package kernel
 23:  * @author  Kazumi Ono <onokazu@xoops.org>
 24:  */
 25: class XoopsModule extends XoopsObject
 26: {
 27:     /**
 28:      *
 29:      * @var string
 30:      */
 31:     public $modinfo;
 32:     /**
 33:      *
 34:      * @var string
 35:      */
 36:     public $adminmenu;
 37:     /**
 38:      *
 39:      * @var array
 40:      */
 41:     public $_msg;
 42: 
 43:     /**
 44:      * Constructor
 45:      */
 46:     public function __construct()
 47:     {
 48:         parent::__construct();
 49:         $this->initVar('mid', XOBJ_DTYPE_INT, null, false);
 50:         $this->initVar('name', XOBJ_DTYPE_TXTBOX, null, true, 150);
 51:         $this->initVar('version', XOBJ_DTYPE_INT, 100, false);
 52:         $this->initVar('last_update', XOBJ_DTYPE_INT, null, false);
 53:         $this->initVar('weight', XOBJ_DTYPE_INT, 0, false);
 54:         $this->initVar('isactive', XOBJ_DTYPE_INT, 1, false);
 55:         $this->initVar('dirname', XOBJ_DTYPE_OTHER, null, true);
 56:         $this->initVar('hasmain', XOBJ_DTYPE_INT, 0, false);
 57:         $this->initVar('hasadmin', XOBJ_DTYPE_INT, 0, false);
 58:         $this->initVar('hassearch', XOBJ_DTYPE_INT, 0, false);
 59:         $this->initVar('hasconfig', XOBJ_DTYPE_INT, 0, false);
 60:         $this->initVar('hascomments', XOBJ_DTYPE_INT, 0, false);
 61:         // RMV-NOTIFY
 62:         $this->initVar('hasnotification', XOBJ_DTYPE_INT, 0, false);
 63:     }
 64: 
 65:     /**
 66:      * Load module info
 67:      *
 68:      * @param string  $dirname Directory Name
 69:      * @param boolean $verbose
 70:      */
 71:     public function loadInfoAsVar($dirname, $verbose = true)
 72:     {
 73:         $dirname = basename($dirname);
 74:         if (!isset($this->modinfo)) {
 75:             $this->loadInfo($dirname, $verbose);
 76:         }
 77:         $this->setVar('name', $this->modinfo['name'], true);
 78:         $this->setVar('version', (int)(100 * ((float) $this->modinfo['version'] + 0.001)), true);
 79:         $this->setVar('dirname', $this->modinfo['dirname'], true);
 80:         $hasmain     = (isset($this->modinfo['hasMain']) && $this->modinfo['hasMain'] == 1) ? 1 : 0;
 81:         $hasadmin    = (isset($this->modinfo['hasAdmin']) && $this->modinfo['hasAdmin'] == 1) ? 1 : 0;
 82:         $hassearch   = (isset($this->modinfo['hasSearch']) && $this->modinfo['hasSearch'] == 1) ? 1 : 0;
 83:         $hasconfig   = ((isset($this->modinfo['config']) && is_array($this->modinfo['config'])) || !empty($this->modinfo['hasComments'])) ? 1 : 0;
 84:         $hascomments = (isset($this->modinfo['hasComments']) && $this->modinfo['hasComments'] == 1) ? 1 : 0;
 85:         // RMV-NOTIFY
 86:         $hasnotification = (isset($this->modinfo['hasNotification']) && $this->modinfo['hasNotification'] == 1) ? 1 : 0;
 87:         $this->setVar('hasmain', $hasmain);
 88:         $this->setVar('hasadmin', $hasadmin);
 89:         $this->setVar('hassearch', $hassearch);
 90:         $this->setVar('hasconfig', $hasconfig);
 91:         $this->setVar('hascomments', $hascomments);
 92:         // RMV-NOTIFY
 93:         $this->setVar('hasnotification', $hasnotification);
 94:     }
 95: 
 96:     /**
 97:      * add a message
 98:      *
 99:      * @param string $str message to add
100:      * @access public
101:      */
102:     public function setMessage($str)
103:     {
104:         $this->_msg[] = trim($str);
105:     }
106: 
107:     /**
108:      * return the messages for this object as an array
109:      *
110:      * @return array an array of messages
111:      * @access public
112:      */
113:     public function getMessages()
114:     {
115:         return $this->_msg;
116:     }
117: 
118:     /**
119:      * Set module info
120:      *
121:      * @param  string $name
122:      * @param  mixed  $value
123:      * @return bool
124:      **/
125:     public function setInfo($name, $value)
126:     {
127:         if (empty($name)) {
128:             $this->modinfo = $value;
129:         } else {
130:             $this->modinfo[$name] = $value;
131:         }
132: 
133:         return true;
134:     }
135: 
136:     /**
137:      * Get module info
138:      *
139:      * @param  string $name
140:      * @return array  |string    Array of module information.
141:      *                     If {@link $name} is set, returns a single module information item as string.
142:      */
143:     public function &getInfo($name = null)
144:     {
145:         if (!isset($this->modinfo)) {
146:             $this->loadInfo($this->getVar('dirname'));
147:         }
148:         if (isset($name)) {
149:             if (isset($this->modinfo[$name])) {
150:                 return $this->modinfo[$name];
151:             }
152:             $return = false;
153: 
154:             return $return;
155:         }
156: 
157:         return $this->modinfo;
158:     }
159: 
160:     /**
161:      * Get a link to the modules main page
162:      *
163:      * @return string FALSE on fail
164:      */
165:     public function mainLink()
166:     {
167:         if ($this->getVar('hasmain') == 1) {
168:             $ret = '<a href="' . XOOPS_URL . '/modules/' . $this->getVar('dirname') . '/">' . $this->getVar('name') . '</a>';
169: 
170:             return $ret;
171:         }
172: 
173:         return false;
174:     }
175: 
176:     /**
177:      * Get links to the subpages
178:      *
179:      * @return string
180:      */
181:     public function subLink()
182:     {
183:         $ret = array();
184:         if ($this->getInfo('sub') && is_array($this->getInfo('sub'))) {
185:             foreach ($this->getInfo('sub') as $submenu) {
186:                 $ret[] = array(
187:                     'name' => $submenu['name'],
188:                     'url'  => $submenu['url']);
189:             }
190:         }
191: 
192:         return $ret;
193:     }
194: 
195:     /**
196:      * Load the admin menu for the module
197:      */
198:     public function loadAdminMenu()
199:     {
200:         if ($this->getInfo('adminmenu') && $this->getInfo('adminmenu') != '' && file_exists(XOOPS_ROOT_PATH . '/modules/' . $this->getVar('dirname') . '/' . $this->getInfo('adminmenu'))) {
201:             $adminmenu = array();
202:             include XOOPS_ROOT_PATH . '/modules/' . $this->getVar('dirname') . '/' . $this->getInfo('adminmenu');
203:             $this->adminmenu =& $adminmenu;
204:         }
205:     }
206: 
207:     /**
208:      * Get the admin menu for the module
209:      *
210:      * @return string
211:      */
212:     public function &getAdminMenu()
213:     {
214:         if (!isset($this->adminmenu)) {
215:             $this->loadAdminMenu();
216:         }
217: 
218:         return $this->adminmenu;
219:     }
220: 
221:     /**
222:      * Load the module info for this module
223:      *
224:      * @param string $dirname Module directory
225:      * @param bool   $verbose Give an error on fail?
226:      *
227:      * @return bool true if loaded
228:      */
229:     public function loadInfo($dirname, $verbose = true)
230:     {
231:         static $modVersions;
232:         $dirname = basename($dirname);
233:         if (isset($modVersions[$dirname])) {
234:             $this->modinfo = $modVersions[$dirname];
235: 
236:             return true;
237:         }
238:         global $xoopsConfig;
239:         if (file_exists($file = $GLOBALS['xoops']->path('modules/' . $dirname . '/language/' . $xoopsConfig['language'] . '/modinfo.php'))) {
240:             include_once $file;
241:         } elseif (file_exists($file = $GLOBALS['xoops']->path('modules/' . $dirname . '/language/english/modinfo.php'))) {
242:             include_once $file;
243:         }
244: 
245:         if (!file_exists($file = $GLOBALS['xoops']->path('modules/' . $dirname . '/xoops_version.php'))) {
246:             if (false !== (bool)$verbose) {
247:                 echo "Module File for $dirname Not Found!";
248:             }
249: 
250:             return false;
251:         }
252:         include $file;
253:         $modVersions[$dirname] = $modversion;
254:         $this->modinfo         = $modVersions[$dirname];
255: 
256:         return true;
257:     }
258: 
259:     /**
260:      * Search contents within a module
261:      *
262:      * @param  string  $term
263:      * @param  string  $andor 'AND' or 'OR'
264:      * @param  integer $limit
265:      * @param  integer $offset
266:      * @param  integer $userid
267:      * @return mixed   Search result.
268:      */
269:     public function search($term = '', $andor = 'AND', $limit = 0, $offset = 0, $userid = 0)
270:     {
271:         if ($this->getVar('hassearch') != 1) {
272:             return false;
273:         }
274:         $search =& $this->getInfo('search');
275:         if ($this->getVar('hassearch') != 1 || !isset($search['file']) || !isset($search['func']) || $search['func'] == '' || $search['file'] == '') {
276:             return false;
277:         }
278:         if (file_exists($file = $GLOBALS['xoops']->path('modules/' . $this->getVar('dirname') . '/' . $search['file']))) {
279:             include_once $file;
280:         } else {
281:             return false;
282:         }
283:         if (function_exists($search['func'])) {
284:             $func = $search['func'];
285: 
286:             return $func($term, $andor, $limit, $offset, $userid);
287:         }
288: 
289:         return false;
290:     }
291: 
292:     /**
293:      * Returns Class Base Variable mid
294:      * @param  string $format
295:      * @return mixed
296:      */
297:     public function id($format = 'N')
298:     {
299:         return $this->getVar('mid', $format);
300:     }
301: 
302:     /**
303:      * Returns Class Base Variable mid
304:      * @param  string $format
305:      * @return mixed
306:      */
307:     public function mid($format = '')
308:     {
309:         return $this->getVar('mid', $format);
310:     }
311: 
312:     /**
313:      * Returns Class Base Variable name
314:      * @param  string $format
315:      * @return mixed
316:      */
317:     public function name($format = '')
318:     {
319:         return $this->getVar('name', $format);
320:     }
321: 
322:     /**
323:      * Returns Class Base Variable version
324:      * @param  string $format
325:      * @return mixed
326:      */
327:     public function version($format = '')
328:     {
329:         return $this->getVar('version', $format);
330:     }
331: 
332:     /**
333:      * Returns Class Base Variable last_update
334:      * @param  string $format
335:      * @return mixed
336:      */
337:     public function last_update($format = '')
338:     {
339:         return $this->getVar('last_update', $format);
340:     }
341: 
342:     /**
343:      * Returns Class Base Variable weight
344:      * @param  string $format
345:      * @return mixed
346:      */
347:     public function weight($format = '')
348:     {
349:         return $this->getVar('weight', $format);
350:     }
351: 
352:     /**
353:      * Returns Class Base Variable isactive
354:      * @param  string $format
355:      * @return mixed
356:      */
357:     public function isactive($format = '')
358:     {
359:         return $this->getVar('isactive', $format);
360:     }
361: 
362:     /**
363:      * Returns Class Base Variable dirname
364:      * @param  string $format
365:      * @return mixed
366:      */
367:     public function dirname($format = '')
368:     {
369:         return $this->getVar('dirname', $format);
370:     }
371: 
372:     /**
373:      * Returns Class Base Variable hasmain
374:      * @param  string $format
375:      * @return mixed
376:      */
377:     public function hasmain($format = '')
378:     {
379:         return $this->getVar('hasmain', $format);
380:     }
381: 
382:     /**
383:      * Returns Class Base Variable hasadmin
384:      * @param  string $format
385:      * @return mixed
386:      */
387:     public function hasadmin($format = '')
388:     {
389:         return $this->getVar('hasadmin', $format);
390:     }
391: 
392:     /**
393:      * Returns Class Base Variable hassearch
394:      * @param  string $format
395:      * @return mixed
396:      */
397:     public function hassearch($format = '')
398:     {
399:         return $this->getVar('hassearch', $format);
400:     }
401: 
402:     /**
403:      * Returns Class Base Variable hasconfig
404:      * @param  string $format
405:      * @return mixed
406:      */
407:     public function hasconfig($format = '')
408:     {
409:         return $this->getVar('hasconfig', $format);
410:     }
411: 
412:     /**
413:      * Returns Class Base Variable hascomments
414:      * @param  string $format
415:      * @return mixed
416:      */
417:     public function hascomments($format = '')
418:     {
419:         return $this->getVar('hascomments', $format);
420:     }
421: 
422:     /**
423:      * Returns Class Base Variable hasnotification
424:      * @param  string $format
425:      * @return mixed
426:      */
427:     public function hasnotification($format = '')
428:     {
429:         return $this->getVar('hasnotification', $format);
430:     }
431: 
432:     /**
433:      * @param $dirname
434:      *
435:      * @return mixed
436:      */
437:     public static function getByDirname($dirname)
438:     {
439:         /* @var $modhandler XoopsModuleHandler */
440:         $modhandler = xoops_getHandler('module');
441:         $inst       = $modhandler->getByDirname($dirname);
442: 
443:         return $inst;
444:     }
445: 
446:     ##################### Deprecated Methods ######################
447: 
448:     /**#@+
449:      * @deprecated
450:      */
451:     public function checkAccess()
452:     {
453:         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING);
454: 
455:         return false;
456:     }
457: 
458:     /**
459:      * @param string $type
460:      *
461:      * @return bool
462:      */
463:     public function loadLanguage($type = 'main')
464:     {
465:         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING);
466: 
467:         return false;
468:     }
469: 
470:     /**
471:      * @return bool
472:      */
473:     public function loadErrorMessages()
474:     {
475:         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING);
476: 
477:         return false;
478:     }
479: 
480:     /**
481:      * @return bool
482:      */
483:     public function getCurrentPage()
484:     {
485:         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING);
486: 
487:         return false;
488:     }
489: 
490:     /**
491:      * @param array $admingroups
492:      * @param array $accessgroups
493:      *
494:      * @return bool
495:      */
496:     public function install($admingroups = array(), $accessgroups = array())
497:     {
498:         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING);
499: 
500:         return false;
501:     }
502: 
503:     /**
504:      * @return bool
505:      */
506:     public function update()
507:     {
508:         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING);
509: 
510:         return false;
511:     }
512: 
513:     /**
514:      * @return bool
515:      */
516:     public function insert()
517:     {
518:         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING);
519: 
520:         return false;
521:     }
522: 
523:     /**
524:      * @return bool
525:      */
526:     public function executeSQL()
527:     {
528:         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING);
529: 
530:         return false;
531:     }
532: 
533:     /**
534:      * @return bool
535:      */
536:     public function insertTemplates()
537:     {
538:         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING);
539: 
540:         return false;
541:     }
542: 
543:     /**
544:      * @param      $template
545:      * @param bool $block
546:      *
547:      * @return bool
548:      */
549:     public function gettemplate($template, $block = false)
550:     {
551:         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING);
552: 
553:         return false;
554:     }
555: 
556:     /**
557:      * @return bool
558:      */
559:     public function insertBlocks()
560:     {
561:         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING);
562: 
563:         return false;
564:     }
565: 
566:     /**
567:      * @return bool
568:      */
569:     public function insertConfigCategories()
570:     {
571:         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING);
572: 
573:         return false;
574:     }
575: 
576:     /**
577:      * @return bool
578:      */
579:     public function insertConfig()
580:     {
581:         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING);
582: 
583:         return false;
584:     }
585: 
586:     /**
587:      * @return bool
588:      */
589:     public function insertProfileFields()
590:     {
591:         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING);
592: 
593:         return false;
594:     }
595: 
596:     /**
597:      * @param     $type
598:      * @param int $state
599:      *
600:      * @return bool
601:      */
602:     public function executeScript($type, $state = 2)
603:     {
604:         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING);
605: 
606:         return false;
607:     }
608: 
609:     /**
610:      * @param $groups
611:      * @param $type
612:      *
613:      * @return bool
614:      */
615:     public function insertGroupPermissions($groups, $type)
616:     {
617:         trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated', E_USER_WARNING);
618: 
619:         return false;
620:     }
621:     /**#@-*/
622: }
623: 
624: /**
625:  * XOOPS module handler class.
626:  *
627:  * This class is responsible for providing data access mechanisms to the data source
628:  * of XOOPS module class objects.
629:  *
630:  * @package       kernel
631:  * @author        Kazumi Ono <onokazu@xoops.org>
632:  * @copyright (c) 2000-2016 XOOPS Project - www.xoops.org
633:  *
634:  * @todo Why is this not a XoopsPersistableObjectHandler?
635:  */
636: class XoopsModuleHandler extends XoopsObjectHandler
637: {
638:     /**
639:      * holds an array of cached module references, indexed by module id
640:      *
641:      * @var array
642:      * @access private
643:      */
644:     public $_cachedModule_mid = array();
645: 
646:     /**
647:      * holds an array of cached module references, indexed by module dirname
648:      *
649:      * @var array
650:      * @access private
651:      */
652:     public $_cachedModule_dirname = array();
653: 
654:     /**
655:      * Create a new {@link XoopsModule} object
656:      *
657:      * @param  boolean $isNew Flag the new object as "new"
658:      * @return XoopsModule
659:      */
660:     public function create($isNew = true)
661:     {
662:         $module = new XoopsModule();
663:         if ($isNew) {
664:             $module->setNew();
665:         }
666: 
667:         return $module;
668:     }
669: 
670:     /**
671:      * Load a module from the database
672:      *
673:      * @param  int $id ID of the module
674:      * @return object FALSE on fail
675:      */
676:     public function get($id)
677:     {
678:         static $_cachedModule_dirname;
679:         static $_cachedModule_mid;
680:         $id     = (int)$id;
681:         $module = false;
682:         if ($id > 0) {
683:             if (!empty($_cachedModule_mid[$id])) {
684:                 return $_cachedModule_mid[$id];
685:             } else {
686:                 $sql = 'SELECT * FROM ' . $this->db->prefix('modules') . ' WHERE mid = ' . $id;
687:                 if (!$result = $this->db->query($sql)) {
688:                     return $module;
689:                 }
690:                 $numrows = $this->db->getRowsNum($result);
691:                 if ($numrows == 1) {
692:                     $module = new XoopsModule();
693:                     $myrow  = $this->db->fetchArray($result);
694:                     $module->assignVars($myrow);
695:                     $_cachedModule_mid[$id]                            = &$module;
696:                     $_cachedModule_dirname[$module->getVar('dirname')] = &$module;
697: 
698:                     return $module;
699:                 }
700:             }
701:         }
702: 
703:         return $module;
704:     }
705: 
706:     /**
707:      * Load a module by its dirname
708:      *
709:      * @param  string $dirname
710:      * @return XoopsModule|FALSE on fail
711:      */
712:     public function getByDirname($dirname)
713:     {
714:         $dirname = basename($dirname);
715:         //could not we check for spaces instead??
716:         if (strpos(strtolower($dirname), ' union ')) {
717:             return false;
718:         }
719:         static $_cachedModule_mid;
720:         static $_cachedModule_dirname;
721:         if (!empty($_cachedModule_dirname[$dirname])) {
722:             return $_cachedModule_dirname[$dirname];
723:         } else {
724:             $module = false;
725:             $sql    = 'SELECT * FROM ' . $this->db->prefix('modules') . " WHERE dirname = '" . trim($dirname) . "'";
726:             if (!$result = $this->db->query($sql)) {
727:                 return $module;
728:             }
729:             $numrows = $this->db->getRowsNum($result);
730:             if ($numrows == 1) {
731:                 $module = new XoopsModule();
732:                 $myrow  = $this->db->fetchArray($result);
733:                 $module->assignVars($myrow);
734:                 $_cachedModule_dirname[$dirname]           =& $module;
735:                 $_cachedModule_mid[$module->getVar('mid')] =& $module;
736:             }
737: 
738:             return $module;
739:         }
740:     }
741: 
742:     /**
743:      * Write a module to the database
744:      *
745:      * @param  XoopsObject|XoopsModule $module a XoopsModule object
746:      *
747:      * @return bool true on success, otherwise false
748:      */
749:     public function insert(XoopsObject $module)
750:     {
751:         $className = 'XoopsModule';
752:         if (!($module instanceof $className)) {
753:             return false;
754:         }
755:         if (!$module->isDirty()) {
756:             return true;
757:         }
758:         if (!$module->cleanVars()) {
759:             return false;
760:         }
761:         foreach ($module->cleanVars as $k => $v) {
762:             ${$k} = $v;
763:         }
764:         if ($module->isNew()) {
765:             $mid = $this->db->genId('modules_mid_seq');
766:             $sql = sprintf('INSERT INTO %s (mid, name, version, last_update, weight, isactive, dirname, hasmain, hasadmin, hassearch, hasconfig, hascomments, hasnotification) VALUES (%u, %s, %u, %u, %u, %u, %s, %u, %u, %u, %u, %u, %u)', $this->db->prefix('modules'), $mid, $this->db->quoteString($name), $version, time(), $weight, 1, $this->db->quoteString($dirname), $hasmain, $hasadmin, $hassearch, $hasconfig, $hascomments, $hasnotification);
767:         } else {
768:             $sql = sprintf('UPDATE %s SET name = %s, dirname = %s, version = %u, last_update = %u, weight = %u, isactive = %u, hasmain = %u, hasadmin = %u, hassearch = %u, hasconfig = %u, hascomments = %u, hasnotification = %u WHERE mid = %u', $this->db->prefix('modules'), $this->db->quoteString($name), $this->db->quoteString($dirname), $version, time(), $weight, $isactive, $hasmain, $hasadmin, $hassearch, $hasconfig, $hascomments, $hasnotification, $mid);
769:         }
770:         if (!$result = $this->db->query($sql)) {
771:             return false;
772:         }
773:         if (empty($mid)) {
774:             $mid = $this->db->getInsertId();
775:         }
776:         $module->assignVar('mid', $mid);
777:         if (!empty($this->_cachedModule_dirname[$dirname])) {
778:             unset($this->_cachedModule_dirname[$dirname]);
779:         }
780:         if (!empty($this->_cachedModule_mid[$mid])) {
781:             unset($this->_cachedModule_mid[$mid]);
782:         }
783: 
784:         return true;
785:     }
786: 
787:     /**
788:      * Delete a module from the database
789:      *
790:      * @param  XoopsObject|XoopsModule $module a XoopsModule object
791:      *
792:      * @return bool true on success, otherwise false
793:      */
794:     public function delete(XoopsObject $module)
795:     {
796:         $className = 'XoopsModule';
797:         if (!($module instanceof $className)) {
798:             return false;
799:         }
800:         $sql = sprintf('DELETE FROM %s WHERE mid = %u', $this->db->prefix('modules'), $module->getVar('mid'));
801:         if (!$result = $this->db->query($sql)) {
802:             return false;
803:         }
804:         // delete admin permissions assigned for this module
805:         $sql = sprintf("DELETE FROM %s WHERE gperm_name = 'module_admin' AND gperm_itemid = %u", $this->db->prefix('group_permission'), $module->getVar('mid'));
806:         $this->db->query($sql);
807:         // delete read permissions assigned for this module
808:         $sql = sprintf("DELETE FROM %s WHERE gperm_name = 'module_read' AND gperm_itemid = %u", $this->db->prefix('group_permission'), $module->getVar('mid'));
809:         $this->db->query($sql);
810: 
811:         $sql = sprintf('SELECT block_id FROM %s WHERE module_id = %u', $this->db->prefix('block_module_link'), $module->getVar('mid'));
812:         if ($result = $this->db->query($sql)) {
813:             $block_id_arr = array();
814:             while ($myrow = $this->db->fetchArray($result)) {
815:                 $block_id_arr[] = $myrow['block_id'];
816:             }
817:         }
818:         // loop through block_id_arr
819:         if (isset($block_id_arr)) {
820:             foreach ($block_id_arr as $i) {
821:                 $sql = sprintf('SELECT block_id FROM %s WHERE module_id != %u AND block_id = %u', $this->db->prefix('block_module_link'), $module->getVar('mid'), $i);
822:                 if ($result2 = $this->db->query($sql)) {
823:                     if (0 < $this->db->getRowsNum($result2)) {
824:                         // this block has other entries, so delete the entry for this module
825:                         $sql = sprintf('DELETE FROM %s WHERE (module_id = %u) AND (block_id = %u)', $this->db->prefix('block_module_link'), $module->getVar('mid'), $i);
826:                         $this->db->query($sql);
827:                     } else {
828:                         // this block doesnt have other entries, so disable the block and let it show on top page only. otherwise, this block will not display anymore on block admin page!
829:                         $sql = sprintf('UPDATE %s SET visible = 0 WHERE bid = %u', $this->db->prefix('newblocks'), $i);
830:                         $this->db->query($sql);
831:                         $sql = sprintf('UPDATE %s SET module_id = -1 WHERE module_id = %u', $this->db->prefix('block_module_link'), $module->getVar('mid'));
832:                         $this->db->query($sql);
833:                     }
834:                 }
835:             }
836:         }
837: 
838:         if (!empty($this->_cachedModule_dirname[$module->getVar('dirname')])) {
839:             unset($this->_cachedModule_dirname[$module->getVar('dirname')]);
840:         }
841:         if (!empty($this->_cachedModule_mid[$module->getVar('mid')])) {
842:             unset($this->_cachedModule_mid[$module->getVar('mid')]);
843:         }
844: 
845:         return true;
846:     }
847: 
848:     /**
849:      * Load some modules
850:      *
851:      * @param  CriteriaElement|CriteriaCompo $criteria  {@link CriteriaElement}
852:      * @param  boolean         $id_as_key Use the ID as key into the array
853:      * @return array
854:      */
855:     public function getObjects(CriteriaElement $criteria = null, $id_as_key = false)
856:     {
857:         $ret   = array();
858:         $limit = $start = 0;
859:         $sql   = 'SELECT * FROM ' . $this->db->prefix('modules');
860:         if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
861:             $sql .= ' ' . $criteria->renderWhere();
862:             $sql .= ' ORDER BY weight ' . $criteria->getOrder() . ', mid ASC';
863:             $limit = $criteria->getLimit();
864:             $start = $criteria->getStart();
865:         }
866:         $result = $this->db->query($sql, $limit, $start);
867:         if (!$result) {
868:             return $ret;
869:         }
870:         while ($myrow = $this->db->fetchArray($result)) {
871:             $module = new XoopsModule();
872:             $module->assignVars($myrow);
873:             if (!$id_as_key) {
874:                 $ret[] =& $module;
875:             } else {
876:                 $ret[$myrow['mid']] =& $module;
877:             }
878:             unset($module);
879:         }
880: 
881:         return $ret;
882:     }
883: 
884:     /**
885:      * Count some modules
886:      *
887:      * @param  CriteriaElement|CriteriaCompo $criteria {@link CriteriaElement}
888:      * @return int
889:      */
890:     public function getCount(CriteriaElement $criteria = null)
891:     {
892:         $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('modules');
893:         if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
894:             $sql .= ' ' . $criteria->renderWhere();
895:         }
896:         if (!$result = $this->db->query($sql)) {
897:             return 0;
898:         }
899:         list($count) = $this->db->fetchRow($result);
900: 
901:         return $count;
902:     }
903: 
904:     /**
905:      * returns an array of module names
906:      *
907:      * @param  CriteriaElement $criteria
908:      * @param  boolean         $dirname_as_key if true, array keys will be module directory names
909:      *                                         if false, array keys will be module id
910:      * @return array
911:      */
912:     public function getList(CriteriaElement $criteria = null, $dirname_as_key = false)
913:     {
914:         $ret     = array();
915:         $modules = $this->getObjects($criteria, true);
916:         foreach (array_keys($modules) as $i) {
917:             if (!$dirname_as_key) {
918:                 $ret[$i] = $modules[$i]->getVar('name');
919:             } else {
920:                 $ret[$modules[$i]->getVar('dirname')] = $modules[$i]->getVar('name');
921:             }
922:         }
923: 
924:         return $ret;
925:     }
926: }
927: 
API documentation generated by ApiGen