id); $alias = $guide_post->link_rewrite; } else { $id = (int)($guide_post); } if ($this->allow == 1) { $url = __PS_BASE_URI__.$this->getLangLink((int)($id_lang)).'guide/'; $url .= $id.($alias?'-'.$alias:''); } else { $url = $this->moduleGuideDir($ssl).'page.php?id_guide_post='.$id.'&id_lang='.$id_lang; } return $url; } private function moduleGuideDir($ssl) { $base = (($ssl AND Configuration::get('PS_SSL_ENABLED')) ? Tools::getShopDomainSsl(true) : Tools::getShopDomain(true)); return $base._MODULE_DIR_.'/'.Module::getModuleNameFromClass('AdminGuidePosts').'/'; } public function getPageLink($filename, $ssl = false, $id_lang = NULL) { global $cookie; if ($id_lang == NULL) $id_lang = (int)($cookie->id_lang); if (array_key_exists($filename.'_'.$id_lang, self::$cache['page']) AND !empty(self::$cache['page'][$filename.'_'.$id_lang])) $uri_path = self::$cache['page'][$filename.'_'.$id_lang]; else { if ($this->allow == 1) { $url_rewrite = ''; if ($filename != 'index.php') { $pagename = substr($filename, 0, -4); $url_rewrite = Db::getInstance()->getValue(' SELECT url_rewrite FROM `'._DB_PREFIX_.'meta` m LEFT JOIN `'._DB_PREFIX_.'meta_lang` ml ON (m.id_meta = ml.id_meta) WHERE id_lang = '.(int)($id_lang).' AND `page` = \''.pSQL($pagename).'\''); $uri_path = $this->getLangLink((int)$id_lang).($url_rewrite ? $url_rewrite : $filename); } else $uri_path = $this->getLangLink((int)$id_lang); } else { $uri_path = ''; if ($filename != 'index.php') $uri_path = $filename; } self::$cache['page'][$filename.'_'.$id_lang] = $uri_path; } $protocol = (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PORT'] == '443')?'https://':'http://'; return $protocol.Tools::getShopDomainSsl().__PS_BASE_URI__.ltrim($uri_path, '/'); } }