function smarty_function_legacy_tag_select($params, &$smarty)
{
	$tDirname = $params['tDirname'];
	$dirname = isset($params['dirname']) ? $params['dirname'] : null;
	$dataname = isset($params['dataname']) ? $params['dataname'] : null;
	$uidList = isset($params['uidList']) ? $params['uidList'] : null;
	$tags = isset($params['tags']) ? $params['tags'] : null;	//selected tags
	$template = isset($params['template']) ? $params['template'] : 'legacy_inc_tag_select.html';
	$cloud = array();

	XCube_DelegateUtils::call('Legacy_Tag.'.$tDirname.'.GetTagCloudSrc',
		new XCube_Ref($cloud),
		$tDirname,
		$dirname,
		$dataname,
		$uidList
	);

	//render template
	$render = new XCube_RenderTarget();
	$render->setTemplateName($template);
	$render->setAttribute('legacy_buffertype',XCUBE_RENDER_TARGET_TYPE_MAIN);
	$render->setAttribute('cloud', $cloud);
	$render->setAttribute('tags', $tags);
	XCube_Root::getSingleton()->getRenderSystem('Legacy_RenderSystem')->render($render);

	echo $render->getResult();
}
Пример #2
0
 function getDefaultView(&$controller, &$xoopsUser)
 {
     if (!isset($_REQUEST['actkey']) || !$this->mObject) {
         $controller->executeForward(XOOPS_URL . '/');
     }
     if ($this->mObject->get('actkey') != xoops_getrequest('actkey')) {
         $controller->executeRedirect(XOOPS_URL . '/', 3, _MD_USER_MESSAGE_ACTKEYNOT);
     }
     if ($this->mObject->get('level') > 0) {
         $controller->executeRedirect(XOOPS_URL . '/user.php', 3, _MD_USER_MESSAGE_ACONTACT);
     }
     $this->mObject->set('level', '1');
     //
     // Force update with GET request
     //
     $this->mObjectHandler->insert($this->mObject, true);
     if ($this->mConfig['activation_type'] == 2) {
         $builder = new User_RegistAdminCommitMailBuilder();
         $director = new User_UserRegistMailDirector($builder, $this->mObject, $controller->mRoot->mContext->getXoopsConfig(), $this->mConfig);
         $director->contruct();
         $mailer =& $builder->getResult();
         XCube_DelegateUtils::call('Legacy.Event.RegistUser.SendMail', new XCube_Ref($mailer), 'Activated');
         if ($mailer->send()) {
             $controller->executeRedirect(XOOPS_URL . '/', 5, sprintf(_MD_USER_MESSAGE_ACTVMAILOK, $this->mObject->get('uname')));
         } else {
             $controller->executeRedirect(XOOPS_URL . '/', 5, sprintf(_MD_USER_MESSAGE_ACTVMAILNG, $this->mObject->get('uname')));
         }
     } else {
         $controller->executeRedirect(XOOPS_URL . '/user.php', 5, _MD_USER_MESSAGE_ACTLOGIN);
     }
 }
Пример #3
0
 function resign(&$flag, &$controller, &$xoopsUser)
 {
     $handler =& xoops_gethandler('member');
     $groups = $handler->getGroupsByUser($xoopsUser->get('uid'));
     foreach ($groups as $group) {
         $handler->removeUserFromGroup($group, $xoopsUser->get('uid'));
     }
     $handler->addUserToGroup(RESIGN_USER_GROUP_ID, $xoopsUser->get('uid'));
     xoops_notification_deletebyuser($xoopsUser->get('uid'));
     XCube_DelegateUtils::call('Legacy.Event.UserDelete', new XCube_Ref($xoopsUser));
     $flag = true;
     $root =& XCube_Root::getSingleton();
     // Reset session
     $_SESSION = array();
     $root->mSession->destroy(true);
     // reset online
     $handler =& xoops_gethandler('online');
     $handler->destroy($xoopsUser->get('uid'));
     xoops_notification_deletebyuser($xoopsUser->get('uid'));
     // Redirect not to call behind delegates.
     $langMgr =& $root->getLanguageManager();
     $langMgr->loadPageTypeMessageCatalog('user');
     $controller =& $root->getController();
     $controller->executeRedirect(XOOPS_URL, 3, _US_BEENDELED);
 }
Пример #4
0
function smarty_function_legacy_comment($params, &$smarty)
{
	$cDirname = $params['cDirname'];
	$dirname = isset($params['dirname']) ? $params['dirname'] : null;
	$dataname = isset($params['dataname']) ? $params['dataname'] : null;
	$dataId = isset($params['data_id']) ? $params['data_id'] : 0;
	$categoryId = isset($params['category_id']) ? $params['category_id'] : 0;
	$comments = null;

	XCube_DelegateUtils::call('Legacy_Comment.'.$cDirname.'.GetComments',
		new XCube_Ref($comments),
		$cDirname,
		$dirname,
		$dataname,
		$dataId,
		$categoryId,
		$params
	);

	$template = isset($params['template']) ? $params['template'] : $comments['template'];

	//render template
	$render = new XCube_RenderTarget();
	$render->setTemplateName($template);
	$render->setAttribute('legacy_buffertype',XCUBE_RENDER_TARGET_TYPE_MAIN);
	$render->setAttribute('comments', $comments);
	XCube_Root::getSingleton()->getRenderSystem('Legacy_RenderSystem')->render($render);

	echo $render->getResult();
}
Пример #5
0
function smarty_function_legacy_map_edit($params, &$smarty)
{
    $dirname = isset($params['dirname']) ? $params['dirname'] : null;
    $dataname = isset($params['dataname']) ? $params['dataname'] : null;
    $dataId = isset($params['data_id']) ? $params['data_id'] : null;
    $addressId = isset($params['geocode']) ? $params['geocode'] : null;
    $template = isset($params['template']) ? $params['template'] : 'legacy_inc_map_edit.html';
    $places = array();
    XCube_DelegateUtils::call('Legacy_Map.GetPlaces', new XCube_Ref($places), $dirname, $dataname, $dataId);
    $root = XCube_Root::getSingleton();
    $latitude = $root->mContext->mRequest->getRequest('latitude');
    $longitude = $root->mContext->mRequest->getRequest('longitude');
    $request = null;
    if (isset($latitude) && isset($longitude)) {
        $request = array('latitude' => $latitude, 'longitude' => $longitude, 'zoom' => 10);
    }
    //render template
    $render = new XCube_RenderTarget();
    $render->setTemplateName($template);
    $render->setAttribute('legacy_buffertype', XCUBE_RENDER_TARGET_TYPE_MAIN);
    $render->setAttribute('places', $places);
    $render->setAttribute('geocode', $geocode);
    $render->setAttribute('request', $request);
    XCube_Root::getSingleton()->getRenderSystem('Legacy_RenderSystem')->render($render);
    echo $render->getResult();
}
 function execute(&$controller, &$xoopsUser)
 {
     if (XCube_Root::getSingleton()->mContext->mRequest->getRequest('_form_control_cancel') != null) {
         return USER_FRAME_VIEW_CANCEL;
     }
     $memberHandler =& xoops_gethandler('member');
     $this->mNewUser =& $memberHandler->createUser();
     $this->mRegistForm->update($this->mNewUser);
     $this->mNewUser->set('uorder', $controller->mRoot->mContext->getXoopsConfig('com_order'), true);
     $this->mNewUser->set('umode', $controller->mRoot->mContext->getXoopsConfig('com_mode'), true);
     if ($this->mConfig['activation_type'] == 1) {
         $this->mNewUser->set('level', 1, true);
     }
     if (!$memberHandler->insertUser($this->mNewUser)) {
         $this->mRedirectMessage = _MD_USER_LANG_REGISTERNG;
         return USER_FRAME_VIEW_ERROR;
     }
     if (!$memberHandler->addUserToGroup(XOOPS_GROUP_USERS, $this->mNewUser->get('uid'))) {
         $this->mRedirectMessage = _MD_USER_LANG_REGISTERNG;
         return USER_FRAME_VIEW_ERROR;
     }
     $this->_clearRegistForm($controller);
     $this->_processMail($controller);
     $this->_eventNotifyMail($controller);
     XCube_DelegateUtils::call('Legacy.Event.RegistUser.Success', new XCube_Ref($this->mNewUser));
     return USER_FRAME_VIEW_SUCCESS;
 }
function smarty_function_legacy_tag_cloud($params, &$smarty)
{
	$tDirname = $params['tDirname'];
	$dirname = isset($params['dirname']) ? $params['dirname'] : null;
	$dataname = isset($params['dataname']) ? $params['dataname'] : null;
	$uidList = isset($params['uidList']) ? $params['uidList'] : null;
	$max = isset($params['max']) ? $params['max'] : 200;	//font size(%)
	$min = isset($params['min']) ? $params['min'] : 80;	//font size(%)
	$template = isset($params['template']) ? $params['template'] : 'legacy_inc_tag_cloud.html';
	$cloud = array();

	XCube_DelegateUtils::call('Legacy_Tag.'.$tDirname.'.GetTagCloudSrc',
		new XCube_Ref($cloud),
		$tDirname,
		$dirname,
		$dataname,
		$uidList
	);

	$sizeArr = _smarty_function_legacy_tag_cloud_get_size($cloud, $max, $min);

	//render template
	$render = new XCube_RenderTarget();
	$render->setTemplateName($template);
	$render->setAttribute('legacy_buffertype',XCUBE_RENDER_TARGET_TYPE_MAIN);
	$render->setAttribute('dirname', $tDirname);
	$render->setAttribute('cloud', $cloud);
	$render->setAttribute('sizeArr', $sizeArr);
	XCube_Root::getSingleton()->getRenderSystem('Legacy_RenderSystem')->render($render);

	echo $render->getResult();
}
Пример #8
0
function b_legacy_waiting_show()
{
    $modules = array();
    XCube_DelegateUtils::call('Legacyblock.Waiting.Show', new XCube_Ref($modules));
    $block['modules'] = $modules;
    return $block;
}
Пример #9
0
 /**
  * &getPlayermapHandler
  * 
  * @param	string	$name
  * @param	string	$dirname
  * 
  * @return	XoopsObjectHandleer
  **/
 public static function &getPlayermapHandler($name, $dirname)
 {
     $asset = null;
     XCube_DelegateUtils::call('Module.playermap.Global.Event.GetAssetManager', new XCube_Ref($asset), $dirname);
     if (is_object($asset) && is_a($asset, 'Playermap_AssetManager')) {
         return $asset->getObject('handler', $name);
     }
 }
Пример #10
0
 function getTemplateName()
 {
     $template_name = $this->template_name;
     // calling a delegate for replacing the main template
     if (class_exists('XCube_DelegateUtils')) {
         XCube_DelegateUtils::raiseEvent('ModuleClass.Pico.Controller.GetTemplateName', $this->mydirname, new XCube_Ref($template_name));
     }
     return $template_name;
 }
 function execute($request)
 {
     // Ticket Check
     if (!$GLOBALS['xoopsGTicket']->check(true, 'pico')) {
         redirect_header(XOOPS_URL . '/', 3, $GLOBALS['xoopsGTicket']->getErrors());
     }
     parent::execute($request);
     // initialize
     $cat_data = $this->currentCategoryObj->getData();
     $picoPermission =& PicoPermission::getInstance();
     // permission check
     if (empty($cat_data['can_post'])) {
         redirect_header(XOOPS_URL . '/', 2, _MD_PICO_ERR_MAKECONTENT);
     }
     // insert a content
     $content_id = pico_makecontent($this->mydirname);
     $content_uri4html = XOOPS_URL . "/modules/{$this->mydirname}/" . pico_common_make_content_link4html($this->mod_config, $content_id, $this->mydirname);
     // get contentObj
     $this->contentObj =& new PicoContent($this->mydirname, $content_id, $this->currentCategoryObj);
     $content_data = $this->contentObj->getData();
     // return uri
     if (!empty($_GET['ret']) && ($ret_uri = pico_main_parse_ret2uri($this->mydirname, $_GET['ret']))) {
         $ret_uri4html = htmlspecialchars($ret_uri, ENT_QUOTES);
     } else {
         $ret_uri4html = $content_uri4html;
     }
     // calling a delegate
     if (class_exists('XCube_DelegateUtils')) {
         XCube_DelegateUtils::raiseEvent('ModuleClass.Pico.Contentman.InsertSuccess', $this->mydirname, $content_id, $cat_data, $ret_uri4html);
     }
     // create extra_tags for notifications
     $extra_tags = array('CONTENT_URL' => pico_common_unhtmlspecialchars($content_uri4html), 'APPROVAL_URL' => XOOPS_URL . "/modules/{$this->mydirname}/index.php?page=contentmanager&content_id={$content_id}", 'CAT_TITLE' => $cat_data['cat_title'], 'CONTENT_SUBJECT' => $content_data['subject_raw']);
     // users2notify (can_readfull only)
     $users2notify = $picoPermission->getUidsFromCatid($this->mydirname, $cat_data['id'], 'can_readfull');
     if ($cat_data['post_auto_approved']) {
         // Notify for new content 'global'
         pico_main_trigger_event($this->mydirname, 'global', 0, 'newcontent', $extra_tags, $users2notify, 0);
         // Notify for new content 'category' of all parental categories
         foreach (array_keys($cat_data['paths_raw']) as $cat_id) {
             pico_main_trigger_event($this->mydirname, 'category', $cat_id, 'newcontent', $extra_tags, $users2notify, 0);
         }
         // message "registered"
         redirect_header($ret_uri4html, 2, _MD_PICO_MSG_CONTENTMADE);
     } else {
         // Notify for new waiting content (only for admin or mod)
         $users2notify = pico_main_get_moderators($this->mydirname, $cat_data['id']);
         if (empty($users2notify)) {
             $users2notify = array(0);
         }
         pico_main_trigger_event($this->mydirname, 'global', 0, 'waitingcontent', $extra_tags, $users2notify);
         // message "waiting approval"
         redirect_header($ret_uri4html, 2, _MD_PICO_MSG_CONTENTWAITINGREGISTER);
     }
     // view
     $this->is_need_header_footer = false;
 }
Пример #12
0
 /**
  * executeViewInput
  * 
  * @param    XCube_RenderTarget    &$render
  * 
  * @return    void
  **/
 public function executeViewInput(&$render)
 {
     $render->setTemplateName($this->mAsset->mDirname . '_group_delete.html');
     $render->setAttribute('actionForm', $this->mActionForm);
     $render->setAttribute('object', $this->mObject);
     //breadcrumb
     $breadcrumbs = array();
     XCube_DelegateUtils::call('Module.' . $this->mAsset->mDirname . '.Global.Event.GetBreadcrumbs', new XCube_Ref($breadcrumbs), $this->mAsset->mDirname, $this->mObject);
     $render->setAttribute('xoops_breadcrumbs', $breadcrumbs);
 }
Пример #13
0
 /**
  * getClientList
  * 
  * @param   string  $dirname
  * 
  * @return  array
  **/
 public static function getClientList($dirname)
 {
     $clients = array();
     $list = array();
     XCube_DelegateUtils::call('Legacy_GroupClient.GetClientList', new XCube_Ref($clients), $dirname);
     foreach ($clients as $module) {
         $list[] = array('dirname' => trim($module['dirname']), 'dataname' => trim($module['dataname']), 'fieldname' => trim($module['fieldname']));
     }
     return $list;
 }
 /**
  * Add OGP tags to theme
  * @param Legacy_XoopsTpl $xoopsTpl
  * @return void
  */
 public function addOGPTagsToTheme(Legacy_XoopsTpl $xoopsTpl)
 {
     if ($this->_isBeginRenderTheme() === false) {
         return;
     }
     $ogpData = array();
     XCube_DelegateUtils::raiseEvent('OGP.SetUp', new XCube_Ref($ogpData), new XCube_Ref($xoopsTpl));
     $ogpTags = $this->_renderOGPTags($ogpData);
     $this->_prependToXoopsModuleHeader($xoopsTpl, $ogpTags);
 }
Пример #15
0
 /**
  * @param string $key
  * @return mixed
  */
 protected function _getProfile($key)
 {
     if ($this->profile === null) {
         XCube_DelegateUtils::call('Legacy_Profile.GetProfile', new XCube_Ref($this->profile), $this->get('uid'));
     }
     if ($this->profile instanceof XoopsSimpleObject) {
         return $this->profile->get($key);
     }
     return null;
 }
 function execute($request)
 {
     // Ticket Check
     if (!$GLOBALS['xoopsGTicket']->check(true, 'pico')) {
         redirect_header(XOOPS_URL . '/', 3, $GLOBALS['xoopsGTicket']->getErrors());
     }
     parent::execute($request);
     // contentObj
     $cat_data = $this->currentCategoryObj->getData();
     $this->contentObj =& new PicoContent($this->mydirname, $request['content_id'], $this->currentCategoryObj);
     // check existence
     if ($this->contentObj->isError()) {
         redirect_header(XOOPS_URL . "/modules/{$this->mydirname}/index.php", 2, _MD_PICO_ERR_READCONTENT);
         exit;
     }
     $content_data = $this->contentObj->getData();
     // permission check
     if (empty($content_data['can_edit'])) {
         if ($content_data['locked']) {
             redirect_header(XOOPS_URL . '/', 2, _MD_PICO_ERR_LOCKEDCONTENT);
             exit;
         } else {
             redirect_header(XOOPS_URL . '/', 2, _MD_PICO_ERR_EDITCONTENT);
             exit;
         }
     }
     // update the content
     pico_updatecontent($this->mydirname, $request['content_id'], $cat_data['post_auto_approved'], $cat_data['isadminormod']);
     $content_uri4html = XOOPS_URL . "/modules/{$this->mydirname}/" . pico_common_make_content_link4html($this->mod_config, $request['content_id'], $this->mydirname);
     // return uri
     if (!empty($_GET['ret']) && ($ret_uri = pico_main_parse_ret2uri($this->mydirname, $_GET['ret']))) {
         $ret_uri4html = htmlspecialchars($ret_uri, ENT_QUOTES);
     } else {
         $ret_uri4html = $content_uri4html;
     }
     // calling a delegate
     if (class_exists('XCube_DelegateUtils')) {
         XCube_DelegateUtils::raiseEvent('ModuleClass.Pico.Contentman.UpdateSuccess', $this->mydirname, $request['content_id'], $cat_data, $ret_uri4html);
     }
     if ($cat_data['post_auto_approved']) {
         // message "modified"
         redirect_header($ret_uri4html, 2, _MD_PICO_MSG_CONTENTUPDATED);
     } else {
         // Notify for new waiting content (only for admin or mod)
         $users2notify = pico_main_get_moderators($this->mydirname, $cat_data['id']);
         if (empty($users2notify)) {
             $users2notify = array(0);
         }
         pico_main_trigger_event($this->mydirname, 'global', 0, 'waitingcontent', array('CONTENT_URL' => XOOPS_URL . "/modules/{$this->mydirname}/index.php?page=contentmanager&content_id=" . $request['content_id']), $users2notify);
         // message "waiting approval"
         redirect_header($ret_uri4html, 2, _MD_PICO_MSG_CONTENTWAITINGUPDATE);
     }
     // view
     $this->is_need_header_footer = false;
 }
Пример #17
0
function smarty_function_xoops_explaceholder($params, &$smarty)
{
    $buf = null;
    if (isset($params['control'])) {
        XCube_DelegateUtils::call('Legacy.Event.Explaceholder.Get.' . $params['control'], new XCube_Ref($buf), $params);
        if ($buf === null) {
            XCube_DelegateUtils::call('Legacy.Event.Explaceholder.Get', new XCube_Ref($buf), $params['control'], $params);
        }
    }
    return $buf;
}
Пример #18
0
 function _doExecute()
 {
     XCube_DelegateUtils::call('Legacy.Admin.Event.UserDelete', new XCube_Ref($this->mObject));
     $handler =& xoops_gethandler('member');
     if ($handler->delete($this->mObject)) {
         XCube_DelegateUtils::call('Legacy.Admin.Event.UserDelete.Success', new XCube_Ref($this->mObject));
         return USER_FRAME_VIEW_SUCCESS;
     } else {
         XCube_DelegateUtils::call('Legacy.Admin.Event.UserDelete.Fail', new XCube_Ref($this->mObject));
         return USER_FRAME_VIEW_ERROR;
     }
 }
Пример #19
0
 /**
  * executeViewIndex
  * 
  * @param    XCube_RenderTarget    &$render
  * 
  * @return    void
  **/
 public function executeViewIndex(&$render)
 {
     $render->setTemplateName($this->mAsset->mDirname . '_group_list.html');
     $render->setAttribute('objects', $this->mObjects);
     $render->setAttribute('dirname', $this->mAsset->mDirname);
     $render->setAttribute('dataname', 'group');
     $render->setAttribute('pageNavi', $this->mFilter->mNavi);
     //breadcrumb
     $breadcrumbs = array();
     XCube_DelegateUtils::call('Module.' . $this->mAsset->mDirname . '.Global.Event.GetBreadcrumbs', new XCube_Ref($breadcrumbs), $this->mAsset->mDirname);
     $render->setAttribute('xoops_breadcrumbs', $breadcrumbs);
 }
 /**
  * prepare
  * 
  * @param   XCube_Controller  &$controller
  * 
  * @return  void
  **/
 public function prepare(&$controller)
 {
     $this->mController =& $controller;
     $this->mSmarty = new Legacy_AdminSmarty();
     // TODO will be use other class?
     $this->mSmarty->register_modifier('theme', array($this, 'modifierTheme'));
     $this->mSmarty->register_function('stylesheet', array($this, 'functionStylesheet'));
     $this->mSmarty->assign(array('xoops_url' => XOOPS_URL, 'xoops_rootpath' => XOOPS_ROOT_PATH, 'xoops_langcode' => _LANGCODE, 'xoops_charset' => _CHARSET, 'xoops_version' => XOOPS_VERSION, 'xoops_upload_url' => XOOPS_UPLOAD_URL));
     // TODO event name is this?
     XCube_DelegateUtils::call('Legacy_RenderSystem.SetupXoopsTpl', new XCube_Ref($this->mSmarty));
     $this->mSmarty->force_compile = $controller->mRoot->mSiteConfig['Legacy_AdminRenderSystem']['ThemeDevelopmentMode'] || $controller->mRoot->mContext->getXoopsConfig('theme_fromfile');
 }
Пример #21
0
function smarty_function_xoops_dhtmltarea($params, &$smarty)
{
	if (!XC_CLASS_EXISTS('xoopsformelement')) {
		require_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
	}
	$form = null;

	$root =& XCube_Root::getSingleton();
	$textFilter =& $root->getTextFilter();
	if (isset($params['name'])) {
		//
		// Fetch major elements from $params.
		//
		$params['name'] = trim($params['name']);
		$params['class'] = isset($params['class']) ? trim($params['class']) : null;
		$params['cols'] = isset($params['cols']) ? intval($params['cols']) : XOOPS_DHTMLTAREA_DEFAULT_COLS;
		$params['rows'] = isset($params['rows']) ? intval($params['rows']) : XOOPS_DHTMLTAREA_DEFAULT_ROWS;
		$params['value'] = isset($params['value']) ? $textFilter->toEdit($params['value']) : null;
		$params['id'] = isset($params['id']) ? trim($params['id']) : XOOPS_DHTMLTAREA_DEFID_PREFIX . $params['name'];
	
		//
		// Build the object for output.
		//
		$html = "";
		switch($params['editor']){
		case 'html':
			XCube_DelegateUtils::call("Site.TextareaEditor.HTML.Show", new XCube_Ref($html), $params);
			break;
		
		case 'none':
			XCube_DelegateUtils::call("Site.TextareaEditor.None.Show", new XCube_Ref($html), $params);
			break;
		case 'bbcode':
		default:
			XCube_DelegateUtils::call("Site.TextareaEditor.BBCode.Show", new XCube_Ref($html), $params);
			break;
		}
		print $html;
	
		/*
		$form =new XoopsFormDhtmlTextArea($name, $name, $value, $rows, $cols);
		$form->setId($id);
		if ($class != null) {
			$form->setClass($class);
		}
		
		print $form->render();
		*/
	}
}
Пример #22
0
function smarty_function_legacy_map_view($params, &$smarty)
{
    $dirname = isset($params['dirname']) ? $params['dirname'] : null;
    $dataname = isset($params['dataname']) ? $params['dataname'] : null;
    $dataId = isset($params['data_id']) ? $params['data_id'] : null;
    $template = isset($params['template']) ? $params['template'] : 'legacy_inc_map_view.html';
    $places = array();
    XCube_DelegateUtils::call('Legacy_Map.GetPlaces', new XCube_Ref($places), $dirname, $dataname, $dataId);
    //render template
    $render = new XCube_RenderTarget();
    $render->setTemplateName($template);
    $render->setAttribute('legacy_buffertype', XCUBE_RENDER_TARGET_TYPE_MAIN);
    $render->setAttribute('places', $places);
    XCube_Root::getSingleton()->getRenderSystem('Legacy_RenderSystem')->render($render);
    echo $render->getResult();
}
Пример #23
0
 /**
  * getClientData
  * 
  * @param	array	$list
  *  $client['template_name']
  *  $client['data']
  *  $client['dirname']
  * @param	array	$client
  *  $client['dirname']
  *  $client['dataname']
  * 
  * @return	mixed[]
  *	string	$list['template_name'][]
  *	string	$list['data'][]
  **/
 public function getClientData($list, $client)
 {
     $handler = Legacy_Utils::getModuleHandler('tag', $this->getDirname());
     $cri = new CriteriaCompo();
     $cri->add(new Criteria('tag', $this->get('tag')));
     $cri->add(new Criteria('dirname', $client['dirname']));
     $cri->add(new Criteria('dataname', $client['dataname']));
     $cri->setSort('posttime', 'DESC');
     $objs = $handler->getObjects($cri);
     $idList = array();
     foreach ($objs as $obj) {
         $idList[] = $obj->get('data_id');
     }
     XCube_DelegateUtils::call('Legacy_TagClient.' . $client['dirname'] . '.GetClientData', new XCube_Ref($list), $client['dirname'], $client['dataname'], $idList);
     return $list;
 }
Пример #24
0
 /**
  * Custom 'mSetupUser' Delegate functions for AutoLogin
  *
  */
 function setupUser(&$principal, &$controller, &$context)
 {
     if (is_object($context->mXoopsUser)) {
         return;
     }
     //Anonymous session
     if (empty($_SESSION['xoopsUserId'])) {
         //Check Cookies for AutoLogin
         $xoopsUser = $this->_getUserFromCookie();
         if (is_object($xoopsUser) && $xoopsUser->getVar('level') > 0) {
             $root =& XCube_Root::getSingleton();
             $context->mXoopsUser =& $xoopsUser;
             // Regist to session
             $root->mSession->regenerate();
             $_SESSION['xoopsUserId'] = $xoopsUser->getVar('uid');
             $_SESSION['xoopsUserGroups'] = $xoopsUser->getGroups();
             $context->mXoopsUser->setGroups($_SESSION['xoopsUserGroups']);
             $roles = array();
             $roles[] = "Site.RegisteredUser";
             if ($context->mXoopsUser->isAdmin(-1)) {
                 $roles[] = "Site.Administrator";
             }
             if (in_array(XOOPS_GROUP_ADMIN, $_SESSION['xoopsUserGroups'])) {
                 $roles[] = "Site.Owner";
             }
             $identity = new Legacy_Identity($context->mXoopsUser);
             $principal = new Legacy_GenericPrincipal($identity, $roles);
             //
             // Use 'mysession'
             //
             $xoopsConfig = $root->mContext->mXoopsConfig;
             if ($xoopsConfig['use_mysession'] && $xoopsConfig['session_name'] != '') {
                 setcookie($xoopsConfig['session_name'], session_id(), time() + 60 * $xoopsConfig['session_expire'], '/', '', 0);
             }
             // Raise Site.CheckLogin.Success event
             XCube_DelegateUtils::call('Site.CheckLogin.Success', new XCube_Ref($xoopsUser));
         } else {
             //Invalid AutoLogin
             setcookie('autologin_uname', '', time() - 3600, $this->mCookiePath, '', 0);
             setcookie('autologin_pass', '', time() - 3600, $this->mCookiePath, '', 0);
             if (is_object($xoopsUser)) {
                 $xoopsUser = false;
             }
         }
     }
 }
Пример #25
0
 /**
  * fetch
  * 
  * @param   string    $dirname
  * 
  * @return  void
  **/
 public function fetch($dirname)
 {
     $this->mNavi->fetch();
     $this->fetchSort();
     $this->mHandler = Legacy_Utils::getModuleHandler('definition', $dirname);
     $request = XCube_Root::getSingleton()->mContext->mRequest;
     if (($catId = $request->getRequest('category_id')) !== null) {
         $this->mNavi->addExtra('category_id', (int) $catId);
     }
     //get child category's data ?
     $child = false;
     if ($request->getRequest('child') === "all") {
         $child = true;
     } elseif ($request->getRequest('child') === "single") {
         $child = false;
     }
     $this->_mCriteria = Xcck_Utils::getListCriteria($dirname, (int) $catId, $child, $this->mSort, Lenum_Status::PUBLISHED);
     //Search previously defined fields
     $definedFields = array('name' => array('page_id', 'title', 'uid', 'maintable_id', 'posttime', 'updatetime'), 'type' => array(Xcck_FieldType::INT, Xcck_FieldType::STRING, Xcck_FieldType::INT, Xcck_FieldType::INT, Xcck_FieldType::DATE, Xcck_FieldType::DATE));
     foreach (array_keys($definedFields['name']) as $key) {
         if ($value = $request->getRequest($definedFields['name'][$key]) !== null) {
             $this->_setDefinedFieldRequest($definedFields['name'][$key], $definedFields['type'][$key], $value);
         }
     }
     //Search User defined fields
     foreach ($this->mDefinitions as $definition) {
         if ($value = $request->getRequest($definition->get('field_name')) !== null) {
             $value = $request->getRequest($definition->get('field_name'));
             $this->_setRequest($definition, $value);
         }
     }
     //Search by keyword: search all string and text field
     if (($value = $request->getRequest('keyword')) !== null) {
         $this->mNavi->addExtra('keywords', $value);
         Xcck_SearchUtils::makeKeywordCriteria($this->_mCriteria, $dirname, $value);
     }
     if (($value = $request->getRequest('child')) !== null) {
         $this->mNavi->addExtra('child', $value);
     }
     //filter by tag
     if (($tags = $request->getRequest('tag')) !== null) {
         $this->_setTagRequest($tags, $dirname);
     }
     XCube_DelegateUtils::call('Module.' . $dirname . '.FetchSearchFilter', $this);
 }
Пример #26
0
 function execute(&$controller, &$xoopsUser)
 {
     $form_cancel = $controller->mRoot->mContext->mRequest->getRequest('_form_control_cancel');
     if ($form_cancel != null) {
         return LEGACY_FRAME_VIEW_CANCEL;
     }
     $this->mActionForm->fetch();
     $this->mActionForm->validate();
     if ($this->mActionForm->hasError()) {
         return $this->_processConfirm($controller, $xoopsUser);
     } else {
         $result = $this->_processSave($controller, $xoopsUser);
         if ($result === LEGACY_FRAME_VIEW_SUCCESS) {
             XCube_DelegateUtils::call('Legacy.Admin.Event.ModuleListSave.Success', new XCube_Ref($this->mActionForm));
         } else {
             XCube_DelegateUtils::call('Legacy.Admin.Event.ModuleListSave.Fail', new XCube_Ref($this->mActionForm));
         }
         return $result;
     }
 }
Пример #27
0
function smarty_function_legacy_image($params, &$smarty)
{
    if (!defined(LEGACY_IMAGE_DUMMY_EXT)) {
        define('LEGACY_IMAGE_DUMMY_EXT', 'gif');
    }
    $dirname = $params['dirname'];
    $dataname = $params['dataname'];
    $dataId = $params['data_id'];
    $num = isset($params['num']) ? $params['num'] : 1;
    $size = isset($params['size']) ? $params['size'] : 0;
    $imageObjs = array();
    XCube_DelegateUtils::call('Legacy_Image.GetImageObjects', new XCube_Ref($imageObjs), $dirname, $dataname, $dataId, $num);
    //display dummy image
    if (!($imageObj = array_shift($imageObjs))) {
        $imageObj = null;
        XCube_DelegateUtils::call('Legacy_Image.CreateImageObject', new XCube_Ref($imageObj));
        $imageObj->set('dirname', $dirname);
        $imageObj->set('dataname', $dataname);
    }
    echo $imageObj->makeImageTag($size);
}
Пример #28
0
 /**
  * getPermittedIdList
  * 
  * @param   string  $dirname
  * @param   string  $action
  * @param   int     $categeoryId
  * 
  * @return  XoopsObjectHandler
  **/
 public static function getPermittedIdList($dirname, $action = null, $categoryId = 0)
 {
     $action = isset($action) ? $action : Af_dmm_AuthType::VIEW;
     $accessController = self::getAccessControllerModule($dirname);
     if (!is_object($accessController)) {
         return;
     }
     $role = $accessController->get('role');
     $idList = array();
     if ($role == 'cat') {
         $delegateName = 'Legacy_Category.' . $accessController->dirname() . '.GetPermittedIdList';
         XCube_DelegateUtils::call($delegateName, new XCube_Ref($idList), $accessController->dirname(), self::getActor($dirname, Af_dmm_AuthType::VIEW), Legacy_Utils::getUid(), $categoryId);
     } elseif ($role == 'group') {
         $delegateName = 'Legacy_Group.' . $accessController->dirname() . '.GetGroupIdListByAction';
         XCube_DelegateUtils::call($delegateName, new XCube_Ref($idList), $accessController->dirname(), $dirname, 'page', Af_dmm_AuthType::VIEW);
     } else {
         //has user group permission ?
         ///TODO
     }
     return $idList;
 }
Пример #29
0
function smarty_function_legacy_profile($params, &$smarty)
{
    $uid = isset($params['uid']) ? intval($params['uid']) : Legacy_Utils::getUid();
    if ($uid === 0) {
        return;
    }
    $profileActionForm = isset($params['actionForm']) ? $params['actionForm'] : null;
    $action = isset($params['action']) ? $params['action'] : 'view';
    $template = isset($params['template']) ? $params['template'] : 'profile_inc_data_view.html';
    $defArr = null;
    XCube_DelegateUtils::call('Legacy_Profile.GetDefinition', new XCube_Ref($defArr), $action);
    $profile = null;
    XCube_DelegateUtils::call('Legacy_Profile.GetProfile', new XCube_Ref($profile), $uid);
    //render template
    $render = new XCube_RenderTarget();
    $render->setTemplateName($template);
    $render->setAttribute('legacy_buffertype', XCUBE_RENDER_TARGET_TYPE_MAIN);
    $render->setAttribute('profileForm', $profileActionForm);
    $render->setAttribute('profile', $profile);
    $render->setAttribute('defArr', $defArr);
    XCube_Root::getSingleton()->getRenderSystem('Legacy_RenderSystem')->render($render);
    echo $render->getResult();
}
Пример #30
0
 public function executeView(&$render)
 {
     $render->setTemplateName('message_userinfo.html');
     $render->setAttribute('thisUser', $this->mObject);
     $render->setAttribute('rank', $this->mRankObject);
     $render->setAttribute('pmliteUrl', $this->mPmliteURL);
     $userSignature = $this->mObject->getShow('user_sig');
     $render->setAttribute('user_signature', $userSignature);
     $render->setAttribute('searchResults', $this->mSearchResults);
     $user_ownpage = is_object($this->mXoopsUser) && $this->mXoopsUser->get('uid') == $this->mObject->get('uid');
     $render->setAttribute('user_ownpage', $user_ownpage);
     $render->setAttribute('self_delete', $this->mSelfDelete);
     if ($user_ownpage && $this->mSelfDelete) {
         $render->setAttribute('enableSelfDelete', true);
     } else {
         $render->setAttribute('enableSelfDelete', false);
     }
     $definitions = array();
     $profile = null;
     XCube_DelegateUtils::call('Legacy_Profile.GetDefinition', new XCube_Ref($definitions), 'view');
     XCube_DelegateUtils::call('Legacy_Profile.GetProfile', new XCube_Ref($profile), $this->mObject->get('uid'));
     $render->setAttribute('definitions', $definitions);
     $render->setAttribute('data', $profile);
 }