Note: this list is kept only as a demonstration for CVSNotice. For the latest CVS notices, see the Xaraya and Postnuke sites
View Statistics - Next Notice - Previous NoticeDirectory filter : [ all ] / postnuke_modules / nascar [ view in CVS ]
| Date | Directory [filter] | File(s) [view] | Author [filter] |
| 09 Aug 2002 05:16:13 | postnuke_modules/nascar | pnuserapi.php,NONE,1.1 | George Neill |
| + initial import of pnuserapi.php (... a work in progress still ...) | |||
Update of /home/cvsroot/postnuke_modules/nascar
In directory ns7.hostnuke.net:/tmp/cvs-serv17946
Added Files:
pnuserapi.php
Log Message:
+ initial import of pnuserapi.php (... a work in progress still ...)
GNeill 2002.08.09
--- NEW FILE: pnuserapi.php ---
<?php
// $Id: pnuserapi.php,v 1.1 2002/08/09 05:16:11 georgen Exp $
// ----------------------------------------------------------------------
// PostNuke Content Management System
// Copyright (C) 2002 by the PostNuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// 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.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Original Author of file: George Neill
// Purpose of file: nascar user API
// ----------------------------------------------------------------------
function nascar_userapi_getall_tracks($args)
{
extract($args);
if (!isset($startnum)) {
$startnum = 1;
}
if (!isset($numitems)) {
$numitems = -1;
}
$invalid = array();
if (!isset($startnum) || !is_numeric($startnum)) {
$invalid[] = 'startnum';
}
if (!isset($numitems) || !is_numeric($numitems)) {
$invalid[] = 'numitems';
}
if (count($invalid) > 0) {
$msg = pnML('Invalid #(1) for #(2) function #(3)() in module #(4)',
join(', ',$invalid), 'user', 'getall', 'Nascar');
pnExceptionSet(PN_USER_EXCEPTION, 'BAD_PARAM',
new SystemException($msg));
return false;
}
$items = array();
if (!pnSecAuthAction(0, 'nascar::', '::', ACCESS_OVERVIEW)) {
$msg = pnML('Not authorized to access #(1) items',
'Nascar');
pnExceptionSet(PN_USER_EXCEPTION, 'NO_PERMISSION',
new SystemException($msg));
return false;
}
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$nascartable = $pntable['nascar_tracks'];
$sql = "SELECT pn_track_id,
pn_track_name,
pn_longname,
pn_location,
pn_weather_url,
pn_track_image,
pn_track_length,
pn_track_url,
pn_active
FROM $nascartable
ORDER BY pn_track_name";
$result = $dbconn->SelectLimit($sql, $numitems, $startnum-1);
if ($dbconn->ErrorNo() != 0) {
$msg = pnML('Database error for #(1) function #(2)() in module #(3)',
'user', 'getall', 'Nascar');
pnExceptionSet(PN_SYSTEM_EXCEPTION, 'DATABASE_ERROR',
new SystemException($msg));
return false;
}
for (; !$result->EOF; $result->MoveNext()) {
list($tid,
$name,
$longname,
$location,
$weather_url,
$track_image,
$track_length,
$track_url,
$active) = $result->fields;
if (pnSecAuthAction(0, 'nascar::', "$name::$tid", ACCESS_OVERVIEW)) {
$items[] = array('tid' => $tid,
'name' => $name,
'longname' => $longname,
'location' => $location,
'weather_url' => $weather_url,
'track_image' => $track_image,
'track_length' => $track_length,
'track_url' => $track_url,
'active' => $active);
}
}
$result->Close();
return $items;
}
function nascar_userapi_tracks_get($args)
{
extract($args);
if (!isset($tid) || !is_numeric($tid)) {
$msg = pnML('Invalid #(1) for #(2) function #(3)() in module #(4)',
'item ID', 'user', 'get', 'Nascar');
pnExceptionSet(PN_USER_EXCEPTION, 'BAD_PARAM',
new SystemException($msg));
return false;
}
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$nascartable = $pntable['nascar'];
$sql = "SELECT pn_track_id, pn_track_name
FROM $nascartable
WHERE pn_track_id = " . pnVarPrepForStore($tid);
$result = $dbconn->Execute($sql);
if ($dbconn->ErrorNo() != 0) {
$msg = pnML('Database error for #(1) function #(2)() in module #(3)',
'user', 'get', 'Nascar');
pnExceptionSet(PN_SYSTEM_EXCEPTION, 'DATABASE_ERROR',
new SystemException($msg));
return false;
}
if ($result->EOF) {
$result->Close();
return false;
}
list($tid, $name) = $result->fields;
$result->Close();
if (!pnSecAuthAction(0, 'nascar::', "$name::$tid", ACCESS_READ)) {
$msg = pnML('Not authorized to access #(1) item #(2)',
'Nascar', pnVarPrepForStore($tid));
pnExceptionSet(PN_USER_EXCEPTION, 'NO_PERMISSION',
new SystemException($msg));
return false;
}
$item = array('tid' => $tid, 'name' => $name);
return $item;
}
function nascar_userapi_tracks_countitems()
{
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$nascartable = $pntable['nascar'];
$sql = "SELECT COUNT(1) FROM $nascartable";
$result = $dbconn->Execute($sql);
if ($dbconn->ErrorNo() != 0) {
$msg = pnML('Database error for #(1) function #(2)() in module #(3)',
'user', 'countitems', 'Nascar');
pnExceptionSet(PN_SYSTEM_EXCEPTION, 'DATABASE_ERROR',
new SystemException($msg));
return false;
}
list($numitems) = $result->fields;
$result->Close();
return $numitems;
}
?>
View Statistics - Next Notice - Previous Notice
| Visit Developer Site - Browse CVS Repository |
Syndicate via backend.rss (max. once per hour please) | Powered by CVSNotice 0.1.3 |