public function createItem() { $apps = app_param('app'); switch ($apps) { case 'article': if (app_param('view') == 'archive' || app_param('view') == 'featured') { $result = Page_ID; return $this->creatLink($result); } else { if (app_param('view') == 'category') { $result = $this->catLink('id'); return $this->creatLink($result); } else { if (app_param('view') == 'item') { $result = $this->artLink('id'); if (empty($result)) { $result = $this->catLink('id'); } return $this->creatLink($result, 1); } else { $result = Page_ID; return $this->creatLink($result); } } } break; default: if (!checkHomePage()) { return $this->creatLink(Page_ID); } break; } }
} elseif ($menu['app'] == "link") { echo "<li class=\"menu{$menu['class']}{$a}{$pos}\" style=\"{$menu['style']}\"><a href=\"{$link}\">{$menu['name']}{$subtitle}</a>"; if ($sub_menu == 1) { sub_menu($menu['id']); } echo "</li>"; } else { if (empty($menu['link'])) { $menu['link'] = "#"; } echo "<li class=\"menu{$menu['class']}{$a}{$pos}\" style=\"{$menu['style']}\"><a href=\"{$link}\">{$menu['name']}{$subtitle}</a>"; if ($sub_menu == 1) { sub_menu($menu['id']); } echo "</li>"; } } else { if (checkHomePage()) { $b = "active"; } else { $b = ""; } echo "<li class=\"menu{$menu['class']}{$a}{$pos}\" style=\"{$menu['style']}\"><a href=\"" . FUrl . "\">{$menu['name']}{$subtitle}</a>"; if ($sub_menu == 1) { sub_menu($menu['id']); } echo "</li>"; } $no++; } echo "</ul>";
$a = FQuery("pdf", "id={$id}", '', 1); } if (!$a) { if (app_param('view') == 'default') { $a = 1; } if (siteConfig('follow_link')) { $follow = 'index, follow'; } else { $follow = 'index, nofollow'; define('MetaRobots', "{$follow}"); } } } if ($a) { if (!checkHomePage()) { if ($view == "item") { define('PageTitle', pdfInfo('title')); $desc = pdfInfo('description'); if (!empty($desc)) { define('MetaDesc', pdfInfo('description')); } $keys = pdfInfo('keyword'); if (!empty($keys)) { define('MetaKeys', pdfInfo('keyword')); } if (siteConfig('follow_link')) { $follow = 'index, follow'; } else { $follow = 'index, nofollow'; }
function app_param($output = null) { if (empty($output)) { $output = 'app'; } if (checkHomePage()) { $source = homeInfo('link') . '&'; } else { if (!empty($_GET["app"])) { $source = getUrl() . '&'; } else { if (isset($_REQUEST['link'])) { //tidak aktif ketika di AdminPanel $source = check_permalink('permalink', $_REQUEST['link'], 'link') . '&'; } else { $source = null; } } } if (strpos("{$source}", $output)) { return param_basic("{$output}", $source, '&'); } }
function add_permalink($title, $cat = NULL, $pid = null, $ext = null, $next = null) { $page = _Page; if (!preg_match("/[0-9]/", $page)) { $page = null; } if (SEF_URL and !checkHomePage() and !$page) { $db = new FQuery(); $db->connect(); $eqpos = strpos($_SERVER['REQUEST_URI'], "="); $tapos = strpos($_SERVER['REQUEST_URI'], "?"); if ($eqpos > 0 and $tapos > 0 and empty($_GET['page'])) { $permalink = str_replace(" ", "-", strtolower($title)); if (app_param('app') == 'article' and app_param('view') == 'item') { while (substr_count($permalink, '/')) { $permalink = str_replace("/", "-", $permalink); } } $category = str_replace(" ", "-", strtolower($cat)); if (!empty($cat)) { $permalink = strtolower($category) . "/" . $permalink; } else { $permalink = $permalink; } while (substr_count($permalink, "[")) { $permalink = str_replace("[", "", $permalink); } while (substr_count($permalink, "]")) { $permalink = str_replace("]", "", $permalink); } while (substr_count($permalink, "(")) { $permalink = str_replace("(", "", $permalink); } while (substr_count($permalink, ")")) { $permalink = str_replace(")", "", $permalink); } while (substr_count($permalink, "{")) { $permalink = str_replace("{", "", $permalink); } while (substr_count($permalink, "}")) { $permalink = str_replace("}", "", $permalink); } while (substr_count($permalink, "&")) { $permalink = str_replace("&", "", $permalink); } while (substr_count($permalink, "&")) { $permalink = str_replace("&", "", $permalink); } /************ ? removal **************/ while (substr_count($permalink, "?")) { $permalink = str_replace("?", "", $permalink); } /************ + removal **************/ while (substr_count($permalink, "+")) { $permalink = str_replace("+", "", $permalink); } /************ # removal **************/ while (substr_count($permalink, "#")) { $permalink = str_replace("#", "", $permalink); } /************ & removal **************/ while (substr_count($permalink, "\\&")) { $permalink = str_replace("\\&", "", $permalink); } /************ . removal **************/ while (substr_count($permalink, ".")) { $permalink = str_replace(".", "-", $permalink); } /************ ! removal **************/ while (substr_count($permalink, "!")) { $permalink = str_replace("!", "", $permalink); } /************ ` removal **************/ while (substr_count($permalink, "`")) { $permalink = str_replace("`", "", $permalink); } /************ ' removal **************/ while (substr_count($permalink, "'")) { $permalink = str_replace("'", "", $permalink); } /************ " removal **************/ while (substr_count($permalink, "\"")) { $permalink = str_replace('"', "", $permalink); } /************ ; removal **************/ while (substr_count($permalink, ";")) { $permalink = str_replace(';', "", $permalink); } /************ " removal **************/ while (substr_count($permalink, '|')) { $permalink = str_replace('|', "", $permalink); } /************ % removal **************/ while (substr_count($permalink, '%')) { $permalink = str_replace('%', "", $permalink); } /************ * removal **************/ while (substr_count($permalink, '*')) { $permalink = str_replace('*', "", $permalink); } /************ ^ removal **************/ while (substr_count($permalink, '^')) { $permalink = str_replace('^', "", $permalink); } /************ \ removal **************/ while (substr_count($permalink, '\\')) { $permalink = str_replace("\\", "", $permalink); } /************ \ removal **************/ /************ , removal **************/ while (substr_count($permalink, ',')) { $permalink = str_replace(",", "", $permalink); } /************ $ removal **************/ while (substr_count($permalink, '$')) { $permalink = str_replace("\$", "", $permalink); } /************ @ removal **************/ while (substr_count($permalink, '@')) { $permalink = str_replace("@", "", $permalink); } while (substr_count($permalink, "--")) { $permalink = str_replace("--", "-", $permalink); } if (empty($pid)) { $pid = Page_ID; } $link = getLink(); if (!empty($category) and empty($ext)) { $permalink = $permalink . SEF_EXT; } else { if (!empty($ext)) { $ext = str_replace(".", "", $ext); $permalink = "{$permalink}.{$ext}"; } } if (check_permalink('link', $link)) { redirect(FUrl . $permalink); } else { if (!empty($permalink)) { if ($c = check_permalink('permalink', $permalink)) { $x = 2; $permalink = str_replace(SEF_EXT, "", $permalink); while ($c) { $p = "{$permalink}-{$x}"; $c = check_permalink('permalink', $p . SEF_EXT); $x++; } $permalink = $p . SEF_EXT; } if (!empty($permalink) and $permalink != "-" and !empty($link)) { $qr = $db->insert(FDBPrefix . 'permalink', array("", "{$link}", "{$permalink}", $pid, 1, 0)); } if (isset($qr)) { redirect(FUrl . $permalink); } } } } } }