/** * @see parent::initHtmlData */ public function initHtmlData() { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/interview.php'; $ids = $this->parseLinks(); if ($ids) { $this->html_data = interview::getInterviewById(array_map("intval", $ids)); } }
/** * Генерирует ЧПУ ссылки * * @param string $type Тип ссылки(project, blog и т.д.) * @param integer|array $data Параметры для ссылки. Если целое, то id объекта в БД, иначе готовый массив $data (см. внутрь). * @return string ЧПУ ссылка */ function getFriendlyURL($type, $data = NULL) { static $url_cache = array(); $url = ''; if (!is_array($data)) { $id = intval($data); $data = NULL; } else { $id = intval($data['id']); } if (!$id) { return NULL; } if ($url_cache[$type][$id]) { return $url_cache[$type][$id]; } switch ($type) { case 'project': if (!$data) { require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/projects.php"; $data = projects::getInfoForFriendlyURL($id); } if ($data) { $name = translit(strtolower(htmlspecialchars_decode($data['name'], ENT_QUOTES))); $url = "/projects/{$id}/" . ($name ? "{$name}.html" : ""); } break; case 'blog': require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/blogs.php"; $data = blogs::getMsgInfoForFriendlyURL($id); if ($data) { $name = translit(strtolower(htmlspecialchars_decode($data['name'], ENT_QUOTES))); $category = translit(strtolower(htmlspecialchars_decode($data['category'], ENT_QUOTES))); $url = "/blogs/{$category}/{$id}/" . ($name ? $name . ".html" : ""); } break; case 'blog_group': require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/blogs.php"; $data = blogs::GetGroupName($id); if ($data) { $category = translit(strtolower(htmlspecialchars_decode($data, ENT_QUOTES))); $url = "/blogs/" . ($category ? "{$category}/" : ""); } break; case 'article': require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/articles.php"; $data = articles::getInfoForFriendlyURL($id); if ($data) { $name = translit(strtolower(htmlspecialchars_decode($data['title'], ENT_QUOTES))); $url = "/articles/{$id}/" . ($name ? $name . ".html" : ""); } break; case 'interview': require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/interview.php"; $data = interview::getInfoForFriendlyURL($id); if ($data) { $name = translit(strtolower(htmlspecialchars_decode($data['uname'] . ' ' . $data['usurname'] . ' ' . $data['login'], ENT_QUOTES))); $url = "/interview/{$id}/" . ($name ? $name . ".html" : ""); } break; case 'commune': require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/commune.php"; $data = commune::getMsgInfoForFriendlyURL($id); if ($data) { $category = translit(strtolower(htmlspecialchars_decode($data['group_link'], ENT_QUOTES))); $commune = translit(strtolower(htmlspecialchars_decode($data['commune_name'], ENT_QUOTES))); $name = translit(strtolower(htmlspecialchars_decode($data['name'], ENT_QUOTES))); $commune_id = $data['commune_id']; $url = "/commune/{$category}/{$commune_id}/{$commune}/{$id}/" . ($name ? $name . ".html" : ""); } break; case 'commune_group': require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/commune.php"; $data = commune::getGroupInfoForFriendlyURL($id); if ($data) { $category = translit(strtolower(htmlspecialchars_decode($data['link'], ENT_QUOTES))); $url = "/commune/{$category}/"; } break; case 'commune_commune': require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/commune.php"; $data = commune::getCommuneInfoForFriendlyURL($id); if ($data) { $category = translit(strtolower(htmlspecialchars_decode($data['category_link'], ENT_QUOTES))); $commune = translit(strtolower(htmlspecialchars_decode($data['name'], ENT_QUOTES))); $commune = $commune ? $commune : 'commune'; $url = "/commune/{$category}/{$id}/{$commune}/"; } break; } if ($url) { $url_cache[$type][$id] = $url; } return $url; }
// } $nav = $int->getNavigation($interview, $ord); $navigation = array(); if ($nav[1]['pos'] == 1) { $navigation['next'] = $nav[1]; } else { $navigation['prev'] = $nav[1]; } if (isset($nav[2])) { $navigation['prev'] = $nav[2]; } $content = 'content_view.php'; $FBShare = array('title' => $interview['uname'] . ' ' . $interview['usurname'] . ' [' . $interview['login'] . ']', 'description' => '', 'image' => HTTP_PREFIX . 'www.free-lance.ru/images/free-lance_logo.jpg'); break; default: $interview = new interview(); $list = $interview->getInterview($uid, null, $ord, $year, $filter); $content = 'content_index.php'; } $css_file = array('/css/main.css', '/css/ai.css'); $css_file[] = '/css/wysiwyg.css'; $css_file[] = '/css/hljs.css'; $js_file = array('mootools-forms.js', 'articles.js'); $js_file_utf8[] = '/scripts/ckedit/ckeditor.js'; $js_file[] = '/scripts/highlight.min.js'; $js_file[] = '/scripts/highlight.init.js'; $js_file[] = '/scripts/comments.all.js'; $js_file[] = '/scripts/banned.js'; $js_file[] = '/scripts/uploader.js'; $additional_header = '<script type="text/javascript" src="/scripts/mootools-forms.js"></script>' . '<script type="text/javascript" src="/scripts/articles.js"></script>' . '<script type="text/javascript" src="/scripts/kwords.js"></script>' . '<script type="text/javascript" src="/kword_js.php"></script>'; include $rpath . '/template2.php';