本文整理汇总了PHP中XoopsModule::getVar方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsModule::getVar方法的具体用法?PHP XoopsModule::getVar怎么用?PHP XoopsModule::getVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsModule
的用法示例。
在下文中一共展示了XoopsModule::getVar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xoops_module_install_publisher
/**
* @param $xoopsModule
*
* @return bool|string
*/
function xoops_module_install_publisher(XoopsModule $xoopsModule)
{
include_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php';
xoops_loadLanguage('admin', $xoopsModule->getVar('dirname'));
xoops_loadLanguage('modinfo', $xoopsModule->getVar('dirname'));
$moduleDirName = $xoopsModule->getVar('dirname');
include_once $GLOBALS['xoops']->path('modules/' . $moduleDirName . '/include/config.php');
foreach (array_keys($uploadFolders) as $i) {
PublisherUtilities::createFolder($uploadFolders[$i]);
}
$file = PUBLISHER_ROOT_PATH . '/assets/images/blank.png';
foreach (array_keys($copyFiles) as $i) {
$dest = $copyFiles[$i] . '/blank.png';
PublisherUtilities::copyFile($file, $dest);
}
return true;
/*
include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/functions.php');
$ret = true;
$msg = '';
// Create content directory
$dir = $GLOBALS['xoops']->path('uploads/' . $xoopsModule->getVar('dirname') . '/content');
if (!publisherMkdir($dir)) {
$msg .= sprintf(_AM_PUBLISHER_DIRNOTCREATED, $dir);
}
if (empty($msg)) {
return $ret;
} else {
return $msg;
}
*/
}
示例2:
function _checkAdmin()
{
if ($this->isadmin) {
return true;
}
if (!is_object($this->user)) {
return false;
}
if (!$this->user->isAdmin($this->module->getVar('mid'))) {
return false;
}
$this->isadmin = true;
return true;
}
示例3: xoops_module_install_profile
/**
* Extended User Profile
*
* You may not change or alter any portion of this comment or credits
* of supporting developers from this source code or any supporting source code
* which is considered copyrighted (c) material of the original comment or credit authors.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* @copyright (c) 2000-2016 XOOPS Project (www.xoops.org)
* @license GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html)
* @package profile
* @since 2.3.0
* @author Jan Pedersen
* @author Taiwen Jiang <phppp@users.sourceforge.net>
* @param $module
* @return bool
*/
function xoops_module_install_profile(XoopsModule $module)
{
global $module_id;
$module_id = $module->getVar('mid');
xoops_loadLanguage('user');
// Create registration steps
profile_install_addStep(_PROFILE_MI_STEP_BASIC, '', 1, 0);
profile_install_addStep(_PROFILE_MI_STEP_COMPLEMENTARY, '', 2, 1);
// Create categories
profile_install_addCategory(_PROFILE_MI_CATEGORY_PERSONAL, 1);
profile_install_addCategory(_PROFILE_MI_CATEGORY_MESSAGING, 2);
profile_install_addCategory(_PROFILE_MI_CATEGORY_SETTINGS, 3);
profile_install_addCategory(_PROFILE_MI_CATEGORY_COMMUNITY, 4);
// Add user fields
xoops_loadLanguage('notification');
xoops_loadLanguage('main', $module->getVar('dirname', 'n'));
include_once $GLOBALS['xoops']->path('include/notification_constants.php');
$umode_options = array('nest' => _NESTED, 'flat' => _FLAT, 'thread' => _THREADED);
$uorder_options = array(0 => _OLDESTFIRST, 1 => _NEWESTFIRST);
$notify_mode_options = array(XOOPS_NOTIFICATION_MODE_SENDALWAYS => _NOT_MODE_SENDALWAYS, XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE => _NOT_MODE_SENDONCE, XOOPS_NOTIFICATION_MODE_SENDONCETHENWAIT => _NOT_MODE_SENDONCEPERLOGIN);
$notify_method_options = array(XOOPS_NOTIFICATION_METHOD_DISABLE => _NOT_METHOD_DISABLE, XOOPS_NOTIFICATION_METHOD_PM => _NOT_METHOD_PM, XOOPS_NOTIFICATION_METHOD_EMAIL => _NOT_METHOD_EMAIL);
profile_install_addField('name', _US_REALNAME, '', 1, 'textbox', 1, 1, 1, array(), 2, 255);
profile_install_addField('user_from', _US_LOCATION, '', 1, 'textbox', 1, 2, 1, array(), 2, 255);
profile_install_addField('timezone_offset', _US_TIMEZONE, '', 1, 'timezone', 1, 3, 1, array(), 2, 0);
profile_install_addField('user_occ', _US_OCCUPATION, '', 1, 'textbox', 1, 4, 1, array(), 2, 255);
profile_install_addField('user_intrest', _US_INTEREST, '', 1, 'textbox', 1, 5, 1, array(), 2, 255);
profile_install_addField('bio', _US_EXTRAINFO, '', 1, 'textarea', 2, 6, 1, array(), 2, 0);
profile_install_addField('user_regdate', _US_MEMBERSINCE, '', 1, 'datetime', 3, 7, 0, array(), 0, 10);
profile_install_addField('user_icq', _US_ICQ, '', 2, 'textbox', 1, 1, 1, array(), 2, 255);
profile_install_addField('user_aim', _US_AIM, '', 2, 'textbox', 1, 2, 1, array(), 2, 255);
profile_install_addField('user_yim', _US_YIM, '', 2, 'textbox', 1, 3, 1, array(), 2, 255);
profile_install_addField('user_msnm', _US_MSNM, '', 2, 'textbox', 1, 4, 1, array(), 2, 255);
profile_install_addField('user_viewemail', _US_ALLOWVIEWEMAIL, '', 3, 'yesno', 3, 1, 1, array(), 2, 1, false);
profile_install_addField('attachsig', _US_SHOWSIG, '', 3, 'yesno', 3, 2, 1, array(), 0, 1, false);
profile_install_addField('user_mailok', _US_MAILOK, '', 3, 'yesno', 3, 3, 1, array(), 2, 1, false);
profile_install_addField('theme', _PROFILE_MA_THEME, '', 3, 'theme', 1, 4, 1, array(), 0, 0, false);
profile_install_addField('umode', _US_CDISPLAYMODE, '', 3, 'select', 1, 5, 1, $umode_options, 0, 0, false);
profile_install_addField('uorder', _US_CSORTORDER, '', 3, 'select', 3, 6, 1, $uorder_options, 0, 0, false);
profile_install_addField('notify_mode', _NOT_NOTIFYMODE, '', 3, 'select', 3, 7, 1, $notify_mode_options, 0, 0, false);
profile_install_addField('notify_method', _NOT_NOTIFYMETHOD, '', 3, 'select', 3, 8, 1, $notify_method_options, 0, 0, false);
profile_install_addField('url', _PROFILE_MI_URL_TITLE, '', 4, 'textbox', 1, 1, 1, array(), 2, 255);
profile_install_addField('posts', _US_POSTS, '', 4, 'textbox', 3, 2, 0, array(), 0, 255);
profile_install_addField('rank', _US_RANK, '', 4, 'rank', 3, 3, 2, array(), 0, 0);
profile_install_addField('last_login', _US_LASTLOGIN, '', 4, 'datetime', 3, 4, 0, array(), 0, 10);
profile_install_addField('user_sig', _US_SIGNATURE, '', 4, 'textarea', 1, 5, 1, array(), 0, 0);
profile_install_initializeProfiles();
return true;
}
示例4: xoops_module_update_search
/**
* XXX
*
* @copyright XOOPS Project (http://xoops.org)
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @since 2.6.0
* @author Mage Grégory (AKA Mage)
* @version $Id: $
*/
function xoops_module_update_search(XoopsModule &$module)
{
$xoops = Xoops::getInstance();
// Copy old configs in new configs and delete old configs
$config_handler = $xoops->getHandlerConfig();
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('conf_modid', 0));
$criteria->add(new Criteria('conf_catid', 5));
$configs = $config_handler->getConfigs($criteria);
$confcount = count($configs);
if ($confcount > 0) {
for ($i = 0; $i < $confcount; ++$i) {
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('conf_modid', $module->getVar('mid')));
$criteria->add(new Criteria('conf_name', $configs[$i]->getvar('conf_name')));
$new_configs = $config_handler->getConfigs($criteria);
$new_confcount = count($new_configs);
if ($new_confcount > 0) {
for ($j = 0; $j < $new_confcount; ++$j) {
$obj = $config_handler->getConfig($new_configs[$j]->getvar('conf_id'));
}
$obj->setVar("conf_value", $configs[$i]->getvar('conf_value'));
$config_handler->insertConfig($obj);
$config_handler->deleteConfig($configs[$i]);
}
}
}
return true;
}
示例5: xoops_module_install_profile
/**
* @param XoopsModule $module
* @return bool
*/
function xoops_module_install_profile($module)
{
$xoops = Xoops::getInstance();
$xoops->registry()->set('profile_id', $module->getVar('mid'));
// Create registration steps
profile_install_addStep(_PROFILE_MI_STEP_BASIC, '', 1, 0);
profile_install_addStep(_PROFILE_MI_STEP_COMPLEMENTARY, '', 2, 1);
// Create categories
profile_install_addCategory(_PROFILE_MI_CATEGORY_PERSONAL, 1);
profile_install_addCategory(_PROFILE_MI_CATEGORY_MESSAGING, 2);
profile_install_addCategory(_PROFILE_MI_CATEGORY_SETTINGS, 3);
profile_install_addCategory(_PROFILE_MI_CATEGORY_COMMUNITY, 4);
profile_install_addField('name', XoopsLocale::REAL_NAME, '', 1, 'textbox', 1, 1, 1, array(), 2, 255);
profile_install_addField('user_from', XoopsLocale::LOCATION, '', 1, 'textbox', 1, 2, 1, array(), 2, 255);
profile_install_addField('timezone', XoopsLocale::TIME_ZONE, '', 1, 'timezone', 1, 3, 1, array(), 2, 0);
profile_install_addField('user_occ', XoopsLocale::OCCUPATION, '', 1, 'textbox', 1, 4, 1, array(), 2, 255);
profile_install_addField('user_intrest', XoopsLocale::INTEREST, '', 1, 'textbox', 1, 5, 1, array(), 2, 255);
profile_install_addField('bio', XoopsLocale::EXTRA_INFO, '', 1, 'textarea', 2, 6, 1, array(), 2, 0);
profile_install_addField('user_regdate', XoopsLocale::MEMBER_SINCE, '', 1, 'datetime', 3, 7, 0, array(), 0, 10);
profile_install_addField('user_icq', XoopsLocale::ICQ, '', 2, 'textbox', 1, 1, 1, array(), 2, 255);
profile_install_addField('user_aim', XoopsLocale::AIM, '', 2, 'textbox', 1, 2, 1, array(), 2, 255);
profile_install_addField('user_yim', XoopsLocale::YIM, '', 2, 'textbox', 1, 3, 1, array(), 2, 255);
profile_install_addField('user_msnm', XoopsLocale::MSNM, '', 2, 'textbox', 1, 4, 1, array(), 2, 255);
profile_install_addField('user_viewemail', XoopsLocale::ALLOW_OTHER_USERS_TO_VIEW_EMAIL, '', 3, 'yesno', 3, 1, 1, array(), 2, 1, false);
profile_install_addField('attachsig', XoopsLocale::ALWAYS_ATTACH_MY_SIGNATURE, '', 3, 'yesno', 3, 2, 1, array(), 0, 1, false);
profile_install_addField('user_mailok', XoopsLocale::Q_RECEIVE_OCCASIONAL_EMAIL_NOTICES_FROM_ADMINISTRATORS, '', 3, 'yesno', 3, 3, 1, array(), 2, 1, false);
profile_install_addField('theme', _PROFILE_MA_THEME, '', 3, 'theme', 1, 4, 1, array(), 0, 0, false);
profile_install_addField('url', _PROFILE_MI_URL_TITLE, '', 4, 'textbox', 1, 1, 1, array(), 2, 255);
profile_install_addField('posts', XoopsLocale::POSTS, '', 4, 'textbox', 3, 2, 0, array(), 0, 255);
profile_install_addField('rank', XoopsLocale::RANK, '', 4, 'rank', 3, 3, 2, array(), 0, 0);
profile_install_addField('last_login', XoopsLocale::LAST_LOGIN, '', 4, 'datetime', 3, 4, 0, array(), 0, 10);
profile_install_addField('user_sig', XoopsLocale::SIGNATURE, '', 4, 'textarea', 1, 5, 1, array(), 0, 0);
profile_install_initializeProfiles();
return true;
}
示例6:
/**
* Create a permission object which has been initialized for admin.
* For flexibility, creation only and not save it.
* @access private
* @param $group
*/
function &_createPermission($group)
{
$gpermHandler =& xoops_gethandler('groupperm');
$perm =& $gpermHandler->create();
$perm->setVar('gperm_groupid', $group);
$perm->setVar('gperm_itemid', $this->_mXoopsModule->getVar('mid'));
$perm->setVar('gperm_modid', 1);
return $perm;
}
示例7: xoops_module_update_pm
/**
* @param $module
* @param null $oldversion
* @return bool
*/
function xoops_module_update_pm(XoopsModule $module, $oldversion = null)
{
global $xoopsDB;
if ($oldversion <= 100) {
// Check pm table version
$sql = 'SHOW COLUMNS FROM ' . $xoopsDB->prefix('priv_msgs');
if (!($result = $xoopsDB->queryF($sql))) {
return false;
}
// Migrate from existent pm module
if (($rows = $xoopsDB->getRowsNum($result)) == 12) {
return true;
} elseif ($rows == 8) {
return $xoopsDB->queryFromFile(XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'n') . '/sql/mysql.upgrade.sql');
} else {
return false;
}
}
if ($oldversion < 110) {
// remove old html template files
$templateDirectory = XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'n') . '/templates/';
$template_list = array_diff(scandir($templateDirectory), array('..', '.'));
foreach ($template_list as $k => $v) {
$fileinfo = new SplFileInfo($templateDirectory . $v);
if ($fileinfo->getExtension() === 'html' && $fileinfo->getFilename() !== 'index.html') {
@unlink($templateDirectory . $v);
}
}
xoops_load('xoopsfile');
//remove /images directory
$imagesDirectory = XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'n') . '/images/';
$folderHandler = XoopsFile::getHandler('folder', $imagesDirectory);
$folderHandler->delete($imagesDirectory);
//delete .html entries from the tpl table
$sql = 'DELETE FROM ' . $xoopsDB->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'";
$xoopsDB->queryF($sql);
}
return true;
}
示例8: xoops_module_update_system
/**
* xoops_module_update_system
*
* @param XoopsModule &$module
*
* @return bool
*/
function xoops_module_update_system(XoopsModule &$module)
{
$xoops = Xoops::getInstance();
if ($module->getVar('version') == 100) {
$qb = $xoops->db()->createXoopsQueryBuilder();
$eb = $qb->expr();
$sql = $qb->select('t1.tpl_id')->fromPrefix('tplfile', 't1')->fromPrefix('tplfile', 't2')->where($eb->eq('t1.tpl_module', 't2.tpl_module '))->andWhere($eb->eq('t1.tpl_tplset', 't2.tpl_tplset'))->andWhere($eb->eq('t1.tpl_file', 't2.tpl_file'))->andWhere($eb->eq('t1.tpl_id', 't2.tpl_id'));
$result = $sql->execute();
$tplids = array();
while (list($tplid) = $result->fetch(PDO::FETCH_NUM)) {
$tplids[] = $tplid;
}
if (count($tplids) > 0) {
$tplfile_handler = $xoops->getHandlerTplfile();
$duplicate_files = $tplfile_handler->getTplObjects(new Criteria('tpl_id', "(" . implode(',', $tplids) . ")", "IN"));
if (count($duplicate_files) > 0) {
foreach (array_keys($duplicate_files) as $i) {
$tplfile_handler->deleteTpl($duplicate_files[$i]);
}
}
}
}
// Copy old configs in new configs and delete old configs
// Not for conf_catid =5 (Update in search extension)
// Not for conf_catid =6 (Update in mail user extension)
$config_handler = $xoops->getHandlerConfig();
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('conf_modid', 0));
$criteria->add(new Criteria('conf_catid', 5, '!='));
$criteria->add(new Criteria('conf_catid', 6, '!='));
$configs = $config_handler->getConfigs($criteria);
$confcount = count($configs);
if ($confcount > 0) {
for ($i = 0; $i < $confcount; ++$i) {
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('conf_modid', 1));
$criteria->add(new Criteria('conf_name', $configs[$i]->getvar('conf_name')));
$new_configs = $config_handler->getConfigs($criteria);
$new_confcount = count($new_configs);
if ($new_confcount > 0) {
for ($j = 0; $j < $new_confcount; ++$j) {
$obj = $config_handler->getConfig($new_configs[$j]->getvar('conf_id'));
}
$obj->setVar("conf_value", $configs[$i]->getvar('conf_value'));
$config_handler->insertConfig($obj);
$config_handler->deleteConfig($configs[$i]);
}
}
}
return true;
}
示例9: get_modules_list
function get_modules_list()
{
$db = XoopsDatabaseFactory::getDatabaseConnection();
$sql = 'SELECT * FROM ' . $db->prefix('modules') . " ORDER BY mid, weight";
$result = $db->query($sql);
$installed_mods = array();
while ($row = $db->fetchArray($result)) {
$mod = new XoopsModule();
$mod->assignVars($row);
$module_icon = $mod->getInfo('icon48') != '' ? XOOPS_URL . '/modules/' . $mod->getVar('dirname') . '/' . $mod->getInfo('icon48') : '';
$module_logo = XOOPS_URL . '/modules/' . $mod->getVar('dirname') . '/' . $mod->getInfo('image');
if ($mod->hasconfig()) {
$config_link = $mod->getInfo('rmnative') ? XOOPS_URL . '/modules/rmcommon/settings.php?action=configure&mod=' . $mod->mid() : XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $mod->mid();
}
$this_module = array('name' => $mod->getVar('name'), 'dirname' => $mod->getVar('dirname'), 'real_name' => $mod->getInfo('name'), 'version' => is_array($mod->getInfo('rmversion')) ? RMModules::format_module_version($mod->getInfo('rmversion')) : $mod->getVar('version') / 100, 'icon' => $module_icon, 'logo' => $module_logo, 'admin' => $mod->getVar('hasadmin') ? XOOPS_URL . '/modules/' . $mod->getVar('dirname') . '/' . $mod->getInfo('adminindex') : '', 'main' => RMUris::anchor($mod->getVar('dirname')), 'updated' => RMTimeFormatter::get()->format($mod->getVar('last_update'), __('%d% %T% %Y%', 'rmcommon')), 'config' => isset($config_link) ? $config_link : '', 'description' => $mod->getInfo('description'));
$installed_mods[] = (object) $this_module;
}
return $installed_mods;
}
示例10: renderAbout
/**
* Render about page
*
* @param bool $logo_xoops show logo
*
* @return bool|mixed|string
*/
public function renderAbout($logo_xoops = true)
{
$xoops = \Xoops::getInstance();
$date = explode('/', $this->module->getInfo('release_date'));
$author = explode(',', $this->module->getInfo('author'));
$nickname = explode(',', $this->module->getInfo('nickname'));
$release_date = \XoopsLocale::formatTimestamp(mktime(0, 0, 0, $date[1], $date[2], $date[0]), 's');
$author_list = '';
foreach (array_keys($author) as $i) {
$author_list .= $author[$i];
if (isset($nickname[$i]) && $nickname[$i] != '') {
$author_list .= " (" . $nickname[$i] . "), ";
} else {
$author_list .= ", ";
}
}
$changelog = '';
$language = $xoops->getConfig('locale');
if (!is_file(\XoopsBaseConfig::get('root-path') . "/modules/" . $this->module->getVar("dirname") . "/locale/" . $language . "/changelog.txt")) {
$language = 'en_US';
}
$file = \XoopsBaseConfig::get('root-path') . "/modules/" . $this->module->getVar("dirname") . "/locale/" . $language . "/changelog.txt";
if (is_readable($file)) {
$changelog = utf8_encode(implode("<br />", file($file))) . "\n";
} else {
$file = \XoopsBaseConfig::get('root-path') . "/modules/" . $this->module->getVar("dirname") . "/docs/changelog.txt";
if (is_readable($file)) {
$changelog = utf8_encode(implode("<br />", file($file))) . "\n";
}
}
$author_list = substr($author_list, 0, -2);
$this->module->setInfo('release_date', $release_date);
$this->module->setInfo('author_list', $author_list);
if (is_array($this->module->getInfo('paypal'))) {
$this->module->setInfo('paypal', $this->module->getInfo('paypal'));
}
$this->module->setInfo('changelog', $changelog);
$xoops->tpl()->assign('module', $this->module);
$this->addInfoBox(\XoopsLocale::MODULE_INFORMATION, 'info', 'id="xo-about"');
$this->addInfoBoxLine(\XoopsLocale::C_DESCRIPTION . ' ' . $this->module->getInfo("description"), 'info');
$this->addInfoBoxLine(\XoopsLocale::C_UPDATE_DATE . ' <span class="bold">' . \XoopsLocale::formatTimestamp($this->module->getVar("last_update"), "m") . '</span>', 'info');
$this->addInfoBoxLine(\XoopsLocale::C_WEBSITE . ' <a class="xo-tooltip" href="http://' . $this->module->getInfo("module_website_url") . '" rel="external" title="' . $this->module->getInfo("module_website_name") . ' - ' . $this->module->getInfo("module_website_url") . '">' . $this->module->getInfo("module_website_name") . '</a>', 'info');
$xoops->tpl()->assign('xoops_logo', $logo_xoops);
$xoops->tpl()->assign('xo_admin_box', $this->itemInfoBox);
return $xoops->tpl()->fetch($this->getTplPath('about'));
}
示例11: xoops_module_install_pm
/**
* Private Message
*
* You may not change or alter any portion of this comment or credits
* of supporting developers from this source code or any supporting source code
* which is considered copyrighted (c) material of the original comment or credit authors.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* @copyright (c) 2000-2016 XOOPS Project (www.xoops.org)
* @license GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html)
* @package pm
* @since 2.3.0
* @author Taiwen Jiang <phppp@users.sourceforge.net>
* @param $module
* @return bool
*/
function xoops_module_install_pm(XoopsModule $module)
{
global $xoopsDB;
// Check pm table version
$sql = 'SHOW COLUMNS FROM ' . $xoopsDB->prefix('priv_msgs');
if (!($result = $xoopsDB->queryF($sql))) {
return false;
}
// Migrate from existent pm module
if (($rows = $xoopsDB->getRowsNum($result)) == 12) {
return true;
} elseif ($rows == 8) {
return $xoopsDB->queryFromFile(XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'n') . '/sql/mysql.upgrade.sql');
} else {
return false;
}
}
示例12: xoops_module_install_pm
/**
* @param XoopsModule $module
* @return bool|void
* @todo this should be removed, it is now handled by schema
*/
function xoops_module_install_pm($module)
{
$xoops = Xoops::getInstance();
$xoops->db();
global $xoopsDB;
// Check pm table version
$sql = "SHOW COLUMNS FROM " . $xoopsDB->prefix("system_privatemessage");
if (!($result = $xoopsDB->queryF($sql))) {
return false;
}
// Migrate from existent pm module
if (($rows = $xoopsDB->getRowsNum($result)) == 12) {
return true;
} elseif ($rows == 8) {
return $xoopsDB->queryFromFile(\XoopsBaseConfig::get('root-path') . "/modules/" . $module->getVar('dirname', 'n') . "/sql/mysql.upgrade.sql");
} else {
return false;
}
}
示例13: xoops_module_update_pm
/**
* @param XoopsModule $module
* @param string|null $oldversion
* @return bool|void
*/
function xoops_module_update_pm(&$module, $oldversion = null)
{
$xoops = Xoops::getInstance();
if ($oldversion <= 100) {
// Check pm table version
$sql = "SHOW COLUMNS FROM " . $xoopsDB->prefix("priv_msgs");
if (!($result = $xoopsDB->queryF($sql))) {
return false;
}
// Migrate from existent pm module
if (($rows = $xoopsDB->getRowsNum($result)) == 12) {
return true;
} elseif ($rows == 8) {
return $xoopsDB->queryFromFile(\XoopsBaseConfig::get('root-path') . "/modules/" . $module->getVar('dirname', 'n') . "/sql/mysql.upgrade.sql");
} else {
return false;
}
}
return true;
}
示例14: getModulesForm
/**
* @param XoopsModule|null $mod
*/
public function getModulesForm($mod = null)
{
$xoops = Xoops::getInstance();
$mid = 0;
if ($mod instanceof XoopsModule) {
$mid = $mod->getVar('mid');
}
/* @var $plugin UserconfigsPluginInterface */
if ($plugins = \Xoops\Module\Plugin::getPlugins('userconfigs')) {
parent::__construct('', 'pref_form', 'index.php', 'post', true, 'inline');
$ele = new Xoops\Form\Select(_MD_USERCONFIGS_CHOOSE_MODULE, 'mid', $mid);
foreach (array_keys($plugins) as $dirname) {
$mHelper = $xoops->getModuleHelper($dirname);
$ele->addOption($mHelper->getModule()->getVar('mid'), $mHelper->getModule()->getVar('name'));
}
$this->addElement($ele);
$this->addElement(new Xoops\Form\Hidden('op', 'showmod'));
$this->addElement(new Xoops\Form\Button('', 'button', XoopsLocale::A_SUBMIT, 'submit'));
}
}
示例15: addNavigation
/**
* @param string $menu
*
* @return string
*/
public function addNavigation($menu = '')
{
$ret = '';
$navigation = '';
$path = XOOPS_URL . '/modules/' . $this->_obj->getVar('dirname') . '/';
$this->_obj->loadAdminMenu();
foreach (array_keys($this->_obj->adminmenu) as $i) {
if ($this->_obj->adminmenu[$i]['link'] == 'admin/' . $menu) {
$navigation .= $this->_obj->adminmenu[$i]['title'] . ' | ';
$ret = "<div class=\"CPbigTitle\" style=\"background-image: url(" . $path . $this->_obj->adminmenu[$i]['icon'] . "); background-repeat: no-repeat; background-position: left; padding-left: 50px;\">\n <strong>" . $this->_obj->adminmenu[$i]['title'] . '</strong></div><br>';
} else {
$navigation .= "<a href = '../" . $this->_obj->adminmenu[$i]['link'] . "'>" . $this->_obj->adminmenu[$i]['title'] . '</a> | ';
}
}
if (substr(XOOPS_VERSION, 0, 9) < 'XOOPS 2.5') {
$navigation .= "<a href = '../../system/admin.php?fct=preferences&op=showmod&mod=" . $this->_obj->getVar('mid') . "'>" . _MI_SYSTEM_ADMENU6 . '</a>';
$ret = $navigation . '<br><br>' . $ret;
}
return $ret;
}