0byt3m1n1
Path:
/
data
/
applications
/
aps.bak
/
postnuke
/
0.764-3
/
standard
/
htdocs
/
modules
/
typetool
/
[
Home
]
File: pnadmin.php
<?php // ---------------------------------------------------------------------- // PostNuke Content Management System // Copyright (C) 2002 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: Brian Bain // Purpose of file: Censor administration display functions // ---------------------------------------------------------------------- /** * @package PostNuke_Utility_Modules * @subpackage typetool * @license http://www.gnu.org/copyleft/gpl.html */ /** * TypeTool Module main admin function * @author Andreas Krapohl * @version * @return string HTML output string */ function typetool_admin_main() { // Security check - important to do this as early as possible to avoid // potential security holes or just too much wasted processing. For the // main function we want to check that the user has at least edit privilege // for some item within this component, or else they won't be able to do // anything and so we refuse access altogether. The lowest level of access // for administration depends on the particular module, but it is generally // either 'edit' or 'delete' if (!pnSecAuthAction(0, 'typetool::', '::', ACCESS_ADMIN)) { return pnVarPrepHTMLDisplay(_BADAUTHKEY); } // Create output object - this object will store all of our output so that // we can return it easily when required $pnRender =& new pnRender(); // get the output of the main function $pnRender->assign('main', typetool_admin_modifyconfig(array())); // Return the output that has been generated by this function return $pnRender->fetch('typetool_admin_main.htm'); } /** * Modify TypeTool configuration * @author Andreas Krapohl * @version * @param int typetool on or off * @param string language for typetool userinterface * @return string HTML output string */ function typetool_admin_modifyconfig($args) { // Security check - important to do this as early as possible to avoid // potential security holes or just too much wasted processing. For the // main function we want to check that the user has at least edit privilege // for some item within this component, or else they won't be able to do // anything and so we refuse access altogether. The lowest level of access // for administration depends on the particular module, but it is generally // either 'edit' or 'delete' if (!pnSecAuthAction(0, 'typetool::', '::', ACCESS_ADMIN)) { return pnVarPrepHTMLDisplay(_BADAUTHKEY); } list($tt_enable, $tt_language)= pnVarCleanFromInput('tt_enable', 'tt_language'); extract($args); // Create output object - this object will store all of our output so that // we can return it easily when required $pnRender =& new pnRender(); // get the existing settings $pnRender->assign('tt_enable', pnModGetVar('typetool', 'enable')); $pnRender->assign('tt_language', pnModGetVar('typetool', 'language')); // Return the output that has been generated by this function return $pnRender->fetch('typetool_admin_modifyconfig.htm'); } /** * Update TypeTool configuration * @author Andreas Krapohl * @version * @param int typetool censor on or off * @param string language for typetool userinterface * @return bool true if successful, false otherwise */ function typetool_admin_updateconfig($args) { // Security check - important to do this as early as possible to avoid // potential security holes or just too much wasted processing. if (!pnSecAuthAction(0, 'typetool::', '::', ACCESS_ADMIN)) { return pnVarPrepHTMLDisplay(_BADAUTHKEY); } list($tt_enable, $tt_language) = pnVarCleanFromInput('tt_enable', 'tt_language'); extract($args); if(empty($tt_language)){ $tt_language = 'language.js'; } if (!pnSecConfirmAuthKey()) { pnSessionSetVar('errormsg', _BADAUTHKEY); pnRedirect(pnModURL('typetool', 'admin', 'main')); return true; } if(!pnModSetVar('typetool', 'enable', $tt_enable)){ pnSessionSetVar('errormsg', _TYPETOOLNOCONFCHANGE); return false; } if(!pnModSetVar('typetool', 'language', $tt_language)){ pnSessionSetVar('errormsg', _TYPETOOLNOCONFCHANGE); return false; } // the module configuration has been updated successfuly pnSessionSetVar('statusmsg', _CONFIGUPDATED); pnRedirect(pnModURL('typetool', 'admin', 'main')); return true; } ?>