Show admin.1.php syntax highlighted
<?php
switch ($_GET['op']) {
case "list_dir" :
if (isset ($_GET['path']))
$path = $_GET['path']."/";
else
$path = "";
unset ($_GET['path']);
$currentModule->addContent("admin_picture.php");
$currentModule = $XCS->loadModule("directory_listing");
$currentModule->object = new module_directory_listing();
$currentModule->object->setRoot($_GET['root']);
$currentModule->object->readPath($path);
//$link = "<a href=\"#\" onClick=\"setPicture(".$_GET['section'].",'__PATH____FILE__');\">__FILE__</a>";
$link = "<a href=\"#\" onClick=\"setPicture(".$_GET['section'].",'__PATH____FILE__');\" onMouseOver=\"return XCS_popupShow('<img src=\'modules/menu/images/__PATH____FILE__\' />',-1,'__FILE__');\" onMouseOut=\"return XCS_popupHide();\">__FILE__</a>";
$currentModule->object->link = $link;
$currentModule->object->printPath();
$currentModule->registerVariable($path, "path");
break;
case "change_item" :
if (!isset ($_POST['id'])) {
$_POST['id'] = 0;
$item->id = 0;
}
else {
$item = $currentModule->object->getItemByID($_POST['id']);
}
$parts = explode(";", $_POST['module']);
if (sizeof($parts) == 2) {
$_POST['module'] = $parts[0];
$site = $parts[1];
}
if ($_POST['module'] != $currentModule->form__no_module) {
$mainModule = $currentModule; // backup current module
$TA = new TA($currentModule);
$TA->addQuery(TA :: SELECT, "xcs_engine_modules");
$TA->WHERE("id=".$_POST['module']);
$TA->LIMIT(1);
$TA->Execute();
$object = $TA->Result()->FetchObject();
$TA->End();
if ($object->instance_name != "none")
$module = $object->instance_name;
else
$module = $object->base;
$currentModule = $XCS->loadModule($module);
DB::SetPrefix($site);
$resources = $currentModule->getResources();
DB::RestorePrefix();
$get_modules = $XCS->loadModule("get_modules");
$get_modules->object = new module_get_modules();
$templates = $get_modules->object->getTemplates($currentModule->getName()); // load templates of current module instance
$currentModule = $mainModule; // restore previous module
$currentModule->addContent("admin_modulelink_change.php");
$currentModule->registerVariable($resources, "resources");
$currentModule->registerVariable($site, "site");
}
else {
$currentModule->addContent("admin_link_change.php");
$templates = array ("default");
}
$currentModule->registerVariable($templates, "templates");
$currentModule->registerVariable($currentModule, "currentModule");
$currentModule->registerVariable($item, "item");
$currentModule->registerVariable($XCS->getGroupNames(), "ranks");
break;
case "save_changes" :
$TA = new TA($currentModule);
if ($_POST['module'] != $currentModule->form__no_module) {
if ($_POST['resource'] != "false") {
$link = $_POST['resource'];
}
else {
$TA->addQuery(TA :: SELECT, "xcs_engine_modules");
$TA->WHERE("id=".$_POST['module']);
$TA->LIMIT(1);
$TA->Execute();
$object = $TA->Result()->FetchObject();
$TA->removeQuery();
if ($object->instance_name != "none")
$module = $object->instance_name;
else
$module = $object->base;
if ($object->block != "none")
$block = "&block=".$object->block;
else
$block = "";
$link = "index.php?module=".$module.$block;
}
}
else {
$link = $_POST['link'];
}
if ($_POST['id'] != 0) {
$TA->addQuery(TA :: UPDATE, "xcs_module_menu");
$TA->addParam("name", TA :: STRING, $_POST['name']);
$TA->addParam("template", TA :: STRING, $_POST['template']);
$TA->addParam("link", TA :: STRING, $link);
//$TA->addParam("picture", TA :: STRING, $_POST['picture1']);
$TA->addParam("group", TA :: NUMBER, $_POST['group']);
$TA->addParam("status", TA :: NUMBER, $_POST['status']);
$TA->WHERE("id=".$_POST['id']);
$TA->LIMIT(1);
$TA->Execute();
$TA->removeQuery();
}
else {
$TA->addQuery(TA :: INSERT, "xcs_module_menu");
$TA->addParam("name", TA :: STRING, $_POST['name']);
$TA->addParam("template", TA :: STRING, $_POST['template']);
$TA->addParam("link", TA :: STRING, $link);
//$TA->addParam("picture", TA :: STRING, $_POST['picture1']);
$TA->addParam("height", TA :: NUMBER, $currentModule->object->getNextHeight());
$TA->addParam("group", TA :: NUMBER, $_POST['group']);
$TA->addParam("status", TA :: NUMBER, $_POST['status']);
$TA->Execute();
$TA->removeQuery();
}
$TA->End();
$currentModule->addContent("admin_saved.php");
break;
case "new" :
$get_modules = $XCS->loadModule("get_modules");
$get_modules->object = new module_get_modules();
$modules = $get_modules->object->getDBModulesByOutput(1);
$currentModule->addContent("admin_new.php");
$currentModule->registerVariable($currentModule, "currentModule");
$currentModule->registerVariable($modules, "modules");
$currentModule->registerVariable($XCS->getGroupNames(), "ranks");
break;
case "edit" :
$item = $currentModule->object->getItemByID($_GET['id']);
$get_modules = $XCS->loadModule("get_modules");
$get_modules->object = new module_get_modules();
$modules = $get_modules->object->getDBModulesByOutput(1);
$currentModule->addContent("admin_edit.php");
$currentModule->registerVariable($currentModule, "currentModule");
$currentModule->registerVariable($item, "item");
$currentModule->registerVariable($modules, "modules");
$currentModule->registerVariable($XCS->getGroupNames(), "ranks");
break;
case "remove" :
$TA = new TA($currentModule);
$TA->addQuery(TA :: DELETE, "xcs_module_menu");
$TA->WHERE("id=".$_GET['id']);
$TA->LIMIT(1);
$TA->Execute();
$TA->End();
$currentModule->object->getItems();
$currentModule->addContent("admin_content.php");
$currentModule->registerVariable($currentModule, "currentModule");
$currentModule->registerVariable($currentModule->object->items, "items");
break;
case "change_height" :
if ($_GET['direction'] == "up")
$new_height = $_GET['height'] - 1;
else
if ($_GET['direction'] == "down")
$new_height = $_GET['height'] + 1;
$TA = new TA($currentModule);
// free next place - update existing item (existing_item=>old_place)
$TA->addQuery(TA :: UPDATE, "xcs_module_menu");
$TA->addParam("height", TA :: NUMBER, $_GET['height']);
$TA->WHERE("height=".$new_height);
$TA->LIMIT(1);
// save current item to this place (selected_item=>new_place)
$TA->addQuery(TA :: UPDATE, "xcs_module_menu");
$TA->addParam("height", TA :: NUMBER, $new_height);
$TA->WHERE("id=".$_GET['id']);
$TA->LIMIT(1);
$TA->Execute();
$TA->End();
$currentModule->object->getItems();
$currentModule->addContent("admin_content.php");
$currentModule->registerVariable($currentModule, "currentModule");
$currentModule->registerVariable($currentModule->object->items, "items");
break;
case "change_status" :
$TA = new TA($currentModule);
$TA->addQuery(TA :: UPDATE, "xcs_module_menu");
$TA->WHERE("`id`='".$_GET['id']."'");
$TA->LIMIT(1);
if ($_GET['status'] == "active") {
$TA->addParam("status", TA :: NUMBER, 0);
}
else
if (($_GET['status'] == "not_active")) {
$TA->addParam("status", TA :: NUMBER, 1);
}
$TA->Execute();
$TA->End();
default :
$currentModule->object->getItems();
$currentModule->addContent("admin_content.php");
$currentModule->registerVariable($currentModule, "currentModule");
$currentModule->registerVariable($currentModule->object->items, "items");
}
?>
See more files for this project here