Location: PHPKode > projects > Aratix > aratix/admin/inc/extension.inc.php
<?php
/*
** Aratix
** Version 0.1.0beta8 (Anubis)
**
** Autor: Manuel Burghammer
** E-Mail: hide@address.com
** Homepage: http://www.xitara.net
**
** File: extension.inc.php - Version 0.1.0 build 81
** Position: /inc/
** Last Modified: 29.05.2006 - 15:33:17
*/

if($action == "install"){
	if(get('submit') == ""){

	}
	else{
		$install = new Install;

		move_uploaded_file(get('new_extension', 'tmp_name'), "install/" . get('new_extension', 'name'));
		$install->install_archive("install/" . get('new_extension', 'name'));
		$installed = $install->installed;

		$content->assign("installed", $installed);

		echo "<script type=\"text/javascript\">\n";
		echo "location.href='index.php?" . $session_string . "module=extension&action=overview&art=" . $install->art . "&id=" . $install->new_id . "';\n";
		echo "</script>";
	}
}
if($action == "overview"){

/* Array durchlaufen und für
** jede Seite Daten in die
** entsprechenden Arrays schreiben
**
** $counter
** Zähler für die Arrays
**
** $menupos_dropdown[]
** Dropdownbox der Menüpositionen
** Array mit allen Selectboxen
**
** $category_list[]
** Liste der Kategorien aus der Datenbank
**
** $group_list[]
** Liste der Gruppen aus der Datenbank
**
** $category_array[]
** Array mit allen Kategorien
** für diese Seite
**
** $group_array[]
** Array mit allen Gruppen
** für diese Seite
*/
	if((isset($array['left']) && count($array['left']) != 0) || isset($array['right']) || isset($array['top']) || isset($array['bottom'])){
		foreach($array as $align){
			if(count($align) > 0){

/* Erster Menüpunkt leer,
** damit smarty mit "iteration"
** arbeiten kann.
*/
				$counter = 1;

				foreach($align as $extension){ // Ausgeben von der Selectbox für die Menüreihenfolge
					if(get('art') == "block")
						$menupos_dropdown[$extension['align']][$counter] = $class->get_menupos_dropdown($extension['position'], $extension['id'], $extension['align']);

					if(get('art') != "layout"){
						$category_list = substr($extension['categories'], 1, strlen($extension['categories']) - 2);
						$category_array[$counter] = explode("|", $category_list);
					}
					$group_list = substr($extension['groups'], 1, strlen($extension['groups']) - 2);
					$group_array[$counter++] = explode("|", $group_list);
				}
			}
		}


/* Alle Kategorien auslesen,
** die in der entprechenden
** Tabelle eingerichtet wurden
*/
		$categories = $db->read_array(TB_CATEGORY, "*", "", "name ASC");

/* Alle Gruppen auslesen, die
** nicht 1 (gesperrt) oder
** 99999 (admin) sind.
*/
		$groups = $db->read_array(TB_GROUPS, "*", "id > 1 AND id != 99999", "name ASC");

/* Daten an Smarty übergeben
*/
		$content->assign("categories", $categories);

		if(get('art') == "block")
			$content->assign("menupos_dropdown", $menupos_dropdown);
		if(get('art') != "layout" && isset($category_array))
			$content->assign("category_array", $category_array);
		if(isset($group_array))
			$content->assign("group_array", $group_array);

		$content->assign("groups", $groups);
		$content->assign("aligns", array("left", "right", "top", "bottom"));

		$content->assign("extension_id", get('id'));
	}
	else
		$content->assign("overview_array", false);

	$content->assign("art", ucfirst(get('art')));
}
if($action == "delete"){
	$extension_name = $GLOBALS['db']->read(TB_PREFIX . strtolower(get('art')) . "s", "name", "id='" . get('id') . "'");
	$extension = strtolower(get('art')) . "_" . $extension_name['name'] . ".xml";

	$install = new Install;
	$install->delete_files($extension);

	echo "<script type=\"text/javascript\">\n";
	echo "location.href='index.php?" . $session_string . "module=extension&action=overview&art=" . strtolower(get('art')) . "';\n";
	echo "</script>";
}
if($action == "activate" || get('action') == "deactivate"){
	if(get('action') == "activate")
		$active = "true";
	if(get('action') == "deactivate")
		$active = "false";

	$art = strtolower(get('art'));

	$GLOBALS['db']->update(TB_PREFIX . $art . "s", "active", $active, "id='" . get('id') . "'");

	echo "<script type=\"text/javascript\">\n";
	echo "location.href='index.php?" . $session_string . "module=extension&action=overview&art=" . $art . "&id=" . get('id') . "';\n";
	echo "</script>";
}
?>
Return current item: Aratix