summaryrefslogtreecommitdiff
path: root/includes/UserCVS.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/UserCVS.php')
-rw-r--r--[-rwxr-xr-x]includes/UserCVS.php178
1 files changed, 77 insertions, 101 deletions
diff --git a/includes/UserCVS.php b/includes/UserCVS.php
index ad7e1d66..7798ee66 100755..100644
--- a/includes/UserCVS.php
+++ b/includes/UserCVS.php
@@ -1,103 +1,79 @@
<?php
-
-
-if( !isset($_SESSION['UID']))
- $_SESSION['UID'] = -1;
-
-// CVS import Data
-$SQL_CVS = "SELECT * FROM `UserCVS` WHERE UID=".$_SESSION['UID'];
-$Erg_CVS = mysql_query($SQL_CVS, $con);
-$_SESSION['CVS'] = mysql_fetch_array($Erg_CVS);
-
-
-// Group import Data, if nesseary
-if( isset( $_SESSION['CVS'][ "GroupID" ]))
-{
- $SQL_GRP = "SELECT * FROM `UserCVS` WHERE UID=".$_SESSION['CVS'][ "GroupID" ];
- $Erg_GRP = mysql_query($SQL_GRP, $con);
- $_SESSION['CVS_Group'] = mysql_fetch_array($Erg_GRP);
-
- foreach( $_SESSION['CVS'] as $k => $v)
- {
- if($v=="G") // Right == Group
- $_SESSION['CVS'][$k] = $_SESSION['CVS_Group'][$k];
- }
-}
-
-//pagename ermitteln
-$Page["Name"] = substr( $_SERVER['PHP_SELF'], strlen($ENGEL_ROOT) );
-
-//recht f?r diese seite auslesen
-if( isset( $_SESSION['CVS'][ $Page["Name"] ]))
- $Page["CVS"] = $_SESSION['CVS'][ $Page["Name"] ];
-else
-{
- echo "SYSTEM ERROR: now right for ". $Page["Name"]. "exist";
- die;
-}
-
-if( $DEBUG )
-{
-// foreach( $_SESSION as $k => $v)
-// echo "$k = $v<br>\n";
- echo "<pre>\$_SESSION:\n";
- print_r($_SESSION);
- echo "</pre>";
-
- if( strlen($Page["CVS"]) == 0 )
- echo "<h1><u> CVS ERROR, on page '". $Page["Name"]. "'</u></h1>";
- else
- echo "CVS: ". $Page["Name"]. " => '". $Page["CVS"]. "'<br>";
-
-}
-
-function funktion_isLinkAllowed( $PageName)
-{
- global $_SESSION;
-
- // separate page parameter
- $ParameterPos = strpos( $PageName, ".php?");
- if( $ParameterPos === FALSE)
- {
- $pName = $PageName;
- }
- else
- {
- $pName = substr( $PageName, 0, $ParameterPos + 4);
- }
-
- // check rights
- if( (isset( $_SESSION['CVS'][ $pName ]) === TRUE) &&
- ($_SESSION['CVS'][ $pName ] == "Y") )
- {
- return TRUE;
- }
-
- return FALSE;
-}
-
-function funktion_isLinkAllowed_addLink_OrLinkText( $PageName, $LinkText)
-{
- global $url, $ENGEL_ROOT;
-
- if( funktion_isLinkAllowed( $PageName) === TRUE)
- {
- return "<a href=\"". $url. $ENGEL_ROOT. $PageName. "\">". $LinkText. "</a>";
- }
-
- return $LinkText;
-}
-
-function funktion_isLinkAllowed_addLink_OrEmpty( $PageName, $LinkText)
-{
- global $url, $ENGEL_ROOT;
-
- if( funktion_isLinkAllowed( $PageName) === TRUE)
- {
- return "<a href=\"". $url. $ENGEL_ROOT. $PageName. "\">". $LinkText. "</a>";
- }
-
- return "";
-}
-
+ if(!isset($_SESSION['UID']))
+ $_SESSION['UID'] = -1;
+
+ // CVS import Data
+ $SQL_CVS = "SELECT * FROM `UserCVS` WHERE UID=" . $_SESSION['UID'];
+ $Erg_CVS = mysql_query($SQL_CVS, $con);
+ $_SESSION['CVS'] = mysql_fetch_array($Erg_CVS);
+
+ // Group import Data, if nesseary
+ if(isset($_SESSION['CVS']["GroupID"])) {
+ $SQL_GRP = "SELECT * FROM `UserCVS` WHERE UID=" . $_SESSION['CVS'][ "GroupID" ];
+ $Erg_GRP = mysql_query($SQL_GRP, $con);
+ $_SESSION['CVS_Group'] = mysql_fetch_array($Erg_GRP);
+
+ foreach($_SESSION['CVS'] as $k => $v) {
+ if($v == "G")
+ $_SESSION['CVS'][$k] = $_SESSION['CVS_Group'][$k];
+ }
+ }
+
+ // pagename ermitteln
+ $Page["Name"] = basename($_SERVER['PHP_SELF']);
+
+ //recht fuer diese seite auslesen
+ if(isset($_SESSION['CVS'][$Page["Name"]]))
+ $Page["CVS"] = $_SESSION['CVS'][$Page["Name"]];
+ else {
+ echo "SYSTEM ERROR: now right for " . $Page["Name"] . " exists.";
+ die;
+ }
+
+ if($debug) {
+ echo "<pre>\$_SESSION:\n";
+ print_r($_SESSION);
+ echo "</pre>";
+
+ if( strlen($Page["CVS"]) == 0 )
+ echo "<h1><u> CVS ERROR, on page '". $Page["Name"]. "'</u></h1>";
+ else
+ echo "CVS: ". $Page["Name"]. " => '". $Page["CVS"]. "'<br />";
+ }
+
+ function funktion_isLinkAllowed($PageName) {
+ global $_SESSION;
+
+ // separate page parameter
+ $ParameterPos = strpos($PageName, ".php?");
+
+ if($ParameterPos === false)
+ $pName = $PageName;
+ else
+ $pName = substr($PageName, 0, $ParameterPos + 4);
+
+ // check rights
+ if((isset( $_SESSION['CVS'][ $pName ]) === true) && $_SESSION['CVS'][ $pName ] == "Y")
+ return true;
+
+ return false;
+ }
+
+ function funktion_isLinkAllowed_addLink_OrLinkText( $PageName, $LinkText) {
+ global $url, $ENGEL_ROOT;
+
+ if(funktion_isLinkAllowed( $PageName) === true)
+ return "<a href=\"" . $url. $ENGEL_ROOT . $PageName . "\">" . $LinkText . "</a>";
+
+ return $LinkText;
+ }
+
+ function funktion_isLinkAllowed_addLink_OrEmpty( $PageName, $LinkText) {
+ global $url, $ENGEL_ROOT;
+
+ if(funktion_isLinkAllowed( $PageName) === true)
+ return "<a href=\"" . $url . $ENGEL_ROOT . $PageName . "\">" . $LinkText . "</a>";
+
+ return "";
+ }
?>