<?php
/***************************************************************************
*
* Homedirectory.php
* -------------------
*
* begin : Friday, Nov 17, 2002
* copyright : (C) 2002 The Kabramps Team
* email : hide@address.com,
* hide@address.com
*
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* See the GNU General Public License for more details.
* (http://www.gnu.org/licenses/gpl.html)
*
***************************************************************************/
class Homedirectory extends Addon {
function Homedirectory() {
}
function get_view() {
global $HTTP_GET_VARS;
$uid = $HTTP_GET_VARS['uid'];
$attribute = $HTTP_GET_VARS['attribute'];
$servers = array();
$filename = "lists/homeserver.txt";
$filebuffer = fopen ($filename,"r");
if ($filebuffer) {
$content = fread($filebuffer, filesize($filename));
fclose($filebuffer);
$servers = split("\n",$content);
}
$tmpl = new Smarty;
$serverlist = "";
for ($i=0; $i<count($servers);$i++){
if ( $servers[$i] != "" ) {
$result = split(":",$servers[$i]);
$server[] = $result[0];
$homes = split(",",$result[1]);
$serverlist .= "";
for ( $j=0; $j<count($homes);$j++) {
$serverlist .= "".$homes[$j].",";
}
$serverlist = substr($serverlist,0,-1).";";
}
}
$serverlist = substr($serverlist,0,-1);
$tmpl->assign(array("SERVER" => $server,
"SERVERLIST" => $serverlist,
"SUBMIT" => gettext("ok"),
"CLOSE" => gettext("cancel"),
"UID" => $uid,
"ATTRIBUTE" => $attribute
));
return $tmpl->fetch("addons/homedirectory.tpl");
}
function get_jsfile() {
global $options;
return array($options['templates']."addons/homedirectory.js");
}
}