cvs: pear /Perm_LiveUser/docs/examples/example5 admin.php home.php

From: Date: Tue, 17 Feb 2004 13:23:02 +0000
Subject: cvs: pear /Perm_LiveUser/docs/examples/example5 admin.php home.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-16618@lists.php.net to get a copy of this message
arnaud Tue Feb 17 08:23:02 2004 EDT Modified files: /pear/Perm_LiveUser/docs/examples/example5 home.php admin.php Log: * CS http://cvs.php.net/diff.php/pear/Perm_LiveUser/docs/examples/example5/home.php?r1=1.2&r2=1.3&ty=u Index: pear/Perm_LiveUser/docs/examples/example5/home.php diff -u pear/Perm_LiveUser/docs/examples/example5/home.php:1.2 pear/Perm_LiveUser/docs/examples/example5/home.php:1.3 --- pear/Perm_LiveUser/docs/examples/example5/home.php:1.2 Sun Feb 8 05:06:15 2004 +++ pear/Perm_LiveUser/docs/examples/example5/home.php Tue Feb 17 08:23:02 2004 @@ -14,8 +14,8 @@ // Setup db and template objects $db = DB::connect($dsn); -if( DB::isError( $db ) ) { - echo $db->getMessage() . ' ' . $db->getUserInfo(); +if (DB::isError( $db)) { + die($db->getMessage() . ' ' . $db->getUserInfo()); } $db->setFetchMode(DB_FETCHMODE_ASSOC); @@ -29,7 +29,7 @@ $login .= '<p><a href="admin.php">Go to the admin part</a></p>'; } -$tpl =& new HTML_Template_IT('./'); +$tpl = &new HTML_Template_IT('./'); $tpl->loadTemplatefile('home.tpl', true, true); // assign the content to the vars @@ -58,7 +58,7 @@ $news = $db->getAssoc($query); - if( DB::isError( $news ) ) { + if (DB::isError($news)) { die($news->getMessage() . ' ' . $news->getUserinfo()); } else { $tpl =& new HTML_Template_IT('./'); http://cvs.php.net/diff.php/pear/Perm_LiveUser/docs/examples/example5/admin.php?r1=1.2&r2=1.3&ty=u Index: pear/Perm_LiveUser/docs/examples/example5/admin.php diff -u pear/Perm_LiveUser/docs/examples/example5/admin.php:1.2 pear/Perm_LiveUser/docs/examples/example5/admin.php:1.3 --- pear/Perm_LiveUser/docs/examples/example5/admin.php:1.2 Sun Feb 8 05:06:15 2004 +++ pear/Perm_LiveUser/docs/examples/example5/admin.php Tue Feb 17 08:23:02 2004 @@ -10,11 +10,11 @@ PEAR::setErrorHandling(PEAR_ERROR_RETURN); -$usr = &LiveUser::factory( $conf ); +$usr = &LiveUser::factory($conf); $usr->setLoginFunction('logIn'); $usr->setLogOutFunction('logOut'); -if( PEAR::isError( $usr->init() ) ) { +if (PEAR::isError( $usr->init())) { die($usr->getMessage() . ' ' . $usr->getUserinfo()); } @@ -38,18 +38,18 @@ //var_dump($usr); echo '</pre>'; */ -if( !$usr->isLoggedin() || !$usr->checkRight( EDITNEWS ) ) { +if (!$usr->isLoggedin() || !$usr->checkRight(EDITNEWS)) { echo 'Sorry but you cannot access this page'; exit; } -if( isset( $_POST['news'] ) ) { - if( !$usr->checkRight( MODIFYNEWS ) ) { +if (isset($_POST['news'])) { + if (!$usr->checkRight(MODIFYNEWS)) { echo 'You are trying to modify a news but do not have the right to do so !'; exit; } - if( isset( $_POST['id'] ) ) { - if( $_POST['id'] == 0 ) { + if (isset( $_POST['id'])) { + if ($_POST['id'] == 0) { insertNews($db, $_POST['title'], $_POST['newscontent'], $usr->getProperty('user_id')); } else { updateNewsContent($db, $_POST['id'], $_POST['title'], $_POST['newscontent'], $usr->getProperty('user_id')); @@ -59,13 +59,13 @@ $category = 'general'; -if( isset( $_GET['mode'] ) && $_GET['mode'] == edit) { - if( !isset( $_GET['id'] ) && !is_numeric( $_GET['id'] ) ) { +if (isset( $_GET['mode']) && $_GET['mode'] == edit) { + if (!isset($_GET['id']) && !is_numeric($_GET['id'])) { die('Missing news id'); } $news = getNewsContent($db, $_GET['id']); -} elseif( isset( $_GET['mode'] ) && $_GET['mode'] == insert) { +} elseif (isset($_GET['mode']) && $_GET['mode'] == insert) { $news = getNewsContent($db, 0); } else { $news = getNewsList($db, $category);

« previous php.pear.cvs (#16618) next »