// Define all the icons we're going to use $IconUarrow = 'icon-uarrow'; $IconDarrow = 'icon-darrow'; if ($TEXT_DIRECTION == 'ltr') { $IconRarrow = 'icon-rarrow'; $IconLarrow = 'icon-larrow'; $IconRDarrow = 'icon-rdarrow'; $IconLDarrow = 'icon-ldarrow'; } else { $IconRarrow = 'icon-larrow'; $IconLarrow = 'icon-rarrow'; $IconRDarrow = 'icon-ldarrow'; $IconLDarrow = 'icon-rdarrow'; } $all_blocks = array(); foreach (WT_Module::getActiveBlocks() as $name => $block) { if ($user_id && $block->isUserBlock() || $gedcom_id && $block->isGedcomBlock()) { $all_blocks[$name] = $block; } } if ($user_id) { $blocks = get_user_blocks($user_id); } elseif ($gedcom_id) { $blocks = get_gedcom_blocks($gedcom_id); } if ($action == 'update') { Zend_Session::writeClose(); foreach (array('main', 'side') as $location) { if ($location == 'main') { $new_blocks = $main; } else {
// RFC2616 requires an absolute URL, but we don’t have it here. header('Location: site-php-version.php'); } define('WT_SCRIPT_NAME', 'index.php'); require './includes/session.php'; // The only option for action is "ajax" $action = WT_Filter::get('action'); // The default view depends on whether we are logged in $ctype = WT_Filter::get('ctype', 'gedcom|user', WT_USER_ID ? 'user' : 'gedcom'); // Get the blocks list if (WT_USER_ID && $ctype == 'user') { $blocks = get_user_blocks(WT_USER_ID); } else { $blocks = get_gedcom_blocks(WT_GED_ID); } $all_blocks = WT_Module::getActiveBlocks(); // The latest version is shown on the administration page. This updates it every day. // TODO: send an email notification to the admin when new versions are available. fetch_latest_version(); // We generate individual blocks using AJAX if ($action == 'ajax') { $controller = new WT_Controller_Ajax(); $controller->pageHeader(); // Check we’re displaying an allowable block. $block_id = WT_Filter::getInteger('block_id'); if (array_key_exists($block_id, $blocks['main'])) { $module_name = $blocks['main'][$block_id]; } elseif (array_key_exists($block_id, $blocks['side'])) { $module_name = $blocks['side'][$block_id]; } else { exit;
// // 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. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA use WT\Auth; define('WT_SCRIPT_NAME', 'admin_module_blocks.php'); require 'includes/session.php'; require WT_ROOT . 'includes/functions/functions_edit.php'; $controller = new WT_Controller_Page(); $controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('Module administration'))->pageHeader(); $modules = WT_Module::getActiveBlocks(WT_GED_ID, WT_PRIV_HIDE); $action = WT_Filter::post('action'); if ($action == 'update_mods' && WT_Filter::checkCsrf()) { foreach ($modules as $module_name => $module) { foreach (WT_Tree::getAll() as $tree) { $value = WT_Filter::post("blockaccess-{$module_name}-{$tree->tree_id}", WT_REGEX_INTEGER, $module->defaultAccessLevel()); WT_DB::prepare("REPLACE INTO `##module_privacy` (module_name, gedcom_id, component, access_level) VALUES (?, ?, 'block', ?)")->execute(array($module_name, $tree->tree_id, $value)); } } } ?> <div id="blocks" align="center"> <form method="post" action="<?php echo WT_SCRIPT_NAME; ?> ">
static function callBlock($params = null) { global $ctype; if ($params === null) { return ''; } if (isset($params[0]) && $params[0] != '') { $block = $params[0]; } else { return ''; } $all_blocks = array(); foreach (WT_Module::getActiveBlocks() as $name => $active_block) { if ($ctype == 'user' && $active_block->isUserBlock() || $ctype == 'gedcom' && $active_block->isGedcomBlock()) { $all_blocks[$name] = $active_block; } } if (!array_key_exists($block, $all_blocks) || $block == 'html') { return ''; } $class_name = $block . '_WT_Module'; // Build the config array array_shift($params); $cfg = array(); foreach ($params as $config) { $bits = explode('=', $config); if (count($bits) < 2) { continue; } $v = array_shift($bits); $cfg[$v] = join('=', $bits); } $block = new $class_name(); $block_id = WT_Filter::getInteger('block_id'); $content = $block->getBlock($block_id, false, $cfg); return $content; }