Example #1
0
 function eventBoot()
 {
     $registry =& MymenusRegistry::getInstance();
     $member_handler =& xoops_getHandler('member');
     $user = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser'] : null;
     if (!$user) {
         $user = $member_handler->createUser();
         $user->setVar('uid', 0);
         $user->setVar('uname', $GLOBALS['xoopsConfig']['anonymous']);
     }
     $ownerid = isset($_GET['uid']) ? intval($_GET['uid']) : null;
     $owner = $member_handler->getUser($ownerid);
     //if uid > 0 but user does not exists
     if (!is_object($owner)) {
         //create new user
         $owner = $member_handler->createUser();
     }
     if ($owner->isNew()) {
         $owner->setVar('uid', 0);
         $owner->setVar('uname', $GLOBALS['xoopsConfig']['anonymous']);
     }
     $registry->setEntry('user', $user->getValues());
     $registry->setEntry('owner', $owner->getValues());
     $registry->setEntry('user_groups', $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : array(XOOPS_GROUP_ANONYMOUS));
     $registry->setEntry('user_uid', $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getVar('uid') : 0);
     $registry->setEntry('get_uid', isset($_GET['uid']) ? intval($_GET['uid']) : 0);
 }
/**
 * @param $params
 * @param $smarty
 * @return null
 */
function smarty_function_xoInboxCount($params, &$smarty)
{
    global $xoopsUser;
    if (!isset($xoopsUser) || !is_object($xoopsUser)) {
        return null;
    }
    $time = time();
    if (isset($_SESSION['xoops_inbox_count']) && @$_SESSION['xoops_inbox_count_expire'] > $time) {
        $count = (int) $_SESSION['xoops_inbox_count'];
    } else {
        $pm_handler = xoops_getHandler('privmessage');
        $xoopsPreload = XoopsPreload::getInstance();
        $xoopsPreload->triggerEvent('core.class.smarty.xoops_plugins.xoinboxcount', array($pm_handler));
        $criteria = new CriteriaCompo(new Criteria('read_msg', 0));
        $criteria->add(new Criteria('to_userid', $xoopsUser->getVar('uid')));
        $count = (int) $pm_handler->getCount($criteria);
        $_SESSION['xoops_inbox_count'] = $count;
        $_SESSION['xoops_inbox_count_expire'] = $time + 60;
    }
    if (!@empty($params['assign'])) {
        $smarty->assign($params['assign'], $count);
    } else {
        echo $count;
    }
}
 /**
  * Constructor
  *
  * @param XoopsTpl $tpl
  * @param boolean  $use_icons
  * @param boolean  $do_iconcheck
  *
  */
 public function __construct(XoopsTpl $tpl, $use_icons = true, $do_iconcheck = false)
 {
     $this->_tpl = $tpl;
     $this->_useIcons = (bool) $use_icons;
     $this->_doIconCheck = (bool) $do_iconcheck;
     $this->_memberHandler = xoops_getHandler('member');
     $this->_statusText = array(XOOPS_COMMENT_PENDING => '<span style="text-decoration: none; font-weight: bold; color: #00ff00;">' . _CM_PENDING . '</span>', XOOPS_COMMENT_ACTIVE => '<span style="text-decoration: none; font-weight: bold; color: #ff0000;">' . _CM_ACTIVE . '</span>', XOOPS_COMMENT_HIDDEN => '<span style="text-decoration: none; font-weight: bold; color: #0000ff;">' . _CM_HIDDEN . '</span>');
 }
Example #4
0
 /**
  * Authenticate user
  *
  * @param  string $uname
  * @param  string $pwd
  * @return bool
  */
 public function authenticate($uname, $pwd = null)
 {
     $member_handler = xoops_getHandler('member');
     $user = $member_handler->loginUser($uname, $pwd);
     if ($user == false) {
         $this->setErrors(1, _US_INCORRECTLOGIN);
     }
     return $user;
 }
Example #5
0
	/**
	 * Check if user profile table already converted
	 *
	 */
	function check_profile()
	{
		$module_handler =& xoops_getHandler('module');
		if (!$profile_module = $module_handler->getByDirname('profile')) return true;
		$sql = "SHOW COLUMNS FROM " . $GLOBALS['xoopsDB']->prefix("users") . " LIKE 'posts'";
		$result = $GLOBALS['xoopsDB']->queryF($sql);
		if (!$result) return false;
		if ($GLOBALS['xoopsDB']->getRowsNum($result) == 0) return false;
		return true;
	}
Example #6
0
 /**
  * @return bool
  */
 public static function validate()
 {
     $module_handler = xoops_getHandler('module');
     if ($admin_module = $module_handler->getByDirname('thadmin')) {
         if ($admin_module->getVar('isactive')) {
             return true;
         }
     }
     return false;
 }
Example #7
0
 /**
  * Authentication Service constructor
  * @param XoopsDatabase $dao
  */
 public function __construct(XoopsDatabase $dao = null)
 {
     $this->_dao = $dao;
     // The config handler object allows us to look at the configuration options that are stored in the database
     $config_handler = xoops_getHandler('config');
     $config = $config_handler->getConfigsByCat(XOOPS_CONF_AUTH);
     $confcount = count($config);
     foreach ($config as $key => $val) {
         $this->{$key} = $val;
     }
 }
 /**
  * Constructor
  *
  * @param string $caption
  * @param string $name
  * @param mixed  $value    Pre-selected value (or array of them).
  */
 public function __construct($caption, $name, $value = null)
 {
     /** @var XoopsMemberHandler $member_handler */
     $member_handler = xoops_getHandler('member');
     $userGroups = $member_handler->getGroupList();
     parent::__construct($caption, $name, $value);
     $this->columns = 3;
     foreach ($userGroups as $group_id => $group_name) {
         $this->addOption($group_id, $group_name);
     }
 }
Example #9
0
 /**
  * @param     $target
  * @param int $subCatsCount
  */
 public function __construct(&$target, $subCatsCount = 4)
 {
     $this->publisher =& PublisherPublisher::getInstance();
     $this->targetObject =& $target;
     $this->subCatsCount = $subCatsCount;
     $memberHandler =& xoops_getHandler('member');
     $this->userGroups = $memberHandler->getGroupList();
     parent::__construct(_AM_PUBLISHER_CATEGORY, 'form', xoops_getenv('PHP_SELF'));
     $this->setExtra('enctype="multipart/form-data"');
     $this->createElements();
     $this->createButtons();
 }
Example #10
0
 /**
  * @param $mydirname
  * @param $category
  * @param $item_id
  *
  * @return mixed
  */
 function protector_notify_base($mydirname, $category, $item_id)
 {
     include_once __DIR__ . '/include/common_functions.php';
     $db = XoopsDatabaseFactory::getDatabaseConnection();
     $module_handler = xoops_getHandler('module');
     $module = $module_handler->getByDirname($mydirname);
     if ($category === 'global') {
         $item['name'] = '';
         $item['url'] = '';
         return $item;
     }
     return null;
 }
function altsys_set_module_config()
{
    global $altsysModuleConfig, $altsysModuleId;
    $module_handler = xoops_getHandler('module');
    $module = $module_handler->getByDirname('altsys');
    if (is_object($module)) {
        $config_handler = xoops_getHandler('config');
        $altsysModuleConfig = $config_handler->getConfigList($module->getVar('mid'));
        $altsysModuleId = $module->getVar('mid');
    } else {
        $altsysModuleConfig = array();
        $altsysModuleId = 0;
    }
}
Example #12
0
 /**
  * @return XoopsThemeForm
  */
 public function getForm()
 {
     if ($this->isNew()) {
         $blank_img = 'blank.gif';
     } else {
         $blank_img = str_replace('avatars/', '', $this->getVar('avatar_file', 'e'));
     }
     // Get User Config
     $config_handler = xoops_getHandler('config');
     $xoopsConfigUser = $config_handler->getConfigsByCat(XOOPS_CONF_USER);
     // New and edit form
     $form = new XoopsThemeForm(_AM_SYSTEM_AVATAR_ADD, 'avatar_form', 'admin.php', 'post', true);
     $form->setExtra('enctype="multipart/form-data"');
     // Name
     $form->addElement(new XoopsFormText(_IMAGENAME, 'avatar_name', 50, 255, $this->getVar('avatar_name', 'e')), true);
     // Name description
     $maxpixel = '<div>' . _US_MAXPIXEL . '&nbsp;:&nbsp;' . $xoopsConfigUser['avatar_width'] . ' x ' . $xoopsConfigUser['avatar_height'] . '</div>';
     $maxsize = '<div>' . _US_MAXIMGSZ . '&nbsp;:&nbsp;' . $xoopsConfigUser['avatar_maxsize'] . '</div>';
     // Upload part
     $imgtray_img = new XoopsFormElementTray(_IMAGEFILE, '<br>');
     $imgtray_img->setDescription($maxpixel . $maxsize);
     $imageselect_img = new XoopsFormSelect(sprintf(_AM_SYSTEM_AVATAR_USE_FILE, XOOPS_UPLOAD_PATH . '/avatars/'), 'avatar_file', $blank_img);
     $image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH . '/avatars');
     $imageselect_img->addOption("{$blank_img}", $blank_img);
     foreach ($image_array_img as $image_img) {
         $imageselect_img->addOption("{$image_img}", $image_img);
     }
     $imageselect_img->setExtra("onchange='showImgSelected(\"xo-avatar-img\", \"avatar_file\", \"avatars\", \"\", \"" . XOOPS_UPLOAD_URL . "\")'");
     $imgtray_img->addElement($imageselect_img, false);
     $imgtray_img->addElement(new XoopsFormLabel('', "<br><img src='" . XOOPS_UPLOAD_URL . '/avatars/' . $blank_img . "' name='image_img' id='xo-avatar-img' alt='' />"));
     $fileseltray_img = new XoopsFormElementTray('<br>', '<br><br>');
     $fileseltray_img->addElement(new XoopsFormFile(_AM_SYSTEM_AVATAR_UPLOAD, 'avatar_file', 500000), false);
     $imgtray_img->addElement($fileseltray_img);
     $form->addElement($imgtray_img);
     // Weight
     $form->addElement(new XoopsFormText(_IMGWEIGHT, 'avatar_weight', 3, 4, $this->getVar('avatar_weight', 'e')));
     // Display
     $form->addElement(new XoopsFormRadioYN(_IMGDISPLAY, 'avatar_display', $this->getVar('avatar_display', 'e'), _YES, _NO));
     // Hidden
     if ($this->isNew()) {
         $form->addElement(new XoopsFormHidden('avatar_type', 's'));
     }
     $form->addElement(new XoopsFormHidden('op', 'save'));
     $form->addElement(new XoopsFormHidden('fct', 'avatars'));
     $form->addElement(new XoopsFormHidden('avatar_id', $this->getVar('avatar_id', 'e')));
     // Button
     $form->addElement(new XoopsFormButton('', 'avt_button', _SUBMIT, 'submit'));
     return $form;
 }
Example #13
0
function user_index($start = 0)
{
    global $xoopsTpl, $xoopsUser, $xoopsConfig, $limit;
    $myts =& MyTextSanitizer::getInstance();
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    $this_handler =& xoops_getModuleHandler('user', 'subscribers');
    $module_handler =& xoops_getHandler('module');
    $query = isset($_POST['query']) ? $_POST['query'] : null;
    $xoopsTpl->assign('query', $query);
    $criteria = null;
    if (!is_null($query)) {
        $criteria = new Criteria('user_email', $myts->addSlashes($query) . '%', 'LIKE');
    }
    $count = $this_handler->getCount($criteria);
    $xoopsTpl->assign('count', $count);
    $mHandler =& xoops_getHandler('member');
    $users_count = $mHandler->getUserCount(new Criteria('level', 0, '>'));
    $xoopsTpl->assign('users_count', $users_count);
    $xoopsTpl->assign('total_count', $users_count + $count);
    $criteria = new CriteriaCompo($criteria);
    $criteria->setSort('user_id');
    $criteria->setOrder('DESC');
    $criteria->setStart($start);
    $criteria->setLimit($limit);
    $objs = $this_handler->getObjects($criteria);
    unset($criteria);
    if ($count > 0) {
        if ($count > $limit) {
            include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
            $nav = new XoopsPageNav($count, $limit, $start, 'start', 'op=list');
            $xoopsTpl->assign('pag', '<div style="float:left; padding-top:2px;" align="center">' . $nav->renderNav() . '</div>');
        } else {
            $xoopsTpl->assign('pag', '');
        }
    } else {
        $xoopsTpl->assign('pag', '');
    }
    include_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
    $countries = XoopsLists::getCountryList();
    foreach ($objs as $obj) {
        $objArray = $obj->toArray();
        $objArray['user_country'] = $countries[$objArray['user_country']];
        $xoopsTpl->append('objs', $objArray);
        unset($objArray);
    }
    $xoopsTpl->assign('add_form', user_form());
    return $xoopsTpl->fetch(XOOPS_ROOT_PATH . '/modules/subscribers/templates/static/subscribers_admin_user.html');
}
Example #14
0
 function getOwner_uids()
 {
     $member_handler = xoops_getHandler('member');
     $sql = 'SELECT DISTINCT uid AS uid FROM ' . $this->table;
     $result = $this->db->query($sql);
     while ($uid = $this->db->fetchArray($result)) {
         $owner_uidsArray[] = $uid['uid'];
     }
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('uid', '(' . implode(', ', $owner_uidsArray) . ')', 'IN'));
     $usersArray = $member_handler->getUserList($criteria);
     $ret = array();
     $ret['default'] = _XUUPS_ANY;
     foreach ($usersArray as $k => $v) {
         $ret[$k] = $v;
     }
     return $ret;
 }
 /**
  * Fetch configs of a module from database
  *
  *
  * @param    string $dirname module dirname
  * @return    array
  */
 function mod_fetchConfig($dirname = '')
 {
     if (empty($dirname)) {
         return null;
     }
     $module_handler = xoops_getHandler('module');
     if (!($module = $module_handler->getByDirname($dirname))) {
         trigger_error("Module '{$dirname}' does not exist", E_USER_WARNING);
         return null;
     }
     $config_handler = xoops_getHandler('config');
     $criteria = new CriteriaCompo(new Criteria('conf_modid', $module->getVar('mid')));
     $configs = $config_handler->getConfigs($criteria);
     foreach (array_keys($configs) as $i) {
         $moduleConfig[$configs[$i]->getVar('conf_name')] = $configs[$i]->getConfValueForOutput();
     }
     unset($module, $configs);
     return $moduleConfig;
 }
Example #16
0
/**
 * See the enclosed file license.txt for licensing information.
 * If you did not receive this file, get it at http://www.gnu.org/licenses/gpl-2.0.html
 *
 * @copyright    (c) 2000-2016 XOOPS Project (www.xoops.org)
 * @license          GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @package          installer
 * @since            2.3.0
 * @author           Haruki Setoyama  <*****@*****.**>
 * @author           Kazumi Ono <*****@*****.**>
 * @author           Skalpa Keo <*****@*****.**>
 * @author           Taiwen Jiang <*****@*****.**>
 * @author           DuGris (aka L. JEN) <*****@*****.**>
 * @param string $hash
 * @return bool
 */
function install_acceptUser($hash = '')
{
    $GLOBALS['xoopsUser'] = null;
    $assertClaims = array('sub' => 'xoopsinstall');
    $claims = \Xmf\Jwt\TokenReader::fromCookie('install', 'xo_install_user', $assertClaims);
    if (false === $claims || empty($claims->uname)) {
        return false;
    }
    $uname = $claims->uname;
    $memberHandler = xoops_getHandler('member');
    $user = array_pop($memberHandler->getUsers(new Criteria('uname', $uname)));
    if (is_object($GLOBALS['xoops']) && method_exists($GLOBALS['xoops'], 'acceptUser')) {
        $res = $GLOBALS['xoops']->acceptUser($uname, true, '');
        return $res;
    }
    $GLOBALS['xoopsUser'] = $user;
    $_SESSION['xoopsUserId'] = $GLOBALS['xoopsUser']->getVar('uid');
    $_SESSION['xoopsUserGroups'] = $GLOBALS['xoopsUser']->getGroups();
    return true;
}
Example #17
0
 /**
  * Get a reference to the only instance of authentication class
  *
  * if the class has not been instantiated yet, this will also take
  * care of that
  *
  * @static
  *
  * @param $uname used to lookup in LDAP bypass config
  *
  * @return object Reference to the only instance of authentication class
  */
 public static function getAuthConnection($uname)
 {
     static $auth_instance;
     if (!isset($auth_instance)) {
         $config_handler = xoops_getHandler('config');
         $authConfig = $config_handler->getConfigsByCat(XOOPS_CONF_AUTH);
         include_once $GLOBALS['xoops']->path('class/auth/auth.php');
         if (empty($authConfig['auth_method'])) {
             // If there is a config error, we use xoops
             $xoops_auth_method = 'xoops';
         } else {
             $xoops_auth_method = $authConfig['auth_method'];
         }
         // Verify if uname allow to bypass LDAP auth
         if (in_array($uname, $authConfig['ldap_users_bypass'])) {
             $xoops_auth_method = 'xoops';
         }
         $ret = (include_once $GLOBALS['xoops']->path('class/auth/auth_' . $xoops_auth_method . '.php'));
         if ($ret == false) {
             return false;
         }
         $class = 'XoopsAuth' . ucfirst($xoops_auth_method);
         if (!class_exists($class)) {
             $GLOBALS['xoopsLogger']->triggerError($class, _XO_ER_CLASSNOTFOUND, __FILE__, __LINE__, E_USER_ERROR);
             return false;
         }
         switch ($xoops_auth_method) {
             case 'xoops':
                 $dao = XoopsDatabaseFactory::getDatabaseConnection();
                 break;
             case 'ldap':
                 $dao = null;
                 break;
             case 'ads':
                 $dao = null;
                 break;
         }
         $auth_instance = new $class($dao);
     }
     return $auth_instance;
 }
Example #18
0
/**
 * @param $module
 *
 * @return bool
 */
function update_system_v211($module)
{
    global $xoopsDB;
    $result = $xoopsDB->query('SELECT t1.tpl_id FROM ' . $xoopsDB->prefix('tplfile') . ' t1, ' . $xoopsDB->prefix('tplfile') . ' t2 WHERE t1.tpl_refid = t2.tpl_refid AND t1.tpl_module = t2.tpl_module AND t1.tpl_tplset=t2.tpl_tplset AND t1.tpl_file = t2.tpl_file AND t1.tpl_type = t2.tpl_type AND t1.tpl_id > t2.tpl_id');
    $tplids = array();
    while (list($tplid) = $xoopsDB->fetchRow($result)) {
        $tplids[] = $tplid;
    }
    if (count($tplids) > 0) {
        $tplfile_handler = xoops_getHandler('tplfile');
        $duplicate_files = $tplfile_handler->getObjects(new Criteria('tpl_id', '(' . implode(',', $tplids) . ')', 'IN'));
        if (count($duplicate_files) > 0) {
            foreach (array_keys($duplicate_files) as $i) {
                $tplfile_handler->delete($duplicate_files[$i]);
            }
        }
    }
    $sql = 'SHOW INDEX FROM ' . $xoopsDB->prefix('tplfile') . " WHERE KEY_NAME = 'tpl_refid_module_set_file_type'";
    if (!($result = $xoopsDB->queryF($sql))) {
        xoops_error($this->db->error() . '<br>' . $sql);
        return false;
    }
    $ret = array();
    while ($myrow = $xoopsDB->fetchArray($result)) {
        $ret[] = $myrow;
    }
    if (!empty($ret)) {
        $module->setErrors("'tpl_refid_module_set_file_type' unique index is exist. Note: check 'tplfile' table to be sure this index is UNIQUE because XOOPS CORE need it.");
        return true;
    }
    $sql = 'ALTER TABLE ' . $xoopsDB->prefix('tplfile') . ' ADD UNIQUE tpl_refid_module_set_file_type ( tpl_refid, tpl_module, tpl_tplset, tpl_file, tpl_type )';
    if (!($result = $xoopsDB->queryF($sql))) {
        xoops_error($xoopsDB->error() . '<br>' . $sql);
        $module->setErrors("'tpl_refid_module_set_file_type' unique index is not added to 'tplfile' table. Warning: do not use XOOPS until you add this unique index.");
        return false;
    }
    return true;
}
Example #19
0
 /**
  * @param $ts
  * @param $text
  *
  * @return mixed|string
  */
 public function load($ts, $text)
 {
     static $censorConf;
     if (!isset($censorConf)) {
         $config_handler = xoops_getHandler('config');
         $censorConf = $config_handler->getConfigsByCat(XOOPS_CONF_CENSOR);
         $config = parent::loadConfig(__DIR__);
         //merge and allow config override
         $censorConf = array_merge($censorConf, $config);
     }
     if (empty($censorConf['censor_enable'])) {
         return $text;
     }
     if (empty($censorConf['censor_words'])) {
         return $text;
     }
     if (empty($censorConf['censor_admin']) && $GLOBALS['xoopsUserIsAdmin']) {
         return $text;
     }
     $replacement = $censorConf['censor_replace'];
     foreach ($censorConf['censor_words'] as $bad) {
         $bad = trim($bad);
         if (!empty($bad)) {
             if (false === strpos($text, $bad)) {
                 continue;
             }
             if (!empty($censorConf['censor_terminate'])) {
                 trigger_error('Censor words found', E_USER_ERROR);
                 $text = '';
                 return $text;
             }
             $patterns[] = "/(^|[^0-9a-z_]){$bad}([^0-9a-z_]|\$)/siU";
             $replacements[] = "\\1{$replacement}\\2";
             $text = preg_replace($patterns, $replacements, $text);
         }
     }
     return $text;
 }
Example #20
0
 /**
  * Instantiate a XoopsModule object for the helper to use.
  * The module is determined as follows:
  * - if null is passed, use the current module
  * - if a string is passed, use as dirname to load
  *
  * @param string|null $dirname dirname
  */
 public function __construct($dirname = null)
 {
     $this->module = null;
     if (empty($dirname)) {
         // nothing specified, use current module
         // check if we are running in 2.6
         if (class_exists('Xoops', false)) {
             $xoops = \Xoops::getInstance();
             if ($xoops->isModule()) {
                 $this->module = $xoops->module;
             }
         } else {
             $this->module = $GLOBALS['xoopsModule'];
         }
     } else {
         // assume dirname specified, try to get a module object
         $moduleHandler = xoops_getHandler('module');
         $this->module = $moduleHandler->getByDirname($dirname);
     }
     if (is_object($this->module)) {
         $this->init();
     }
 }
Example #21
0
 /**
  * constructor
  *
  * @param mixed $id
  **/
 public function __construct($id = null)
 {
     $this->initVar('bid', XOBJ_DTYPE_INT, null, false);
     $this->initVar('mid', XOBJ_DTYPE_INT, 0, false);
     $this->initVar('func_num', XOBJ_DTYPE_INT, 0, false);
     $this->initVar('options', XOBJ_DTYPE_TXTBOX, null, false, 255);
     $this->initVar('name', XOBJ_DTYPE_TXTBOX, null, true, 150);
     //$this->initVar('position', XOBJ_DTYPE_INT, 0, false);
     $this->initVar('title', XOBJ_DTYPE_TXTBOX, null, false, 150);
     $this->initVar('content', XOBJ_DTYPE_TXTAREA, null, false);
     $this->initVar('side', XOBJ_DTYPE_INT, 0, false);
     $this->initVar('weight', XOBJ_DTYPE_INT, 0, false);
     $this->initVar('visible', XOBJ_DTYPE_INT, 0, false);
     $this->initVar('block_type', XOBJ_DTYPE_OTHER, null, false);
     $this->initVar('c_type', XOBJ_DTYPE_OTHER, null, false);
     $this->initVar('isactive', XOBJ_DTYPE_INT, null, false);
     $this->initVar('dirname', XOBJ_DTYPE_TXTBOX, null, false, 50);
     $this->initVar('func_file', XOBJ_DTYPE_TXTBOX, null, false, 50);
     $this->initVar('show_func', XOBJ_DTYPE_TXTBOX, null, false, 50);
     $this->initVar('edit_func', XOBJ_DTYPE_TXTBOX, null, false, 50);
     $this->initVar('template', XOBJ_DTYPE_OTHER, null, false);
     $this->initVar('bcachetime', XOBJ_DTYPE_INT, 0, false);
     $this->initVar('last_modified', XOBJ_DTYPE_INT, 0, false);
     // for backward compatibility
     if (isset($id)) {
         if (is_array($id)) {
             $this->assignVars($id);
         } else {
             $blkhandler = xoops_getHandler('block');
             $obj = $blkhandler->get($id);
             foreach (array_keys($obj->getVars()) as $i) {
                 $this->assignVar($i, $obj->getVar($i, 'n'));
             }
         }
     }
 }
Example #22
0
/**
 * @param        $add_or_edit
 * @param string $user
 */
function form_user($add_or_edit, $user = '')
{
    global $xoopsConfig, $xoopsUser;
    $uid = system_CleanVars($_REQUEST, 'uid', 0);
    //RMV-NOTIFY
    include_once XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/notification.php';
    include_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
    if ($add_or_edit === true) {
        //Add user
        $uid_value = '';
        $uname_value = '';
        $name_value = '';
        $email_value = '';
        $email_cbox_value = 0;
        $url_value = '';
        $timezone_value = $xoopsConfig['default_TZ'];
        $icq_value = '';
        $aim_value = '';
        $yim_value = '';
        $msnm_value = '';
        $location_value = '';
        $occ_value = '';
        $interest_value = '';
        $sig_value = '';
        $sig_cbox_value = 0;
        $umode_value = $xoopsConfig['com_mode'];
        $uorder_value = $xoopsConfig['com_order'];
        // RMV-NOTIFY
        $notify_method_value = XOOPS_NOTIFICATION_METHOD_PM;
        $notify_mode_value = XOOPS_NOTIFICATION_MODE_SENDALWAYS;
        $bio_value = '';
        $rank_value = 0;
        $mailok_value = 0;
        $form_title = _AM_SYSTEM_USERS_ADDUSER;
        $form_isedit = false;
        $groups = array(XOOPS_GROUP_USERS);
    } else {
        //Edit user
        $member_handler = xoops_getHandler('member');
        $user = $member_handler->getUser($uid);
        if (is_object($user)) {
            $uid_value = $uid;
            $uname_value = $user->getVar('uname', 'E');
            $name_value = $user->getVar('name', 'E');
            $email_value = $user->getVar('email', 'E');
            $email_cbox_value = $user->getVar('user_viewemail') ? 1 : 0;
            $url_value = $user->getVar('url', 'E');
            $temp = $user->getVar('theme');
            $timezone_value = $user->getVar('timezone_offset');
            $icq_value = $user->getVar('user_icq', 'E');
            $aim_value = $user->getVar('user_aim', 'E');
            $yim_value = $user->getVar('user_yim', 'E');
            $msnm_value = $user->getVar('user_msnm', 'E');
            $location_value = $user->getVar('user_from', 'E');
            $occ_value = $user->getVar('user_occ', 'E');
            $interest_value = $user->getVar('user_intrest', 'E');
            $sig_value = $user->getVar('user_sig', 'E');
            $sig_cbox_value = $user->getVar('attachsig') == 1 ? 1 : 0;
            $umode_value = $user->getVar('umode');
            $uorder_value = $user->getVar('uorder');
            // RMV-NOTIFY
            $notify_method_value = $user->getVar('notify_method');
            $notify_mode_value = $user->getVar('notify_mode');
            $bio_value = $user->getVar('bio', 'E');
            $rank_value = $user->rank(false);
            $mailok_value = $user->getVar('user_mailok', 'E');
            $form_title = _AM_SYSTEM_USERS_UPDATEUSER . ': ' . $user->getVar('uname');
            $form_isedit = true;
            $groups = array_values($user->getGroups());
        }
    }
    //Affichage du formulaire
    $form = new XoopsThemeForm($form_title, 'form_user', 'admin.php', 'post', true);
    $form->addElement(new XoopsFormText(_AM_SYSTEM_USERS_NICKNAME, 'username', 25, 25, $uname_value), true);
    $form->addElement(new XoopsFormText(_AM_SYSTEM_USERS_NAME, 'name', 30, 60, $name_value));
    $email_tray = new XoopsFormElementTray(_AM_SYSTEM_USERS_EMAIL, '<br>');
    $email_text = new XoopsFormText('', 'email', 30, 60, $email_value);
    $email_tray->addElement($email_text, true);
    $email_cbox = new XoopsFormCheckBox('', 'user_viewemail', $email_cbox_value);
    $email_cbox->addOption(1, _AM_SYSTEM_USERS_AOUTVTEAD);
    $email_tray->addElement($email_cbox);
    $form->addElement($email_tray, true);
    $form->addElement(new XoopsFormText(_AM_SYSTEM_USERS_URL, 'url', 30, 100, $url_value));
    $form->addElement(new XoopsFormSelectTimezone(_AM_SYSTEM_USERS_TIMEZONE, 'timezone_offset', $timezone_value));
    $form->addElement(new XoopsFormText(_AM_SYSTEM_USERS_ICQ, 'user_icq', 15, 15, $icq_value));
    $form->addElement(new XoopsFormText(_AM_SYSTEM_USERS_AIM, 'user_aim', 18, 18, $aim_value));
    $form->addElement(new XoopsFormText(_AM_SYSTEM_USERS_YIM, 'user_yim', 25, 25, $yim_value));
    $form->addElement(new XoopsFormText(_AM_SYSTEM_USERS_MSNM, 'user_msnm', 30, 100, $msnm_value));
    $form->addElement(new XoopsFormText(_AM_SYSTEM_USERS_LOCATION, 'user_from', 30, 100, $location_value));
    $form->addElement(new XoopsFormText(_AM_SYSTEM_USERS_OCCUPATION, 'user_occ', 30, 100, $occ_value));
    $form->addElement(new XoopsFormText(_AM_SYSTEM_USERS_INTEREST, 'user_intrest', 30, 150, $interest_value));
    $sig_tray = new XoopsFormElementTray(_AM_SYSTEM_USERS_SIGNATURE, '<br>');
    $sig_tarea = new XoopsFormTextArea('', 'user_sig', $sig_value);
    $sig_tray->addElement($sig_tarea);
    $sig_cbox = new XoopsFormCheckBox('', 'attachsig', $sig_cbox_value);
    $sig_cbox->addOption(1, _AM_SYSTEM_USERS_SHOWSIG);
    $sig_tray->addElement($sig_cbox);
    $form->addElement($sig_tray);
    $umode_select = new XoopsFormSelect(_AM_SYSTEM_USERS_CDISPLAYMODE, 'umode', $umode_value);
    $umode_select->addOptionArray(array('nest' => _NESTED, 'flat' => _FLAT, 'thread' => _THREADED));
    $form->addElement($umode_select);
    $uorder_select = new XoopsFormSelect(_AM_SYSTEM_USERS_CSORTORDER, 'uorder', $uorder_value);
    $uorder_select->addOptionArray(array('0' => _OLDESTFIRST, '1' => _NEWESTFIRST));
    $form->addElement($uorder_select);
    // RMV-NOTIFY
    $notify_method_select = new XoopsFormSelect(_NOT_NOTIFYMETHOD, 'notify_method', $notify_method_value);
    $notify_method_select->addOptionArray(array(XOOPS_NOTIFICATION_METHOD_DISABLE => _NOT_METHOD_DISABLE, XOOPS_NOTIFICATION_METHOD_PM => _NOT_METHOD_PM, XOOPS_NOTIFICATION_METHOD_EMAIL => _NOT_METHOD_EMAIL));
    $form->addElement($notify_method_select);
    $notify_mode_select = new XoopsFormSelect(_NOT_NOTIFYMODE, 'notify_mode', $notify_mode_value);
    $notify_mode_select->addOptionArray(array(XOOPS_NOTIFICATION_MODE_SENDALWAYS => _NOT_MODE_SENDALWAYS, XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE => _NOT_MODE_SENDONCE, XOOPS_NOTIFICATION_MODE_SENDONCETHENWAIT => _NOT_MODE_SENDONCEPERLOGIN));
    $form->addElement($notify_mode_select);
    $form->addElement(new XoopsFormTextArea(_AM_SYSTEM_USERS_EXTRAINFO, 'bio', $bio_value));
    $rank_select = new XoopsFormSelect(_AM_SYSTEM_USERS_RANK, 'rank', $rank_value);
    $ranklist = XoopsLists::getUserRankList();
    if (count($ranklist) > 0) {
        $rank_select->addOption(0, '--------------');
        $rank_select->addOptionArray($ranklist);
    } else {
        $rank_select->addOption(0, _AM_SYSTEM_USERS_NSRID);
    }
    $form->addElement($rank_select);
    // adding a new user requires password fields
    if (!$form_isedit) {
        $form->addElement(new XoopsFormPassword(_AM_SYSTEM_USERS_PASSWORD, 'password', 10, 32), true);
        $form->addElement(new XoopsFormPassword(_AM_SYSTEM_USERS_RETYPEPD, 'pass2', 10, 32), true);
    } else {
        $form->addElement(new XoopsFormPassword(_AM_SYSTEM_USERS_PASSWORD, 'password', 10, 32));
        $form->addElement(new XoopsFormPassword(_AM_SYSTEM_USERS_RETYPEPD, 'pass2', 10, 32));
    }
    $form->addElement(new XoopsFormRadioYN(_AM_SYSTEM_USERS_ACCEPT_EMAIL, 'user_mailok', $mailok_value));
    //Groups administration addition XOOPS 2.0.9: Mith
    $gperm_handler = xoops_getHandler('groupperm');
    //If user has admin rights on groups
    if ($gperm_handler->checkRight('system_admin', XOOPS_SYSTEM_GROUP, $xoopsUser->getGroups(), 1)) {
        //add group selection
        $group_select[] = new XoopsFormSelectGroup(_AM_SYSTEM_USERS_GROUPS, 'groups', false, $groups, 5, true);
    } else {
        //add each user groups
        foreach ($groups as $key => $group) {
            $group_select[] = new XoopsFormHidden('groups[' . $key . ']', $group);
        }
    }
    foreach ($group_select as $group) {
        $form->addElement($group);
        unset($group);
    }
    $form->addElement(new XoopsFormHidden('fct', 'users'));
    $form->addElement(new XoopsFormHidden('op', 'users_save'));
    $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
    if (!empty($uid_value)) {
        $form->addElement(new XoopsFormHidden('uid', $uid_value));
    }
    $form->display();
}
Example #23
0
 /**
  * load all local filters for the object
  *
  * Filter distribution:
  * In each module folder there is a folder "filter" containing filter files with,
  * filename: [name_of_target_class][.][function/action_name][.php];
  * function name: [dirname][_][name_of_target_class][_][function/action_name];
  * parameter: the target object
  *
  * @param string $method function or action name
  *
  * @deprecated \XoopsObject::loadFilters is deprecated since XOOPS 2.5.8 and will be removed in the next major release
  */
 public function loadFilters($method)
 {
     $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
     trigger_error("XoopsObject::loadFilters() is deprecated, called from {$trace[0]['file']} line {$trace[0]['line']},");
     $this->_loadFilters();
     xoops_load('XoopsCache');
     $class = get_class($this);
     if (!($modules_active = XoopsCache::read('system_modules_active'))) {
         $module_handler = xoops_getHandler('module');
         $modules_obj = $module_handler->getObjects(new Criteria('isactive', 1));
         $modules_active = array();
         foreach (array_keys($modules_obj) as $key) {
             $modules_active[] = $modules_obj[$key]->getVar('dirname');
         }
         unset($modules_obj);
         XoopsCache::write('system_modules_active', $modules_active);
     }
     foreach ($modules_active as $dirname) {
         if (file_exists($file = XOOPS_ROOT_PATH . '/modules/' . $dirname . '/filter/' . $class . '.' . $method . '.php')) {
             include_once $file;
             if (function_exists($class . '_' . $method)) {
                 call_user_func_array($dirname . '_' . $class . '_' . $method, array(&$this));
             }
         }
     }
 }
Example #24
0
     $banner_handler = xoops_getModuleHandler('banner', 'system');
     $banner = $banner_handler->getCount();
     $menu['infos'] = sprintf(_AM_SYSTEM_BANNER_INFO, $banner);
     break;
 case 'comments':
     $comment_handler = xoops_getHandler('comment');
     $comment = $comment_handler->getCount();
     $menu['infos'] = sprintf(_AM_SYSTEM_COMMENT_INFO, $comment);
     break;
 case 'groups':
     $groups_Handler = xoops_getModuleHandler('group', 'system');
     $groups = $groups_Handler->getCount();
     $menu['infos'] = sprintf(_AM_SYSTEM_GROUP_INFO, $groups);
     break;
 case 'images':
     $imgcat_handler = xoops_getHandler('image');
     $img = $imgcat_handler->getCount();
     $menu['infos'] = sprintf(_AM_SYSTEM_IMG_INFO, $img);
     break;
 case 'smilies':
     $smilies_Handler = xoops_getModuleHandler('smilies', 'system');
     $smilies = $smilies_Handler->getCount();
     $menu['infos'] = sprintf(_AM_SYSTEM_SMILIES_INFO, $smilies);
     break;
 case 'userrank':
     $userrank_Handler = xoops_getModuleHandler('userrank', 'system');
     $userrank = $userrank_Handler->getCount();
     $menu['infos'] = sprintf(_AM_SYSTEM_RANKS_INFO, $userrank);
     break;
 case 'users':
     $member_handler = xoops_getModuleHandler('users', 'system');
Example #25
0
         if (is_array($field_default)) {
             $obj->setVar('field_default', serialize($field_default));
         } else {
             $obj->setVar('field_default', $field_default);
         }
     }
 }
 if ($obj->getVar('field_show')) {
     $obj->setVar('field_weight', $_REQUEST['field_weight']);
     $obj->setVar('cat_id', $_REQUEST['field_category']);
 }
 if (isset($_REQUEST['step_id'])) {
     $obj->setVar('step_id', $_REQUEST['step_id']);
 }
 if ($profilefield_handler->insert($obj)) {
     $groupperm_handler = xoops_getHandler('groupperm');
     $perm_arr = array();
     if ($obj->getVar('field_show')) {
         $perm_arr[] = 'profile_show';
         $perm_arr[] = 'profile_visible';
     }
     if ($obj->getVar('field_edit')) {
         $perm_arr[] = 'profile_edit';
     }
     if ($obj->getVar('field_edit') || $obj->getVar('field_show')) {
         $perm_arr[] = 'profile_search';
     }
     if (count($perm_arr) > 0) {
         foreach ($perm_arr as $perm) {
             $criteria = new CriteriaCompo(new Criteria('gperm_name', $perm));
             $criteria->add(new Criteria('gperm_itemid', (int) $obj->getVar('field_id')));
Example #26
0
} elseif (!empty($_POST['xoops_login'])) {
    include_once $GLOBALS['xoops']->path('include/checklogin.php');
    exit;
}
if (!$allowed) {
    require_once $GLOBALS['xoops']->path('class/template.php');
    require_once $GLOBALS['xoops']->path('class/theme.php');
    $xoopsThemeFactory = null;
    $xoopsThemeFactory = new xos_opal_ThemeFactory();
    $xoopsThemeFactory->allowedThemes = $xoopsConfig['theme_set_allowed'];
    $xoopsThemeFactory->defaultTheme = $xoopsConfig['theme_set'];
    $xoTheme = $xoopsThemeFactory->createInstance(array('plugins' => array()));
    $xoTheme->addScript('/include/xoops.js', array('type' => 'text/javascript'));
    $xoopsTpl = $xoTheme->template;
    $xoopsTpl->assign(array('xoops_theme' => $xoopsConfig['theme_set'], 'xoops_imageurl' => XOOPS_THEME_URL . '/' . $xoopsConfig['theme_set'] . '/', 'xoops_themecss' => xoops_getcss($xoopsConfig['theme_set']), 'xoops_requesturi' => htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES), 'xoops_sitename' => htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES), 'xoops_slogan' => htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES), 'xoops_dirname' => @$xoopsModule ? $xoopsModule->getVar('dirname') : 'system', 'xoops_banner' => $xoopsConfig['banners'] ? xoops_getbanner() : '&nbsp;', 'xoops_pagetitle' => isset($xoopsModule) && is_object($xoopsModule) ? $xoopsModule->getVar('name') : htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES), 'lang_login' => _LOGIN, 'lang_username' => _USERNAME, 'lang_password' => _PASSWORD, 'lang_siteclosemsg' => $xoopsConfig['closesite_text']));
    $config_handler = xoops_getHandler('config');
    $criteria = new CriteriaCompo(new Criteria('conf_modid', 0));
    $criteria->add(new Criteria('conf_catid', XOOPS_CONF_METAFOOTER));
    $config = $config_handler->getConfigs($criteria, true);
    foreach (array_keys($config) as $i) {
        $name = $config[$i]->getVar('conf_name', 'n');
        $value = $config[$i]->getVar('conf_value', 'n');
        if (substr($name, 0, 5) === 'meta_') {
            $xoopsTpl->assign("xoops_{$name}", htmlspecialchars($value, ENT_QUOTES));
        } else {
            // prefix each tag with 'xoops_'
            $xoopsTpl->assign("xoops_{$name}", $value);
        }
    }
    $xoopsTpl->debugging = false;
    $xoopsTpl->debugging_ctrl = 'none';
Example #27
0
 foreach ($newCatArray as $oldid => $newCat) {
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('categoryid', $newCat['newid']));
     $oldpid = $newCat['oldpid'];
     if ($oldpid == 0) {
         $newpid = $parentId;
     } else {
         $newpid = $newCatArray[$oldpid]['newid'];
     }
     $publisher->getCategoryHandler()->updateAll('parentid', $newpid, $criteria);
     unset($criteria);
 }
 // Looping through the comments to link them to the new articles and module
 echo _AM_PUBLISHER_IMPORT_COMMENTS . "<br />";
 $publisher_module_id = $publisher->getModule()->mid();
 $comment_handler = xoops_getHandler('comment');
 $criteria = new CriteriaCompo();
 $criteria->add(new Criteria('com_modid', $news_module_id));
 $comments = $comment_handler->getObjects($criteria);
 foreach ($comments as $comment) {
     $comment->setVar('com_itemid', $newArticleArray[$comment->getVar('com_itemid')]);
     $comment->setVar('com_modid', $publisher_module_id);
     $comment->setNew();
     if (!$comment_handler->insert($comment)) {
         echo "&nbsp;&nbsp;" . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "<br />";
     } else {
         echo "&nbsp;&nbsp;" . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . "<br />";
     }
 }
 echo "<br/><br/>Done.<br/>";
 echo sprintf(_AM_PUBLISHER_IMPORTED_CATEGORIES, $cnt_imported_cat) . "<br/>";
Example #28
0
 /**
  * Send notifications
  */
 public function sendNotifications()
 {
     $tags = array();
     $tags['MODULE_NAME'] = $this->publisher->getModule()->getVar('name');
     $tags['CATEGORY_NAME'] = $this->name();
     $tags['CATEGORY_URL'] = $this->getCategoryUrl();
     $notificationHandler =& xoops_getHandler('notification');
     $notificationHandler->triggerEvent('global_item', 0, 'category_created', $tags);
 }
Example #29
0
<?php

/*
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       The XUUPS Project http://sourceforge.net/projects/xuups/
 * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
 * @package         Publisher
 * @since           1.0
 * @author          trabis <*****@*****.**>
 * @author          The SmartFactory <www.smartfactory.ca>
 * @version         $Id: menu.php 10374 2012-12-12 23:39:48Z trabis $
 */
// defined("XOOPS_ROOT_PATH") || exit("XOOPS root path not defined");
$dirname = basename(dirname(__DIR__));
$moduleHandler =& xoops_getHandler('module');
$module = $moduleHandler->getByDirname($dirname);
$pathIcon32 = '../../' . $module->getInfo('sysIcons32');
$pathModIcon32 = $module->getInfo('modIcons32');
include_once dirname(__DIR__) . '/include/config.php';
xoops_loadLanguage('admin', $dirname);
$adminmenu = array(array('title' => _MI_PUBLISHER_ADMENU0, 'link' => 'admin/index.php', 'icon' => $pathIcon32 . '/home.png'), array('title' => _MI_PUBLISHER_ADMENU1, 'link' => 'admin/main.php', 'icon' => $pathIcon32 . '/manage.png'), array('title' => _MI_PUBLISHER_ADMENU2, 'link' => 'admin/category.php', 'icon' => $pathIcon32 . '/category.png'), array('title' => _MI_PUBLISHER_ADMENU3, 'link' => 'admin/item.php', 'icon' => $pathIcon32 . '/content.png'), array('title' => _MI_PUBLISHER_ADMENU4, 'link' => 'admin/permissions.php', 'icon' => $pathIcon32 . '/permissions.png'), array('title' => _MI_PUBLISHER_ADMENU6, 'link' => 'admin/mimetypes.php', 'icon' => $pathIcon32 . '/type.png'), array('title' => _AM_PUBLISHER_IMPORT, 'link' => 'admin/import.php', 'icon' => $pathIcon32 . '/download.png'), array('title' => _AM_PUBLISHER_CLONE, 'link' => 'admin/clone.php', 'icon' => $pathModIcon32 . '/editcopy.png'), array('title' => _AM_PUBLISHER_ABOUT, 'link' => 'admin/about.php', 'icon' => $pathIcon32 . '/about.png'));
$GLOBALS['xoTheme']->addStylesheet('modules/' . $dirname . '/assets/css/style.css');
<?php

/**
 *  TinyMCE adapter for XOOPS
 *
 * @copyright       (c) 2000-2016 XOOPS Project (www.xoops.org)
 * @license             GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @package             class
 * @subpackage          editor
 * @since               2.3.0
 * @author              Laurent JEN <*****@*****.**>
 */
defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
// check categories readability by group
$groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : array(XOOPS_GROUP_ANONYMOUS);
$imgcat_handler = xoops_getHandler('imagecategory');
return !(count($imgcat_handler->getList($groups, 'imgcat_read', 1)) == 0);