Re: RC7 delayed

"Eric Barr" <[email protected]>
Newsgroups gmane.comp.web.envolution.devel
Message-ID <00e301c25061$5aebd550$1768ac41@Sylvester>
mh7,
i fixed the skin select list.. it gets errors right now but that's because
we haven't put all of the skin_id's in the _theme_zones, and _theme_config.
anyway.. the updated file is attatched to this. hope it helps.

ApathyBoy

----- Original Message -----
From: "MADHATter7" <[email protected]>
To: <[email protected]>
Sent: Friday, August 30, 2002 11:43 AM
Subject: Re: [envdev] RC7 delayed


> Here is the new Encompass RC:
>
> ftp://ftp.envolution.com/releases/envolution/Encompass_0926_rc1.zip
>
> Brief directions:
> - Select a non-Encompass theme
> - Move you old modules/Encompass/addons directory to your active skin
directory
> (or copy it to all of them)
> - Copy & replace all files in the package
> - Files in your Encompasss directory that are not in the new on are
deprecated,
> please remove
> - Create the field 'skin_id' in the $prefix_nuke_config and
$prefix_nuke_zones
> - Figure out your active skins ID in the databse
> - Fill in that ID in the skin_id fields you created above
> - Empty your skins xcache
> - Select you Encompass powered theme
>
>
> Known bugs:
> - Skin select list is not working properly
> - Permissions check fails... they are commented out in the above package
>
> I'll get up a list of new features later... real job is killing me ;)
>
> mh7
>
> ----- Original Message -----
> From: "Brook Humphrey" <[email protected]>
> To: <[email protected]>
> Sent: Friday, August 30, 2002 12:11 PM
> Subject: Re: [envdev] RC7 delayed
>
>
> > On Friday 30 August 2002 09:10 am, MADHATter7 wrote:
> > > That's alright --blame it all on me...
> > >
> > > that's fine though, I have broad shoulders.
> > >
> > > :-)
> > >
> > > mh7
> > >
> > > P.S. Someone have a few minutes to help me root out the two last bugs
??
> >
> > What are they? I'll look.
> >
> > --
>
  -~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'
~-
> >                                       Brook Humphrey
> >         Mobile PC Medic, 420 1st, Cheney, WA 99004, 509-235-9107
> > http://www.webmedic.net, [email protected], [email protected]
> >                                  Holiness unto the Lord
>
  -~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'
~-
> >
> >
> > _______________________________________________
> > Envdev mailing list
> > [email protected]
> > http://www.madhatt.info/mailman/listinfo/envdev_madhatt.info
> >
>
>
> _______________________________________________
> Envdev mailing list
> [email protected]
> http://www.madhatt.info/mailman/listinfo/envdev_madhatt.info
>
>
pnadmin.php (application/octet-stream, 35.6 KB)
<?php
// File: $Id: Exp $ $Name:  $
// Copyright (c) 2002 by Brian K. Virgin (madhatter7-9O8nC7T3vzfSUeElwK9/[email protected])
// http://www.envolution.com
// Envolution Content Management System - http://www.envolution.com
// 
// ----------------------------------------------------------------------------
// 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 read the docs/license.txt or visit
// http://www.gnu.org/copyleft/gpl.html
//
// ----------------------------------------------------------------------------
// Filename:	Encompass Configurator				pnadmin.php
// Author:		Brian K. Virgin
// Version:		0.925
// Purpose:		Encompass Configurator mainfile
// ----------------------------------------------------------------------------
// Changelog
// 01-02-2002: mh7 - rough draft
// 09-03-2002: mh7 - rewrite to new Encompass Core, rewrite as OO
// 10-03-2002: mh7 - initial release
// 24-03-2002: mh7 - rewrite (again) to 0.710 standards
// 28-03-2002: mh7 - enhance to use pnHTML
// 01-04-2002: mh7 - cleanup, small bug fixes
// 02-04-2002: mh7 - implement user API
// 22-08-2002: mh7 - full support for skin specific layouts, configs & colors
// 23-08-2002: mh7 - admin interface improvements
// 24-08-2002: mh7 - optimization and speed improvements
// 24-08-2002: mh7 - add comments and cleanup per the Envolution coding spec
// 29-08-2002: mh7 - revise main interface
// ----------------------------------------------------------------------------


/*
	NOTE:	This is the last incarnation of the Encompass Theme Engine,
			future versions of Encompass will be for minor tweaks or
			bug fixes only. The new Envolution methods to be implemented
			will replace this code. Encompass will, at that time,
			become the API for modules, addons and blocks to communicate
			directly with the Template Engine --plus an enhanced version
			of this Admin configuration utility.		~mh7
*/


////
// Default action | Show the initial menu
// @access		public
// @author		mh7
// @since		0.911		02-04-2002
// @param		none
// @return		redirect to admin_view
//				ID of the active skin
// @todo		fix permissions issues
function encompass_admin_main()
{
	// Check Permissions
	/*if (!pnSecAuthAction(0, 'Encompass::', '::', ACESS_EDIT))
	{
		// Create output object
		$output = new pnHTML();

		// Display warning & render
		$output->Text(_ENCOMPASSNOAUTH);
		return $output->GetOutput();
		exit;
	}*/

	// Create output object
	$output = new pnHTML();

	// determine the active skin
	$skinName = pnModAPIFunc('Encompass','user','getSkinName');
	$skinID = pnModAPIFunc('Encompass','user','getSkinID',
								array('skin' => $skinName));

	// Display Admin Menu
	$output->SetInputMode(_PNH_VERBATIMINPUT);
	$output->Text(encompass_admin_view(array('skinID' => $skinID)));
	$output->SetInputMode(_PNH_PARSEINPUT);

	// Render the output
	return $output->GetOutput();
}


////
// Main admin interface, configure by skin
// @access		private
// @author		mh7
// @since		0.911		02-04-2002
// @param		none
// @return		moxed $ooutput page output
// @todo		fix permissions issues
function encompass_admin_view($args)
{
	// Ceate output object
	$output = new pnHTML();

	// Check Permissions
	/*if (!pnSecAuthAction(0, 'Encompass::', '::', ACCESS_EDIT))
	{
        $output->Text(_ENCOMPASSNOAUTH);
        return $output->GetOutput();
    }*/

	// Extract our parameters
	extract ($args);

	// Load user API
	if (!pnModAPILoad('Encompass','user'))
	{
		$output->Text(_ENAPILOADFAIL);
		return $output->GetOutput();
	}

	// Load admin API
	if (!pnModAPILoad('Encompass', 'admin')) {
		$output->Text(_ENAPILOADFAIL);
		return $output->GetOutput();
	}

	// Check $skin parameter
	if (!isset($skinID))
	{
		// get the active skin name and ID
		$skinName = pnModAPIFunc('Encompass','user','getSkinName');
		$skinID = pnModAPIFunc('Encompass','user','getSkinID',
									array('skin' => $skinName));
	} else {
		// get the skin name for supplied ID
		$skinName = pnModAPIFunc('Encompass','admin','getSkinFromID',
									array('id' => $skinID));
	}

	// render our page header
	$output->SetInputMode(_PNH_VERBATIMINPUT);
	$output->Text(encompass_adminmenu());

	// Setup pnHTML form
	$output->Formstart(pnModURL('Encompass', 'admin', 'changeView'));

	// start Table
	$output->TableStart();

	// skin name
	$row = array();
	$output->SetOutputMode(_PNH_RETURNOUTPUT);
	$row[] = $output->BoldText(pnvarPrepForDisplay(_ENSKINNAME.": "));

	// get installed skins names
	$themes = pnModAPIFunc('Encompass','admin','getAllSkins');

	// @var themeinfo $ | holds the skin info to build a select list
	$themeinfo = array();

	// iterate through the list, building an array of data
	foreach ($themes as $theme)
	{
		// test if the skin name in the select box is our current skin
		if ($theme['id'] == $skinID)
		{
			// match, mark it as selected
			$themeinfo[] = array('id'		=> $theme['id'],
								'name'		=> $theme['name'],
								'selected'	=> 1);
		} else {
			// not our skin, add to select list
			$themeinfo[] = array('id'	=> $theme['id'],
								'name'	=> $theme['name']);
		}
	}

	// Assign the result
	$row[] = $output->FormSelectMultiple('skinID', $themeinfo);

	// add our change button
	$row[] = $output->FormSubmit(_ENCHANGE);

	// Send to output
	$output->SetOutputMode(_PNH_KEEPOUTPUT);
	$output->SetInputMode(_PNH_VERBATIMINPUT);
	$output->TableAddRow($row, 'CENTER');

	// End form
	$output->TableEnd();
	$output->FormEnd();

	// call the primary view functions
	$output->SetInputMode(_PNH_VERBATIMINPUT);
	$output->Text(encompass_admin_viewZones(array('skinID' => $skinID)));
	$output->Text(encompass_admin_viewColors(array('skinID' => $skinID)));
	$output->Text(encompass_admin_viewConfig(array('skinID' => $skinID)));
	$output->SetInputMode(_PNH_PARSEINPUT);
	$output->Linebreak();
	
	// Render the output
	return $output->GetOutput();
}


////
// View zones info
// @access		public
// @author		mh7
// @since		0.926		29-08-2002
// @param		integer $skin ID for the skin
// @return		mixed $output page output
// @todo		fix permissions issues
function encompass_admin_viewZones($args)
{

	// Ceate output object
	$output = new pnHTML();

	// Extract our parameters
	extract($args);

	// Generate Session Auth ID
	$authid = pnSecGenAuthKey();

	// Load user API
	if (!pnModAPILoad('Encompass','user'))
	{
		$output->Text(_ENAPILOADFAIL);
		return $output->GetOutput();
	}

	// Load admin API
	if (!pnModAPILoad('Encompass', 'admin')) {
		$output->Text(_ENAPILOADFAIL);
		return $output->GetOutput();
	}

	// @var array $zones | list of all zones for this skin
	$zones = pnModAPIFunc('Encompass','admin','listZones',
								array('skin' => $skinID));

	// Check results
	if ($zones == false) {
		$output->Text(_ENCOMPASSNOZONES);
		return $output->GetOutput();
	}

	// Area title
	$output->BoldText(_ZONECONFIG);
	$output->Text(' [ ');
	$output->URL(pnModURL('Encompass','admin','newZone',
							array('skin' => $skinID)),
							_ENADDZONE);
	$output->Text(' ]');

	// @var array $theaders | table headers
	$theaders = array(_ENZONENAME,
					_ENZONELABEL,
					_ENZONETYPE,
					_ENISACTIVE,
					_ENTEMPLATE,
					_ENACTIONS);

	// Start output table
	$output->TableStart('', $theaders, 1);

	foreach ($zones as $zone) {
		// Set Zone type for display
		if ($zone['type'] == 0)
		{
			$type = _ENREQUIRED;
		} else {
			$type = _ENOPTIONAL;
		}

		// Set Zone state for display
		if ($zone['active'] == 0)
		{
			$active = _NO;
		} else {
			$active = _YES;
		}

		// @var array $template | find template file for the zone
		$template = pnModAPIFunc('Encompass','admin','listTpl',
									array('skin' => $skinID,
										'zone' => $zone['label']));

		// Check results
		if (empty($template)) {
			$template = _ENTPLNOTSET;
		}

		// @var array actions | list of available configuration options
		$actions = array();
		$output->SetOutputMode(_PNH_RETURNOUTPUT);

		// determine zone type (0=required; 1=addon)
		if (!$zone['type'] == 0)
		{
			// Determine Zone State
			switch ($zone['active'])
			{
				// Currently Inactive
				case 0:
					$actions[] = $output->URL(
						pnModURL('Encompass','admin','modifyZones',
									array('task'	=> 'activate',
										'skin'		=> $skinID,
										'zone'		=> $zone['label'],
										'authid'	=> $authid)),
									_ENACTIVATE);
					break;

				// Currently Active
				case 1:
					$actions[] = $output->URL(
						pnModURL('Encompass','admin','modifyZones',
									array('task'	=> 'deactivate',
										'skin'		=> $skinID,
										'zone'		=> $zone['label'],
										'authid'	=> $authid)),
									_ENDEACTIVATE);
					break;
			}

			// Add a "delete" option for Addons
			$actions[] = $output->URL(
				pnModURL('Encompass','admin','deleteZones',
							array('skin'	=> $skinID,
								'zone'		=> $zone['label'],
								'authid'	=> $authid)),
							_ENDELETE);
		}

		// Add a "configure' option for all Zones
		$actions[] = $output->URL(
			pnModURL('Encompass','admin','modifyZones',
							array('task'	=> 'configure',
								'skin'		=> $skinID,
								'zone'		=> $zone['label'],
								'authid'	=> $authid)),
							_ENCONFIGURE);

		$output->SetOutputMode(_PNH_KEEPOUTPUT);
		$actions = join(' | ', $actions);

		// Setup the array for display
		$row = array(pnVarPrepForDisplay($zone['name']),
					pnVarPrepForDisplay($zone['label']),
					pnVarPrepForDisplay($type),
					pnVarPrepForDisplay($active),
					pnVarPrepForDisplay($template),
					$actions);

		// Send to output
		$output->SetInputMode(_PNH_VERBATIMINPUT);
		$output->TableAddRow($row, 'CENTER');
		$output->SetInputMode(_PNH_PARSEINPUT);
	}

	// Close table
	$output->TableEnd();
	
	// Render the output
	return $output->GetOutput();
}


////
// View colors info
// @access		public
// @author		mh7
// @since		0.926		29-08-2002
// @param		integer $skin ID for the skin
// @return		mixed $output page output
// @todo		fix permissions issues
function encompass_admin_viewColors($args)
{
	// Ceate output object
	$output = new pnHTML();

	// Extract our parameters
	extract($args);

	// Generate Session Auth ID
	$authid = pnSecGenAuthKey();

	// Load user API
	if (!pnModAPILoad('Encompass','user'))
	{
		$output->Text(_ENAPILOADFAIL);
		return $output->GetOutput();
	}

	// Load admin API
	if (!pnModAPILoad('Encompass', 'admin')) {
		$output->Text(_ENAPILOADFAIL);
		return $output->GetOutput();
	}

	// @var array $colors | current colors for this skin
	$colors = pnModAPIFunc('Encompass', 'admin', 'listColors',
								array('skin' => $skinID));

	// Check results
	if ($colors == false)
	{
		$output->Text(_ENARGSERROR);
		return $output->GetOutput();
	}

	// Area title
	$output->LineBreak();
	$output->BoldText(_COLORSCONFIG);

	// skin color table headers
	$theaders = array(_ENBGCOLOR1,
					_ENBGCOLOR2,
					_ENBGCOLOR3,
					_ENBGCOLOR4,
					_ENBGCOLOR5,
					_ENBGCOLOR6,
					_ENSEPCOLOR,
					_ENTEXTCOLOR1,
					_ENTEXTCOLOR2,
					_ENACTIONS);

	// Start output table
	$output->TableStart('', $theaders, 1);

	foreach ($colors as $color)
	{
		$output->SetOutputMode(_PNH_RETURNOUTPUT);

		$actions = $output->URL(
			pnModURL('Encompass','admin','modifyColors',
						array('skin'	=> $skinID,
							'authid'	=> $authid)),
						_ENCONFIGURE);

		$output->SetOutputMode(_PNH_KEEPOUTPUT);

		// Setup the array for display
		$row = array(pnVarPrepForDisplay($color['bcolor1']),
					pnVarPrepForDisplay($color['bcolor2']),
					pnVarPrepForDisplay($color['bcolor3']),
					pnVarPrepForDisplay($color['bcolor4']),
					pnVarPrepForDisplay($color['bcolor5']),
					pnVarPrepForDisplay($color['bcolor6']),
					pnVarPrepForDisplay($color['scolor']),
					pnVarPrepForDisplay($color['tcolor1']),
					pnVarPrepForDisplay($color['tcolor2']),
					$actions);

		// Send to output
		$output->SetInputMode(_PNH_VERBATIMINPUT);

		// TiMax: show the actual color
		$output->Text('<tr>');
		for ($i=0; $i<=8; $i++)
		{
			$output->Text('<td align="center" bgcolor="'.$row[$i].'">&nbsp;&nbsp;</td>');
		}
		$output->Text('<td align="center">&nbsp;&nbsp;</td>');
		$output->Text('</tr>');

		$output->TableAddRow($row, 'CENTER');
		$output->SetInputMode(_PNH_PARSEINPUT);
	}

	// Close table
	$output->TableEnd();
	
	// Render the output
	return $output->GetOutput();
}


////
// View configuration settings
// @access		public
// @author		mh7
// @since		0.926		29-08-2002
// @param		integer $skin ID for the skin
// @return		mixed $output page output
// @todo		fix permissions issues
function encompass_admin_viewConfig($args)
{
	// Ceate output object
	$output = new pnHTML();

	// Extract our parameters
	extract($args);

	// Generate Session Auth ID
	$authid = pnSecGenAuthKey();

	// Load user API
	if (!pnModAPILoad('Encompass','user'))
	{
		$output->Text(_ENAPILOADFAIL);
		return $output->GetOutput();
	}

	// Load admin API
	if (!pnModAPILoad('Encompass', 'admin')) {
		$output->Text(_ENAPILOADFAIL);
		return $output->GetOutput();
	}

	// @var array $configs | general config options for this skin
	$configs = pnModAPIFunc('Encompass', 'admin', 'listConfig',
								array('skin' => $skinID));

	// check the results for $configs
	if ($configs == false) {
		$output->Text(_ENARGSERROR);
		return $output->GetOutput();
	}

	// Area title
	$output->LineBreak();
	$output->BoldText(_GENERALCONFIG);

	// Setup table headers
	$theaders = array(
		_ENCONFIGNAME,
		_ENCONFIGDESCRIPT,
		_ENCONFIGSETTING,
		_ENACTIONS
	);

	// Start output table
	$output->TableStart('', $theaders, 1);

	foreach ($configs as $config) {
		$output->SetOutputMode(_PNH_RETURNOUTPUT);

		// Add a "configure" option
		$actions = $output->URL(
			pnModURL('Encompass','admin','modifyConfig',
						array('skin'	=> $skinID,
							'config'	=> $config['name'],
							'authid'	=> $authid)),
						_ENCONFIGURE);
		

		// Setup the array for display
		$row = array(pnVarPrepForDisplay($config['name']),
					pnVarPrepForDisplay($config['description']),
					pnVarPrepForDisplay($config['setting']),
					$actions);

		// Send to output
		$output->SetOutputMode(_PNH_KEEPOUTPUT);
		$output->SetInputMode(_PNH_VERBATIMINPUT);
		$output->TableAddRow($row, 'CENTER');
		$output->SetInputMode(_PNH_PARSEINPUT);
	}

	// Close the table
	$output->TableEnd();


	// Render the output
	return $output->GetOutput();

}


////
// Modify items as requestd
// @access		private
// @author		mh7
// @since		0.911		02-04-2002
// @deprecated	0.925		24-08-2002
// @see			encompass_admin_modify() | version 0.911
function encompass_admin_modify()
{
	// pass thru, this function has been deprecated
	// code removed for clarity
}


////
// Modify zone settings
// @access		private
// @author		mh7
// @since		0.925		24-08-2002
// @param		string $task action to perform (configure|activate|deactivate)
// @param		integer $skin ID for the skin
// @param		string $zone label of the zone we are working with
// @return		mixed $output page output
function encompass_admin_modifyZones()
{
	// Ceate output object
	$output = new pnHTML();

	// check the session auth key
    if (!pnSecConfirmAuthKey())
	{
        pnSessionSetVar('errormsg', _ENBADAUTHKEY);
        pnRedirect(pnModURL('Encompass', 'admin', 'main'));
        return true;
    }

	// grab our parameters in a secure manner
	list($task, $skin, $zone) = pnVarCleanFromInput('task', 'skin', 'zone');

	// check our parameters
	if (empty($task) || empty($skin) || empty($zone))
	{
		pnSessionSetVar('errormsg', _ENARGSERROR);
		return false;
	}

	// load user API
	if (!pnModAPILoad('Encompass', 'user'))
	{
		$output->Text(_ENAPILOADFAIL);
		return $output->GetOutput();
	}

	// load admin API
	if (!pnModAPILoad('Encompass', 'admin'))
	{
		$output->Text(_ENAPILOADFAIL);
		return $output->GetOutput();
	}

	// Figure out the task at hand
	switch ($task)
	{
		// TASK: configure templates
		case 'configure':
			// Display Title
			$output->Linebreak();
			$output->Title(_ENCONFIGTEMPLATES);

			// Setup pnHTML form
			$output->Formstart(pnModURL('Encompass', 'admin', 'updateZones'));
			$output->FormHidden('authid', pnSecGenAuthKey());
			$output->FormHidden('skin', $skin);
			$output->FormHidden('zone', $zone);

			// Start Table
			$output->TableStart();

			// Zone Label (info only)
			$row = array();
			$output->SetOutputMode(_PNH_RETURNOUTPUT);
			$row[] = $output->Text(pnvarPrepForDisplay(_ENZONELABEL));
			$row[] = $output->BoldText(pnVarPrepForDisplay($zone));
			$output->SetOutputMode(_PNH_KEEPOUTPUT);
			$output->SetInputMode(_PNH_VERBATIMINPUT);
			$output->TableAddRow($row, 'left');

			// Template select list
			$row = array();
			$output->SetOutputMode(_PNH_RETURNOUTPUT);
			$row[] = $output->Text(pnVarPrepForDisplay(_ENTEMPLATE));

			// Read the Skins templates directory
			$templates = pnModAPIFunc('Encompass','admin','getTplFiles',
										array('skin' => $skin,
											'zone' => $zone));

			// @var array $tplinfo | holds the info to build a zone select list
			$tplinfo = array();
			foreach ($templates as $template)
			{
				$tplinfo[] = array('id'	=> $template,
								'name'	=> $template);
			}

			// Assign the result
			$row[] = $output->FormSelectMultiple('template', $tplinfo);

			// Send to output
			$output->SetOutputMode(_PNH_KEEPOUTPUT);
			$output->SetInputMode(_PNH_VERBATIMINPUT);
			$output->TableAddRow($row, 'left');
			$output->SetInputMode(_PNH_PARSEINPUT);
			$output->Linebreak(2);

			// End form
			$output->TableEnd();
			$output->Linebreak(2);
			$output->Text(pnVarPrepForDisplay(_ENTPLINFO));
			$output->Linebreak(2);
			$output->FormSubmit(_ENCOMMIT);
			$output->FormEnd();
			break;

		// TASK: deactivate zone
		case 'deactivate':
			// Update state
			if (pnModAPIFunc('Encompass', 'admin', 'setstate',
								array('skin'	=> $skin,
									'zone'		=> $zone,
									'task'		=> 'deactivate')))
			{
				// Successful deactivation
				pnSessionSetVar('statusmsg', _ENZONEDEACTIVATED);
			}

			// Work completed, back to the menu
			pnRedirect(pnModURL('Encompass', 'admin', 'view',
									array('skin' => $skin)));
			return true;
			break;

		// TASK: activate zone
		case 'activate':
			// Update state
			if (pnModAPIFunc('Encompass', 'admin', 'setstate',
								array('skin'	=> $skin,
									'zone'		=> $zone,
									'task'		=> 'activate')))
			{
				// Successful activation
				pnSessionSetVar('statusmsg', _ENZONEACTIVATED);
			}

			// Work completed, back to the menu
			pnRedirect(pnModURL('Encompass', 'admin', 'view',
									array('skin' => $skin)));
			return true;
			break;
	}

	// Render the output
	return $output->GetOutput();

}


////
// Modify skin color settings
// @access		private
// @author		mh7
// @since		0.925		24-08-2002
// @param		integer $skin ID for the skin
// @return		mixed $output page output
function encompass_admin_modifyColors()
{
	// Ceate output object
	$output = new pnHTML();

	// check the session auth key
    if (!pnSecConfirmAuthKey())
	{
        pnSessionSetVar('errormsg', _ENBADAUTHKEY);
        pnRedirect(pnModURL('Encompass', 'admin', 'main'));
        return true;
    }

	// grab our parameters in a secure manner
	$skin = pnVarCleanFromInput('skin');

	// check for our parameters
	if (empty($skin))
	{
		pnSessionSetVar('errormsg', _ENARGSERROR);
		return false;
	}

	// load admin API
	if (!pnModAPILoad('Encompass', 'admin'))
	{
		$output->Text(_ENAPILOADFAIL);
		return $output->GetOutput();
	}

	// get the name of the skin
	$skinName = pnModAPIFunc('Encompass','admin','getSkinFromID',
								array('id' => $skin));

	// Display Title
	$output->Title(_ENCONFIGCOLORS);
	$output->Linebreak();
	$output->BoldText(pnVarPrepForDisplay(_ENSKINNAME.': '.$skinName));

	// Setup pnHTML form
	$output->Formstart(pnModURL('Encompass', 'admin', 'updateColors'));
	$output->Linebreak();
	$output->FormHidden('authid', pnSecGenAuthKey());
	$output->FormHidden('skin', $skin);
	//$output->FormHidden('name', $skinName);

	// Start Table
	$output->TableStart();

	// @var array $colors | skin colors list
	$colors = pnModAPIFunc('Encompass', 'admin', 'listColors',
								array('skin' => $skin));

	// Build the form
	foreach ($colors as $color)
	{
		while (list($key, $var) = each($color))
		{
			$row = array();
			$output->SetOutputMode(_PNH_RETURNOUTPUT);
			$row[] = $output->Text(pnVarPrepForDisplay($key));
			$row[] = $output->FormText($key, $var, 40, 60);
			$output->SetOutputMode(_PNH_KEEPOUTPUT);
			$output->SetInputMode(_PNH_VERBATIMINPUT);
			$output->TableAddRow($row, 'left');
			$output->SetInputMode(_PNH_PARSEINPUT);
		}
	}

	// Close the Table & Form
	$output->Linebreak(2);
	$output->TableEnd();
	$output->Text(pnVarPrepForDisplay(_ENCOLORSINFO));
	$output->Linebreak(2);
	$output->FormSubmit(_ENCOMMIT);
	$output->FormEnd();

	// Render the output
	return $output->GetOutput();
}


////
// Modify skin general configuration
// @access		private
// @author		mh7
// @since		0.925		24-08-2002
// @param		integer $skin ID for the skin
// @param		string $config the config we are modifying
// @return		mixed $output page output
function encompass_admin_modifyConfig()
{
	// Ceate output object
	$output = new pnHTML();

	// check the session auth key
    if (!pnSecConfirmAuthKey())
	{
        pnSessionSetVar('errormsg', _ENBADAUTHKEY);
        pnRedirect(pnModURL('Encompass', 'admin', 'main'));
        return true;
    }

	// grab our parameters in a secure manner
	list($skin, $config) = pnVarCleanFromInput('skin', 'config');

	// check for our parameters
	if (empty($skin) || empty($config))
	{
		pnSessionSetVar('errormsg', _ENARGSERROR);
		return false;
	}

	// load admin API
	if (!pnModAPILoad('Encompass', 'admin'))
	{
		$output->Text(_ENAPILOADFAIL);
		return $output->GetOutput();
	}

	// Display Title
	$output->Title(_ENCONFIGCONFIGS);

	// Setup pnHTML form
	$output->Formstart(pnModURL('Encompass', 'admin', 'updateConfig'));
	$output->Linebreak();
	$output->FormHidden('authid', pnSecGenAuthKey());
	$output->FormHidden('skin', $skin);
	$output->FormHidden('config', $config);

	// Start Table
	$output->TableStart();

	// @var array $data | config name and current setting
	$data = pnModAPIFunc('Encompass','admin','getConfigInfo',
							array('skin'	=> $skin,
								'config'	=> $config));

	// Build the form
	$output->SetOutputMode(_PNH_RETURNOUTPUT);
	$row[] = $output->Text(pnVarPrepForDisplay($data['description']));
	$row[] = $output->FormText('setting', $data['setting'], 32, 32);
	$output->SetOutputMode(_PNH_KEEPOUTPUT);
	$output->SetInputMode(_PNH_VERBATIMINPUT);
	$output->TableAddrow($row, 'left');
	$output->SetInputMode(_PNH_PARSEINPUT);

	// Close the table & form
	$output->Linebreak(2);
	$output->TableEnd();
	$output->Text(pnVarPrepForDisplay(_ENCONFIGINFO));
	$output->Linebreak(2);
	$output->FormSubmit(_ENCOMMIT);
	$output->FormEnd();

	// Render the output
	return $output->GetOutput();

}


////
// Update items as requestd
// @access		private
// @author		mh7
// @since		0.911		02-04-2002
// @deprecated	0.925		24-08-2002
// @see			encompass_admin_update() | version 0.911
function encompass_admin_update()
{
	// pass thru, this function has been deprecated
	// code removed for clarity
}


////
// Update zone settings and configurations
// @access		private
// @author		mh7
// @since		0.925		24-08-2002
// @param		string $task action to perform (configure|activate|deactivate)
// @param		integer $skin ID for the skin
// @param		string $zone label of the zone we are looking at
// @param		string $template the template file we are to use
// @return		bool true upon successful update
//				redirect to encompass_admin_view()
//				ID of the updated skin
function encompass_admin_updateZones()
{
	// check the session auth key
    if (!pnSecConfirmAuthKey())
	{
        pnSessionSetVar('errormsg', _ENBADAUTHKEY);
        pnRedirect(pnModURL('Encompass', 'admin', 'main'));
        return true;
    }

	// grab our parameters in a secure manner
	list($skin, $zone, $template) = pnVarCleanFromInput('skin', 'zone', 'template');

	// check for our parameters
	if (empty($skin) || empty($zone) || empty($template))
	{
		pnSessionSetVar('errormsg', _ENARGSERROR);
		return false;
	}

	// load admin API
	if (!pnModAPILoad('Encompass', 'admin'))
	{
		$output = new pnHTML();
		$output->Text(_ENAPILOADFAIL);
		return $output->GetOutput();
	}

	// Update template
	if (pnModAPIFunc('Encompass', 'admin', 'updateZones',
						array('skin'	=> $skin,
							'zone'		=> $zone,
							'tpl'		=> $template)))
	{
		// Success
		pnSessionSetVar('statusmsg', _ENTPLUPDATED);
	}

	// Work completed, return to main
	pnRedirect(pnModURL('Encompass', 'admin', 'view',
							array('skin' => $skin)));
	return true;
}


////
// Update skin color sets
// @access		private
// @author		mh7
// @since		0.925		24-08-2002
// @param		integer $skin ID for the skin
// @param		string $bcolor1 background color #1 (HEX)
// @param		string $bcolor2 background color #2 (HEX)
// @param		string $bcolor3 background color #3 (HEX)
// @param		string $bcolor4 background color #4 (HEX)
// @param		string $bcolor5 background color #5 (HEX)
// @param		string $bcolor6 background color #6 (HEX)
// @param		string $scolor  seperator color (HEX)
// @param		string $tcolor1 text color #1 (HEX)
// @param		string $tcolor2 text color #2 (HEX)
// @return		bool true upon successful update
//				redirect to encompass_admin_view()
//				ID of the updated skin
function encompass_admin_updateColors()
{
	// check the session auth key
    if (!pnSecConfirmAuthKey())
	{
        pnSessionSetVar('errormsg', _ENBADAUTHKEY);
        pnRedirect(pnModURL('Encompass', 'admin', 'main'));
        return true;
    }

	// grab our parameters in a secure manner
	$skin = pnVarCleanFromInput('skin');

	list($bcolor1, $bcolor2, 
		$bcolor3, $bcolor4, 
		$bcolor5, $bcolor6,
		$scolor, $tcolor1, 
		$tcolor2) = pnVarCleanFromInput('bcolor1', 'bcolor2', 
										'bcolor3', 'bcolor4', 
										'bcolor5', 'bcolor6',
										'scolor', 'tcolor1', 
										'tcolor2');

	// check for our parameters
	if (empty($skin))
	{
		pnSessionSetVar('errormsg', _ENARGSERROR);
		return false;
	}

	// load admin API
	if (!pnModAPILoad('Encompass', 'admin'))
	{
		$output = new pnHTML();
		$output->Text(_ENAPILOADFAIL);
		return $output->GetOutput();
	}

	// Update colors
	if (pnModAPIFunc('Encompass', 'admin', 'updateColors',
						array('skin'		=> $skin,
							'bcolor1'		=> $bcolor1,
							'bcolor2'		=> $bcolor2,
							'bcolor3'		=> $bcolor3,
							'bcolor4'		=> $bcolor4,
							'bcolor5'		=> $bcolor5,
							'bcolor6'		=> $bcolor6,
							'scolor'		=> $scolor,
							'tcolor1'		=> $tcolor1,
							'tcolor2'		=> $tcolor2)))
	{
		// Success
		pnSessionSetVar('statusmsg', _ENCOLORSUPDATED);
	}

	// Work completed, return to main
	pnRedirect(pnModURL('Encompass', 'admin', 'view',
							array('skin' => $skin)));
	return true;
}


////
// Update general configurations
// @access		private
// @author		mh7
// @since		0.925		24-08-2002
// @param		integer $skin ID for the skin
// @param		string $config config name we are modifying
// @param		string $setting config new value
// @return		bool true upon successful update
//				redirect to encompass_admin_view()
//				ID of the updated skin
function encompass_admin_updateConfig()
{
	// check the session auth key
    if (!pnSecConfirmAuthKey())
	{
        pnSessionSetVar('errormsg', _ENBADAUTHKEY);
        pnRedirect(pnModURL('Encompass', 'admin', 'main'));
        return true;
    }

	// grab our parameters in a secure manner
	list($skin, $config, $setting) = pnVarCleanFromInput('skin', 'config', 'setting');

	// check for our parameters
	if (empty($skin) || empty($config) || empty($setting))
	{
		pnSessionSetVar('errormsg', _ENARGSERROR);
		return false;
	}

	// load admin API
	if (!pnModAPILoad('Encompass', 'admin'))
	{
		$output = new pnHTML();
		$output->Text(_ENAPILOADFAIL);
		return $output->GetOutput();
	}

	// Update config
	if (pnModAPIFunc('Encompass', 'admin', 'updateConfig',
						array('skin'		=> $skin,
							'config'		=> $config,
							'setting'		=> $setting)))
	{
		// Success
		pnSessionSetVar('statusmsg', _ENCONFIGUPDATED);
	}

	// Work completed, return to main
	pnRedirect(pnModURL('Encompass', 'admin', 'view',
							array('skin' => $skin)));
	return true;
}


////
// Gather new items to be created
// @access		private
// @author		mh7
// @since		0.911		02-04-2002
// @deprecated	0.925		24-08-2002
// @see			encompass_admin_new() | version 0.911
function encompass_admin_new()
{
	// pass thru, this function has been deprecated
	// code removed for clarity
}


////
// Gather info to create new zone
// @access		private
// @author		mh7
// @since		0.925		24-08-2002
// @param		integer $skin ID for the skin
// @return		mixed $output page output
function encompass_admin_newZones()
{
	// Ceate output object
	$output = new pnHTML();

	// check the session auth key
    if (!pnSecConfirmAuthKey())
	{
        pnSessionSetVar('errormsg', _ENBADAUTHKEY);
        pnRedirect(pnModURL('Encompass', 'admin', 'main'));
        return true;
    }

	// grab our parameters in a secure manner
	$skin = pnVarCleanFromInput('skin');

	// check for our parameters
	if (empty($skin))
	{
		pnSessionSetVar('errormsg', _ENARGSERROR);
		return false;
	}

	// load admin API
	if (!pnModAPILoad('Encompass', 'admin'))
	{
		$output->Text(_ENAPILOADFAIL);
		return $output->GetOutput();
	}

	// Display Title
	$output->Title(_ENCREATEZONE);
	$output->Linebreak(2);

	// Setup pnHTML form
	$output->Formstart(pnModURL('Encompass', 'admin', 'createZones'));
	$output->Linebreak();
	$output->FormHidden('authid', pnSecGenAuthKey());
	$output->FormHidden('skin', $skin);

	// Start Table
	$output->TableStart();

	// Zone Name
	$row = array();
	$output->SetOutputMode(_PNH_RETURNOUTPUT);
	$row[] = $output->Text(pnVarPrepForDisplay(_ENZONENAME));
	$row[] = $output->FormText('zone', '', 40, 60);
	$output->SetOutputMode(_PNH_KEEPOUTPUT);
	$output->SetInputMode(_PNH_VERBATIMINPUT);
	$output->TableAddRow($row, 'left');

	// Zone Label
	$row = array();
	$output->SetOutputMode(_PNH_RETURNOUTPUT);
	$row[] = $output->Text(pnVarPrepForDisplay(_ENZONELABEL));
	$row[] = $output->FormText('label', '', 40, 60);
	$output->SetOutputMode(_PNH_KEEPOUTPUT);
	$output->SetInputMode(_PNH_VERBATIMINPUT);
	$output->TableAddRow($row, 'left');

	// End form
	$output->TableEnd();
	$output->Linebreak(2);
	$output->Text(pnVarPrepForDisplay(_ENZONENEWINFO));
	$output->Linebreak(2);
	$output->FormSubmit(_ENCOMMIT);
	$output->FormEnd();

	// Render the output
	return $output->GetOutput();
}


////
// Gather info to create new config
// @access		private
// @author		mh7
// @since		0.911		02-04-2002
// @deprecated	0.925		24-08-2002
// @see			encompass_admin_new() | version 0.911
// @note		never fully implemented, never will be
function encompass_admin_newConfig()
{
	// pass thru, this function has been deprecated
	// code removed for clarity
}


////
// Create new zones
// @access		private
// @author		mh7
// @since		0.925		24-08-2002
// @param		integer $skin ID for the skin
// @param		string $zone zone name we are creating
// @param		string $label long title of the zone
// @return		bool true upon successful update
//				redirect to encompass_admin_view()
//				ID of the updated skin
function encompass_admin_createZones()
{
	// check the session auth key
    if (!pnSecConfirmAuthKey())
	{
        pnSessionSetVar('errormsg', _ENBADAUTHKEY);
        pnRedirect(pnModURL('Encompass', 'admin', 'main'));
        return true;
    }

	// grab our parameters in a secure manner
	list($skin, $zone, $label) = pnVarCleanFromInput('skin', 'zone', 'label');

	// check for our parameters
	if (empty($skin))
	{
		pnSessionSetVar('errormsg', _ENARGSERROR);
		return false;
	}

	// load admin API
	if (!pnModAPILoad('Encompass', 'admin'))
	{
		$output = new pnHTML();
		$output->Text(_ENAPILOADFAIL);
		return $output->GetOutput();
	}

	// Create the new zone
	if (pnModAPIFunc('Encompass', 'admin', 'createZones',
						array('skin'	=> $skin,
							'zone'		=> $zone,
							'label'		=> $label)))
	{

		// Success
		pnSessionSetVar('statusmsg', _ENZONECREATED);
	}

	// Work completed, return to main
	pnRedirect(pnModURL('Encompass', 'admin', 'view',
							array('skin' => $skin)));
	return true;
}


////
// Create new config
// @access		private
// @author		mh7
// @since		0.911		02-04-2002
// @deprecated	0.925		24-08-2002
// @see			encompass_admin_create() | version 0.911
// @note		never fully implemented, never will be
function encompass_admin_createConfig()
{
	// pass thru, this function has been deprecated
	// code removed for clarity
}


////
// Delete items as requested
// @access		private
// @author		mh7
// @since		0.911		02-04-2002
// @deprecated	0.925		24-08-2002
// @see			encompass_admin_delete() | version 0.911
function encompass_admin_delete()
{
	// pass thru, this function has been deprecated
	// code removed for clarity
}


////
// Delete zones
// @access		private
// @author		mh7
// @since		0.925		24-08-2002
// @param		integer $skin ID for the skin
// @param		string $zone zone name we are creating
// @param		string $label long title of the zone
// @return		bool true upon successful update
//				redirect to encompass_admin_view()
//				ID of the updated skin
function encompass_admin_deleteZones()
{
	// check the session auth key
    if (!pnSecConfirmAuthKey())
	{
        pnSessionSetVar('errormsg', _ENBADAUTHKEY);
        pnRedirect(pnModURL('Encompass', 'admin', 'main'));
        return true;
    }

	// grab our parameters in a secure manner
	list($skin, $zone, $label) = pnVarCleanFromInput('skin', 'zone', 'label');

	// check for our parameters
	if (empty($skin))
	{
		pnSessionSetVar('errormsg', _ENARGSERROR);
		return false;
	}

	// load admin API
	if (!pnModAPILoad('Encompass', 'admin'))
	{
		$output = new pnHTML();
		$output->Text(_ENAPILOADFAIL);
		return $output->GetOutput();
	}

	// Delete the zone
	if (pnModAPIFunc('Encompass', 'admin', 'delete',
						array('skin'	=> $skin,
							'zone'		=> $zone)))
	{
		// Success
		pnSessionSetVar('statusmsg', _ENZONEDELETED);
	}

	// Work completed, return to main
	pnRedirect(pnModURL('Encompass', 'admin', 'view',
							array('skin' => $skin)));
	return true;
}


////
// Delete config
// @access		private
// @author		mh7
// @since		0.911		02-04-2002
// @deprecated	0.925		24-08-2002
// @see			encompass_admin_delete() | version 0.911
// @note		never fully implemented, never will be
function encompass_admin_deleteConfig()
{
	// pass thru, this function has been deprecated
	// code removed for clarity
}


////
// Change the skin to view/edit
// @access		private
// @author		mh7
// @since		0.926		30-08-2002
// @param		integer $skin ID for the skin to view
// @return		none
function encompass_admin_changeView()
{
	$skinID = pnVarCleanFromInput('skinID');
	$output = new pnHTML();
	
	// Check $skin parameter
	if (!isset($skinID))
	{
		// get the active skin name and ID
		/*$skinName = pnModAPIFunc('Encompass','user','getSkinName');
		$skinID = pnModAPIFunc('Encompass','user','getSkinID',
									array('skin' => $skinName));*/
		pnSessionSetVar('errormsg', _ENARGSERROR);
		return false;
	}

	// Display Admin Menu
	$output->SetInputMode(_PNH_VERBATIMINPUT);
	$output->Text(encompass_admin_view(array('skinID' => $skinID)));
	$output->SetInputMode(_PNH_PARSEINPUT);

	// Render the output
	return $output->GetOutput();
	
	/*// Redirect to view function with new parameters
	pnModFunc('Encompass', 'admin', 'view',
				array('skinID' => $skinID));*/
}


////
// Admin menu bar
// @access		private
// @author		mh7
// @since		0.911		02-04-2002
// @param		integer $skin ID of the current skin
// @param		string $sec section of the menu to render
// @return		mixed $output page output
function encompass_adminmenu()
{
	// Create output object
	$output = new pnHTML();

	// Display status message if any
	$output->Text(pnGetStatusMsg());

	// Start options menu
	$output->Title(_ENCOMPASSEDIT);

	// Render the output
	return $output->GetOutput();
}


?>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.