From: Andreas K. <la...@us...> - 2002-12-29 20:30:06
|
Update of /cvsroot/pn-modules/PN_Shoutbox/html/modules/Shoutbox In directory sc8-pr-cvs1:/tmp/cvs-serv30904/PN_Shoutbox/html/modules/Shoutbox Added Files: pnadmin.php Log Message: new admin functions --- NEW FILE: pnadmin.php --- <?php function Shoutbox_admin_main() { $output = new pnHTML(); if (!pnSecAuthAction(0, 'Shoutbox::', '::', ACCESS_ADMIN)) { $output->Text(_SHOUTBOXNOAUTH); return $output->GetOutput(); } $output->SetInputMode(_PNH_VERBATIMINPUT); $output->Text(Shoutbox_admin_modify(array())); $output->SetInputMode(_PNH_PARSEINPUT); return $output->GetOutput(); } function Shoutbox_admin_modify($args) { list( $sb_fontcolor, $sb_fontface, $sb_bgcolor, $sb_maxdisplay, $sb_refresh, $sb_maxwordlength, $sb_width, $sb_height, $sb_height )= pnVarCleanFromInput( 'sb_fontcolor', 'sb_fontface', 'sb_bgcolor', 'sb_maxdisplay', 'sb_refresh', 'sb_maxwordlength', 'sb_width', 'sb_height', 'sb_size' ); extract($args); $output = new pnHTML(); if (!pnSecAuthAction(0, 'Shoutbox::', "::", ACCESS_ADMIN)) { $output->Text(_SHOUTBOXNOAUTH); return $output->GetOutput(); } $output->SetInputMode(_PNH_VERBATIMINPUT); $output->Title(_EDITSHOUTBOX); $output->FormStart(pnModURL('Shoutbox', 'admin', 'update')); $output->FormHidden('authid', pnSecGenAuthKey()); // get shoutbox vars $sb_fontcolor = pnModGetVar('Shoutbox', 'sb_fontcolor'); $sb_fontface = pnModGetVar('Shoutbox', 'sb_fontface'); $sb_bgcolor = pnModGetVar('Shoutbox', 'sb_bgcolor'); $sb_maxdisplay = pnModGetVar('Shoutbox', 'sb_maxdisplay'); $sb_refresh = pnModGetVar('Shoutbox', 'sb_refresh'); $sb_maxwordlength = pnModGetVar('Shoutbox', 'sb_maxwordlength'); $sb_width = pnModGetVar('Shoutbox', 'sb_width'); $sb_height = pnModGetVar('Shoutbox', 'sb_height'); $sb_size = pnModGetVar('Shoutbox', 'sb_size'); $output->TableStart(pnModGetName()); $output->TableRowStart(); $output->TableColStart(); $output->Text("<label>"._SHOUTBOXFONTCOLOR."</label>:"); $output->TableColEnd(); $output->TableColStart(1); $output->FormText('sb_fontcolor',$sb_fontcolor, 35); $output->TableColEnd(); $output->TableRowEnd(); $output->TableRowStart(); $output->TableColStart(); $output->Text("<label>"._SHOUTBOXFONTFACE."</label>:"); $output->TableColEnd(); $output->TableColStart(1); $output->FormText('sb_fontface',$sb_fontface, 35); $output->TableColEnd(); $output->TableRowEnd(); $output->TableRowStart(); $output->TableColStart(); $output->Text("<label>"._SHOUTBOXBGCOLOR."</label>:"); $output->TableColEnd(); $output->TableColStart(1); $output->FormText('sb_bgcolor',$sb_bgcolor, 35); $output->TableColEnd(); $output->TableRowEnd(); $output->TableRowStart(); $output->TableColStart(); $output->Text("<label>"._SHOUTBOXMAXDISPLAY."</label>:"); $output->TableColEnd(); $output->TableColStart(1); $output->FormText('sb_maxdisplay',$sb_maxdisplay, 35); $output->TableColEnd(); $output->TableRowEnd(); $output->TableRowStart(); $output->TableColStart(); $output->Text("<label>"._SHOUTBOXREFRESH."</label>:"); $output->TableColEnd(); $output->TableColStart(1); $output->FormText('sb_refresh',$sb_refresh, 35); $output->TableColEnd(); $output->TableRowEnd(); $output->TableRowStart(); $output->TableColStart(); $output->Text("<label>"._SHOUTBOXMAXWORDLENGTH."</label>:"); $output->TableColEnd(); $output->TableColStart(1); $output->FormText('sb_maxwordlength',$sb_maxwordlength, 35); $output->TableColEnd(); $output->TableRowEnd(); $output->TableRowStart(); $output->TableColStart(); $output->Text("<label>"._SHOUTBOXWIDTH."</label>:"); $output->TableColEnd(); $output->TableColStart(1); $output->FormText('sb_width',$sb_width, 35); $output->TableColEnd(); $output->TableRowEnd(); $output->TableRowStart(); $output->TableColStart(); $output->Text("<label>"._SHOUTBOXHEIGHT."</label>:"); $output->TableColEnd(); $output->TableColStart(1); $output->FormText('sb_height',$sb_height, 35); $output->TableColEnd(); $output->TableRowEnd(); $output->TableRowStart(); $output->TableColStart(); $output->Text("<label>"._SHOUTBOXSIZE."</label>:"); $output->TableColEnd(); $output->TableColStart(1); $output->FormText('sb_size',$sb_size, 35); $output->TableColEnd(); $output->TableRowEnd(); $output->TableEnd(); $output->Linebreak(2); $output->FormSubmit(_SHOUTBOXUPDATE); $output->FormEnd(); $output->SetInputMode(_PNH_PARSEINPUT); $output->SetInputMode(_PNH_VERBATIMINPUT); return $output->GetOutput(); } function Shoutbox_admin_update($args) { list( $sb_fontcolor, $sb_fontface, $sb_bgcolor, $sb_maxdisplay, $sb_refresh, $sb_maxwordlength, $sb_width, $sb_height, $sb_size )= pnVarCleanFromInput( 'sb_fontcolor', 'sb_fontface', 'sb_bgcolor', 'sb_maxdisplay', 'sb_refresh', 'sb_maxwordlength', 'sb_width', 'sb_height', 'sb_size' ); extract($args); if (!pnSecConfirmAuthKey()) { pnSessionSetVar('errormsg', _BADAUTHKEY); pnRedirect(pnModURL('Shoutbox', 'admin', 'view')); return true; } if (!pnModAPILoad('Shoutbox', 'admin')) { pnSessionSetVar('errormsg', _LOADFAILED); return $output->GetOutput(); } if(pnModAPIFunc('Shoutbox', 'admin', 'update', array( 'sb_fontcolor' => $sb_fontcolor, 'sb_fontface' => $sb_fontface, 'sb_bgcolor' => $sb_bgcolor, 'sb_maxdisplay' => $sb_maxdisplay, 'sb_refresh' => $sb_refresh, 'sb_maxwordlength' => $sb_maxwordlength, 'sb_width' => $sb_width, 'sb_height' => $sb_height, 'sb_size' => $sb_size ))) { pnSessionSetVar('statusmsg', _SHOUTBOXUPDATED); } pnRedirect(pnModURL('Shoutbox', 'admin', 'view')); return true; } ?> |