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_official / html / modules / admin [ view in CVS ]
| Date | Directory [filter] | File(s) [view] | Author [filter] |
| 04 Aug 2002 21:23:23 | postnuke_official/html/modules/admin | admin.php,NONE,1.1.2.1 changes.txt,NONE,1.1.2.1 index.php,NONE,1.1.2.1 moduleChanges.php,NONE,1.1.2.1 pnfunctions.php,NONE,1.1.2.1 pninit.php,NONE,1.1.2.1 pntables.php,NONE,1.1.2.1 pnversion.php,NONE,1.1.2.1 | John Cox |
| added new admin view | |||
Update of /home/cvsroot/postnuke_official/html/modules/admin
In directory ns7.hostnuke.net:/tmp/cvs-serv23009/html/modules/admin
Added Files:
Tag: PostNuke_71
admin.php changes.txt index.php moduleChanges.php
pnfunctions.php pninit.php pntables.php pnversion.php
Log Message:
added new admin view
--- NEW FILE: admin.php ---
<?
// File: $Id: admin.php,v 1.1.2.1 2002/08/04 21:23:21 niceguyeddie Exp $ $Name: $
// ----------------------------------------------------------------------
// POST-NUKE Content Management System
// Copyright (C) 2001 by the PostNuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// 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: Magnus Hammar & Bjarne Varöystrand
// Purpose of file: Display a new adminlayout with more options
// ----------------------------------------------------------------------
if (!eregi("admin.php", $PHP_SELF)) {
die ("Access Denied");
}
$index = 0;
/************************************************************************/
$ModName = basename(dirname(__FILE__));
/************************************************************************/
modules_get_language();
/************************************************************************/
/************************************************************************/
function adminlite_show($gID,$show_in_a_row) {
$ModName = basename(dirname(__FILE__));
// -------------------------------------------------------------
// Do some database stuff...
list($dbconn) = pnDBGetConn();
$pntable = admin_pntables();
$table = $pntable['member_table'];
$column = &$pntable['members'];
$modTable = pnConfigGetVar('prefix')."_modules";
// -------------------------------------------------------------
// Number of modules shown in a row
// $show_in_a_row = 4; // Number of files to show in a row
// -------------------------------------------------------------
// Calculate some stuff like rowspan...
$colspan = $show_in_a_row * 2;
$show_in_a_row = $show_in_a_row - 1;
$shown = 0;
// -------------------------------------------------------------
// Get the name of this module
$gName = getAdminLiteName($gID);
// -------------------------------------------------------------
// Start with the printout of all the modules in this group
echo "
<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td colspan=\"".$colspan."\" align=\"center\" nowrap height=\"15\"><img src=\"modules/$ModName/pnimages/spacer.gif\" alt=\"An Empty Spacer\" width=\"1\" height=\"10\"></td>
</tr>";
// -------------------------------------------------------------
//
// Select all modules in this group and display them.
// Also check and see if there is an admin-image and if it is
// using admin.php och index.php.
$query = "SELECT ".$column['mid']." FROM ".$table." INNER JOIN ".$modTable." AS mod ON ".$column['mid']." = mod.pn_id WHERE ".$column['gid']."='".$gID."' ORDER BY mod.pn_displayname";
$result = mysql_query($query);
$num = mysql_numrows($result);
if($num > 0){
for ($i = 0 ;$i < $num; $i++){
$mID = mysql_result($result, $i, $column['mid']);
// -------------------------------------------------------------
// Get information about the module
//
list($admin,$image,$name,$status) = getModInfo($mID);
if (pnSecAuthAction(0, "admin::", ":".$name.":", ACCESS_EDIT)){
// -------------------------------------------------------------
//
// Check and see if there is an image that we can use, else just
// display the name.
//
if($status == 3 || $status == 5){
if(checkShowModule($name)){
if($image){
if(substr($image,-4,4) != ".png"){
if(file_exists($image) && substr($image,-4,4) == ".png" || substr($image,-4,4) ==".jpg" || substr($image,-4,4) ==".gif"){
$imInfo = getimagesize($image);
$imHight = $imInfo[1];
$imWidth = $imInfo[0];
$image = "<img src=\"".$image."\" alt=\"".$name."\" width=\"".$imWidth."\" height=\"".$imHight."\" border=\"0\">";
}
}else{
$image = "<img src=\"".$image."\" alt=\"".$name."\" border=\"0\">";
}
}else{
if(file_exists("modules/".$ModName."/pnimages/default.gif")){
$image = "<img src=\"modules/".$ModName."/pnimages/default.gif\" alt=\"".$name."\" border=\"0\">";
}else{
$image = _ADMIN_LITE_NO_IMAGE_FOUND_;
}
}
// Now we start and check how many outputs in a row we have
// If none, then start with a new row.
if($shown == 0){
echo "<tr>\n";
}
// Print the module
echo "<td align=\"center\" nowrap valign=\"bottom\" height=\"45\" width=\"10\"><img src=\"modules/$ModName/pnimages/spacer.gif\" alt=\"Spacer\" width=\"10\" height=\"1\"></td>\n";
echo "<td align=\"center\" nowrap valign=\"bottom\" height=\"45\" width=\"110\"><a href=\"".$admin."\">".$image."<br>$name</a></td>\n";
// If we have reached the maximum number of modules in a row then make a new row and a spacer
// else just add a new number to the count.
if($shown == $show_in_a_row){
$shown = 0;
echo "</tr><tr><td colspan=\"".$colspan."\" align=\"center\" valign=\"middle\" nowrap><img src=\"modules/$ModName/pnimages/spacer.gif\" alt=\"An Empty Spacer\" width=\"10\" height=\"25\"></td></tr>\n";
}else{
$shown = $shown + 1;
}
}
}
}
}
// When the loop of all modules in group is done we have some cleaning up to do
// some rows ma be incomplete and then we have to finish them and in the end type a stop row tag.
//
if($shown != 0){
for($i = $shown; $i < ($show_in_a_row+1);$i++){
echo "<td align=\"center\" nowrap></td>\n";
echo "<td align=\"center\" nowrap></td>\n";
}
echo "</tr>\n";
}
}else{
echo "<tr><td colspan=\"".$colspan."\" align=\"left\">";
echo '<b>'._ADMIN_LITE_EMPTY_TAB_.'</b>
<p>'._ADMIN_LITE_HOW_TO_ADD_MODULES_TO_TAB_.'</p>';
echo "</td></tr>";
}
// Display a logout-link at the bottom.
echo "</table>";
}
function adminlite_edit($gID){
$ModName = basename(dirname(__FILE__));
$allSkins = getAllSkins();
$current_skin = pnModGetVar('AdminLite','use_skin');
echo "
<form action=\"admin.php?op=main&module=$ModName&admin_func=edit\" method=\"post\">
<table>
<tr>
<td><select name=\"gID\" size=\"1\">";
listAllGroups($gID);
echo "</select></td>
<td> </td>
<td><input type=\"submit\" value=\""._ADMIN_LITE_EDIT_TAB_."\"></td>
</form><form action=\"admin.php?op=main&module=$ModName&admin_func=edit_groups\" method=\"post\">
<input type=\"hidden\" name=\"gID\" value=\"".$gID."\">
<td><input type=\"submit\" value=\""._ADMIN_LITE_EDIT_ALL_TABS_."\"></td>
</tr>
<tr>
<td><input type=\"text\" name=\"new_group\" size=\"30\" maxlength=\"200\"></td>
<td> </td>
<td colspan=\"2\"><input type=\"submit\" value=\""._ADMIN_LITE_ADD_NEW_TAB_."\"></td>
</tr>
</form>
<form action=\"admin.php?op=main&module=$ModName&admin_func=edit\" method=\"post\">
<input type=\"hidden\" name=\"gID\" value=\"".$gID."\">
<tr>
<td><select name=\"new_skin\" size=\"1\">";
for($i = 0;$i < count($allSkins);$i++){
$skinInfo = $allSkins[$i];
// ........................
// Information available:
//
// dir
// name
// version
// description
// author
// contact
// ........................
echo "<option value=\"".$skinInfo['dir']."\"";
if($skinInfo['dir'] == $current_skin){
echo " selected";
}
echo ">".$skinInfo['name']."</option>\n";
}
echo "</select></td>
<td> </td>
<td colspan=\"2\"><input type=\"submit\" value=\""._ADMIN_LITE_CHANGE_SKIN_."\"></td>
</tr>
</table>
</form>
<br>";
// ---------------------------------------------
// If there is any changes in the modules table
// let's display a page with an alert or make it
// automatic.
$returnValue = checkSync($gID);
if($returnValue){
// -------------------------------------------------------------------
// Sync with all the new modules
//
if($returnValue['regen']){
regenerateModules($GLOBALS['regen']);
$gID = $GLOBALS['regen'];
echo "<p><b>"._ADMIN_LITE_INSTALLED_NEW_MODULES_."</b></p>";
}
// -------------------------------------------------------------------
// Remove all old modules not in use
//
if($returnValue['remove']){
removeOldModules();
echo "<p><b>"._ADMIN_LITE_REMOVED_OLD_MODULES_."</b></p>";
}
// -------------------------------------------------------------------
// This function displays a new window with information about new modules
// and modules that has been removed.
//
// $page = "admin.php?DnMC=1&gID=".$gID."&op=main&module=$ModName&admin_func=0";
// printNewStatusModules($page,'400','250');
//
// -------------------------------------------------------------------
}
//
// ---------------------------------------------
echo "<br>";
if($gID > 0){
displaySingleEditTable($gID);
}
if(countMembersInGroup($gID) > 0){
displayModuleList($gID);
}else{
echo "<b>"._ADMIN_LITE_EMPTY_TAB_."</b>";
echo "<p>"._ADMIN_LITE_HOW_TO_ADD_MODULES_TO_TAB_IN_ADMIN_."</p>";
}
}
function admin_main_automated()
{
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
if (pnSecAuthAction(0, 'Stories::', '::', ACCESS_EDIT)) {
OpenTable();
echo '<center><b>'._AUTOMATEDARTICLES.'</b></center>'."\n"
.'<br>'."\n";
$count = 0;
$column = &$pntable['autonews_column'];
$query = buildSimpleQuery ('autonews', array ('anid', 'catid', 'aid', 'title', 'time', 'alanguage'), "$column[anid]!='" . language_sql('a','AND') . "'", "$column[time] ASC");
$result = $dbconn->Execute($query);
if ($result->EOF) {
echo '<center><i>'._NOAUTOARTICLES.'</i></center>'."\n";
} else {
echo '<table border="1" width="100%">'."\n";
while(list($anid,$catid,$said,$title,$time,$alanguage) = $result->fields) {
echo '<tr>'."\n";
if ($alanguage == '') $alanguage = 'x_all';
if ($count == 0) $count = 1;
$time = ereg_replace(" ", "@", $time);
if ($catid == 0) {
// Default category
$cattitle = "";
} else {
$catcolumn = &$pntable['stories_cat_column'];
$catquery = buildSimpleQuery('stories_cat', array('title'), "$catcolumn[catid] = $catid");
$catresult = $dbconn->Execute($catquery);
list($cattitle) = $catresult->fields;
}
if (pnSecAuthAction(0, 'Stories::', "$said:$cattitle:", ACCESS_EDIT)) {
echo '<td align="right" nowrap>(<a href="admin.php?module=ns-addstory&op=autoEdit&anid='.$anid.'">'._EDIT.'</a>';
if (pnSecAuthAction(0, 'Stories::', "$said:$cattitle:", ACCESS_DELETE)) {
echo '-<a href="admin.php?module=ns-addstory&op=autoDelete&anid='.$anid.'">'._DELETE.'</a>'."\n";
}
echo ')';
}
echo '<td width="100%"> '.pnVarPrepForDisplay($title).' </td>'."\n"
.'<td align="center"> '.language_name($alanguage).' </td>'."\n"
.'<td nowrap> '.$time.' </td>'."\n"
.'</tr>'."\n";
$result->MoveNext();
}
echo '</table>'."\n";
}
CloseTable();
}
}
function admin_main_article()
{
global $bgcolor1;
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$admart = pnConfigGetVar('admart');
if (pnSecAuthAction(0, 'Stories::', '::', ACCESS_EDIT)) {
OpenTable();
echo '<center><b>'._LAST.' '.pnVarPrepForDisplay($admart).' '._ARTICLES.'</b></center>'."\n"
.'<br>'."\n"
.'<center>'."\n"
.'<table border="1" width="100%" bgcolor="'.$bgcolor1.'">';
$storiescolumn = &$pntable['stories_column'];
$topicscolumn = &$pntable['topics_column'];
if (strcmp(pnConfigGetVar('dbtype'), 'oci8') == 0) {
$myquery = "SELECT $storiescolumn[sid],
$storiescolumn[cid],
$storiescolumn[aid],
$storiescolumn[title],
$storiescolumn[time],
$storiescolumn[topic],
$storiescolumn[informant],
$storiescolumn[alanguage],
$topicscolumn[topicname]
FROM $pntable[stories], $pntable[topics]
WHERE $storiescolumn[topic]=$topicscolumn[topicid](+)
ORDER BY $storiescolumn[time] DESC LIMIT $admart";
} else {
$myquery = "SELECT $storiescolumn[sid],
$storiescolumn[cid],
$storiescolumn[aid],
$storiescolumn[title],
$storiescolumn[time],
$storiescolumn[topic],
$storiescolumn[informant],
$storiescolumn[alanguage],
$topicscolumn[topicname]
FROM $pntable[stories]
LEFT JOIN $pntable[topics] ON $storiescolumn[topic]=$topicscolumn[topicid]
ORDER BY $storiescolumn[time] DESC LIMIT $admart";
}
$result = $dbconn->Execute($myquery);
while(list($sid, $cid, $said, $title, $time, $topic, $informant, $alanguage,$topicname) = $result->fields) {
if ($alanguage=='') {
$alanguage = 'x_all';
}
formatTimestamp($time);
if ($title == "") {
$title = '- No title -';
}
echo '<tr>'."\n"
.'<td align="right"><b>'.$sid.'</b></td>'
.'<td align="left" width="100%"><a href="modules.php?op=modload&name=news&file=article&sid='.$sid.'">'.pnVarPrepForDisplay($title).'</a></td>'."\n"
.'<td align="center">'.language_name($alanguage).'</td>'."\n"
.'<td align="right" nowrap>'.$topicname.'</td>'."\n";
if ($cid == 0) {
// Default category
$cattitle = "";
} else {
$catcolumn = &$pntable['stories_cat_column'];
$catquery = buildSimpleQuery('stories_cat', array('title'), "$catcolumn[catid] = $cid");
$catresult = $dbconn->Execute($catquery);
list($cattitle) = $catresult->fields;
}
if (pnSecAuthAction(0, 'Stories::', "$said:$cattitle:", ACCESS_EDIT)) {
echo '<td align="right" nowrap>(<a href="admin.php?module=ns-addstory&op=EditStory&sid='.$sid.'">'._EDIT.'</a>';
if (pnSecAuthAction(0, 'Stories::', "$said:$cattitle:", ACCESS_DELETE)) {
echo '-<a href="admin.php?module=ns-addstory&op=RemoveStory&sid='.$sid.'">'._DELETE.'</a>'."\n";
}
echo ')</td>';
} else {
echo '<td> </td>';
}
echo '</tr>'."\n";
$result->MoveNext();
}
echo '</table>'."\n";
if (pnSecAuthAction(0, 'Stories::', '::', ACCESS_EDIT)) {
echo '<center>'."\n"
.'<form action="admin.php" method="post">'."\n"
.'<input type="hidden" name="module" value="ns-addstory">'."\n"
._STORYID.' : <input type="text" NAME="sid" SIZE="10">'."\n"
.'<select name="op">'."\n"
.'<option value="EditStory" SELECTED>'._EDIT.'</option>'."\n";
if (pnSecAuthAction(0, 'Stories::', '::', ACCESS_DELETE)) {
echo '<option value="RemoveStory">'._DELETE.'</option>'."\n";
}
echo '</select>'."\n"
.'<input type="hidden" name="authid" value="' . pnSecGenAuthKey() . '">'
.'<input type="submit" value="'._GO.'">'."\n"
.'</form>'."\n"
.'</center>'."\n";
}
CloseTable();
}
}
function admin_main_poll()
{
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$column = &$pntable['poll_desc_column'];
$myquery = buildSimpleQuery ('poll_desc', array ('polltitle', 'pollid'), language_sql('p'), "$column[pollid] DESC", 1);
$result = $dbconn->Execute($myquery);
list($pollTitle, $pid) = $result->fields;
if (pnSecAuthAction(0, 'Polls::', "$pollTitle::$pid", ACCESS_EDIT)) {
OpenTable();
echo "<center>"._CURRENTPOLL.": ".pnVarPrepForDisplay($pollTitle)."</center>";
CloseTable();
}
}
function admin_admin_main(){
/************************************************************************/
$ModName = basename(dirname(__FILE__));
$useNewAdmin = pnConfigGetVar('use_new_admin');
if($GLOBALS['new_skin'] != ""){
$newSkin = $GLOBALS['new_skin'];
if(!pnModSetVar('AdminLite', 'use_skin', $newSkin)){
echo "No skin was set!";
}
}
$useThisSkin = pnModGetVar('AdminLite','use_skin');
if($useThisSkin == ""){
if(!pnModSetVar('AdminLite', 'use_skin', 'default')){
echo "No skin was set!";
}
}
if($useThisSkin == ""){
$useThisSkin = 'default';
}
$use_skin = "modules/".$ModName."/skins/".$useThisSkin."/pnfunctions.php";
$func = $GLOBALS['admin_func'];
$gID = $GLOBALS['gID'];
include("modules/".$ModName."/pntables.php");
// include("modules/".$ModName."/pnfunctions.php");
include("modules/".$ModName."/pninit.php"); // Only to use the restore function
if(file_exists($use_skin)){
include($use_skin);
}else{
include("modules/".$ModName."/skins/default/pnfunctions.php");
}
Admin_Lite_initiation($gID);
if(!$func){
$func = getAdminLiteName(0,1);
}
// This will sync the modules table with the new admin
// so the new modules will be displayed and any removed modules
// will be removed.
if($GLOBALS['DnMC'] == 1){
include("modules/".$ModName."/moduleChanges.php");
die;
}elseif($GLOBALS['DnMC'] == 2){
include("modules/".$ModName."/moduleChanges.php");
die;
}
// Get the id so we know what tab to be selected when the
// user access the admin without any selected tab or with a tabID
// that is removed.
if(allow_editable_tabs == 0){
if($func == "edit"){
$func = $gID;
}
$func = checkIfGroupNumberExists($func);
}else{
if($func != "edit"){
if($func != "edit_groups"){
$func = checkIfGroupNumberExists($func);
}
}
}
// ----------------------------------------------------------------
// Check if there is anything we should do before anything else
//
// ----------------------------------------------------------------
include("header.php"); // Output PN Default header
// What do we want to use, the new or the old?
if($useNewAdmin){
// Ok, let's use the new one then...
adminlite_header($func,$numberOfTabsToShow,$tabImages); // Output our AdminLite Header
// ----------------------------------------------------------------
// If no group was selected then choose the default group.
if(allow_editable_tabs == 1){
if($func == "edit"){
// Edit tab
adminlite_edit($gID);
}elseif($func == "edit_groups"){
// Edit all tabs
displayAllEditTable();
}else{
// Show the tab if the tabnumber exists.
// else display the default.
$func = checkIfGroupNumberExists($func);
adminlite_show($func,$displayNumberOfModules);
}
}else{
// If the function allow_editable_tabs is false, then we will not show any
// function to edit the tab.
if($func == "edit"){
$func = $gID;
}elseif($func == "edit_groups"){
$func = $gID;
}
// Show the tab if the tabnumber exists.
// else display the default.
$func = checkIfGroupNumberExists($func);
adminlite_show($func,$displayNumberOfModules);
}
// ----------------------------------------------------------------
echo "<hr>";
}else{
// Ok, let's use the OLD one then...
menu_draw();
}
// Do some old stuff
if(($func != "edit") AND ($func != "edit_groups")){
admin_main_automated();
admin_main_article();
admin_main_poll();
}
if($useNewAdmin){
adminlite_footer($func,$tabImages,$ModName); // Output the AdminLite Footer
}
include("footer.php"); // Output PN Default Footer
/************************************************************************/
}
?>
--- NEW FILE: changes.txt ---
-------------------------------------------
2002-07-30
v.0.0.7
The block is finished.
Copied the function to display waiting content.
/Magnus Hammar
-------------------------------------------
2002-07-29
v.0.0.7
Implemented all the old admin functions into the new so we can replace the old module with this new one.
Created a new function to display a window if new modules has been added to the modules table or if it is removed from the table.
Started to code a new block that will display all tabs.
/Magnus Hammar
-------------------------------------------
2002-07-25 23:58
v.0.0.6
Fixed so we know what skin i sin use.
/Magnus Hammar
-------------------------------------------
--- NEW FILE: index.php ---
<?
// File: $Id: index.php,v 1.1.2.1 2002/08/04 21:23:21 niceguyeddie Exp $ $Name: $
// ----------------------------------------------------------------------
// POST-NUKE Content Management System
// Copyright (C) 2001 by the PostNuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// 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:
// Purpose of file:
// ----------------------------------------------------------------------
die ("You can't access this file directly...");
?>
--- NEW FILE: moduleChanges.php ---
<?
// File: $Id: moduleChanges.php,v 1.1.2.1 2002/08/04 21:23:21 niceguyeddie Exp $ $Name: $
// ----------------------------------------------------------------------
// POST-NUKE Content Management System
// Copyright (C) 2001 by the PostNuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// 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: Magnus Hammar - Team PostNukeSweden
// Purpose of file: Display a popupwindow with the option to sunc all the
// adminmodules if there are any changes, like new ones or deleted ones.
// ----------------------------------------------------------------------
if (!eregi("admin.php", $GLOBALS['PHP_SELF'])) {
die ("Access Denied");
}
echo "
<html>
<head><title>Table status changed</title></head>
<body>
<center>
<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">
<tr>
<td>";
if($GLOBALS['DnMC'] == 2){
echo '<script language="JavaScript">
<!--//
window.close();
//-->
</script>';
}else{
$returnValue = checkSync($gID);
echo $returnValue['regen'];
echo $returnValue['remove'];
}
echo '</td>
</tr>
<tr>
<td><a href="admin.php?op=main&module='.$ModName.'&admin_func=edit®en=1&remove_old_modules=1&DnMC=2&gID='.$gID.'">Initiate</a></td>
</tr>
</table>
</center>
</body>
</html>';
?>
--- NEW FILE: pnfunctions.php ---
<?
// File: $Id: pnfunctions.php,v 1.1.2.1 2002/08/04 21:23:21 niceguyeddie Exp $ $Name: $
// ----------------------------------------------------------------------
// POST-NUKE Content Management System
// Copyright (C) 2001 by the PostNuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// 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,
[...1309 lines suppressed...]
}
}
}
}
}
function admin_title($title)
{
OpenTable();
echo "<center><font class=\"pn-title\"><b>".$title."</b></font></center>";
CloseTable();
}
function admin_submit($module,$op,$text)
{
echo '<input type="hidden" name="module" value="'.$module.'">'."\n"
.'<input type="hidden" name="op" value="'.$op.'">'."\n"
.'<input type="submit" value="'.$text.'">'."\n";
}
?>
--- NEW FILE: pninit.php ---
<?
// File: $Id: pninit.php,v 1.1.2.1 2002/08/04 21:23:21 niceguyeddie Exp $ $Name: $
// ----------------------------------------------------------------------
// POST-NUKE Content Management System
// Copyright (C) 2001 by the PostNuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// 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:
// Purpose of file:
// ----------------------------------------------------------------------
if(basename($PHP_SELF) == basename(__FILE__)){
echo "You have no access to this file!!!";
exit;
}
// --------------------------------------------
// This is not a standardfunction in pninit.php
//
function isInAGroup($mID){
list($dbconn) = pnDBGetConn();
if(function_exists(admin_pntables)){
$pntable = admin_pntables();
}else{
$pntable = pnDBGetTables();
}
$table = $pntable['member_table'];
$column = &$pntable['members'];
$query = "SELECT * FROM ".$table." WHERE ".$column['mid']."='".$mID."'";
$result = mysql_query($query);
return mysql_numrows($result);
}
function restoreToDefault(){
$ModName = basename(dirname(__FILE__));
list($dbconn) = pnDBGetConn();
if(function_exists(admin_pntables)){
$pntable = admin_pntables();
}else{
$pntable = pnDBGetTables();
}
$modTable = pnConfigGetVar('prefix')."_modules";
// Delete all records of any tab and modules
$table = $pntable['member_table'];
mysql_query("DELETE FROM ".$table);
if (mysql_error()){
pnSessionSetVar('errormsg', _CREATETABLEFAILED);
echo "<p>".nl2br($query). " <br> ".mysql_error()."</p>";
return false;
}
$table = $pntable['group_table'];
mysql_query("DELETE FROM ".$table);
if (mysql_error()){
pnSessionSetVar('errormsg', _CREATETABLEFAILED);
echo "<p>".nl2br($query). " <br> ".mysql_error()."</p>";
return false;
} // Create a list of default tabs
// ----------------------------------------------------------------------------------------
// All tabnames
$tabNames = array("Configuration","Users","Content","Quick Links");
// ----------------------------------------------------------------------------------------
// All sorting of tabs
$sort['Quick Links'] = 1;
$sort['Content'] = 2;
$sort['Users'] = 3;
$sort['Configuration'] = 4;
// ----------------------------------------------------------------------------------------
// All sorting of tabs
$lockID['Quick Links'] = 0;
$lockID['Content'] = 0;
$lockID['Users'] = 0;
$lockID['Configuration'] = 1;
// ----------------------------------------------------------------------------------------
// All sorting of tabs
$defaultID['Quick Links'] = 1;
$defaultID['Content'] = 0;
$defaultID['Users'] = 0;
$defaultID['Configuration'] = 0;
// ----------------------------------------------------------------------------------------
// All default modules in tabs, each number is the ID in the table "modules"
$modsIDs['Quick Links'] = array("6","60","84","86","77","19","52","25");
$modsIDs['Content'] = array("8","9","10","13","3","20","27","90","33");
$modsIDs['Users'] = array("14","16","18","53","32");
$modsIDs['Configuration'] = array("7","96","11","12","15","17","41","93","21","22","29","31");
// ----------------------------------------------------------------------------------------
// Let's loop and create tabs and it's content.
for($x = 0;$x < count($tabNames);$x++){
$newTabName = $tabNames[$x];
$sortOrder = $sort[$newTabName];
$listODModIDs = $modsIDs[$newTabName];
$UseLock = $lockID[$newTabName];
$default = $defaultID[$newTabName];
$infotype_cols = &$pntable['group'];
$query = "INSERT INTO ".$pntable['group_table']." (". $infotype_cols['id'].",". $infotype_cols['lock'].",".$infotype_cols['order'].",". $infotype_cols['name'].",". $infotype_cols['default'].") VALUES ('','".$UseLock."','".$sortOrder."','".$newTabName."','".$default."')";
mysql_query($query);
if (mysql_error()){
pnSessionSetVar('errormsg', _CREATETABLEFAILED);
echo "<p>".nl2br($query). " <br> ".mysql_error()."</p>";
return false;
}else{
$infotype_cols = &$pntable['members'];
$groupID = mysql_insert_id();
for($i = 0;$i < count($listODModIDs);$i++){
$modID = $listODModIDs[$i];
$query = "INSERT INTO ".$pntable['member_table']." (". $infotype_cols['gid'].",". $infotype_cols['mid'].") VALUES ('".$groupID."','".$modID."')";
mysql_query($query);
}
}
}
// ----------------------------------------------------------------------------------------
// Create a Misc tab where all other modules should be stored.
//
$infotype_cols = &$pntable['group'];
$newTabName = "Misc";
$sortOrder = "";
$default = 0;
$query = "INSERT INTO ".$pntable['group_table']." (". $infotype_cols['id'].",". $infotype_cols['lock'].",".$infotype_cols['order'].",". $infotype_cols['name'].",". $infotype_cols['default'].") VALUES ('','0','".(count($tabNames)+1)."','".$newTabName."','".$default."')";
mysql_query($query);
if (mysql_error()){
pnSessionSetVar('errormsg', _CREATETABLEFAILED);
echo "<p>".nl2br($query). " <br> ".mysql_error()."</p>";
return false;
}else{
$miscID = mysql_insert_id();
}
// ----------------------------------------------------------------------------------------
// Modules in group
$infotype_cols = &$pntable['members'];
$result = mysql_query("SELECT * FROM ".pnConfigGetVar('prefix')."_modules WHERE pn_admin_capable='1'");
$num = mysql_numrows($result);
for ($i = 0 ;$i < $num; $i++){
$modID = mysql_result($result, $i, "pn_id");
if(isInAGroup($modID) < 1){
$query = "INSERT INTO ".$pntable['member_table']." (". $infotype_cols['gid'].",". $infotype_cols['mid'].") VALUES ('".$miscID."','".$modID."')";
mysql_query($query);
if(mysql_error()){
pnSessionSetVar('errormsg', _CREATETABLEFAILED);
echo "<p>".nl2br($sql). " <br> ".mysql_error()."</p>";
return false;
}
}
}
return true;
}
function admin_init(){
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
if(!is_array($pntable)){
echo "<p><b>No tables found to create!</b></p>";
}
// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// ============================== NEXT TABLE ===============================
// group_table
// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
$templatetable = $pntable['group_table'];
$templatecolumn = &$pntable['group'];
$sql = "CREATE TABLE ".$templatetable." (
".$templatecolumn['id']." INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
".$templatecolumn['name']." VARCHAR(200) NOT NULL DEFAULT '',
".$templatecolumn['lock']." VARCHAR(200) NOT NULL DEFAULT '0',
".$templatecolumn['all']." VARCHAR(200) NOT NULL DEFAULT '0',
".$templatecolumn['order']." INT(11) NOT NULL DEFAULT '0',
".$templatecolumn['default']." TINYINT(1) DEFAULT '0' NOT NULL
)";
mysql_query($sql);
// Check for an error with the database code, and if so set an
// appropriate error message and return
if (mysql_error()) {
pnSessionSetVar('errormsg', _CREATETABLEFAILED);
return false;
}
// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// ============================== NEXT TABLE ===============================
// member_table
// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
$templatetable = $pntable['member_table'];
$templatecolumn = &$pntable['members'];
$sql = "CREATE TABLE ".$templatetable." (
".$templatecolumn['gid']." INT(11),
".$templatecolumn['order']." INT(11),
".$templatecolumn['mid']." INT(11)
)";
mysql_query($sql);
// Check for an error with the database code, and if so set an
// appropriate error message and return
if (mysql_error()) {
pnSessionSetVar('errormsg', _CREATETABLEFAILED);
return false;
}
$query = "INSERT INTO ".pnConfigGetVar('prefix')."_module_vars (pn_modname,pn_name,pn_value) VALUES ('/PNConfig','use_new_admin','1')";
mysql_query($query);
if(restoreToDefault()){
return true;
}else{
return false;
}
}
/**
* upgrade the template module from an old version
* This function Agent_Registration_user_can be called multiple times
*/
function admin_upgrade($oldversion){
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
if(!is_array($pntable)){
echo "<p><b>No tables to create were found!</b></p>";
die;
return false;
}
switch($oldversion) {
case "0.0.6":
// No table update needed.
return true;
break;
case "0.0.5":
// No table update needed.
admin_upgrade("0.0.6");
break;
case "0.0.4":
$query = "INSERT INTO ".pnConfigGetVar('prefix')."_module_vars (pn_modname,pn_name,pn_value) VALUES ('/PNConfig','use_new_admin','1')";
mysql_query($sql);
if (mysql_error()) {
pnSessionSetVar('errormsg', _UPDATETABLEFAILED);
echo "<p>".nl2br($sql). " <br> ".mysql_error()."</p>";
return false;
}
admin_upgrade("0.0.5");
break;
case "0.0.3":
$templatetable = $pntable['group_table'];
$templatecolumn = &$pntable['group'];
$sql = "ALTER TABLE ".$templatetable." ADD ".$templatecolumn['all']." INT(11) NOT NULL default '0'";
mysql_query($sql);
if (mysql_error()) {
pnSessionSetVar('errormsg', _UPDATETABLEFAILED);
echo "<p>".nl2br($sql). " <br> ".mysql_error()."</p>";
return false;
}
admin_upgrade("0.0.4");
break;
case "0.0.2":
$templatetable = $pntable['group_table'];
$templatecolumn = &$pntable['group'];
$sql = "ALTER TABLE ".$templatetable." ADD ".$templatecolumn['lock']." INT(11) NOT NULL default '0'";
mysql_query($sql);
if (mysql_error()) {
pnSessionSetVar('errormsg', _UPDATETABLEFAILED);
echo "<p>".nl2br($sql). " <br> ".mysql_error()."</p>";
return false;
}
admin_upgrade("0.0.3");
break;
case "0.0.1":
$templatetable = $pntable['member_table'];
$templatecolumn = &$pntable['members'];
$sql = "ALTER TABLE ".$templatetable." ADD ".$templatecolumn['order']." INT(11) NOT NULL default '1'";
mysql_query($sql);
if (mysql_error()) {
pnSessionSetVar('errormsg', _UPDATETABLEFAILED);
echo "<p>".nl2br($sql). " <br> ".mysql_error()."</p>";
return false;
}
$templatetable = $pntable['group_table'];
$templatecolumn = &$pntable['group'];
$sql = "ALTER TABLE ".$templatetable." ADD ".$templatecolumn['order']." INT(11) NOT NULL default '1'";
mysql_query($sql);
if (mysql_error()){
pnSessionSetVar('errormsg', _UPDATETABLEFAILED);
echo "<p>".nl2br($sql). " <br> ".mysql_error()."</p>";
return false;
}
admin_upgrade("0.0.2");
break;
// ------------------------------------------------------------------------
}
}
/**
* delete the template module
* This function Agent_Registration_user_is only ever called once during the lifetime of a particular
* module instance
*/
function admin_delete()
{
// Get datbase setup - note that both pnDBGetConn() and pnDBGetTables()
// return arrays but we handle them differently. For pnDBGetConn()
// we currently just want the first item, which is the official
// database handle. For pnDBGetTables() we want to keep the entire
// tables array together for easy reference later on
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
// Drop the table - for such a simple command the advantages of separating
// out the SQL statement from the Execute() command are minimal, but as
// this has been done elsewhere it makes sense to stick to a single method
$sql = "DROP TABLE IF EXISTS ".$pntable['group_table'];
mysql_query($sql);
if (mysql_error()) {
return false;
}
$sql = "DROP TABLE IF EXISTS ".$pntable['member_table'];
mysql_query($sql);
if (mysql_error()) {
return false;
}
$sql = "DELETE FROM ".pnConfigGetVar('prefix')."_module_vars WHERE pn_modname='/PNConfig' AND pn_name='use_new_admin'";
mysql_query($sql);
if (mysql_error()) {
return false;
}
return true;
}
?>
--- NEW FILE: pntables.php ---
<?
// File: $Id: pntables.php,v 1.1.2.1 2002/08/04 21:23:21 niceguyeddie Exp $ $Name: $
// ----------------------------------------------------------------------
// POST-NUKE Content Management System
// Copyright (C) 2001 by the PostNuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// 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:
// Purpose of file:
// ----------------------------------------------------------------------
if(basename($PHP_SELF) == basename(__FILE__)){
echo "You have no access to this file!!!";
exit;
}
function admin_pntables(){
// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
$pntable = array();
// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// ============================== NEXT TABLE ===============================
// admin_lite_group
// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// Get the name for the template item table. This is not necessary
// but helps in the following statements and keeps them readable
$departments = pnConfigGetVar('prefix') . '_admin_lite_group';
$pntable['group_table'] = $departments;
$pntable['group'] = array(
'id' => $departments . '.groupID',
'name' => $departments . '.groupName',
'lock' => $departments . '.groupLock',
'all' => $departments . '.groupShowAllModules',
'default' => $departments . '.groupDefault',
'order' => $departments . '.sortOrder'
);
// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// ============================== NEXT TABLE ===============================
// admin_lite_group_members
// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// Get the name for the template item table. This is not necessary
// but helps in the following statements and keeps them readable
$departments_members = pnConfigGetVar('prefix') . '_admin_lite_group_members';
$pntable['member_table'] = $departments_members;
$pntable['members'] = array(
'gid' => $departments_members . '.groupID',
'order' => $departments_members . '.sortOrder',
'mid' => $departments_members . '.moduleID'
);
return $pntable;
}
?>
--- NEW FILE: pnversion.php ---
<?
// $Id: pnversion.php,v 1.1.2.1 2002/08/04 21:23:21 niceguyeddie Exp $ $Name: $
$modversion['name'] = 'Admin';
$modversion['version'] = '0.0.7';
$modversion['description'] = 'PostNuke Admin Module';
$modversion['credits'] = 'docs/';
$modversion['help'] = 'docs/docs/';
$modversion['changelog'] = 'docs/';
$modversion['license'] = 'docs/';
$modversion['offical'] = 0;
$modversion['author'] = 'Magnus Hammar & Bjarne Varöystrand';
$modversion['contact'] = 'magnus@programmering.nu, bjarne@vgit.se';
$modversion['admin'] = 0;
$modversion['securityschema'] = array('admin::' => 'Tab Name:Tab Module:');
?>
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 |