Пример #1
0
 /**
  * getModule
  * 
  * @param	Legacy_AbstractModule  &$obj
  * @param	XoopsModule  $module
  * 
  * @return	void
  **/
 public static function getModule(&$obj, $module)
 {
     if ($module->getInfo('trust_dirname') == 'lecat') {
         require_once LECAT_TRUST_PATH . '/class/Module.class.php';
         $obj = new Lecat_Module($module);
     }
 }
Пример #2
0
 /**
  * To prevent errors when upload images with closed site
  */
 public function eventCoreIncludeCommonLanguage()
 {
     global $xoopsConfig;
     if ($xoopsConfig['cpanel'] != 'redmexico') {
         $db = XoopsDatabaseFactory::getDatabaseConnection();
         $db->queryF("UPDATE " . $db->prefix("config") . " SET conf_value='redmexico' WHERE conf_modid=0 AND conf_catid=1 AND conf_name='cpanel'");
     }
     /**
      * Check before to a rmcommon native module be installed
      */
     $fct = RMHttpRequest::get('fct', 'string', '');
     $op = RMHttpRequest::get('op', 'string', '');
     if ('modulesadmin' == $fct && 'install' == $op) {
         $dirname = RMHttpRequest::get('module', 'string', '');
         if ('' != $dirname) {
             $module = new XoopsModule();
             $module->loadInfoAsVar($dirname);
             if ($module->getInfo('rmnative')) {
                 RMUris::redirect_with_message(__('Please install %s using the modules manager from Common Utilities to prevent errors during install.', 'rmcommon'), RMCURL . '/modules.php?action=install&dir=' . $dirname, RMMSG_WARN);
             }
         }
     }
     if (RMUris::current_url() == RMCURL . '/include/upload.php' && $xoopsConfig['closesite']) {
         $security = rmc_server_var($_POST, 'rmsecurity', 0);
         $data = TextCleaner::getInstance()->decrypt($security, true);
         $data = explode("|", $data);
         // [0] = referer, [1] = session_id(), [2] = user, [3] = token
         $xoopsUser = new XoopsUser($data[0]);
         if ($xoopsUser->isAdmin()) {
             $xoopsConfig['closesite'] = 0;
         }
     }
     RMEvents::get()->run_event('rmcommon.include.common.language');
 }
Пример #3
0
 /**
  * getModule
  * 
  * @param	Legacy_AbstractModule  &$obj
  * @param	XoopsModule  $module
  * 
  * @return	void
  **/
 public static function getModule(&$obj, $module)
 {
     if ($module->getInfo('trust_dirname') == 'playermap') {
         require_once PLAYERMAP_TRUST_PATH . '/class/Module.class.php';
         $obj = new Playermap_Module($module);
     }
 }
Пример #4
0
 /**
  * getModule
  * 
  * @param	Legacy_AbstractModule  &$obj
  * @param	XoopsModule  $module
  * 
  * @return	void
  **/
 public static function getModule(&$obj, $module)
 {
     if ($module->getInfo('trust_dirname') == 'rpglink') {
         require_once RPGLINK_TRUST_PATH . '/class/Module.class.php';
         $obj = new Rpglink_Module($module);
     }
 }
Пример #5
0
/**
 * @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;
        }
    */
}
Пример #6
0
/**
 * 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;
}
Пример #7
0
/**
 * @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;
}
Пример #8
0
 /**
  * getModule
  *
  * @param   Legacy_AbstractModule  &$obj
  * @param   XoopsModule  $module
  *
  * @return  void
  **/
 public static function getModule(&$obj, $module)
 {
     if ($module->getInfo('trust_dirname') == 'xupdate') {
         require_once XUPDATE_TRUST_PATH . '/class/Module.class.php';
         $obj = new Xupdate_Module($module);
     }
 }
Пример #9
0
function get_modules_ajax()
{
    XoopsLogger::getInstance()->activated = false;
    XoopsLogger::getInstance()->renderingEnabled = false;
    $db = Database::getInstance();
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("modules");
    $page = rmc_server_var($_POST, 'page', 1);
    $limit = RMFunctions::configs('mods_number');
    list($num) = $db->fetchRow($db->query($sql));
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url('javascript:;" onclick="get_mods_page({PAGE_NUM})');
    $sql = 'SELECT * FROM ' . $db->prefix('modules') . " ORDER BY mid, weight LIMIT {$start},{$limit}";
    $result = $db->query($sql);
    $installed_mods = array();
    while ($row = $db->fetchArray($result)) {
        $mod = new XoopsModule();
        $mod->assignVars($row);
        $installed_mods[] = $mod;
    }
    include RMTemplate::get()->get_template('rmc_mods_installed.php', 'module', 'rmcommon');
    die;
}
 /**
  * get module.
  * 
  * @param Legacy_AbstractModule &$obj
  * @param XoopsModule           $module
  */
 public static function getModule(&$obj, $module)
 {
     if ($module->getInfo('trust_dirname') == COSMOAPI_TRUST_DIRNAME) {
         $mytrustdirname = COSMOAPI_TRUST_DIRNAME;
         require_once XOOPS_TRUST_PATH . '/modules/' . COSMOAPI_TRUST_DIRNAME . '/class/Module.class.php';
         $className = ucfirst(COSMOAPI_TRUST_DIRNAME) . '_Module';
         $obj = new $className($module);
     }
 }
Пример #11
0
 /**
  * Loads roles of the specific module with $module, and set loaded roles to
  * the current principal.
  * @static
  * @param XoopsModule $module
  */
 function loadRolesByModule(&$module)
 {
     static $cache;
     $root =& XCube_Root::getSingleton();
     $context =& $root->mContext;
     if ($module == null) {
         return;
     }
     if (isset($cache[$module->get('mid')])) {
         return;
     }
     $groups = is_object($context->mXoopsUser) ? $context->mXoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS);
     $handler =& xoops_gethandler('groupperm');
     if ($handler->checkRight('module_read', $module->get('mid'), $groups)) {
         $context->mUser->addRole('Module.' . $module->get('dirname') . '.Visitor');
     }
     if (is_object($context->mXoopsUser) && $handler->checkRight('module_admin', $module->get('mid'), $groups)) {
         $context->mUser->addRole('Module.' . $module->get('dirname') . '.Admin');
     }
     $handler =& xoops_getmodulehandler('group_permission', 'legacy');
     $roleArr = $handler->getRolesByModule($module->get('mid'), $groups);
     foreach ($roleArr as $role) {
         $context->mUser->addRole('Module.' . $module->get('dirname') . '.' . $role);
     }
     $cache[$module->get('mid')] = true;
 }
Пример #12
0
 public function test_insertModule()
 {
     $instance = new $this->myclass($this->conn);
     $module = new XoopsModule();
     $module->setDirty(true);
     $module->setNew(true);
     $module->setVar('name', 'MODULE_DUMMY_FOR_TESTS', true);
     $value = $instance->insertModule($module);
     $this->assertTrue($value);
     $value = $instance->deleteModule($module);
     $this->assertTrue($value);
 }
Пример #13
0
/**
 * 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;
}
Пример #14
0
 function __construct(XoopsModule $module)
 {
     parent::__construct($this);
     $this->module = $module;
     $module->loadAdminMenu();
     $this->adminmenu = $this->module->adminmenu;
     foreach ($this->adminmenu as $menu) {
         if (stripos($_SERVER['REQUEST_URI'], $menu['link']) !== false) {
             $this->title = $menu['title'];
             $this->icon = $menu['link'];
             $this->icon = $menu['icon'];
         }
     }
 }
Пример #15
0
 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;
 }
Пример #16
0
 /**
  * Do execute porting. This member function is added to Delegate.
  * 
  * @access public
  * @param XoopsModule $module
  * @param Legacy_ModuleInstallLog $log
  */
 function execute(&$module, &$log)
 {
     if ($module->get('dirname') != 'XUpgrade') {
         return;
     }
     $this->mLog =& $log;
     $log->add(_MI_XUPGRADE_MESSAGE_START_PORTING);
     $this->_portConfigs();
     if (XUPGRADE_ENABLE_TEMPLATEPORTING == true) {
         $this->_portTemplates();
     }
     if ($this->mIsInstall) {
         $this->_adjustModules();
     }
 }
Пример #17
0
/**
 * 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 <*****@*****.**>
 * @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;
}
Пример #18
0
 static function anchor($module, $controller = '', $action = '', $parameters = array())
 {
     global $cuSettings;
     if ($module == '') {
         return null;
     }
     $url = XOOPS_URL;
     $paths = isset($cuSettings->modules_path) ? $cuSettings->modules_path : array();
     $path = isset($paths[$module]) ? $paths[$module] : '/' . $module;
     if (defined('XOOPS_CPFUNC_LOADED')) {
         if ($cuSettings->permalinks && isset($paths[$module])) {
             $url .= '/admin' . $path;
         } else {
             $objModule = XoopsModule::getByDirName($module);
             $url .= '/modules/' . $module . '/' . $objModule->getInfo('adminindex');
         }
     } else {
         $url .= $cuSettings->permalinks ? $path : '/modules/' . $module;
     }
     if ($controller == '') {
         return $url;
     }
     $url .= $cuSettings->permalinks ? '/' . $controller . '/' : '/' . $controller . '/';
     $url .= $action != '' ? $action . '/' : '';
     $query = '';
     foreach ($parameters as $name => $value) {
         $query .= $name . '/' . urlencode($value) . '/';
     }
     return $url . $query;
 }
Пример #19
0
 /**
  * @todo no $renderer. It should be $render.
  */
 function executeViewInput(&$controller, &$xoopsUser, &$renderer)
 {
     $renderer->setTemplateName("module_install.html");
     $renderer->setAttribute('module', $this->mXoopsModule);
     $renderer->setAttribute('actionForm', $this->mActionForm);
     $renderer->setAttribute('currentVersion', round($this->mXoopsModule->get('version') / 100, 2));
 }
 /**
  * execute uninstall.
  *
  * @return bool
  */
 public function executeUninstall()
 {
     $this->_uninstallTables();
     if (!$this->_mForceMode && $this->mLog->hasError()) {
         $this->_processReport();
         return false;
     }
     if ($this->_mXoopsModule->get('mid') != null) {
         $this->_uninstallModule();
         if (!$this->_mForceMode && $this->mLog->hasError()) {
             $this->_processReport();
             return false;
         }
         $this->_uninstallTemplates();
         if (!$this->_mForceMode && $this->mLog->hasError()) {
             $this->_processReport();
             return false;
         }
         $this->_uninstallBlocks();
         if (!$this->_mForceMode && $this->mLog->hasError()) {
             $this->_processReport();
             return false;
         }
         $this->_uninstallPreferences();
         if (!$this->_mForceMode && $this->mLog->hasError()) {
             $this->_processReport();
             return false;
         }
     }
     $this->_processReport();
     return true;
 }
Пример #21
0
 /**
  * getModule
  * 
  * @param	Legacy_AbstractModule  &$obj
  * @param	XoopsModule  $module
  * 
  * @return	void
  **/
 public static function getModule(&$obj, $module)
 {
     if ($module->getInfo('trust_dirname') == 'trpg') {
         require_once TRPG_TRUST_PATH . '/class/Module.class.php';
         $obj = new Trpg_Module($module);
     }
 }
Пример #22
0
 function _processReport()
 {
     if (!$this->mLog->hasError()) {
         $this->mLog->add(XCube_Utils::formatMessage(_AD_LEGACY_MESSAGE_UPDATING_MODULE_SUCCESSFUL, $this->_mCurrentXoopsModule->get('name')));
     } else {
         $this->mLog->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_UPDATING_MODULE_FAILURE, $this->_mCurrentXoopsModule->get('name')));
     }
 }
Пример #23
0
/**
 * 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 <*****@*****.**>
 * @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;
    }
}
Пример #24
0
 function _processReport()
 {
     if (!$this->mLog->hasError()) {
         $this->mLog->add(XCube_Utils::formatString(_AD_LEGACY_MESSAGE_INSTALLATION_MODULE_SUCCESSFUL, $this->_mXoopsModule->get('name')));
     } else {
         $this->mLog->addError(XCube_Utils::formatString(_AD_LEGACY_ERROR_INSTALLATION_MODULE_FAILURE, $this->_mXoopsModule->get('name')));
     }
 }
Пример #25
0
 function __construct(XoopsModule $module)
 {
     parent::__construct($this);
     $this->setTemplate(XMF_ROOT_PATH . '/templates/xmf_adminmenu.html');
     $this->module =& $module;
     $this->currentoption = -1;
     $this->breadcrumb = '';
     $this->submenus = false;
     $this->currentsub = -1;
     $this->headermenu = array();
     $this->adminmenu = $module->loadAdminMenu();
     foreach ($this->module->adminmenu as $i => $menu) {
         if (stripos($_SERVER['REQUEST_URI'], $menu['link']) !== false) {
             $this->currentoption = $i;
             $this->breadcrumb = $menu['title'];
         }
     }
 }
Пример #26
0
 /**
  * Add a message to the module log
  *
  * @param string $log log message
  *
  * @return void
  */
 public function addLog($log)
 {
     if ($this->debug) {
         if (!is_scalar($log)) {
             $log = serialize($log);
         }
         $name = is_object($this->object) ? $this->object->name() : $this->dirname;
         \Xoops::getInstance()->logger()->debug($log, array('channel' => 'Extra', 'name' => $name));
     }
 }
 /**
  * process report.
  */
 private function _processReport()
 {
     $dirname = $this->_mCurrentXoopsModule->get('dirname');
     $constpref = '_MI_' . strtoupper($dirname);
     if (!$this->mLog->hasError()) {
         $this->mLog->add(XCube_Utils::formatString(constant($constpref . '_INSTALL_MSG_MODULE_UPDATED'), $this->_mCurrentXoopsModule->get('name')));
     } else {
         $this->mLog->add(XCube_Utils::formatString(constant($constpref . '_INSTALL_ERROR_MODULE_UPDATED'), $this->_mCurrentXoopsModule->get('name')));
     }
 }
Пример #28
0
/**
 * @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;
    }
}
Пример #29
0
function tellafriend_isAdminModule()
{
    global $xoopsUser, $xoopsModule, $xoopsmod;
    $bolOk = false;
    if ($xoopsUser) {
        $xoopsModule = XoopsModule::getByDirname("tellafriend");
        $bolOk = $xoopsUser->isAdmin($xoopsModule->mid());
    }
    return $bolOk;
}
Пример #30
0
 /**
  * Obtiene la version del mdulo actual
  * Esta funci?n solo funciona con m?dulos de Red M?xico Soft
  * o compatibles
  * @param bool $includename Mostrar todo el nombre del m?dulo
  * @param string $module Obtener Versi?n del M?dulo Espec?ficado
  * @param int $type 0 = String, 1 = Array
  */
 public function getVersion($includename = true, $module = '', $type = 0)
 {
     global $xoopsModule, $xoopsConfig;
     //global $version;
     if ($module != '') {
         if ($xoopsModule->dirname() == $module) {
             $mod = $xoopsModule;
         } else {
             $mod = new XoopsModule();
         }
     }
     $mod->loadInfoAsVar($module);
     $version = $mod->getInfo('rmversion');
     $version = is_array($version) ? $version : array('number' => $version, 'revision' => 0, 'status' => 0, 'name' => $mod->getInfo('name'));
     if ($type == 1) {
         return $version;
     }
     $rtn = '';
     if ($includename) {
         $rtn .= (defined($version['name']) ? constant($version['name']) : $version['name']) . ' ';
     }
     $rtn .= $version['number'];
     if ($version['revision'] > 0) {
         $rtn .= '.' . $version['revision'] / 100;
     } else {
         $rtn .= '.0';
     }
     switch ($version['status']) {
         case '-3':
             $rtn .= ' alfa';
             break;
         case '-2':
             $rtn .= ' beta';
             break;
         case '-1':
             $rtn .= ' final';
             break;
         case '0':
             break;
     }
     return $rtn;
 }