menu->params); $template = $params->get('template'); $limit_section = $params->get('limit_section'); if (!isset($id)) { $id = $params->get('default_category'); } if (!$id) { trigger_error('Failed get id', E_USER_WARNING); mosNotAuth(); return; } global $database; $category = new mosCategory($database); if (preg_match('/^[1-9][0-9]*$/', $id)) { /* * id が数値ならばカテゴリID として */ $id = (int) $id; $result = $category->load($id); } else if ($limit_section) { /* * id が数値以外ならばカテゴリ名として * ただしセクション制限時のみ */ $quoted_name = $database->Quote($id); $quoted_section = $database->Quote($limit_section); $query =<<<__PHP__ SELECT * FROM #__categories WHERE name = {$quoted_name} AND section = {$quoted_section} __PHP__; $database->setQuery($query); $result = $database->loadObject($category); } else { trigger_error("Failed get id", E_USER_WARNING); mosNotAuth(); return; } if (!$result || !$category->title) { $errormsg = "Unknown category: {$id}"; if ($errornum = $database->getErrorNum()) { $errormsg .= "; {$errornum}:".$database->getErrorMsg(); } trigger_error($errormsg, E_USER_WARNING); mosNotAuth(); return; } if ($limit_section && ($category->section !== $limit_section)) { trigger_error("User can not access category: {$id}", E_USER_WARNING); mosNotAuth(); return; } $access = (int) $category->access; if ($access > $gid) { trigger_error("User can not access category: {$id}", E_USER_WARNING); mosNotAuth(); return; } $id = (int) $category->id; $section = new mosSection($database); $result = $section->load($category->section); if (!$result) { trigger_error("Unknown section: {$category->section}", E_USER_WARNING); mosNotAuth(); return; } $access = (int) $section->access; if ($access > $gid) { trigger_error("User can not access category: {$id}", E_USER_WARNING); mosNotAuth(); return; } $unpublish = $params->get('unpublish'); if (!$unpublish && (!$category->published || !$section->published)) { trigger_error("Category unpublish: {$id}", E_USER_NOTICE); mosNotAuth(); return; } if ($params->get('category_page_title')) { $mainframe->setPageTitle($category->title); } else if ($params->get('menu_page_title')) { $mainframe->setPageTitle($mainframe->menu->name); } if ($constant = $params->get('view_id_constant_name')) { define($constant, $id); } $template_resource = $params->get('template_resource'); if ($template_resource === 'file') { global $mosConfig_absolute_path; $template = "{$mosConfig_absolute_path}/{$template}"; if (!is_file($template)) { trigger_error("Failed get template: {$template}", E_USER_NOTICE); mosNotAuth(); return; } $template = file_get_contents($template); } else { $template_content = new mosContent($database); $result = $template_content->load($template); if (!$result) { trigger_error("Failed get template content: {$template}", E_USER_NOTICE); mosNotAuth(); return; } $template_content->text = $template_content->introtext; $template_content_params = new mosParameters("introtext=1\nintro_only=0"); $template_content_params->set('image', true); global $_MAMBOTS; $_MAMBOTS->loadBotGroup( 'content' ); $results = botMosImage( true, $template_content, $template_content_params ); $template = $template_content->text; } require_once $mainframe->getPath('front_html', $option); $html = new HTML_kingyoya_category_view(); $html->option = $option; $html->id = $id; $Itemid and $html->Itemid = $Itemid; $html->category = $category; $html->section = $section; $html->template = $template; $html->show(); } } if ($option === 'com_kingyoya_category_view') { TASK_kingyoya_category_view::show($option, $gid, isset($_REQUEST['id']) ? $_REQUEST['id'] : null, $Itemid); }