Beispiel #1
0
    function &getList($avatar_type = null, $avatar_display = null)
    {
        $criteria = new CriteriaCompo();
        if (isset($avatar_type)) {
            $avatar_type = ($avatar_type == 'C') ? 'C' : 'S';
            $criteria->add(new Criteria('avatar_type', $avatar_type));
        }
        if (isset($avatar_display)) {
            $criteria->add(new Criteria('avatar_display', intval($avatar_display)));
        }
        $avatars =& $this->getObjects($criteria, true);
        $ret = array();
        $ret[] = array(
        	'id' => 0,
        	'name' => _NONE,
        	'file' => 'blank.gif',
        );
        if(is_array($avatars)){
	        foreach ($avatars as $id => $obj) {
	            $ret[] = array(
	            	'id' => $id,
	            	'name' => $obj->getVar('avatar_name'),
	            	'file' => $obj->getVar('avatar_file'),
	            );
	        }
        }
        return $ret;
    }
Beispiel #2
0
function xoops_module_update_ckeditor4()
{
    $module_handler = xoops_gethandler('module');
    $Module = $module_handler->getByDirname('ckeditor4');
    $config_handler = xoops_gethandler('config');
    $mid = $Module->mid();
    $ModuleConfig = $config_handler->getConfigsByCat(0, $mid);
    if (substr($ModuleConfig['toolbar_user'], -4) === '""]]') {
        //fix typo '""]]' to '"]]' for version <= 0.37
        $criteria = new CriteriaCompo(new Criteria('conf_modid', $mid));
        $criteria->add(new Criteria('conf_catid', 0));
        $criteria->add(new Criteria('conf_name', 'toolbar_user'));
        if ($configs = $config_handler->_cHandler->getObjects($criteria)) {
            $val = str_replace('""]]', '"]]', $ModuleConfig['toolbar_user']);
            $configs[0]->setVar('conf_value', $val, true);
            $config_handler->insertConfig($configs[0]);
        }
    }
    if (preg_match('/^head\\s*$/m', $ModuleConfig['contentsCss'])) {
        //fix typo 'head' to '<head>' for version <= 0.38
        $criteria = new CriteriaCompo(new Criteria('conf_modid', $mid));
        $criteria->add(new Criteria('conf_catid', 0));
        $criteria->add(new Criteria('conf_name', 'contentsCss'));
        if ($configs = $config_handler->_cHandler->getObjects($criteria)) {
            $val = preg_replace('/^head(\\s*)$/m', '<head>$1', $ModuleConfig['contentsCss']);
            $configs[0]->setVar('conf_value', $val, true);
            $config_handler->insertConfig($configs[0]);
        }
    }
    return true;
}
Beispiel #3
0
 /**
  * @param int $uid
  *
  * @return int
  */
 public function userPosts($uid)
 {
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('content_status', 0, '!='));
     $criteria->add(new Criteria('content_author', (int) $uid));
     return Page::getInstance()->getContentHandler()->getCount($criteria);
 }
Beispiel #4
0
 /**
  * @param int $uid
  *
  * @return int
  */
 public function userPosts($uid)
 {
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('content_status', 0, '!='));
     $criteria->add(new Criteria('content_author', (int) $uid));
     return \Xoops::getModuleHelper('page')->getContentHandler()->getCount($criteria);
 }
Beispiel #5
0
function get_system_main_menu_show()
{
    global $xoopsUser, $xoopsModule;
    $block = array();
    $block['lang_home'] = _MB_SYSTEM_HOME;
    $block['lang_close'] = _CLOSE;
    $module_handler =& xoops_gethandler('module');
    $criteria = new CriteriaCompo(new Criteria('hasmain', 1));
    $criteria->add(new Criteria('isactive', 1));
    $criteria->add(new Criteria('weight', 0, '>'));
    $modules = $module_handler->getObjects($criteria, true);
    $moduleperm_handler =& xoops_gethandler('groupperm');
    $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
    $read_allowed = $moduleperm_handler->getItemIds('module_read', $groups);
    foreach (array_keys($modules) as $i) {
        if (in_array($i, $read_allowed)) {
            $block['modules'][$i]['name'] = $modules[$i]->getVar('name');
            $block['modules'][$i]['directory'] = $modules[$i]->getVar('dirname');
            $sublinks = $modules[$i]->subLink();
            if (count($sublinks) > 0) {
                foreach ($sublinks as $sublink) {
                    $block['modules'][$i]['sublinks'][] = array('name' => $sublink['name'], 'url' => XOOPS_URL . '/modules/' . $modules[$i]->getVar('dirname') . '/' . $sublink['url']);
                }
            } else {
                $block['modules'][$i]['sublinks'] = array();
            }
        }
    }
    return $block;
}
Beispiel #6
0
 function checkRight($gperm_name, $gperm_itemid, $gperm_groupid, $gperm_modid = 1)
 {
     //ver3.0 by domifara
     if (isset($this->gpermission[$gperm_name]) && isset($this->gpermission[$gperm_name][$gperm_itemid]) && isset($this->gpermission[$gperm_name][$gperm_itemid][serialize($gperm_groupid)]) && isset($this->gpermission[$gperm_name][$gperm_itemid][serialize($gperm_groupid)][$gperm_modid])) {
         return $this->gpermission[$gperm_name][$gperm_itemid][serialize($gperm_groupid)][$gperm_modid];
     }
     $criteria = new CriteriaCompo(new Criteria('gperm_modid', $gperm_modid));
     $criteria->add(new Criteria('gperm_name', $gperm_name));
     $gperm_itemid = intval($gperm_itemid);
     if ($gperm_itemid > 0) {
         $criteria->add(new Criteria('gperm_itemid', $gperm_itemid));
     }
     if (is_array($gperm_groupid)) {
         $criteria2 = new CriteriaCompo();
         foreach ($gperm_groupid as $key => $gid) {
             $criteria2->add(new Criteria('gperm_groupid', $gid), 'OR');
         }
         $criteria->add($criteria2);
     } else {
         $criteria->add(new Criteria('gperm_groupid', $gperm_groupid));
     }
     $ret = false;
     if ($this->getCount($criteria) > 0) {
         $ret = true;
     }
     $this->gpermission[$gperm_name][$gperm_itemid][serialize($gperm_groupid)][$gperm_modid] = $ret;
     return $ret;
 }
Beispiel #7
0
function about_block_page_edit($options)
{
    @(include dirname(dirname(__FILE__)) . "/xoops_version.php");
    $page_handler =& xoops_getmodulehandler('page', 'about');
    $criteria = new CriteriaCompo();
    $criteria->add(new Criteria('page_status', 1), 'AND');
    $criteria->add(new Criteria('page_type', 1));
    $criteria->setSort('page_order');
    $criteria->setOrder('ASC');
    $fields = array("page_id", "page_title", "page_image");
    $pages = $page_handler->getAll($criteria, $fields, false);
    $page_title = '';
    foreach ($pages as $k => $v) {
        $page_title = '<a href="' . XOOPS_URL . '/modules/' . $modversion['dirname'] . '/index.php?page_id=' . $k . '" target="_blank">' . $v['page_title'] . '</a>';
        $options_page[$k] = empty($v['page_image']) ? $page_title : $page_title . '<img src="' . XOOPS_URL . '/modules/' . $modversion['dirname'] . '/images/picture.png' . '" />';
    }
    include_once dirname(dirname(__FILE__)) . '/include/xoopsformloader.php';
    $form = new XoopsBlockForm();
    $page_select = new XoopsFormRadio(_MI_ABOUT_BLOCKPAGE, 'options[0]', $options[0], '<br />');
    $page_select->addOptionArray($options_page);
    $form->addElement($page_select);
    $form->addElement(new XoopsFormText(_MI_ABOUT_TEXT_LENGTH, 'options[1]', 5, 5, $options[1]));
    $form->addElement(new XoopsFormText(_MI_ABOUT_VIEW_MORELINKTEXT, 'options[2]', 30, 50, $options[2]));
    $form->addElement(new XoopsFormRadioYN(_MI_ABOUT_DOTITLEIMAGE, 'options[3]', $options[3]));
    return $form->render();
}
Beispiel #8
0
	function &getModule()
	{
		global $xoopsUser;
		$ret = NULL;
		
		if(empty($this->module_dirname) || empty($this->user_blog_url)){
			return $ret;
		}
		
		$criteria = new CriteriaCompo(new Criteria('hassearch', 1));
		$criteria->add(new Criteria('isactive', 1));
		$criteria->add(new Criteria('dirname', $this->module_dirname));
		$module_handler =& xoops_gethandler('module');
		$blog_module_list =& $module_handler->getList($criteria);
		if(count($blog_module_list) != 1){
			return $ret;
		}
		
		$blog_module =& $module_handler->getByDirName($this->module_dirname);
		if(!is_object($blog_module) || strtolower(get_class($blog_module))!='xoopsmodule'){
			return $ret;
		}
		
		$gperm_handler =& xoops_gethandler('groupperm');
		$groups = is_object($xoopsUser)? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
		
		if($gperm_handler->checkRight('module_read', $blog_module->getVar('mid'), $groups)) {
			$ret =& $blog_module;
		}
		return $ret;
	}
Beispiel #9
0
 function getGrantedGroupsForIds($item_ids_array, $gperm_name = false)
 {
     static $groups;
     if ($gperm_name) {
         if (isset($groups[$gperm_name])) {
             return $groups[$gperm_name];
         }
     } else {
         // if !$gperm_name then we will fetch all permissions in the module so we don't need them again
         return $groups;
     }
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('gperm_modid', $this->mid));
     if ($gperm_name) {
         $criteria->add(new Criteria('gperm_name', $gperm_name));
     }
     $objs = $this->getObjects($criteria);
     foreach ($objs as $obj) {
         $groups[$obj->getVar('gperm_name')][$obj->getVar('gperm_itemid')][] = $obj->getVar('gperm_groupid');
     }
     //Return the permission array
     if ($gperm_name) {
         return isset($groups[$gperm_name]) ? $groups[$gperm_name] : array();
     } else {
         return isset($groups) ? $groups : array();
     }
 }
Beispiel #10
0
function publisher_date_to_date_show($options)
{
    $myts = MyTextSanitizer::getInstance();
    $publisher = PublisherPublisher::getInstance();
    $block = array();
    $criteria = new CriteriaCompo();
    $criteria->add(new Criteria('datesub', strtotime($options[0]), '>'));
    $criteria->add(new Criteria('datesub', strtotime($options[1]), '<'));
    $criteria->setSort('datesub');
    $criteria->setOrder('DESC');
    // creating the ITEM objects that belong to the selected category
    $itemsObj = $publisher->getHandler('item')->getObjects($criteria);
    $totalItems = count($itemsObj);
    if ($itemsObj) {
        for ($i = 0; $i < $totalItems; $i++) {
            $newItems['itemid'] = $itemsObj[$i]->itemid();
            $newItems['title'] = $itemsObj[$i]->title();
            $newItems['categoryname'] = $itemsObj[$i]->getCategoryName();
            $newItems['categoryid'] = $itemsObj[$i]->categoryid();
            $newItems['date'] = $itemsObj[$i]->datesub();
            $newItems['poster'] = $itemsObj[$i]->linkedPosterName();
            $newItems['itemlink'] = $itemsObj[$i]->getItemLink(false, isset($options[3]) ? $options[3] : 65);
            $newItems['categorylink'] = $itemsObj[$i]->getCategoryLink();
            $block['items'][] = $newItems;
        }
        $block['lang_title'] = _MB_PUBLISHER_ITEMS;
        $block['lang_category'] = _MB_PUBLISHER_CATEGORY;
        $block['lang_poster'] = _MB_PUBLISHER_POSTEDBY;
        $block['lang_date'] = _MB_PUBLISHER_DATE;
        $modulename = $myts->displayTarea($publisher->getModule()->getVar('name'));
        $block['lang_visitItem'] = _MB_PUBLISHER_VISITITEM . " " . $modulename;
        $block['lang_articles_from_to'] = sprintf(_MB_PUBLISHER_ARTICLES_FROM_TO, $options[0], $options[1]);
    }
    return $block;
}
/**
 * xoopsfaq_search()
 *
 * @param mixed $queryarray
 * @param mixed $andor
 * @param mixed $limit
 * @param mixed $offset
 * @param mixed $userid
 * @return
 */
function xoopsfaq_search($queryarray, $andor, $limit, $offset, $userid)
{
    global $xoopsDB;
    $ret = array();
    if ($userid != 0) {
        return $ret;
    }
    $xfDir = basename(dirname(dirname(__FILE__)));
    $xfContentsHandler =& xoops_getmodulehandler('contents', $xfDir);
    $contentFields = array('contents_id', 'contents_cid', 'contents_title', 'contents_contents', 'contents_publish');
    $criteria = new CriteriaCompo();
    $criteria->add(new Criteria('contents_active', 1, '='));
    $criteria->setSort('contents_id');
    $criteria->setOrder('DESC');
    $criteria->setLimit(intval($limit));
    $criteria->setStart(intval($offset));
    if (is_array($queryarray) && !empty($queryarray)) {
        $criteria->add(new Criteria('contents_title', "%{$queryarray[0]}%", 'LIKE'));
        $criteria->add(new Criteria('contents_contents', "%{$queryarray[0]}%", 'LIKE'), 'OR');
        array_shift($queryarray);
        //get rid of first element
        foreach ($queryarray as $query) {
            $criteria->add(new Criteria('contents_title', "%{$query}%", 'LIKE'), $andor);
            $criteria->add(new Criteria('contents_contents', "%{$query}%", 'LIKE'), 'OR');
        }
    }
    $contentArray = $xfContentsHandler->getAll($criteria, $contentFields, false);
    foreach ($contentArray as $content) {
        $ret[] = array('image' => 'images/question2.gif', 'link' => "index.php?cat_id=" . $content['contents_cid'] . "#" . $content['contents_id'], 'title' => $content['contents_title'], 'time' => $content['contents_publish']);
    }
    unset($contentArray);
    return $ret;
}
function update_block_permissions($old_gid, $new_gid)
{
    // get handlers
    $gperm_handler =& xoops_gethandler('groupperm');
    $module_handler =& xoops_gethandler('module');
    $module =& $module_handler->getByDirname('xoonips');
    $mid = $module->getVar('mid');
    $block_objs =& XoopsBlock::getByModule($mid);
    foreach ($block_objs as $block_obj) {
        // find moderator menu block
        if ($block_obj->getVar('show_func') == 'b_xoonips_moderator_show') {
            $bid = $block_obj->getVar('bid');
            // if old_gid don't have module admin right,
            // delete the right to access from old_gid.
            if (!$gperm_handler->checkRight('module_admin', $mid, $old_gid)) {
                $criteria = new CriteriaCompo();
                $criteria->add(new Criteria('gperm_groupid', $old_gid));
                $criteria->add(new Criteria('gperm_itemid', $bid));
                $criteria->add(new Criteria('gperm_name', 'block_read'));
                $gperm_handler->deleteAll($criteria);
            }
            // if there is no right to access moderator block in new_gid,
            // the right gives new_gid.
            if (!$gperm_handler->checkRight('block_read', $bid, $new_gid)) {
                $gperm_handler->addRight('block_read', $bid, $new_gid);
            }
            break;
        }
    }
}
Beispiel #13
0
 public static function makeKeywordCriteria(CriteriaCompo $cri, $dirname, $keywords, $andor = 'AND')
 {
     $handler = Legacy_Utils::getModuleHandler('definition', $dirname);
     //keywords
     $keywordArr = self::splitKeywords($keywords);
     //definition
     $cri->add(new Criteria('search_flag', 1));
     $cri->add(new Criteria('field_type', array(Xcck_FieldType::STRING, Xcck_FieldType::TEXT, Xcck_FieldType::URI), 'IN'));
     $defObjs = $handler->getObjects($cri);
     foreach ($defObjs as $obj) {
         $fieldList['field_name'][] = $obj->get('field_name');
         $fieldList['field_type'][] = $obj->get('field_type');
     }
     //page
     $cri = new CriteriaCompo();
     foreach ($defObjs as $def) {
         foreach ($keywordArr as $keyword) {
             if (strtoupper($andor) === 'OR') {
                 $cri->add(new Criteria($def->get('field_name'), self::makeKeyword($keyword), 'LIKE'), 'OR');
             } else {
                 $cri->add(new Criteria($def->get('field_name'), self::makeKeyword($keyword), 'LIKE'));
             }
         }
     }
     return $cri;
 }
Beispiel #14
0
 function getGrantedGroupsForIds($item_ids_array, $gperm_name = false)
 {
     static $groups;
     static $smartsection_all_permissions_fetched;
     if ($gperm_name) {
         if (isset($groups[$gperm_name])) {
             return $groups[$gperm_name];
         }
     } else {
         // if !$gperm_name then we will fetch all permissions in the module so we don't need them again
         if ($smartsection_all_permissions_fetched) {
             return $groups;
         } else {
             $smartsection_all_permissions_fetched = true;
         }
     }
     $smartModule =& smartsection_getModuleInfo();
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('gperm_modid', $smartModule->getVar('mid')));
     if ($gperm_name) {
         $criteria->add(new Criteria('gperm_name', $gperm_name));
     }
     //Get group permissions handler
     $gperm_handler =& xoops_gethandler('groupperm');
     $permissionsObj = $gperm_handler->getObjects($criteria);
     foreach ($permissionsObj as $permissionObj) {
         $groups[$permissionObj->getVar('gperm_name')][$permissionObj->getVar('gperm_itemid')][] = $permissionObj->getVar('gperm_groupid');
     }
     //Return the permission array
     if ($gperm_name) {
         return isset($groups[$gperm_name]) ? $groups[$gperm_name] : array();
     } else {
         return isset($groups) ? $groups : array();
     }
 }
Beispiel #15
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;
}
 /**
  * _setupObject
  * 
  * @param    void
  * 
  * @return    void
  **/
 protected function _setupObject()
 {
     $dirname = $this->mRoot->mContext->mRequest->getRequest('dirname');
     $dataname = $this->mRoot->mContext->mRequest->getRequest('dataname');
     $groupId = $this->mRoot->mContext->mRequest->getRequest('group_id');
     XCube_DelegateUtils::call('Legacy_GroupClient.GetActionList', new XCube_Ref($this->mActionList), $dirname, $dataname);
     $this->mObjectHandler =& $this->_getHandler();
     $cri = new CriteriaCompo();
     $cri->add(new Criteria('dirname', $dirname));
     $cri->add(new Criteria('dataname', $dataname));
     $cri->add(new Criteria('group_id', $groupId));
     $cri->add(new Criteria('action', $this->mActionList['action'], 'IN'));
     $this->mObject = $this->mObjectHandler->getObjects($cri);
     if (count($this->mObject) < count($this->mActionList['action'])) {
         foreach (array_keys($this->mActionList['action']) as $key) {
             if (!$this->_checkObject($this->mActionList['action'][$key])) {
                 $obj = $this->mObjectHandler->create();
                 $obj->set('group_id', $groupId);
                 $obj->set('dirname', $dirname);
                 $obj->set('dataname', $dataname);
                 $obj->set('action', $this->mActionList['action'][$key]);
                 $obj->set('rank', $this->mActionList['rank'][$key]);
                 $this->mObject[] = $obj;
                 unset($obj);
             }
         }
     }
     $this->mPolicyArr = array('groupId' => $groupId, 'dirname' => $dirname, 'dataname' => $dataname);
 }
Beispiel #17
0
/**
 * @param $options
 * @return array
 */
function alumni_show($options)
{
    $block = array();
    $myts = MyTextSanitizer::getInstance();
    $xoops = Xoops::getInstance();
    $helper = $xoops->getModuleHelper('alumni');
    $module_id = $helper->getModule()->getVar('mid');
    $listingHandler = $helper->getHandler('listing');
    $groups = $xoops->getUserGroups();
    $alumni_ids = $xoops->getHandlerGroupPermission()->getItemIds('alumni_view', $groups, $module_id);
    $all_ids = implode(', ', $alumni_ids);
    $criteria = new CriteriaCompo();
    $criteria->add(new Criteria('valid', 1, '='));
    $criteria->add(new Criteria('cid', '(' . $all_ids . ')', 'IN'));
    $criteria->setLimit($options[1]);
    $criteria->setSort('date');
    $criteria->setOrder('DESC');
    $block_listings = $listingHandler->getall($criteria);
    foreach (array_keys($block_listings) as $i) {
        $name = $block_listings[$i]->getVar('name');
        $mname = $block_listings[$i]->getVar('mname');
        $lname = $block_listings[$i]->getVar('lname');
        $school = $block_listings[$i]->getVar('school');
        $year = $block_listings[$i]->getVar('year');
        $view = $block_listings[$i]->getVar('view');
        $a_item = array();
        $a_item['school'] = $school;
        $a_item['link'] = '<a href="' . XOOPS_URL . "/modules/alumni/listing.php?lid=" . addslashes($block_listings[$i]->getVar('lid')) . "\"><b>{$year}&nbsp;-&nbsp;{$name} {$mname} {$lname}</b><br /></a>";
        $block['items'][] = $a_item;
    }
    $block['lang_title'] = AlumniLocale::BLOCKS_ITEM;
    $block['lang_date'] = AlumniLocale::BLOCKS_DATE;
    $block['link'] = "<a href=\"" . XOOPS_URL . "/modules/alumni/index.php\"><b>" . AlumniLocale::BLOCKS_ALL_LISTINGS . "</b></a></div>";
    return $block;
}
Beispiel #18
0
 function checkLogin(&$xoopsUser)
 {
     $root =& XCube_Root::getSingleton();
     if ($root->mContext->mUser->isInRole('Site.RegisteredUser')) {
         return;
     }
     $root->mLanguageManager->loadModuleMessageCatalog('user');
     $userHandler =& xoops_getmodulehandler('users', 'user');
     $criteria = new CriteriaCompo();
     if (xoops_getrequest('uname') != "" && strpos(xoops_getrequest('uname'), '@') !== false) {
         $criteria->add(new Criteria('email', xoops_getrequest('uname')));
     } else {
         $criteria->add(new Criteria('uname', xoops_getrequest('uname')));
         // use for both e-mail or uname logiin
         //	$criteria->add(new Criteria('uname',''));				// use for only e-mail logiin
     }
     $criteria->add(new Criteria('pass', md5(xoops_getrequest('pass'))));
     $userArr =& $userHandler->getObjects($criteria);
     if (count($userArr) != 1) {
         return;
     }
     if ($userArr[0]->get('level') == 0) {
         return;
     }
     $handler =& xoops_gethandler('user');
     $user =& $handler->get($userArr[0]->get('uid'));
     $xoopsUser = $user;
     require_once XOOPS_ROOT_PATH . '/include/session.php';
     xoops_session_regenerate();
     $_SESSION = array();
     $_SESSION['xoopsUserId'] = $xoopsUser->get('uid');
     $_SESSION['xoopsUserGroups'] = $xoopsUser->getGroups();
 }
Beispiel #19
0
function dispatch()
{
	global $xoopsUser, $xoopsUserIsAdmin;
	
	if($this->isGuest() || !$this->validateToken('MEMBER_EDIT')){
		redirect_header(XOOPS_URL, 2, _NOPERM);
	}
	$own_uid = $xoopsUser->getVar('uid');
	
	$cid = $this->getIntRequest('cid');
	$uid = $this->getIntRequest('uid');
	if(!$cid || !$uid || $uid == $own_uid){
		redirect_header(XOOPS_URL, 2, _NOPERM);
	}
	
	// コミュニティの取得
	$perm = XSNS_AUTH_XOOPS_ADMIN | XSNS_AUTH_ADMIN;
	$commu_handler =& XsnsCommunityHandler::getInstance();
	$community =& $commu_handler->get($cid);
	if(!is_object($community) || !$community->checkAuthority($perm)){
		redirect_header(XOOPS_URL, 2, _NOPERM);
	}
	
	// 対象コミュニティメンバーの取得
	$c_member_handler =& XsnsMemberHandler::getInstance();
	$c_member =& $c_member_handler->getOne($cid, $uid);
	if(!is_object($c_member)){
		redirect_header(XOOPS_URL, 2, _NOPERM);
	}
	$c_member_info =& $c_member->getInfo();
	
	// コミュニティメンバーの強制退会
	if($c_member_handler->delete($c_member)){
		
		// 既存の依頼を削除
		$confirm_handler =& XsnsConfirmHandler::getInstance();
		$criteria = new CriteriaCompo(new Criteria('c_commu_id', $cid));
		$criteria->add(new Criteria('uid_from', $own_uid));
		$criteria->add(new Criteria('uid_to', $uid));
		$criteria->add(new Criteria('mode', '(1,2)', 'IN'));	// 管理者交代 or 副管理者就任
		$confirm_handler->deleteObjects($criteria);
		
		// XOOPS管理者による特別な処理
		if($xoopsUserIsAdmin){
			// 対象が管理者の場合、自分が管理者に代わる
			if($uid == $community->getVar('uid_admin')){
				$community->setVar('uid_admin', $own_uid);
			}
			// 対象が副管理者の場合、副管理者は無しにする
			elseif($uid == $community->getVar('uid_sub_admin')){
				$community->setVar('uid_sub_admin', 0);
			}
			$commu_handler->insert($community);
		}
		
		redirect_header(XSNS_URL_COMMU.'?cid='.$cid, 2, sprintf(_MD_XSNS_MEMBER_LEAVE_OK, $c_member_info['name']));
	}
	redirect_header(XSNS_URL_COMMU, 2, _MD_XSNS_MEMBER_LEAVE_NG);
}
Beispiel #20
0
 /**
  * Export  data
  * @return boolean
  */
 function export()
 {
     $def = array(array('o_id', 'N', 10, 0), array('o_uid', 'N', 10, 0), array('o_date', 'D'), array('o_state', 'N', 1, 0), array('o_ip', 'C', 32), array('o_lastname', 'C', 155), array('o_firstnam', 'C', 155), array('o_adress', 'C', 155), array('o_zip', 'C', 30), array('o_town', 'C', 155), array('o_country', 'C', 3), array('o_telephon', 'C', 30), array('o_email', 'C', 155), array('o_articles', 'N', 10, 0), array('o_total', 'N', 10, 2), array('o_shipping', 'N', 10, 2), array('o_bill', 'L'), array('o_password', 'C', 155), array('o_text', 'C', 155), array('o_cancel', 'C', 155), array('c_id', 'N', 10, 0), array('c_prod_id', 'N', 10, 0), array('c_qte', 'N', 10, 0), array('c_price', 'N', 10, 2), array('c_o_id', 'N', 10, 0), array('c_shipping', 'N', 10, 2), array('c_pass', 'C', 155));
     /*
      * Correspondances
      * cmd_id				   o_id
      * cmd_uid                 o_uid
      * cmd_date                o_date
      * cmd_state               o_state
      * cmd_ip                  o_ip
      * cmd_lastname            o_lastname
      * cmd_firstname           o_firstnam
      * cmd_adress              o_adress
      * cmd_zip                 o_zip
      * cmd_town                o_town
      * cmd_country             o_country
      * cmd_telephone           o_telephon
      * cmd_email               o_email
      * cmd_articles_count      o_articles
      * cmd_total               o_total
      * cmd_shipping            o_shipping
      * cmd_bill                o_bill
      * cmd_password            o_password
      * cmd_text                o_text
      * cmd_cancel              o_cancel
      * caddy_id                c_id
      * caddy_product_id        c_prod_id
      * caddy_qte               c_qte
      * caddy_price             c_price
      * caddy_cmd_id            c_o_id
      * caddy_shipping          c_shipping
      * caddy_pass              c_pass
      */
     if (!dbase_create($this->folder . DIRECTORY_SEPARATOR . $this->filename, $def)) {
         $this->success = false;
         return false;
     }
     $dbf = dbase_open($this->folder . DIRECTORY_SEPARATOR . $this->filename, 2);
     if ($dbf === false) {
         $this->success = false;
         return false;
     }
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('cmd_id', 0, '<>'));
     $criteria->add(new Criteria('cmd_state', $this->orderType, '='));
     $criteria->setSort('cmd_date');
     $criteria->setOrder('DESC');
     $orders = $this->handlers->h_myshop_commands->getObjects($criteria);
     foreach ($orders as $order) {
         $carts = array();
         $carts = $this->handlers->h_myshop_caddy->getObjects(new Criteria('caddy_cmd_id', $order->getVar('cmd_id'), '='));
         foreach ($carts as $cart) {
             dbase_add_record($dbf, array($order->getVar('cmd_id'), $order->getVar('cmd_uid'), date('Ymd', strtotime($order->getVar('cmd_date'))), $order->getVar('cmd_state'), $order->getVar('cmd_ip'), $order->getVar('cmd_lastname'), $order->getVar('cmd_firstname'), $order->getVar('cmd_adress'), $order->getVar('cmd_zip'), $order->getVar('cmd_town'), $order->getVar('cmd_country'), $order->getVar('cmd_telephone'), $order->getVar('cmd_email'), $order->getVar('cmd_articles_count'), $order->getVar('cmd_total'), $order->getVar('cmd_shipping'), $order->getVar('cmd_bill'), $order->getVar('cmd_password'), $order->getVar('cmd_text'), $order->getVar('cmd_cancel'), $cart->getVar('caddy_id'), $cart->getVar('caddy_product_id'), $cart->getVar('caddy_qte'), $cart->getVar('caddy_price'), $cart->getVar('caddy_cmd_id'), $cart->getVar('caddy_shipping'), $cart->getVar('caddy_pass')));
         }
     }
     dbase_close($dbf);
     $this->success = true;
     return true;
 }
Beispiel #21
0
 function isUserOfGroup($uid, $groupid)
 {
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('groupid', $groupid));
     $criteria->add(new Criteria('uid', $uid));
     $objs =& $this->getObjects($criteria);
     return count($objs) > 0 && is_object($objs[0]);
 }
 function fetch()
 {
     parent::fetch();
     $root =& XCube_Root::getSingleton();
     $image_display = $root->mContext->mRequest->getRequest('image_display');
     $imgcat_id = $root->mContext->mRequest->getRequest('imgcat_id');
     $option_field = $root->mContext->mRequest->getRequest('option_field');
     $option_field2 = $root->mContext->mRequest->getRequest('option_field2');
     $search = $root->mContext->mRequest->getRequest('search');
     if (isset($_REQUEST['image_display'])) {
         $this->mNavi->addExtra('image_display', xoops_getrequest('image_display'));
         $this->_mCriteria->add(new Criteria('image_display', xoops_getrequest('image_display')));
     }
     if (isset($_REQUEST['imgcat_id'])) {
         $this->mNavi->addExtra('imgcat_id', xoops_getrequest('imgcat_id'));
         $this->_mCriteria->add(new Criteria('imgcat_id', xoops_getrequest('imgcat_id')));
     }
     if (isset($_REQUEST['option_field'])) {
         $this->mNavi->addExtra('option_field', $option_field);
         $this->mOptionField = $option_field;
         if ($this->mOptionField == "visible") {
             $this->_mCriteria->add(new Criteria('image_display', '1'));
         } elseif ($this->mOptionField == "invisible") {
             $this->_mCriteria->add(new Criteria('image_display', '0'));
         } else {
             //all
         }
     }
     if (isset($_REQUEST['option_field2'])) {
         $this->mNavi->addExtra('option_field2', $option_field2);
         $this->mOptionField2 = $option_field2;
         if ($this->mOptionField2 == "gif") {
             $this->_mCriteria->add(new Criteria('image_mimetype', 'image/gif'));
         } elseif ($this->mOptionField2 == "png") {
             $this->_mCriteria->add(new Criteria('image_mimetype', 'image/png'));
         } elseif ($this->mOptionField2 == "jpeg") {
             $cri = new CriteriaCompo();
             $cri->add(new Criteria('image_mimetype', 'image/jpeg'));
             $cri->add(new Criteria('image_mimetype', 'image/pjpeg'), 'OR');
             $this->_mCriteria->add($cri);
         } else {
             //all
         }
     }
     //
     if (!empty($search)) {
         $this->mKeyword = $search;
         $this->mNavi->addExtra('search', $this->mKeyword);
         $this->_mCriteria->add(new Criteria('image_nicename', '%' . $this->mKeyword . '%', 'LIKE'));
     }
     $this->_mCriteria->addSort($this->getSort(), $this->getOrder());
     /*
     if (abs($this->mSort) != IMAGE_SORT_KEY_IMAGE_WEIGHT) {
     	$this->_mCriteria->addSort($this->mSortKeys[IMAGE_SORT_KEY_IMAGE_WEIGHT], $this->getOrder());
     }
     */
 }
Beispiel #23
0
 /**
  * @param int $uid
  *
  * @return int
  */
 public function userPosts($uid)
 {
     $comments = \Xoops::getModuleHelper('comments');
     //need this here to init constants
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('status', Comments::STATUS_ACTIVE));
     $criteria->add(new Criteria('uid', $uid));
     return $comments->getHandlerComment()->getCount($criteria);
 }
Beispiel #24
0
 /**
  * @param int $uid
  *
  * @return int
  */
 public function userPosts($uid)
 {
     $comments = Comments::getInstance();
     //need this here to init constants
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('status', COMMENTS_ACTIVE));
     $criteria->add(new Criteria('uid', $uid));
     return Comments::getInstance()->getHandlerComment()->getCount($criteria);
 }
Beispiel #25
0
 public function getLatestRevision($pageId, $status = Lenum_Status::PROGRESS)
 {
     $cri = new CriteriaCompo();
     $cri->add(new Criteria('page_id', $pageId));
     $cri->add(new Criteria('status', $status, '>='));
     $cri->setSort('revision_id', 'DESC');
     $objs = $this->getObjects($cri);
     return count($objs) > 0 ? array_shift($objs) : null;
 }
Beispiel #26
0
 /**
  * Gets users who this mailjob will send mail to, with $retry number.
  * @param int $retry
  */
 function &getUsers($retry)
 {
     $handler =& xoops_getmodulehandler('mailjob_link', 'user');
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('mailjob_id', $this->get('mailjob_id')));
     $criteria->add(new Criteria('retry', $retry));
     $arr =& $handler->getObjects($criteria);
     return $arr;
 }
Beispiel #27
0
 function setContent($isreturn = false)
 {
     global $jieqiTpl;
     global $jieqiConfigs;
     jieqi_getconfigs('article', 'configs');
     $article_static_url = empty($jieqiConfigs['article']['staticurl']) ? $GLOBALS['jieqiModules']['article']['url'] : $jieqiConfigs['article']['staticurl'];
     $article_dynamic_url = empty($jieqiConfigs['article']['dynamicurl']) ? $GLOBALS['jieqiModules']['article']['url'] : $jieqiConfigs['article']['dynamicurl'];
     $jieqiTpl->assign('article_static_url', $article_static_url);
     $jieqiTpl->assign('article_dynamic_url', $article_dynamic_url);
     jieqi_includedb();
     $query = JieqiQueryHandler::getInstance('JieqiQueryHandler');
     $criteria = new CriteriaCompo();
     $criteria->setFields("r.*,a.articlename");
     $criteria->setTables(jieqi_dbprefix('article_reviews') . " AS r LEFT JOIN " . jieqi_dbprefix('article_article') . " AS a ON r.ownerid=a.articleid");
     if ($this->exevars['istop'] == 1) {
         $criteria->add(new Criteria('r.istop', '1'));
     } elseif ($this->exevars['istop'] == 2) {
         $criteria->add(new Criteria('r.istop', '0'));
     }
     if ($this->exevars['isgood'] == 1) {
         $criteria->add(new Criteria('r.isgood', '1'));
     } elseif ($this->exevars['isgood'] == 2) {
         $criteria->add(new Criteria('r.isgood', '0'));
     }
     $criteria->setSort('r.topicid');
     $criteria->setOrder('DESC');
     $criteria->setLimit($this->exevars['listnum']);
     $criteria->setStart(0);
     $query->queryObjects($criteria);
     $reviewrows = array();
     $i = 0;
     while ($v = $query->getObject()) {
         $reviewrows[$i]['reviewtitle'] = jieqi_htmlstr(str_replace(array("\r", "\n"), array('', ' '), $v->getVar('title', 'n')));
         $reviewrows[$i]['ownerid'] = $v->getVar('ownerid');
         $reviewrows[$i]['articlename'] = $v->getVar('articlename');
         $reviewrows[$i]['topicid'] = $v->getVar('topicid');
         $reviewrows[$i]['url_review'] = $article_dynamic_url . '/reviews.php?aid=' . $v->getVar('ownerid');
         $reviewrows[$i]['poster'] = $v->getVar('poster');
         $reviewrows[$i]['posterid'] = $v->getVar('posterid');
         $reviewrows[$i]['postdate'] = date('m-d H:i', $v->getVar('posttime'));
         $reviewrows[$i]['posttime'] = $v->getVar('posttime');
         $reviewrows[$i]['replytime'] = $v->getVar('replytime');
         $reviewrows[$i]['views'] = $v->getVar('views');
         $reviewrows[$i]['replies'] = $v->getVar('replies');
         $reviewrows[$i]['islock'] = $v->getVar('islock');
         $reviewrows[$i]['istop'] = $v->getVar('istop');
         $reviewrows[$i]['isgood'] = $v->getVar('isgood');
         $reviewrows[$i]['topictype'] = $v->getVar('topictype');
         $reviewrows[$i]['url_articleinfo'] = jieqi_geturl('article', 'article', $v->getVar('ownerid'), 'info');
         $reviewrows[$i]['url_articleindex'] = jieqi_geturl('article', 'article', $v->getVar('ownerid'), 'index');
         $reviewrows[$i]['url_articleread'] = $reviewrows[$i]['url_articleindex'];
         $i++;
     }
     $jieqiTpl->assign_by_ref('reviewrows', $reviewrows);
     $jieqiTpl->assign('url_more', $article_dynamic_url . '/reviewslist.php');
 }
 /**
  * _getPermit
  * 
  * @param   int		$groupId
  * 
  * @return  Lecat_PermitObject[]
  **/
 protected function _getPermit($groupid = 0)
 {
     $handler = Legacy_Utils::getModuleHandler('permit', $this->mAsset->mDirname);
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('cat_id', 0));
     if (intval($groupid) > 0) {
         $criteria->add(new Criteria('groupid', $groupid));
     }
     return $handler->getObjects($criteria);
 }
Beispiel #29
0
 function setContent($isreturn = false)
 {
     global $jieqiTpl;
     include_once JIEQI_ROOT_PATH . '/class/ptopics.php';
     $ptopics_handler =& JieqiPtopicsHandler::getInstance('JieqiPtopicsHandler');
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('ownerid', $this->blockvars['cacheid']));
     if ($this->exevars['istop'] == 1) {
         $criteria->add(new Criteria('istop', 1));
     } elseif ($this->exevars['istop'] == 2) {
         $criteria->add(new Criteria('istop', 0));
     }
     if ($this->exevars['isgood'] == 1) {
         $criteria->add(new Criteria('isgood', 1));
     } elseif ($this->exevars['isgood'] == 2) {
         $criteria->add(new Criteria('isgood', 0));
     }
     if ($this->exevars['islock'] == 1) {
         $criteria->add(new Criteria('islock', 1));
     } elseif ($this->exevars['islock'] == 2) {
         $criteria->add(new Criteria('islock', 0));
     }
     $criteria->setSort($this->exevars['field']);
     if ($this->exevars['asc'] == 1) {
         $criteria->setOrder('ASC');
     } else {
         $criteria->setOrder('DESC');
     }
     $criteria->setLimit($this->exevars['listnum']);
     $criteria->setStart(0);
     $ptopics_handler->queryObjects($criteria);
     $ptopicrows = array();
     $k = 0;
     while ($v = $ptopics_handler->getObject()) {
         $ptopicrows[$k]['istop'] = $v->getVar('istop');
         $ptopicrows[$k]['isgood'] = $v->getVar('isgood');
         $ptopicrows[$k]['islock'] = $v->getVar('islock');
         $ptopicrows[$k]['topicid'] = $v->getVar('topicid');
         $ptopicrows[$k]['posttime'] = $v->getVar('posttime');
         $ptopicrows[$k]['replytime'] = $v->getVar('replytime');
         $ptopicrows[$k]['posterid'] = $v->getVar('posterid');
         $ptopicrows[$k]['poster'] = $v->getVar('poster');
         $ptopicrows[$k]['title'] = $v->getVar('title');
         $ptopicrows[$k]['views'] = $v->getVar('views');
         $ptopicrows[$k]['replies'] = $v->getVar('replies');
         $ptopicrows[$k]['size'] = $v->getVar('size');
         $ptopicrows[$k]['size_c'] = ceil($v->getVar('size') / 2);
         $ptopicrows[$k]['ownerid'] = $v->getVar('ownerid');
         $k++;
     }
     $jieqiTpl->assign_by_ref('ptopicrows', $ptopicrows);
     $jieqiTpl->assign('ownerid', $this->blockvars['cacheid']);
     $jieqiTpl->assign('url_more', JIEQI_URL . '/ptopics?oid=' . $this->blockvars['cacheid']);
 }
 function validateLogin()
 {
     if (strlen($this->get('login')) > 0) {
         $handler =& xoops_getmodulehandler('bannerclient', 'legacyRender');
         $criteria = new CriteriaCompo();
         $criteria->add(new Criteria('login', $this->get('login')));
         $criteria->add(new Criteria('cid', $this->get('cid'), '<>'));
         if ($handler->getCount($criteria) > 0) {
             $this->addErrorMessage(_AD_LEGACYRENDER_ERROR_LOGIN_REPETITION);
         }
     }
 }