if (isset($pipes4assign[$pipe_id])) { // EDIT (DETAIL) $template = 'admin_pipe_edit.html'; $pipe4edit = $pipes4assign[$pipe_id]; $pipe4edit['joints'] = array_merge($pipe4edit['joints'], array_fill(0, 3, $blank_joint)); } else { // NEW $pipe_id = -1; $template = 'admin_pipe_edit.html'; $pipe4edit = array('id' => -1, 'name' => '', 'joints' => array(array('joint' => 'fetch', 'joint_class' => d3pipes_common_get_default_joint_class($mydirname, 'fetch'), 'option' => ''), array('joint' => 'parse', 'joint_class' => d3pipes_common_get_default_joint_class($mydirname, 'parse'), 'option' => ''), array('joint' => 'utf8to', 'joint_class' => d3pipes_common_get_default_joint_class($mydirname, 'utf8to'), 'option' => $xoopsModuleConfig['internal_encoding']), array('joint' => 'clip', 'joint_class' => d3pipes_common_get_default_joint_class($mydirname, 'clip'), 'option' => ''))); $pipe4edit['joints'] = array_merge($pipe4edit['joints'], array_fill(0, 3, $blank_joint)); } } // joint_classes options $joint_classes_options = array(); foreach ($all_joints as $joint_type => $joint_type_name) { $joint_classes_options[$joint_type_name] = array(); foreach (d3pipes_admin_fetch_classes($mydirname, $joint_type) as $joint_class) { $joint_classes_options[$joint_type_name][$joint_type . '::' . $joint_class] = defined('_MD_D3PIPES_CLASS_' . strtoupper($joint_type . $joint_class)) ? constant('_MD_D3PIPES_CLASS_' . strtoupper($joint_type . $joint_class)) : $joint_class; } } $joint_classes_options[_NONE] = array('::' => '----'); // // display stage // xoops_cp_header(); include dirname(__FILE__) . '/mymenu.php'; $tpl = new D3Tpl(); $tpl->assign(array('mydirname' => $mydirname, 'mod_name' => $xoopsModule->getVar('name'), 'mod_url' => XOOPS_URL . '/modules/' . $mydirname, 'mod_imageurl' => XOOPS_URL . '/modules/' . $mydirname . '/' . $xoopsModuleConfig['images_dir'], 'mod_config' => $xoopsModuleConfig, 'pipe_id' => $pipe_id, 'pipes' => $pipes4assign, 'pipe' => $pipe4edit, 'all_joints' => $all_joints, 'joint_classes_options' => $joint_classes_options, 'gticket_hidden' => $xoopsGTicket->getTicketHtml(__LINE__, 1800, 'd3pipes_admin'))); $tpl->display('db:' . $mydirname . '_' . $template); xoops_cp_footer();
<?php require_once dirname(dirname(__FILE__)) . '/include/common_functions.php'; require_once dirname(dirname(__FILE__)) . '/include/admin_functions.php'; $myts =& MyTextSanitizer::getInstance(); $db =& Database::getInstance(); $index = intval($_GET['index']); $option_value_utf8 = $myts->stripSlashesGPC(@$_GET['option_value']); $option_value = d3pipes_common_convert_encoding_utf8toie($mydirname, $option_value_utf8); $all_joints = d3pipes_admin_fetch_joints($mydirname); $disabled_option_input = '<input type="text" name="joint_option[' . $index . ']" id="joint_option_' . $index . '" value="' . htmlspecialchars($option_value, ENT_QUOTES) . '" size="20" disabled="disabled" />'; @(list($joint_type, $joint_class) = explode('::', $myts->stripSlashesGPC(@$_GET['type_class']))); if (empty($joint_type) || !isset($all_joints[$joint_type])) { die($disabled_option_input); } $valid_classes = d3pipes_admin_fetch_classes($mydirname, $joint_type); if (!isset($valid_classes[$joint_class])) { die($disabled_option_input); } $obj =& d3pipes_common_get_joint_object($mydirname, $joint_type, $joint_class); while (ob_get_level()) { ob_end_clean(); } @ini_set('default_charset', 'UTF-8'); @header('Content-Type: text/html; charset=UTF-8'); echo d3pipes_common_convert_encoding_ietoutf8($mydirname, $obj->renderOptions($index, $option_value)); if (!defined('ALTSYS_DONT_USE_ADMIN_IN_THEME')) { define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1); } unset($xoopsUser); // for preventing older admin_in_theme
// if (!empty($_POST['do_update'])) { foreach (array_keys($all_joints) as $joint_type) { $valid_classes = d3pipes_admin_fetch_classes($mydirname, $joint_type); if (!empty($_POST['jointclass'][$joint_type])) { $joint_class = $_POST['jointclass'][$joint_type]; if (isset($valid_classes[$joint_class])) { $db->query("DELETE FROM " . $db->prefix($mydirname . "_joints") . " WHERE joint_type='" . mysql_real_escape_string($joint_type) . "'"); $db->query("INSERT INTO " . $db->prefix($mydirname . "_joints") . " (joint_type,default_class) VALUES ('" . mysql_real_escape_string($joint_type) . "','" . mysql_real_escape_string($joint_class) . "')"); } } } redirect_header(XOOPS_URL . "/modules/{$mydirname}/admin/index.php?page=joint", 3, _MD_A_D3PIPES_MSG_CACHEDELETED); exit; } // // form stage // $joints4assign = array(); foreach ($all_joints as $joint_type => $joint_name4disp) { $joints4assign[$joint_type] = array('type' => $joint_type, 'name' => $joint_name4disp, 'classes' => d3pipes_admin_fetch_classes($mydirname, $joint_type), 'selected_class' => d3pipes_common_get_default_joint_class($mydirname, $joint_type)); } // // display stage // xoops_cp_header(); include dirname(__FILE__) . '/mymenu.php'; $tpl = new D3Tpl(); $tpl->assign(array('mydirname' => $mydirname, 'mod_name' => $xoopsModule->getVar('name'), 'mod_url' => XOOPS_URL . '/modules/' . $mydirname, 'mod_imageurl' => XOOPS_URL . '/modules/' . $mydirname . '/' . $xoopsModuleConfig['images_dir'], 'mod_config' => $xoopsModuleConfig, 'joints' => $joints4assign)); $tpl->display('db:' . $mydirname . '_admin_joint.html'); xoops_cp_footer();