diff options
23 files changed, 69 insertions, 71 deletions
@@ -4,6 +4,7 @@ 22 Apr 2006; Preston Cody <codeman@gentoo.org> ChangeLog: initial scire files and directory added. more will come soon + Lots more general updates. Getting things converted over and simplified. 22 Apr 2006; Preston Cody <codeman@gentoo.org> ChangeLog: updated globaluse and Utility diff --git a/scire/DBInterface.php b/scire/DBInterface.php index c18ddc6..1f3b1bf 100755 --- a/scire/DBInterface.php +++ b/scire/DBInterface.php @@ -38,8 +38,18 @@ function get_scire_modules() for ($i =0; $i < $num_modules;$i++) { $module[$i] = mysql_fetch_row($result); - $module[$i]; - #$module_list[$i] = $module[$i][1]; + } + return $module; +} + +function get_scire_module_list() +{ + $query = "SELECT main_content,name FROM modules;"; + $result = call_query($query); + $num_modules = mysql_num_rows($result); + for ($i =0; $i < $num_modules;$i++) + { + $module[$i] = mysql_fetch_row($result); } return $module; } diff --git a/scire/admin.php b/scire/admin.php index 4b494eb..39367d2 100644 --- a/scire/admin.php +++ b/scire/admin.php @@ -1,28 +1,12 @@ <?php +include('main_checklogin.php'); include('Smarty.class.php'); +include('main_smarty.php'); #Instantiates Smarty and sets the left nav bar. + require_once('DBInterface.php'); -if(!isset($_SESSION['userid'])) { - #print "<h1>NO MATCH</h1>"; - header("Location: login.php"); -} -else { - print "Welcome $_SESSION[userid]<br>"; -} -$smarty = new Smarty; -#phpinfo(); -$smarty->template_dir = './templates'; -$smarty->compile_dir = './templates_c'; -$smarty->cache_dir = './cache'; -$smarty->config_dir = './configs'; -$smarty->assign('topbar', array( - array('name'=> 'Login', 'link' => 'login.php'), - array('name'=> 'Clients', 'link' => 'clients.php'), - array('name'=> 'Jobs/Tasks', 'link' => 'jobs.php'), - array('name'=> 'Modules', 'link' => 'modules.php'), - array('name'=> 'Admin', 'link' => 'admin.php'))); - + $smarty->display('admin.tpl'); diff --git a/scire/index.php b/scire/index.php index d881a3d..2e11ec7 100755 --- a/scire/index.php +++ b/scire/index.php @@ -1,10 +1,7 @@ <?php - + #session_start(); This is now done by main_checklogin.php require_once('DBInterface.php'); -#include('main_checklogin.php'); -print "SESSION: "; -print_r($_SESSION); -exit; +include('main_checklogin.php'); include('Smarty.class.php'); include('main_smarty.php'); #Instantiates Smarty and sets the left nav bar. @@ -21,9 +18,8 @@ include('main_smarty.php'); #Instantiates Smarty and sets the left nav bar. # distribution = varchar(30) # group? like categorizing them? # homepage = varchar(90) #misc modules should have a website -$module_list = array(); -$module_list = get_scire_modules(); -$smarty->assign('leftnav', $module_list); + + $smarty->display('index.tpl'); diff --git a/scire/login.php b/scire/login.php index d520093..5f262b5 100644 --- a/scire/login.php +++ b/scire/login.php @@ -1,36 +1,38 @@ <?php +session_start(); include('Smarty.class.php'); include('DBInterface.php'); -#phpinfo(); if ($_POST['username']) { - $users = array(); - $users = get_scire_users(); - foreach ($users as $user) { - if ($_POST['username'] == $user[0]) { - if ($_POST['passwd'] and (crypt($_POST['passwd'],447470567) == $user[1])) { - print "<h3>Found a match. Setting user's session now. ".$user[0]."</h3>"; - #session_start(); - #session_register('userid', $user[0]); - $_SESSION['userid'] = $user[0]; - session_write_close(); - print_r($_SESSION); - #header("Location: index.php"); - exit; - } - else { - session_unset(); - print "<h1>Invalid password supplied!</h1>"; - exit; - } + $user = get_scire_user($_POST['username']); + if($user) { + if ($_POST['passwd'] and (crypt($_POST['passwd'],447470567) == $user[1])) { + $_SESSION['userid'] = $user[0]; + header("Location: index.php"); + exit; + } else { + print "<h1>Invalid password supplied!</h1>"; } + } else { + print "<h1>Invalid user supplied!</h1>"; } - #session_unset(); - #print "<h1>Invalid user supplied!</h1>"; - } -include('main_smarty.php'); +$smarty = new Smarty; + +$smarty->template_dir = './templates'; +$smarty->compile_dir = './templates_c'; +$smarty->cache_dir = './cache'; +$smarty->config_dir = './configs'; + +$smarty->assign('topbar', array( + array('name'=> 'Login', 'link' => 'login.php'), + array('name'=> 'Clients', 'link' => 'clients.php'), + array('name'=> 'Jobs/Tasks', 'link' => 'jobs.php'), + array('name'=> 'Modules', 'link' => 'modules.php'), + array('name'=> 'Admin', 'link' => 'admin.php'))); + + $smarty->display('header.tpl'); ?> <b>Please Login to use Scire:</b> diff --git a/scire/main_checklogin.php b/scire/main_checklogin.php index 597c241..458fce2 100644 --- a/scire/main_checklogin.php +++ b/scire/main_checklogin.php @@ -1,4 +1,5 @@ <?php +session_start(); if(!isset($_SESSION['userid'])) { #print "<h1>NO MATCH</h1>"; header("Location: login.php"); diff --git a/scire/main_smarty.php b/scire/main_smarty.php index d3241b9..543f683 100644 --- a/scire/main_smarty.php +++ b/scire/main_smarty.php @@ -13,7 +13,11 @@ array('name'=> 'Modules', 'link' => 'modules.php'), array('name'=> 'Admin', 'link' => 'admin.php'))); $smarty->assign('left_section_header',"Module List"); - $smarty->assign('leftnav', array()); + + $module_list = array(); + $module_list = get_scire_module_list(); + print_r($module_list); + $smarty->assign('leftnav', $module_list); if($status) { $smarty->assign('error', $status); diff --git a/scire/templates/admin/add_client.tpl b/scire/templates/admin/add_client.tpl index 39f2bf0..d5ba264 100644 --- a/scire/templates/admin/add_client.tpl +++ b/scire/templates/admin/add_client.tpl @@ -1,4 +1,4 @@ -{include file="header.tpl" title="GIMLI - Admin - Add a Client"} +{include file="header.tpl" title="Scire - Admin - Add a Client"} <h2>Add a client:</h2> <form id="form1" name="form1" method="post" action=""> <table width="733" border="1"> diff --git a/scire/templates/admin/add_permission.tpl b/scire/templates/admin/add_permission.tpl index 5338deb..2c4b3bd 100644 --- a/scire/templates/admin/add_permission.tpl +++ b/scire/templates/admin/add_permission.tpl @@ -1,4 +1,4 @@ -{include file="header.tpl" title="GIMLI - Admin - Add a Permission"} +{include file="header.tpl" title="Scire - Admin - Add a Permission"} <h2>Add a permission:</h2> <form name="form7" method="post" action=""> <p>Add Permission:</p> diff --git a/scire/templates/admin/assign_permissions.tpl b/scire/templates/admin/assign_permissions.tpl index b02f00d..6d0b2e9 100644 --- a/scire/templates/admin/assign_permissions.tpl +++ b/scire/templates/admin/assign_permissions.tpl @@ -1,4 +1,4 @@ -{include file="header.tpl" title="GIMLI - Admin - Assign Permissions"} +{include file="header.tpl" title="Scire - Admin - Assign Permissions"} <form name="form1" method="post" action=""> <h3>Assign Permissions:</h3> {if !$idnum} diff --git a/scire/templates/admin/create_clientgroup.tpl b/scire/templates/admin/create_clientgroup.tpl index cb97d7f..9705dc4 100644 --- a/scire/templates/admin/create_clientgroup.tpl +++ b/scire/templates/admin/create_clientgroup.tpl @@ -1,4 +1,4 @@ -{include file="header.tpl" title="GIMLI - Admin - Create a ClientGroup"} +{include file="header.tpl" title="Scire - Admin - Create a ClientGroup"} <h2>Create a ClientGroup:</h2> <form name="form3" method="post" action=""> <p>Add Client Group:</p> diff --git a/scire/templates/admin/create_user.tpl b/scire/templates/admin/create_user.tpl index 219023d..60e5129 100644 --- a/scire/templates/admin/create_user.tpl +++ b/scire/templates/admin/create_user.tpl @@ -1,4 +1,4 @@ -{include file="header.tpl" title="GIMLI - Admin - Create a User"} +{include file="header.tpl" title="Scire - Admin - Create a User"} <h2>Create a user:</h2> <form id="form1" name="form1" method="post" action=""> <table width="733" border="1"> diff --git a/scire/templates/admin/create_usergroup.tpl b/scire/templates/admin/create_usergroup.tpl index 26f99b9..7720d45 100644 --- a/scire/templates/admin/create_usergroup.tpl +++ b/scire/templates/admin/create_usergroup.tpl @@ -1,4 +1,4 @@ -{include file="header.tpl" title="GIMLI - Admin - Create a UserGroup"} +{include file="header.tpl" title="Scire - Admin - Create a UserGroup"} <h2>Create a UserGroup:</h2> <form name="form3" method="post" action=""> <p>Add UserGroup:</p> diff --git a/scire/templates/admin/delete_client.tpl b/scire/templates/admin/delete_client.tpl index 33a09cf..a719e22 100644 --- a/scire/templates/admin/delete_client.tpl +++ b/scire/templates/admin/delete_client.tpl @@ -1,4 +1,4 @@ -{include file="header.tpl" title="GIMLI - Admin - DELETE a Client"} +{include file="header.tpl" title="Scire - Admin - DELETE a Client"} DELETE a client: <form id="form1" name="form1" method="post" action="#"> {if $clients} diff --git a/scire/templates/admin/delete_clientgroup.tpl b/scire/templates/admin/delete_clientgroup.tpl index 9131870..dafd461 100644 --- a/scire/templates/admin/delete_clientgroup.tpl +++ b/scire/templates/admin/delete_clientgroup.tpl @@ -1,4 +1,4 @@ -{include file="header.tpl" title="GIMLI - Admin - DELETE a ClientGroup"} +{include file="header.tpl" title="Scire - Admin - DELETE a ClientGroup"} DELETE a ClientGroup (subgroups will be automatically reparented): <form id="form1" name="form1" method="post" action="#"> {if $clientgroups} diff --git a/scire/templates/admin/delete_permission.tpl b/scire/templates/admin/delete_permission.tpl index cc20621..b784f69 100644 --- a/scire/templates/admin/delete_permission.tpl +++ b/scire/templates/admin/delete_permission.tpl @@ -1,4 +1,4 @@ -{include file="header.tpl" title="GIMLI - Admin - Edit a Permission"} +{include file="header.tpl" title="Scire - Admin - Edit a Permission"} <h2>Edit a permission:</h2> <form name="form7" method="post" action=""> <table width="100%" border="1"> diff --git a/scire/templates/admin/delete_user.tpl b/scire/templates/admin/delete_user.tpl index 2f4182c..5a181b8 100644 --- a/scire/templates/admin/delete_user.tpl +++ b/scire/templates/admin/delete_user.tpl @@ -1,4 +1,4 @@ -{include file="header.tpl" title="GIMLI - Admin - DELETE a User"} +{include file="header.tpl" title="Scire - Admin - DELETE a User"} DELETE a user: <form id="form1" name="form1" method="post" action="#"> {if $users} diff --git a/scire/templates/admin/delete_usergroup.tpl b/scire/templates/admin/delete_usergroup.tpl index 13ed884..fb1b006 100644 --- a/scire/templates/admin/delete_usergroup.tpl +++ b/scire/templates/admin/delete_usergroup.tpl @@ -1,4 +1,4 @@ -{include file="header.tpl" title="GIMLI - Admin - DELETE a UserGroup"} +{include file="header.tpl" title="Scire - Admin - DELETE a UserGroup"} DELETE a UserGroup (subgroups will be automatically reparented): <form id="form1" name="form1" method="post" action="#"> {if $usergroups} diff --git a/scire/templates/admin/edit_client.tpl b/scire/templates/admin/edit_client.tpl index f77fb6c..6b5eb30 100644 --- a/scire/templates/admin/edit_client.tpl +++ b/scire/templates/admin/edit_client.tpl @@ -1,4 +1,4 @@ -{include file="header.tpl" title="GIMLI - Admin - Edit a Client"} +{include file="header.tpl" title="Scire - Admin - Edit a Client"} Edit a Client: <form id="form1" name="form1" method="post" action="#"> {if $clients} diff --git a/scire/templates/admin/edit_clientgroup.tpl b/scire/templates/admin/edit_clientgroup.tpl index e0379bb..623af0f 100644 --- a/scire/templates/admin/edit_clientgroup.tpl +++ b/scire/templates/admin/edit_clientgroup.tpl @@ -1,4 +1,4 @@ -{include file="header.tpl" title="GIMLI - Admin - Edit a ClientGroup"} +{include file="header.tpl" title="Scire - Admin - Edit a ClientGroup"} <h2>Edit a ClientGroup: {$editgroupdata[3]}</h2> <form name="form4" method="post" action=""> {if $editgroup} diff --git a/scire/templates/admin/edit_permission.tpl b/scire/templates/admin/edit_permission.tpl index 22fba1b..0394858 100644 --- a/scire/templates/admin/edit_permission.tpl +++ b/scire/templates/admin/edit_permission.tpl @@ -1,4 +1,4 @@ -{include file="header.tpl" title="GIMLI - Admin - Edit a Permission"} +{include file="header.tpl" title="Scire - Admin - Edit a Permission"} <h2>Edit a permission:</h2> <form name="form7" method="post" action=""> {if $permissions} diff --git a/scire/templates/admin/edit_user.tpl b/scire/templates/admin/edit_user.tpl index 19e1fda..79ebc4b 100644 --- a/scire/templates/admin/edit_user.tpl +++ b/scire/templates/admin/edit_user.tpl @@ -1,4 +1,4 @@ -{include file="header.tpl" title="GIMLI - Admin - Edit a User"} +{include file="header.tpl" title="Scire - Admin - Edit a User"} Edit a User: <form id="form1" name="form1" method="post" action="#"> {if $users} diff --git a/scire/templates/admin/edit_usergroup.tpl b/scire/templates/admin/edit_usergroup.tpl index 4a5faf8..2f72a4f 100644 --- a/scire/templates/admin/edit_usergroup.tpl +++ b/scire/templates/admin/edit_usergroup.tpl @@ -1,4 +1,4 @@ -{include file="header.tpl" title="GIMLI - Admin - Edit a UserGroup"} +{include file="header.tpl" title="Scire - Admin - Edit a UserGroup"} <h2>Edit a UserGroup: {$editgroupdata[3]}</h2> <form name="form4" method="post" action=""> {if $editgroup} |