• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

[8wayRun.Com] XenPorta (Module Add-Ons)

Can a module be created that requires a user's own settings and stored for that user...for example with the widgets in say iGoogle many of them have a function where you add your own setting like Horoscope (date of birth), Latest News (number of items to display) etc...say I want a module that displays the user's Gmail Inbox, it would need to have a setting of the user's Gmail address.

If modules can be created like this then this would have to be the best Portal/Home Page addon outside of Google...you would get creating their own unique home page and then treating your site as their internet home page in the browser meaning they keep coming back to your site.
XenPorta 1.5.0 can do this.
 
Ok having some trouble figuring this out..

xml
Code:
<div class="messageText ugc baseHtml">
    <div class="section">
        <div class="secondaryContent">
            <h3>Multiworld (Start World/Survival (NoGrief)/Waterworld)</h3>
                <div align="center">
                        <div align="center">
{xen:raw $MMCUsers.User_Count}/64: {xen:raw $MMCUsers.User_List}                          </div>
                </div>
        </div>
    </div>
</div>

PHP file
Code:
/**
* Query a Minecraft server running hMod with Minequery
*/

// new line constant
define("NL", "\n");
$survive = new Minequery('68.68.201.213', '25567');
class Minequery
{
public function getModule()
{
return array(
'User_List' => $survive->flatTree($survive->player_list()),
'User_Count' => $survive->player_count(),
);
}
// create the socket and establish a connection
// with the minecraft server
function __construct($server, $port)
{
$this->socket = fsockopen($server, $port, $erno, $erst, 5);
if ($this->socket == FALSE) {
// error out and die if we cant connect
//trigger_error("Could not connect to the remote server", E_USER_ERROR);
//die();
$down = "This server is currently down.";
return $down;
}
else {
$this->query();
}

}

// send the request and store the result for later
// processing by the class
private function query()
{
$query = "QUERY" . NL ;
$buffer = "";
fwrite($this->socket, $query);
while (!feof($this->socket)) {
$buffer .= fgets($this->socket, 1024);
}
$this->query = explode(NL, $buffer);
}

// these functions split the line into 2 sections
// and return the second section

// SERVERPORT ####
public function port()
{
$port = explode(' ', $this->query[0]);
return $port[1];
}

// PLAYERCOUNT ####
public function player_count()
{
$count = explode(' ', $this->query[1]);
return $count[1];
}

// MAXPLAYERS ####
public function max_players()
{
$max = explode(' ', $this->query[2]);
return $max[1];
}

// PLAYERLIST [ABCD,EFGH,etc]
public function player_list()
{
$list = explode(' ', $this->query[3], 2 );
$list = trim($list[1], '[]');
$list = explode(',', $list);
foreach ($list as $player) {
$player_list[] = trim($player);
}
return $player_list;
}

    public function flatTree($tree) {
$Moderators = array("ZionRx", "Chelskimo", "pyneapll",
"darkpid", "bsmarshall", "rodtang", "Gerrit8500", "painking5000", "Kai_Jones", "Iszuldin", "fuzzamuzza", "DJRedFlames", "bingbong2715");
$Admins = array("fffizzz", "Howard_Roark");
$out = '';
$mods = "0";
$admins = "0";

foreach($tree as $key => $value) {

if ( in_array( strtolower($value), array_map('strtolower', $Moderators) ) ) {
$olist = "<font color=blue>$value</font>";
$mods++;
}
elseif ( in_array( strtolower($value), array_map('strtolower', $Admins) ) ) {
$olist = "<font color=red>$value</font>";
$admins++;
} else {
$olist = "<font color=gray>$value</font>";
}
            if ($out != '')
                $out.=', ';

            $out.= '<a href="http://myminecraft.com/skin/index.php?user=' . $value . '&refresh=1" target="_blank">' . $olist . '</a>';

        }

        return $out;
    }

    public function treeList($tree) {
                $Moderators = array("fauxm", "Chelskimo", "pyneapll",
"darkpid", "bsmarshall", "rodtang", "Gerrit8500", "painking5000");
                $Admins = array("fffizzz", "Howard_Roark");
                        $out = '';
        foreach($tree as $key => $value) {

                        if ( in_array( strtolower($value), array_map('strtolower', $Moderators) ) ) {
                                $olist = "<font color=blue>$value</font>";
                        }
                        elseif ( in_array( strtolower($value), array_map('strtolower', $Admins) ) ) {
                              $olist = "<font color=red>$value</font>";
                      } else {
                                $olist = "<font color=gray>$value</font>";
                        }

            $out.= '<a href="http://myminecraft.com/skin/index.php?user=' . $value . '&refresh=1" target="_blank">' . $olist . '</a>';
        }
        return $out;
    }

}

/* End of file minequery.class.php */

I added the
public function getModule()
{
return array(
'User_List' => $survive->flatTree($survive->player_list()),
'User_Count' => $survive->player_count(),
);
}

and $survive line at the top of the php file. Before i would just use an include and call the content like so $survive->flatTree($survive->player_list())

please help :)

thanks
 
When I added xenporta to my new site, and created a post for the recent news. It looked like the post was outside the module. I included a Picture. How can I fix this?
 

Attachments

  • Screen Shot 2011-10-19 at 11.17.17 PM.webp
    Screen Shot 2011-10-19 at 11.17.17 PM.webp
    31.4 KB · Views: 38
So ive been trying to go about this a different way.
Code:
<?

class EWRporta_Block_MMCUsers extends XenForo_Model {
public function getModule() {
require('/home/mcraft/public_html/minequery.class.php');
$survive = new Minequery('68.68.201.213', '25567');

$User_Count = $survive->player_count();
$Max_Users = $survive->max_players();
$User_List = $survive->flatTree($survive->player_list());

return array(
'Max_Users' => $Max_Users,
'User_Count' => $User_Count,
'User_List' => $User_List,
);
}
}
?>

If i echo instead of array, i get the results (by visiting the script directly), but cant get the data to display on the template no matter how i try..
Ive tried {$var}, {xen:raw $var}, {$MMCUsers.var} with no effect.. Please advise..

current template (as you can see im trying all 3 var methods to see what works
Code:
<div class="discussionList section sectionMain" id="usersOnline">
<dl class="sectionHeaders">
<dt class="posterAvatar"></dt>
<dd class="main">
<a class="title"><span>Multiworld (Start World/Survival (NoGrief)/Waterworld)</span></a>
</dd>
<dd class="stats">
<a class="major"><span>{$User_Count} of {xen:raw $Max_Users} Online</span></a>
</dd>
        </dl>

<ol class="discussionListItems">
{xen:raw $MMCUsers.User_List}
</ol>
</div>
 
Back
Top Bottom