Get XOOPS XOOPS FAQ Forums News Themes Modules
New Posts New Topics All Forums Index General Modules Themes Development International XOOPS.org

XOOPS vs. Herko Coomans

Make a donation

Please select an amount to donate


Do you want your username revealed with your donation?
Yes - List me as a Generous Donor
No - List my donation as from an Anonymous Donor


Search

Local Support Sites

Cumulus Tag Cloud

admin Arabic banner block Christmas comments cumulus DayDawn dhsoft e-Commerce E-Learning Google GUI hacks instant-zero jQuery module news Nordic Olédrion oxygen PageRank security SEO simple-XOOPS sport tag Theme wiki xoops

New Users

Registering user

# 96568

dvsshoescom

Welcome to XOOPS!
XOOPS Code hosted on SourceForge


 Bottom   Previous Topic   Next Topic

1 2 »
#1 Posted on: 2009/8/26 16:42 xmobile running in xoops?
There is some hack to work properly xmobile module on xoops? Currently, the module makes calls to class not available in xoops, but if xoops cube.

Currently the module runs on my website in a test section, but with errors.

NOTE: xmobile works fine (running on xoops) with pico, eguide, xoopspoll and d3blog modules (also system login and comments)

Debug mode:

News
Fatal error: Class 'XmobileNewsPluginAbstract' not found in MyROOT/modules/xmobile/plugins/news.php(28) : eval()'d code on line 2

Newbb
Blank page (contents)

piCal
Fatal error: Class 'XmobilePicalPluginAbstract' not found in MyROOT/modules/xmobile/plugins/piCal.php(28) : eval()'d code on line 2

myAlbum
Fatal error: Class 'XmobileMyalbumPluginAbstract' not found in MyROOT/modules/xmobile/plugins/myalbum.php(27) : eval()'d code on line 2

Bulletin
Fatal error: Class 'XmobileBulletinPluginAbstract' not found in MyROOT/modules/xmobile/plugins/bulletin.php(32) : eval()'d code on line 2

Thanks for your help!


Top

laguna
Just popping in
Joined:
2004/10/8 20:28
From Lomas de Zamora, Buenos Aires, Argentina
Posts: 45
(Show More) (Show Less)
#2 Posted on: 2009/8/26 19:30 Re: xmobile running in xoops?
Could it be, that you have no plugin file for these modules?

Top

ghia
Community Support Member
Joined:
2008/7/3 15:19
From Belgium
Posts: 3665
(Show More) (Show Less)
#3 Posted on: 2009/8/26 21:21 Re: xmobile running in xoops?
If I do, but the module returns these errors.

I think it's because xoopscube has other class in their core. Or I'm wrong? Do not know much about php...

For example, news plugin (returns the following error)

<?php
if (!defined('XOOPS_ROOT_PATH')) exit();

$mydirname strtolower(basename(__FILE__,'.php'));
$Pluginname ucfirst($mydirname);
if (!
preg_match("/^\w+$/"$Pluginname))
{
    
trigger_error('Invalid pluginName');
    exit();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
eval('
class Xmobile'
.$Pluginname.'Plugin extends XmobileNewsPluginAbstract
{
    function Xmobile'
.$Pluginname.'Plugin()
    {
        $this->__construct();
    }
}

class Xmobile'
.$Pluginname.'PluginHandler extends XmobileNewsPluginHandlerAbstract
{
    function Xmobile'
.$Pluginname.'PluginHandler($db)
    {
        $this->__construct("'
.$mydirname.'",$db);
    }
}
'
);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class XmobileNewsPluginAbstract extends XmobilePlugin
{
    function 
__construct()
    {
        
// call parent constructor
        
XmobilePlugin::XmobilePlugin();

        
// define object elements
        
$this->initVar('storyid'XOBJ_DTYPE_INT'0'true);
        
$this->initVar('uid'XOBJ_DTYPE_INT'0'true);
        
$this->initVar('title'XOBJ_DTYPE_TXTBOX''true255);
        
$this->initVar('created'XOBJ_DTYPE_INT'0'true);
        
$this->initVar('published'XOBJ_DTYPE_INT'0'true);
        
$this->initVar('expired'XOBJ_DTYPE_INT'0'true);
        
$this->initVar('hostname'XOBJ_DTYPE_TXTBOX''true20);
        
$this->initVar('nohtml'XOBJ_DTYPE_INT'0'true);
        
$this->initVar('nosmiley'XOBJ_DTYPE_INT'0'true);
        
$this->initVar('hometext'XOBJ_DTYPE_TXTAREA''true);
        
$this->initVar('bodytext'XOBJ_DTYPE_TXTAREA''true);
        
$this->initVar('counter'XOBJ_DTYPE_INT'0'true);
        
$this->initVar('topicid'XOBJ_DTYPE_INT'0'true);
        
$this->initVar('ihome'XOBJ_DTYPE_INT'0'true);
        
$this->initVar('notifypub'XOBJ_DTYPE_INT'0'true);
        
$this->initVar('story_type'XOBJ_DTYPE_TXTBOX''true5);
        
$this->initVar('topicdisplay'XOBJ_DTYPE_INT'0'true);
        
$this->initVar('topicalign'XOBJ_DTYPE_TXTBOX''true1);
        
$this->initVar('comments'XOBJ_DTYPE_INT'0'true);

        
// define primary key
        
$this->setKeyFields(array('storyid'));
        
$this->setAutoIncrementField('storyid');
    }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
function assignSanitizerElement()
    {
        
$dohtml 0;
        
$dosmiley 0;

        if (
$this->getVar('nohtml') == 0$dohtml 1;
        if (
$this->getVar('nosmiley') == 0$dosmiley 1;

        
$this->initVar('dohtml',XOBJ_DTYPE_INT,$dohtml);
        
$this->initVar('dosmiley',XOBJ_DTYPE_INT,$dosmiley);
    }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class XmobileNewsPluginHandlerAbstract extends XmobilePluginHandler
{
    var 
$template 'xmobile_news.html';
    var 
$moduleDir 'news';
    var 
$categoryTableName 'topics';
    var 
$itemTableName 'stories';

    var 
$category_id_fld 'topic_id';
    var 
$category_pid_fld 'topic_pid';
    var 
$category_title_fld 'topic_title';
    var 
$category_order_fld 'topic_id';

    var 
$item_id_fld 'storyid';
    var 
$item_cid_fld 'topicid';
    var 
$item_title_fld 'title';
    var 
$item_description_fld 'hometext';
    var 
$item_order_fld 'published';
    var 
$item_date_fld 'published';
    var 
$item_uid_fld 'uid';
    var 
$item_hits_fld 'counter';
    var 
$item_comments_fld 'comments';
    var 
$item_extra_fld = array('bodytext'=>'');
//    var $item_order_sort = 'DESC';
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
function __construct($mydirname,$db)
    {
        
XmobilePluginHandler::XmobilePluginHandler($db);

        
$this->moduleDir $mydirname;

        if ( 
preg_match("/^\D+(\d*)$/"$mydirname,$matches) )
        {
            
$number $matches[1];
            
$this->categoryTableName 'topics'$number;
            
$this->itemTableName 'stories'$number;
        }
    }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
function setItemCriteria()
    {
        
$this->item_criteria =& new CriteriaCompo();
        
$item_criteria_1 = new CriteriaCompo();
        
$item_criteria_1->add(new Criteria('published'0'>'));
        
$item_criteria_1->add(new Criteria('published'time(), '<='));
        
$item_criteria_2 = new CriteriaCompo();
        
$item_criteria_2->add(new Criteria('expired'0));
        
$item_criteria_2->add(new Criteria('expired'time(), '>'),'OR');
        
$this->item_criteria->add($item_criteria_1);
        
$this->item_criteria->add($item_criteria_2);
    }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
?>



xmobile .40 rc2
xoops 2.0.18.2

Top

laguna
Just popping in
Joined:
2004/10/8 20:28
From Lomas de Zamora, Buenos Aires, Argentina
Posts: 45
(Show More) (Show Less)
#4 Posted on: 2009/8/27 2:38 Re: xmobile running in xoops?
Weird! The eval function tries to extend classes that are defined below.
So, I would try with changing it and put the eval block at the very end of the file:
...
    function 
setItemCriteria()
    {
...
    }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
eval('
class Xmobile'
.$Pluginname.'Plugin extends XmobileNewsPluginAbstract
{
    function Xmobile'
.$Pluginname.'Plugin()
    {
        $this->__construct();
    }
}

class Xmobile'
.$Pluginname.'PluginHandler extends XmobileNewsPluginHandlerAbstract
{
    function Xmobile'
.$Pluginname.'PluginHandler($db)
    {
        $this->__construct("'
.$mydirname.'",$db);
    }
}
'
); 
?>


NB
I don't understand why the plugin is evaluated only partially. I assume it is for cloned modules. But then the fix part seems to become double.
But maybe you don't have cloned modules and then there will be no problem.

Top

ghia
Community Support Member
Joined:
2008/7/3 15:19
From Belgium
Posts: 3665
(Show More) (Show Less)
#5 Posted on: 2009/8/29 10:14 Re: xmobile running in xoops?
Excellent! It works! Thanks for your help!

Now I have other problems. For example, unable to read or create private messages

Debug
Fatal error: Class 'XoopsMultiTokenHandler' not found in MyHome/modules/xmobile/actions/PmessageAction.php on line 198

File (PmessageAction.php)

<?php
if (!defined('XOOPS_ROOT_PATH')) exit();
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class PmessageAction extends XmobileAction
{
    var 
$template 'xmobile_pmessage.html';
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
function PmessageAction()
    {
        global 
$xoopsConfig;
//        include_once XOOPS_ROOT_PATH.'/language/'.$xoopsConfig['language'].'/pmsg.php';
//        $this->ticket = new XoopsGTicket;
    
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
function setTitle()
    {
        
$this->controller->render->setTitle(_MD_XMOBILE_INBOX);
        
$this->controller->render->template->assign('page_title',_MD_XMOBILE_INBOX);
        
$base_url $this->utils->getLinkUrl('pmessage',null,null,$this->sessionHandler->getSessionID());
        
$title_link '<a href="'.$base_url.'">'._MD_XMOBILE_INBOX.'</a>';
        
$this->controller->render->template->assign('page_title_link',$title_link);
    }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
function getDefaultView()
    {
        global 
$xoopsModuleConfig;
        
$myts =& MyTextSanitizer::getInstance();
        
$op $myts->makeTboxData4Show($this->utils->getGetPost('op'''));
        
$session_id $this->sessionHandler->getSessionID();
        
$uid $this->sessionHandler->getUid();
        if (
$uid == 0)
        {
            
$base_url $this->utils->getLinkUrl('register',null,null,$this->sessionHandler->getSessionID());
            
$message _MD_XMOBILE_PM_SORRY.'<br /><a href="'.$base_url.'">'._MD_XMOBILE_REGISTERNOW.'</a>.';
            
$this->controller->render->redirectHeader($message,5,$base_url);
            exit();
        }

        
$pm_handler =& xoops_gethandler('privmessage');

        
$criteria =& new Criteria('to_userid'$uid);
        
$criteria->setSort('msg_time');
        
$criteria->setOrder('DESC');
        
$extra_arg $this->baseUrl;
        
$pm_count $pm_handler->getCount($criteria);
        
$pageNavi =& new XmobilePageNavigator($pm_count$xoopsModuleConfig['pm_title_row'], 'pm_start'$extra_arg);
        
$start $pageNavi->getStart();
        
$criteria->setLimit($pageNavi->getPerpage());
        
$criteria->setStart($pageNavi->getStart());

        
$pm_arr =& $pm_handler->getObjects($criteria);
        
$total_messages count($pm_arr);

        if (
$total_messages == 0)
        {
            
$display 0;
        }
        else
        {
            
$display 1;
            
$pms = array();
            for(
$i 0$i $total_messages$i++)
            {
                
$pms[$i]['read_msg'] = $pm_arr[$i]->getVar('read_msg');
                
$poster_name XoopsUser::getUnameFromId($pm_arr[$i]->getVar('from_userid'));
                if (!
$poster_name)
                {
                    
$poster_name $xoopsConfig['anonymous'];
                }
                
$pms[$i]['poster_name'] = $poster_name;

                
// $ext¤ÎÃͤÏgetLinkUrl()¤Çhtmlspecialchars()¤ò³Ý¤±¤é¤ì¤ë¤Î¤Ç&amp;¤Ç¤Ï¤Ê¤¯&¤Èµ­½Ò¤·¤Æ¤ª¤¯
//                $ext = 'start='.$i.'&total_messages='.$total_messages;
                
$ext 'start='.($start $i).'&total_messages='.$total_messages;
                
$base_url $this->utils->getLinkUrl('pmessage','detail',null,$this->controller->sessionHandler->getSessionID(),$ext);
                
$subject '<a href="'.$base_url.'">'.$pm_arr[$i]->getVar('subject').'</a>';
                
$pms[$i]['subject'] = $subject;
                
$msg_time formatTimestamp($pm_arr[$i]->getVar('msg_time'));
                
$pms[$i]['msg_time'] = $msg_time;
            }
            
$this->controller->render->template->assign('pms',$pms);
        }

        
$this->controller->render->template->assign('pm_page_navi',$pageNavi->renderNavi());

        
$ext 'send=1';
        
$base_url $this->utils->getLinkUrl('pmessage','confirm',null,$this->controller->sessionHandler->getSessionID(),$ext);
        
$base_url preg_replace('/&amp;/i','&',$base_url);
        
$this->controller->render->template->assign('base_url',$base_url);
        
$this->controller->render->template->assign('total_messages',$total_messages);
        
$this->controller->render->template->assign('show_list',true);
        
$this->controller->render->template->assign('display',$display);

    }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
function getDetailView()
    {
        if (isset(
$_POST['cancel']))
        {
            
$base_url XMOBILE_URL.'/?act=pmessage&sess='.$this->sessionHandler->getSessionID();
            
header('Location: '.$base_url);
            exit();
        }

        
$this->controller->render->template->assign('show_detail',true);

        
$myts =& MyTextSanitizer::getInstance();
//        $op = $myts->makeTboxData4Show($this->utils->getGetPost('op', ''));
        
$msg_id intval($this->utils->getGetPost('msg_id'0));
        
$session_id $this->sessionHandler->getSessionID();
        
$uid $this->sessionHandler->getUid();
        
$message '';

/*
        if (isset($_POST['reply']))
        {
            $base_url = XMOBILE_URL.'/?act=pmessage&view=confirm&reply=1&msg_id='.$msg_id.'&sess='.$this->sessionHandler->getSessionID();
            header('Location: '.$base_url);
            exit();
        }
*/
        
if ($uid == 0)
        {
            
$base_url $this->utils->getLinkUrl('register',null,null,$this->sessionHandler->getSessionID());
            
$message _MD_XMOBILE_PM_SORRY.'<br /><a href="'.$base_url.'">'._MD_XMOBILE_REGISTERNOW.'</a>.';
            
$this->controller->render->redirectHeader($message,5,$base_url);
            exit();
        }

        
$pm_handler =& xoops_gethandler('privmessage');
/*
        if (!empty($_POST['delete']))
        {
            $pm =& $pm_handler->get(intval($_POST['msg_id']));
            if (!is_object($pm) || $pm->getVar('to_userid') != $uid || !$pm_handler->delete($pm))
            {
                $base_url = $this->utils->getLinkUrl($this->controller->getActionState(),null,null,$this->sessionHandler->getSessionID());
                $this->controller->render->redirectHeader(_MD_XMOBILE_DELETE_FAILED,5,$base_url);
                exit();
            }
            else
            {
                $base_url = $this->utils->getLinkUrl($this->controller->getActionState(),null,null,$this->sessionHandler->getSessionID());
                $this->controller->render->redirectHeader(_MD_XMOBILE_PM_DELETED,3,$base_url);
                exit();
            }
        }
*/
//        $start = !empty($_GET['start']) ? intval($_GET['start']) : 0;
//        $total_messages = !empty($_GET['total_messages']) ? intval($_GET['total_messages']) : 0;

/*
        $criteria = new Criteria('to_userid', $uid);
        $criteria->setLimit($limit);
        $criteria->setStart($start);
        $criteria->setSort('msg_time');
        $criteria->setOrder('DESC');
        $pm_arr =& $pm_handler->getObjects($criteria);
*/
        
$criteria =& new Criteria('to_userid'$uid);
        
$criteria->setSort('msg_time');
        
$criteria->setOrder('DESC');
        
$extra_arg $this->baseUrl;
        
$total_messages $pm_handler->getCount($criteria);

        
$limit 1;
        
$pageNavi =& new XmobilePageNavigator($total_messages$limit'start'$extra_arg);
        
$criteria->setLimit($limit);
        
$criteria->setStart($pageNavi->getStart());
        
$pm_arr =& $pm_handler->getObjects($criteria);

        if (empty(
$pm_arr))
        {
            
$has_message false;
        }
        else
        {
            
$has_message true;

            
$pm_handler->setRead($pm_arr[0]); // check read_msg
            
$poster = new XoopsUser($pm_arr[0]->getVar('from_userid'));
            if (
$poster->isActive())
            {
                
$poster_name $poster->getVar('uname');
                
// $ext¤ÎÃͤÏgetLinkUrl()¤Çhtmlspecialchars()¤ò³Ý¤±¤é¤ì¤ë¤Î¤Ç&amp;¤Ç¤Ï¤Ê¤¯&¤Èµ­½Ò¤·¤Æ¤ª¤¯
//                $ext = 'uid='.$pm_arr[0]->getVar('from_userid');
                
$ext 'uid='.$poster->getVar('uid');
                
$base_url $this->utils->getLinkUrl('userinfo',null,null,$this->controller->sessionHandler->getSessionID(),$ext);
                
$poster_name '<a href="'.$base_url.'">'.$poster->getVar('uname').'</a>';
                
$reply true;
            }
            else
            {
                
$poster_name $xoopsConfig['anonymous'];
                
$reply false;
            }

            
$token =& XoopsMultiTokenHandler::quickCreate('pm');

//            $base_url = $this->utils->getLinkUrl($this->controller->getActionState(),$this->controller->getViewState(),null,$this->sessionHandler->getSessionID());
            
$ext 'send=1';
            
$base_url $this->utils->getLinkUrl('pmessage','confirm',null,$this->controller->sessionHandler->getSessionID(),$ext);
            
$base_url preg_replace('/&amp;/i','&',$base_url);

            
$this->controller->render->template->assign('base_url',$base_url);
            
$this->controller->render->template->assign('ticket_html',$token->getHtml());
            
$this->controller->render->template->assign('session_name',session_name());
            
$this->controller->render->template->assign('session_id',session_id());
            
$this->controller->render->template->assign('referer_url',$this->getBaseUrl());
            
$this->controller->render->template->assign('subject',$pm_arr[0]->getVar('subject'));
            
$this->controller->render->template->assign('poster_name',$poster_name);
            
$this->controller->render->template->assign('msg_time',formatTimestamp($pm_arr[0]->getVar('msg_time')));
            
$this->controller->render->template->assign('msg_text',$pm_arr[0]->getVar('msg_text'));
            
$this->controller->render->template->assign('msg_id',$pm_arr[0]->getVar('msg_id'));
            
$this->controller->render->template->assign('reply',$reply);

            
// page navigation
/*
            $previous = $start - 1;
            $next = $start + 1;
            $pm_page_navi = '';
            if ($previous >= 0)
            {
                // $ext¤ÎÃͤÏgetLinkUrl()¤Çhtmlspecialchars()¤ò³Ý¤±¤é¤ì¤ë¤Î¤Ç&amp;¤Ç¤Ï¤Ê¤¯&¤Èµ­½Ò¤·¤Æ¤ª¤¯
                $ext = 'start='.$previous.'&total_messages='.$total_messages;
                $base_url = $this->utils->getLinkUrl('pmessage','detail',null,$this->sessionHandler->getSessionID(),$ext);
                $pm_page_navi .= '<a href="'.$base_url.'">'._MD_XMOBILE_PM_PREVIOUS.'</a>&nbsp;&nbsp;';
            }
            if ($next < $total_messages)
            {
                // $ext¤ÎÃͤÏgetLinkUrl()¤Çhtmlspecialchars()¤ò³Ý¤±¤é¤ì¤ë¤Î¤Ç&amp;¤Ç¤Ï¤Ê¤¯&¤Èµ­½Ò¤·¤Æ¤ª¤¯
                $ext = 'start='.$next.'&total_messages='.$total_messages;
                $base_url = $this->utils->getLinkUrl('pmessage','detail',null,$this->sessionHandler->getSessionID(),$ext);
                $pm_page_navi .= '<a href="'.$base_url.'">'._MD_XMOBILE_PM_NEXT.'</a>';
            }
            $this->controller->render->template->assign('pm_page_navi',$pm_page_navi);
*/
            
$this->controller->render->template->assign('pm_page_navi',$pageNavi->renderNavi());
        }
        
$this->controller->render->template->assign('message',$message);
        
$this->controller->render->template->assign('has_message',$has_message);
    }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
function getConfirmView()
    {
        global 
$xoopsModuleConfig,$xoopsDB;
        
$myts =& MyTextSanitizer::getInstance();

        if (isset(
$_POST['cancel']))
        {
            
$base_url XMOBILE_URL.'/?act=pmessage&sess='.$this->sessionHandler->getSessionID();
            
header('Location: '.$base_url);
            exit();
        }

// XOOPS Cube 2.1 ¤Î¾ì¹çÁ÷¿®ÀèÆþÎÏÊýË¡¤òÈ¿±Ç¤¹¤ë
        
$send_type 0;
        if (
preg_match("/^XOOPS Cube/",XOOPS_VERSION))
        {
            
$module_handler =& xoops_gethandler('module');
            
$pm_module =& $module_handler->getByDirName('pm');
            if (
is_object($pm_module))
            {
                
$pm_mid $pm_module->getVar('mid');
            }
            
$config_handler =& xoops_gethandler('config');
            
$pm_moduleConfig =& $config_handler->getConfigsByCat(0$pm_mid);
            
$send_type $pm_moduleConfig['send_type'];
        }
        
$this->controller->render->template->assign('send_type',$send_type);
// XOOPS Cube 2.1 ¤Î¾ì¹çÁ÷¿®ÀèÆþÎÏÊýË¡¤òÈ¿±Ç¤¹¤ë

        
$this->controller->render->template->assign('show_edit',true);

        
$op $myts->makeTboxData4Show($this->utils->getGetPost('op'''));
        
$reply intval($this->utils->getGetPost('reply'0));
        
$delete intval($this->utils->getGetPost('delete'0));
        
$send intval($this->utils->getGetPost('send'0));
        
$send2 intval($this->utils->getGetPost('send2'0));
        
$to_userid intval($this->utils->getGetPost('to_userid'''));
        
$msg_id intval($this->utils->getGetPost('msg_id'0));
        
$subject $myts->makeTboxData4Save($this->utils->getPost('subject'''));
        
$msg_text $myts->makeTareaData4Save($this->utils->getPost('msg_text'''),0,1,1);
        
$session_id $this->sessionHandler->getSessionID();
        
$uid $this->sessionHandler->getUid();

        if (isset(
$_POST['reply'])) $reply 1;
        if (isset(
$_POST['delete'])) $delete 1;

// ÉÔÍס©
/*
        if (empty($_GET['refresh'] ) && isset($_POST['op']) && $_POST['op'] != 'submit')
        {
            // $jump¤ÎÃͤÏgetLinkUrl()¤Çhtmlspecialchars()¤ò³Ý¤±¤é¤ì¤ë¤Î¤Ç&amp;¤Ç¤Ï¤Ê¤¯&¤Èµ­½Ò¤·¤Æ¤ª¤¯
            $jump = '';
            if ($send == 1)
            {
                $jump .= 'send='.$send.'';
            }
            elseif ($send2 == 1)
            {
                $jump .= 'send2='.$send2.'&to_userid='.$to_userid.'';
            }
            elseif ($reply == 1)
            {
                $jump .= 'reply='.$reply.'&msg_id='.$msg_id.'';
            }
            $base_url = $this->utils->getLinkUrl($this->controller->getActionState(),null,null,$this->sessionHandler->getSessionID(),$jump);
            $this->controller->render->redirectHeader($message,5,$base_url);
            exit();
        }
*/

        
if ($uid)
        {
            if (
$op == 'submit' && XoopsMultiTokenHandler::quickValidate('pm'))
            {
                
$res $xoopsDB->query('SELECT COUNT(*) FROM '.$xoopsDB->prefix('users').' WHERE uid='.$to_userid);
                list(
$count) = $xoopsDB->fetchRow($res);
                if (
$count != 1)
                {
                    
$base_url $this->utils->getLinkUrl('pmessage',null,null,$this->sessionHandler->getSessionID());
                    
$this->controller->render->redirectHeader(_MD_XMOBILE_USERNOEXIST.'<br />'._MD_XMOBILE_PLZTRYAGAIN,5,$base_url);
                    exit();
                }
                else
                {
                    
$pm_handler =& xoops_gethandler('privmessage');
                    
$pm =& $pm_handler->create();
                    
$pm->setVar('subject'$subject);
                    
$pm->setVar('msg_text'$msg_text);
                    
$pm->setVar('to_userid'$to_userid);
                    
$pm->setVar('from_userid'$uid);
                    if (!
$pm_handler->insert($pm))
                    {
                        
$base_url $this->utils->getLinkUrl('pmessage',null,null,$this->sessionHandler->getSessionID());
                        
$this->controller->render->redirectHeader($pm->getHtmlErrors(),5,$base_url);
                        exit();
                    }
                    else
                    {
                        
$base_url $this->utils->getLinkUrl('pmessage',null,null,$this->sessionHandler->getSessionID());
                        
$this->controller->render->redirectHeader(_MD_XMOBILE_PM_MESSAGEPOSTED,5,$base_url);
                        exit();
                    }
                }

            }
            elseif (
$delete == && XoopsMultiTokenHandler::quickValidate('pm'))
            {
                
$pm_handler =& xoops_gethandler('privmessage');
                
$pm =& $pm_handler->get($msg_id);
                if (!
is_object($pm) || $pm->getVar('to_userid') != $uid || !$pm_handler->delete($pm))
                {
                    
$base_url $this->utils->getLinkUrl($this->controller->getActionState(),null,null,$this->sessionHandler->getSessionID());
                    
$this->controller->render->redirectHeader(_MD_XMOBILE_DELETE_FAILED,5,$base_url);
                    exit();
                }
                else
                {
                    
$base_url $this->utils->getLinkUrl($this->controller->getActionState(),null,null,$this->sessionHandler->getSessionID());
                    
$this->controller->render->redirectHeader(_MD_XMOBILE_PM_DELETED,3,$base_url);
                    exit();
                }
            }
            elseif (
$reply == || $send == || $send2 == 1)
            {
                
$token =& XoopsMultiTokenHandler::quickCreate('pm');
                
$pm_uid '';
                
$pm_uname '';
                
$msg_text '';

                include_once 
XOOPS_ROOT_PATH.'/include/xoopscodes.php';
                if (
$reply == 1)
                {
                    
$pm_handler =& xoops_gethandler('privmessage');
                    
$pm =& $pm_handler->get($msg_id);
                    if (
$pm->getVar('to_userid') == $uid)
                    {
                        
$pm_uname XoopsUser::getUnameFromId($pm->getVar('from_userid'));
                        
$msg_text '>'.$pm->getVar('msg_text''E');
                    }
                    else
                    {
                        unset(
$pm);
                        
$reply $send2 0;
                    }
                }

                if (
$reply == 1)
                {
                    
$pm_uid $pm->getVar('from_userid');
                }
                elseif (
$send2 == 1)
                {
                    
$pm_uid $to_userid;
                    
$pm_uname XoopsUser::getUnameFromId($to_userid);
                }
                else
                {
                    
$pm_uids = array();
                    
$i 0;
                    
$result $xoopsDB->query('SELECT uid, uname FROM '.$xoopsDB->prefix('users').' WHERE level > 0 ORDER BY uname');
//                    while(list($ftouid, $ftouname) = $xoopsDB->fetchRow($result))
                    
while($row $xoopsDB->fetchArray($result))
                    {
//                        $pm_uids[$i]['uid'] = $ftouid;
//                        $pm_uids[$i]['uname'] = $myts->makeTboxData4Show($ftouname);
                        
$pm_uids[$i]['uid'] = intval($row['uid']);
                        
$pm_uids[$i]['uname'] = $myts->makeTboxData4Show($row['uname']);
                        
$i++;
                    }
                    
$this->controller->render->template->assign('pm_uids',$pm_uids);
                }

                
$subject '';
                if (
$reply == 1)
                {
                    
$subject $pm->getVar('subject''E');
                    if (!
preg_match('/^Re:/i',$subject))
                    {
                        
$subject 'Re: '.$subject;
                    }
                }

                
$base_url $this->utils->getLinkUrl('pmessage','confirm',null,$this->controller->sessionHandler->getSessionID());
                
$base_url preg_replace('/&amp;/i','&',$base_url);
                
$this->controller->render->template->assign('base_url',$base_url);
                
$this->controller->render->template->assign('ticket_html',$token->getHtml());
                
$this->controller->render->template->assign('session_name',session_name());
                
$this->controller->render->template->assign('session_id',session_id());
                
$this->controller->render->template->assign('referer_url',$this->getBaseUrl());
                
$this->controller->render->template->assign('msg_text',$msg_text);
                
$this->controller->render->template->assign('reply',$reply);
                
$this->controller->render->template->assign('send2',$send2);
                
$this->controller->render->template->assign('pm_uid',$pm_uid);
                
$this->controller->render->template->assign('pm_uname',$pm_uname);
                
$this->controller->render->template->assign('subject',$subject);
                
$this->controller->render->template->assign('tarea_cols',$xoopsModuleConfig['tarea_cols']);
                
$this->controller->render->template->assign('tarea_rows',$xoopsModuleConfig['tarea_rows']);
            }
        }
        else
        {
            
$base_url $this->utils->getLinkUrl('register',null,null,$this->sessionHandler->getSessionID());
            
$message _MD_XMOBILE_PM_SORRY.'<br /><a href="'.$base_url.'">'._MD_XMOBILE_REGISTERNOW.'</a>.';
            
$this->controller->render->redirectHeader($message,5,$base_url);
        }
    }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
?>


NOTES:

1. Debug mode on
2. Use the following information to log
User: Liliana
Password: Liliana


[EN]Inbox - [ES]Bandeja de entrada

Thanks for your help!

Top

laguna
Just popping in
Joined:
2004/10/8 20:28
From Lomas de Zamora, Buenos Aires, Argentina
Posts: 45
(Show More) (Show Less)
#6 Posted on: 2009/9/19 4:56 Re: xmobile running in xoops?
XoopsMultiTokenHandler is core source on XOOPS Cube, or XOOPS 2.0.16a ( Fork version by Japanese community)

So, currently it's not running in the other core. It should be change to other common token or include it as xMobile class.


Top

Edited by dashbord on 2009/9/20 3:05:22

bluemooninc.biz
dashbord
Just popping in
Joined:
2004/4/19 9:49
From Tokyo, Japan
Posts: 70
(Show More) (Show Less)
#7 Posted on: 2009/9/20 21:09 Re: xmobile running in xoops?
Oh, that hurts. Thanks for your answer!

I have seen on their website which has now taken up the development of this module. I encourage you to continue, is an excellent module.

Thanks again!

Top

laguna
Just popping in
Joined:
2004/10/8 20:28
From Lomas de Zamora, Buenos Aires, Argentina
Posts: 45
(Show More) (Show Less)
#8 Posted on: 2009/9/21 20:08 Re: xmobile running in xoops?
Hi laguna,

I prefer supporting various cores to selected core. So I changed XoopsMultiToken to gTicket as common ticket class.

Now, you can take it at SVN in sourceforge.jp


Top

Edited by dashbord on 2009/9/23 0:15:14

bluemooninc.biz
dashbord
Just popping in
Joined:
2004/4/19 9:49
From Tokyo, Japan
Posts: 70
(Show More) (Show Less)
#9 Posted on: 2009/9/22 0:53 Re: xmobile running in xoops?
Excellent! I'm reviewing the repository! Thank you very much for your answer! I love this module!

Top

laguna
Just popping in
Joined:
2004/10/8 20:28
From Lomas de Zamora, Buenos Aires, Argentina
Posts: 45
(Show More) (Show Less)
#10 Posted on: 2009/10/1 0:23 Re: xmobile running in xoops?
I updated to xmobile version 040rc4. Private messages work perfectly. Excellent!

CORE: XOOPS 2.0.18.2
SERVER: Linux
PHP Version: 5.2.9
MySQL API Version: 5.0.81

Test site (debug mode on)

Congratulations by your great work!


Top

laguna
Just popping in
Joined:
2004/10/8 20:28
From Lomas de Zamora, Buenos Aires, Argentina
Posts: 45
(Show More) (Show Less)

 Top   Previous Topic   Next Topic

1 2 »

You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You can vote in polls.
You cannot attach files to posts.
You cannot post without approval.

[Advanced Search]