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 / pnblocks [ view in CVS ]
Date | Directory [filter] | File(s) [view] | Author [filter] |
04 Aug 2002 21:24:16 | postnuke_official/html/modules/admin/pnblocks | adminmodules.php,NONE,1.1.2.1 | John Cox |
added new admin |
Update of /home/cvsroot/postnuke_official/html/modules/admin/pnblocks In directory ns7.hostnuke.net:/tmp/cvs-serv23037/html/modules/admin/pnblocks Added Files: Tag: PostNuke_71 adminmodules.php Log Message: added new admin --- NEW FILE: adminmodules.php --- <?php // File: $Id: adminmodules.php,v 1.1.2.1 2002/08/04 21:24:14 niceguyeddie Exp $ $Name: $ // ---------------------------------------------------------------------- // POST-NUKE Content Management System // Copyright (C) 2001 by the Post-Nuke 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 // Purpose of file: Display a list of all admin modules // ---------------------------------------------------------------------- $blocks_modules['adminmodules'] = array( 'func_display' => 'admin_list_modules', 'func_edit' => 'blocks_admin_actions', 'func_update' => 'blocks_admin_update_content', 'text_type' => 'Admin modules', 'text_type_long' => 'Admin modules', 'allow_multiple' => false, 'form_content' => false, 'form_refresh' => false, 'show_preview' => true ); // Security pnSecAddSchema('admin::', 'Tab Name:Tab module:'); function getUrl($back){ $dirList = explode("/",__FILE__); $url = $dirList[(count($dirList)-$back)]; return $url; } function getRequests($url){ $url = explode("?",$url); $get_list = explode("&",$url[1]); for($i = 0;$i < count($get_list);$i++){ $getContent = explode("=",$get_list[$i]); $getName = $getContent[0]; $getValue = $getContent[1]; if($getName != "gID"){ if($content){ $content .="&"; } $content .= $getName."=".$getValue; } } return "?".$content; } function admin_list_modules($row){ list($dbconn) = pnDBGetConn(); $pntable = pnDBGetTables(); if(!pnSecAuthAction(0, "admin::", "::", ACCESS_EDIT)) { return; } // Get the modName, a little hard to do when the __FILE__ doesn't work // so we have to go "back" a few steps to get the name of the module $ModName = getUrl(3); // Get all requests made by other pages so we an remember where we are // have to get the sessionvar because the modload cleans the request uri // so the gID will be lost. $getQuery = getRequests($GLOBALS['REQUEST_URI']); $use_gID = $GLOBALS['gID']; if($use_gID > 0 || $use_gID == 'none'){ if($use_gID == 'none'){ $use_gID = 0; } $setSuccess = pnModSetVar('admin','user_'.pnUserGetVar('uid'),$use_gID); }else{ $use_gID = pnModGetVar('admin','user_'.pnUserGetVar('uid')); } if(!$setSuccess){ // $content = "Unable to set \"user_".pnUserGetVar('uid')."\" with value ".$use_gID."!?<br>"; } // Start the first content data, a table start $content .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; // Include this only if it hasen't been included before. require_once("modules/".$ModName."/pntables.php"); require_once("modules/".$ModName."/pnfunctions.php"); require_once("modules/".$ModName."/pninit.php"); // Only to use the restore function // Make a connection and get all tables $pntable = admin_pntables(); // Group/Tab table $table = $pntable['group_table']; $column = &$pntable['group']; // Modules in group/tab table $modtable = $pntable['member_table']; $modcolumn = &$pntable['members']; // Modules table $modulestable = pnConfigGetVar('prefix')."_modules"; // Select $result = mysql_query("SELECT * FROM ".$table." ORDER BY ".$column['order']); $num = mysql_numrows($result); for ($i = 0 ;$i < $num; $i++){ $gID = mysql_result($result, $i, $column['id']); $gName = mysql_result($result, $i, $column['name']); if (pnSecAuthAction(0, "Admin::", $gName."::", ACCESS_EDIT)) { if($use_gID == $gID){ $content .= "<tr><td><b>".$gName."</b> <a href=\"".$getQuery."&gID=none\"><img src=\"images/global/upb.gif\" border=\"0\"></a></td></tr>"; $query = "SELECT ".$modcolumn['mid']." FROM ".$modtable." INNER JOIN ".$modulestable." AS mod ON ".$modcolumn['mid']." = mod.pn_id WHERE ".$modcolumn['gid']."='".$gID."' ORDER BY mod.pn_displayname"; $result2 = mysql_query($query); $num2 = mysql_numrows($result2); if($num2 > 0){ for ($i2 = 0 ;$i2 < $num2; $i2++){ $mID = mysql_result($result2, $i2, $modcolumn['mid']); // ------------------------------------------------------------- // Get information about the module // list($admin,$image,$name,$status) = getModInfo($mID); // ------------------------------------------------------------- // // Check and see if there is an image that we can use, else just // display the name. // // if (pnSecAuthAction(0, "Adminblock::", $gName.":".$name.":", ACCESS_EDIT)) { if (pnSecAuthAction(0, "admin::", ":".$name.":", ACCESS_EDIT)) { if($status == 3 || $status == 5){ if(checkShowModule($name)){ $content .= "<tr><td align=\"left\" nowrap valign=\"bottom\"> <strong><big>·</big></strong> <a href=\"".$admin."&gID=".$gID."\">$name</a></td></tr>\n"; } } } } } }else{ $content .= "<tr><td><strong><big>·</big></strong> <a href=\"".$getQuery."&gID=".$gID."\">".$gName."</a></td></tr>"; } } } //$content .="<tr><td align=\"right\" valign=\"bottom\" nowrap>[ <a href=\"admin.php?op=main&module=".$ModName."&admin_func=edit&gID=".$gID."\">Edit admin</a> ]</td></TR>"; $content .="</table><br>"; $content .="<div align=\"center\">[ <a href=\"admin.php?op=main&module=".$ModName."&admin_func=edit&gID=".$GLOBALS['gID']."\">"._ADMIN_LITE_EDIT_."</a> | <a href=\"admin.php\">"._ADMIN_LITE_ADMIN_."</a> | <a href=\"user.php?module=ns-user&op=logout\">"._ADMIN_LITE_LOGOUT_."</a> ]</div>"; // <Original Author> // ----------------------------------------------------------------------------------------------------- // Original Author of the following code: Jim McDonald // Purpose of code: Display menu, with lots of options // ----------------------------------------------------------------------------------------------------- $pntable = pnDBGetTables(); $vars = pnBlockVarsFromContent($row['content']); // Waiting content if (!empty($vars['displaywaiting'])) { // Separate from current content, if any if ($contentOther == 1) { $content .= addMenuStyledUrl_WaitingContent($vars['style'], "", "", ""); } $header = 0; if (pnSecAuthAction(0, "Stories::", "::", ACCESS_ADD)) { $result = $dbconn->Execute("SELECT count(1) FROM $pntable[queue] WHERE {$pntable['queue_column']['arcd']}=0"); if ($dbconn->ErrorNo() == 0) { list($qnum) = $result->fields; $result->Close(); if ($qnum) { if ($header == 0) { $content .= addMenuStyledUrl_WaitingContent($vars['style'], "<strong>" . _WAITINGCONT. "</strong>", "", ""); $header = 1; } $content .= addMenuStyledUrl_WaitingContent($vars['style'], _SUBMISSIONS.": $qnum", "admin.php?module=ns-addstory&op=submissions", ""); $contentOther = 1; } } } if (pnSecAuthAction(0, "Reviews::", "::", ACCESS_ADD)) { $result = $dbconn->Execute("SELECT count(1) FROM $pntable[reviews_add]"); if ($dbconn->ErrorNo() == 0) { list($rnum) = $result->fields; $result->Close(); if ($rnum) { if ($header == 0) { $content .= addMenuStyledUrl_WaitingContent($vars['style'], "<strong>" . _WAITINGCONT. "</strong>", "", ""); $header = 1; } $content .= addMenuStyledUrl_WaitingContent($vars['style'], _WREVIEWS.": $rnum", "admin.php?module=reviews&op=main", ""); $contentOther = 1; } } } if (pnSecAuthAction(0, "Web Links::", "::", ACCESS_ADD)) { $result = $dbconn->Execute("SELECT count(1) FROM $pntable[links_newlink]"); if ($dbconn->ErrorNo() == 0) { list($lnum) = $result->fields; $result->Close(); if ($lnum) { if ($header == 0) { $content .= addMenuStyledUrl_WaitingContent($vars['style'], "<strong>" . _WAITINGCONT. "</strong>", "", ""); $header = 1; } $content .= addMenuStyledUrl_WaitingContent($vars['style'], _WLINKS.": $lnum", "admin.php?module=web_links&op=main", ""); $contentOther = 1; } } } if (pnSecAuthAction(0, "Downloads::", "::", ACCESS_ADD)) { $result = $dbconn->Execute("SELECT count(1) FROM $pntable[downloads_newdownload]"); if ($dbconn->ErrorNo() == 0) { list($dnum) = $result->fields; $result->Close(); if ($dnum) { if ($header == 0) { $content .= addMenuStyledUrl_WaitingContent($vars['style'], "<strong>" . _WAITINGCONT. "</strong>", "", ""); $header = 1; } $content .= addMenuStyledUrl_WaitingContent($vars['style'], _WDOWNLOADS.": $dnum", "admin.php?module=downloads&op=main", ""); $contentOther = 1; } } } if (pnSecAuthAction(0, "FAQ::", "::", ACCESS_ADD)) { $faqcolumn = &$pntable['faqanswer_column']; $result = $dbconn->Execute("SELECT count(1) FROM $pntable[faqanswer] WHERE $faqcolumn[answer]=''"); if ($dbconn->ErrorNo() == 0) { list($fnum) = $result->fields; $result->Close(); if ($fnum) { if ($header == 0) { $content .= addMenuStyledUrl_WaitingContent($vars['style'], "<strong>" . _WAITINGCONT. "</strong>", "", ""); $header = 1; } $content .= addMenuStyledUrl_WaitingContent($vars['style'], _FQUESTIONS.": $fnum", "admin.php?module=faq&op=FaqCatUnanswered", ""); $contentOther = 1; } } } } // ----------------------------------------------------------------------------------------------------- // </Original Author> if(empty($row['title'])) { $row['title'] = "Admin Menu"; } $row['content'] = $content; return themesideblock($row); } // <Original Author> // ----------------------------------------------------------------------------------------------------- // Original Author of the following code: Jim McDonald // Purpose of code: Display menu, with lots of options function startMenuStyle_WaitingContent($style){ // Nothing to do for style == 1 (bullet list) $content = ""; if ($style == 2) { $content = "<br><center><form method=\"post\" action=\"index.php\"><select class=\"pn-text\" name=\"newlanguage\" onChange=\"top.location.href=this.options[this.selectedIndex].value\">"; } return $content; } function endMenuStyle_WaitingContent($style){ // Nothing to do for style == 1 (bullet list) $content = ""; if ($style == 2) { $content = "</select></form></center>"; } return $content; } function addMenuStyledUrl_WaitingContent($style, $name, $url, $comment){ if ($style == 1) { // Bullet list if (empty($url)) { // Separator if (empty($name)) { $content = "<br />"; } else { $content = "<br /><b>$name</b><br />"; } } else { switch ($url[0]) // Used to allow support for linking to modules with the use of bracket { case '[': // old style module link { $url = explode(':', substr($url, 1, - 1)); $url = 'modules.php?op=modload&name='.$url[0].'&file='.((isset($url[1])) ? $url[1]:'index'); break; } case '{': // new module link { $url = explode(':', substr($url, 1, - 1)); $url = 'index.php?module='.$url[0].'&func='.((isset($url[1])) ? $url[1]:'main'); break; } } // End Bracket Linking $content = "<strong><big>·</big></strong> <a class=\"pn-normal\" href=\"$url\" title=\"$comment\">$name</a><br />"; } } else if ($style == 2) { // Drop-down lilst if (empty($url)) { // Separator $content = "<option>-----</option>"; if (!empty($name)) { $content .= "<option>$name</option>"; $content .= "<option>-----</option>"; } } else { switch ($url[0]) // Used to allow support for linking to modules with the use of bracket { case '[': // module link { $url = explode(':', substr($url, 1, - 1)); $url = 'modules.php?op=modload&name='.$url[0].'&file='.((isset($url[1])) ? $url[1]:'index'); break; } case '{': // new module link { $url = explode(':', substr($url, 1, - 1)); $url = 'index.php?module='.$url[0].'&func='.((isset($url[1])) ? $url[1]:'main'); break; } } // End bracket linking. $content = "<option value=\"$url\">$name</option>"; } } return $content; } function blocks_admin_actions($row){ global $pntheme; list($dbconn) = pnDBGetConn(); $pntable = pnDBGetTables(); // Break out options from our content field $vars = pnBlockVarsFromContent($row['content']); $row['content'] = ""; // Defaults if (empty($vars['style'])) { $vars['style'] = 1; } $output .= '<table><tr><td class="pn-normal">'._WAITINGCONT.':</td><td><input type="checkbox" value="1" name="displaywaiting"'; if (!empty($vars['displaywaiting'])) { $output .= ' checked'; } $output .= ' /></td></tr>'; $output .= '</table>'; return $output; } function blocks_admin_update_content($row) { list($vars['displaymodules'], $vars['displaywaiting'], $vars['style']) = pnVarCleanFromInput('displaymodules', 'displaywaiting', 'style'); // Defaults if (empty($vars['displaymodules'])) { $vars['displaymodules'] = 0; } if (empty($vars['displaywaiting'])) { $vars['displaywaiting'] = 0; } if (empty($vars['style'])) { $vars['style'] = 1; } // User links $content = array(); $c = 1; if (isset($row['linkname'])) { list($linkurl, $linkname, $linkdesc) = pnVarCleanFromInput('linkurl', 'linkname', 'linkdesc'); foreach ($row['linkname'] as $v) { if (!isset($row['linkdelete'][$c])) { $content[] = "$linkurl[$c]|$linkname[$c]|$linkdesc[$c]"; } if (isset($row['linkinsert'][$c])) { $content[] = "||"; } $c++; } } if ($row['new_linkname']) { $content[] = pnVarCleanFromInput('new_linkurl').'|'.pnVarCleanFromInput('new_linkname').'|'.pnVarCleanFromInput('new_linkdesc'); } $vars['content'] = implode("LINESPLIT", $content); $row['content']=pnBlockVarsToContent($vars); return($row); } // ----------------------------------------------------------------------------------------------------- // </Original Author> ?>
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 |