function website_modules($menu_type = VERTICAL_MENU) { import('modules/modules_discovery_service'); $modules_menu = new LinksMenu('PHPBoost', '/', '', $menu_type); $modules_discovery_service = new ModulesDiscoveryService(); $modules = $modules_discovery_service->get_all_modules(); $sorted_modules = array(); foreach ($modules as $module) { $sorted_modules[$module->get_name()] = $module; } ksort($sorted_modules); foreach ($sorted_modules as $module) { $infos = $module->get_infos(); if (!empty($infos['infos']) && !empty($infos['infos']['starteable_page'])) { $img = ''; $img_url = PATH_TO_ROOT . '/' . $module->get_id() . '/' . $module->get_id(); import('io/filesystem/file'); foreach (array('_mini.png', '_mini.gif', '_mini.jpg') as $extension) { $file = new File($img_url . $extension); if ($file->exists()) { $img = '/' . $module->get_id() . '/' . $file->get_name(); break; } } $modules_menu->add(new LinksMenuLink($module->get_name(), '/' . $module->get_id() . '/' . $infos['infos']['starteable_page'], $img)); } } return $modules_menu; }
/** * @desc Return a menu with links to modules * @param int $menu_type the menu type * @return LinksMenu the menu with links to modules */ public static function website_modules($menu_type = LinksMenu::AUTOMATIC_MENU) { $modules_menu = new LinksMenu('PHPBoost', '/', '', $menu_type); $modules = ModulesManager::get_activated_modules_map_sorted_by_localized_name(); foreach ($modules as $module) { $configuration = $module->get_configuration(); $start_page = $configuration->get_home_page(); if (!empty($start_page)) { $img = ''; $img_url = PATH_TO_ROOT . '/' . $module->get_id() . '/' . $module->get_id(); foreach (array('_mini.png', '_mini.gif', '_mini.jpg') as $extension) { $file = new File($img_url . $extension); if ($file->exists()) { $img = '/' . $module->get_id() . '/' . $file->get_name(); break; } } $modules_menu->add(new LinksMenuLink($configuration->get_name(), '/' . $module->get_id() . '/', $img)); } } return $modules_menu; }
} header('Content-type: image/png'); header_nocache(); // Do NOT cache errors! People won't see they have fixed them!! imagepng($im_handle); } } else { // We want the regular file: // Headers to display the file directly in the browser if (!is_readable($File->get_full_path())) { debug_die(sprintf('File "%s" is not readable!', rel_path_to_base($File->get_full_path()))); } $Filetype =& $File->get_Filetype(); if (!empty($Filetype)) { header('Content-type: ' . $Filetype->mimetype); if ($Filetype->viewtype == 'download') { header('Content-disposition: attachment; filename="' . addcslashes($File->get_name(), '\\"') . '"'); // escape quotes and slashes, according to RFC } } $file_path = $File->get_full_path(); header('Content-Length: ' . filesize($file_path)); // The URL refers to this specific file, therefore we can tell the browser that // it does not expire anytime soon. // fp> I don't think mtime changes anything to the cacheability of the data // if( $mtime && $mtime == $File->get_lastmod_ts() ) // TODO: dh> use salt here?! fp>what for? header_noexpire(); // static file // Display the content of the file readfile($file_path); }
/** * @see ItemListenerInterface::get_item_object_name() * @return string */ public final function get_item_object_name() { if ($this->data_entity_id and $this->data_entity) { if (($file_id = File::get_file_id_by_data_entity_id($data_entity_id)) != null) { $file = new File($file_id); return $file->get_name(); } elseif (($value_id = Value::get_value_id_by_data_entity_id($data_entity_id)) != null) { $value = new Value($value_id); $value->get_name(); } elseif (($parameter_id = Parameter::get_parameter_id_by_data_entity_id($data_entity_id)) != null) { $parameter = new Parameter($parameter_id); $parameter->get_name(); } } else { return null; } }