Skip to content

Commit

Permalink
added first (pre-beta) version of public section functionality. You m…
Browse files Browse the repository at this point in the history
…ust run setup to update your ilias.ini OR add the directive [system]ANONYMOUS_USER_ID = <user account id> manually.

The user with <user account id> must have username & password set to 'anonymous'. Furthermore you need to enable 'public section' in the basic settings.


git-svn-id: http://svn.ilias.de/svn/ilias/trunk@1840 21b2c9ec-7c21-0410-8b45-9bfb8ed2bfc5
  • Loading branch information
shofmann committed Aug 11, 2003
1 parent 645e2cc commit 7a9e8f0
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 9 deletions.
19 changes: 18 additions & 1 deletion classes/class.ilMainMenuGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function setTemplateVars()
global $rbacsystem, $lng, $ilias;

// administration button
if ($rbacsystem->checkAccess("visible", ROOT_FOLDER_ID))
if ($rbacsystem->checkAccess("visible", SYSTEM_FOLDER_ID))
{
$this->tpl->setCurrentBlock("userisadmin");
$this->tpl->setVariable("IMG_ADMIN2", ilUtil::getImagePath("navbar/admin.gif", false));
Expand All @@ -100,6 +100,23 @@ function setTemplateVars()
$this->tpl->setVariable("TARGET2", $this->target);
$this->tpl->parseCurrentBlock();
}

if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID)
{
$this->tpl->setCurrentBlock("userisanonymous");
$this->tpl->setVariable("TXT_NOT_LOGGED_IN",$lng->txt("not_logged_in"));
$this->tpl->setVariable("TXT_LOGIN",$lng->txt("login"));
$this->tpl->setVariable("TXT_REGISTER",$lng->txt("register"));
$this->tpl->parseCurrentBlock();
}
else
{
$this->tpl->setCurrentBlock("userisloggedin");
$this->tpl->setVariable("TXT_WELCOME",$lng->txt("welcome"));
$this->tpl->setVariable("TXT_LOGOUT2",$lng->txt("logout"));
$this->tpl->setVariable("USERNAME",$ilias->account->getFullname());
$this->tpl->parseCurrentBlock();
}

$var2image = array( "IMG_DESK" => "navbar/desk.gif",
"IMG_DESK_O" => "navbar/desk_o.gif",
Expand Down
5 changes: 3 additions & 2 deletions classes/class.ilObjUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -1035,19 +1035,20 @@ function setSkin($a_str)

/*
* check user id with login name
* @param integer account id
* @access public
*/
function checkUserId($AccountId)
function checkUserId()
{
$r = $this->ilias->db->query("SELECT usr_id FROM usr_data WHERE login='".$this->ilias->auth->getUsername()."'");
//query has got a result
if ($r->numRows() > 0)
{
$data = $r->fetchRow();
$this->id = $data[0];

return $this->id;
}

return false;
}

Expand Down
5 changes: 5 additions & 0 deletions classes/class.ilias.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ function ILIAS()
define ("ILIAS_HTTP_PATH",$this->ini->readVariable('server','http_path'));
define ("ILIAS_ABSOLUTE_PATH",$this->ini->readVariable('server','absolute_path'));

define ("ANONYMOUS_USER_ID",$this->ini->readVariable('system','ANONYMOUS_USER_ID'));

// build dsn of database connection and connect
$this->dsn = $this->ini->readVariable("db","type").
"://".$this->ini->readVariable("db", "user").
Expand All @@ -168,6 +170,9 @@ function ILIAS()

$this->db = new ilDBx($this->dsn);

// set anonymous user id
//define ("ANONYMOUS_USER_ID",$this->getSetting("anonymous_user_id"));

// build option string for PEAR::Auth
$this->auth_params = array(
'dsn' => $this->dsn,
Expand Down
1 change: 1 addition & 0 deletions ilias.master.ini.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@
ROLE_FOLDER_ID = 8
MAXLENGTH_OBJ_TITLE = 65
MAXLENGTH_OBJ_DESC = 123
ANONYMOUS_USER_ID =
DEBUG = 0
*/ ?>
7 changes: 5 additions & 2 deletions include/inc.header.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
$ilias->auth->setExpire($ilias->ini->readVariable("session","expire"),true);
$ilias->auth->start();


// start logging
$log = new ilLog("ilias.log");

Expand All @@ -138,7 +137,7 @@
//get user id
if (empty($_SESSION["AccountId"]))
{
$_SESSION["AccountId"] = $ilias->account->checkUserId($_SESSION["AccountId"]);
$_SESSION["AccountId"] = $ilias->account->checkUserId();

// assigned roles are stored in $_SESSION["RoleId"]
$rbacreview = new ilRbacReviewH();
Expand All @@ -160,6 +159,10 @@
}

}
elseif ($script != "login.php" and $script != "nologin.php")
{
header("Location: index.php");
}

//init language
$lng = new ilLanguage($ilias->account->prefs["language"]);
Expand Down
13 changes: 13 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@
require_once "include/inc.check_pear.php";
require_once "include/inc.header.php";

if ($_GET["cmd"] == "login")
{
$ilias->auth->logout();
session_destroy();
header("location: login.php");
exit();
}

// Specify your start page in ilias.ini.php
$start = $ilias->ini->readVariable("server", "start");

Expand All @@ -42,6 +50,11 @@
$start = "login.php";
}

if ($ilias->getSetting("pub_section") == "y")
{
$start = "nologin.php";
}

// catch reload
if ($_GET["reload"])
{
Expand Down
3 changes: 3 additions & 0 deletions lang/ilias_de.lang
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ common#:#accept_usr_agreement#:#Benutzer-Lizenz akzeptieren?
common#:#access#:#Zugang
common#:#action_aborted#:#Aktion abgebrochen###09 Aug 2003 content changed
common#:#actions#:#Aktionen
common#:#welcome#:#Willkommen
common#:#not_logged_in#:#Sie sind nicht eingeloggt
common#:#register#:#Anmelden
common#:#active_roles#:#Aktive Rollen
common#:#add#:#hinzufügen
common#:#add_author#:#Autor hinzufügen
Expand Down
3 changes: 3 additions & 0 deletions lang/ilias_en.lang
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ common#:#active_roles#:#Active Roles
common#:#add#:#Add
common#:#add_author#:#Add Author
common#:#add_member#:#Add Member
common#:#welcome#:#Welcome
common#:#not_logged_in#:#Your are not logged in
common#:#register#:#Register
common#:#administrate#:#Administrate
common#:#administration#:#Administration
common#:#administrator#:#Administrator
Expand Down
1 change: 1 addition & 0 deletions login.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
*
* @package ilias-layout
*/

require_once "include/inc.check_pear.php";
require_once "include/inc.header.php";

Expand Down
11 changes: 11 additions & 0 deletions templates/default/blueshadow.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ td {
.btnbar {
background-color:#ffffff;
background-image: url(blueshadow/images/navbar/back.gif);
color:#ffffff;
}

a.menu:link, a.menu:visited {
color:#f7f7f7;
text-decoration:underline;
font-size:9px;
}

a.menu:hover {
color:#2255a0;
}

input, textarea {
Expand Down
15 changes: 11 additions & 4 deletions templates/default/tpl.main_buttons.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr class="btnbar">
<td width="1%" height="1"></td>
<td width="59%" height="1"></td>
<td width="39%" height="1"></td>
<td width="43%" height="1"></td>
<td width="30%" height="1"></td>
<td width="25%" height="1"></td>
<td width="1%" height="1"></td>
</tr>
<tr class="btnbar">
<td><img class="spacer" src="{IMG_SPACE}" border="0" width="10" height="1" /></td>
<td width="100%">
<td>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td colspan="6"><img class="spacer" border="0" src="{IMG_SPACE}" width="1" height="4" /></td>
Expand Down Expand Up @@ -118,6 +119,12 @@
</tr>
</table>
</td>
<!-- BEGIN userisanonymous -->
<td width="100%" align="right" nowrap="nowrap">{TXT_NOT_LOGGED_IN}!<br/><a class="menu" href="index.php?cmd=login" target="_top">{TXT_LOGIN}</a>&nbsp;<a class="menu" href="register.php" target="_top">{TXT_REGISTER}</a></td>
<!-- END userisanonymous -->
<!-- BEGIN userisloggedin -->
<td width="100%" align="right" nowrap="nowrap">{TXT_WELCOME}, {USERNAME}!<br/><a class="menu" href="logout.php" target="_top">{TXT_LOGOUT2}</a></td>
<!-- END userisloggedin -->
<td align="right">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
Expand All @@ -143,6 +150,6 @@
</tr>
</table>
</td>
<td class="btnbar"><small>&nbsp;</small></td>
<td><img class="spacer" src="{IMG_SPACE}" border="0" width="10" height="1" /></td>
</tr>
</table>

0 comments on commit 7a9e8f0

Please sign in to comment.