function WebPageTitle() { if (self_q() == "p") { $t = PageTitle(arg(0)); if ($t) { return "{$t} - "; } else { return ""; } } else { return ""; } }
function in_admin() { return str_start(self_q(), "admin"); }
function replace_my_tags(&$html) { if (!str_beg(self_q(), "admin/edit")) { if (function_exists("on_my_tags")) { on_my_tags($html); } } preg_match_all("|{f[^}]*}|", $html, $matches); foreach ($matches[0] as $value) { $varname = substr($value, 2, strlen($value) - 3); $parts = explode(":", $varname); if (count($parts) < 2) { $fname = $parts[0]; $cut = 0; } else { $fname = $parts[0]; $cut = $parts[1]; } $file = file_get_contents($fname); if ($cut) { $file = substr($file, 0, $cut) . "..."; } $html = str_replace("{f{$varname}}", $file, $html); } preg_match_all("|{call[^}]*}|", $html, $matches); foreach ($matches[0] as $value) { $varname = substr($value, 2 + 3, strlen($value) - 3 - 3); $varname = $varname; $parts = explode(" ", trim($varname)); if (function_exists($parts[0])) { $function = $parts[0]; global $template_call; global $template_call_admin; if (!isset($template_call[$function])) { echo "template_call['{$function}'] is not set "; continue; } if (str_beg(self_q(), "admin") && !isset($template_call_admin[$function])) { continue; } $content = $function(isset($parts[1]) ? $parts[1] : null, isset($parts[2]) ? $parts[2] : null, isset($parts[3]) ? $parts[3] : null, isset($parts[4]) ? $parts[4] : null, isset($parts[5]) ? $parts[5] : null, isset($parts[6]) ? $parts[6] : null); $html = str_replace("{call{$varname}}", $content, $html); } } preg_match_all("|{href[^}]*}|", $html, $matches); foreach ($matches[0] as $value) { $varname = substr($value, 2 + 3, strlen($value) - 3 - 3); $varname = $varname; $parts = explode(" ", trim($varname)); global $base_url; $background = ""; if (isset($parts[5])) { $background = 'background:' . $parts[5] . ";"; } $loc = $parts[4]; $blank = false; if (str_beg($loc, "blank:")) { $loc = str_replace("blank:", "", $loc); $blank = true; } if (!str_beg($loc, "http") && !str_beg($loc, "javascript")) { $loc = $base_url . $loc; } if ($blank) { $content = "<div class=href_sensor style='cursor:pointer;position:absolute;margin-left:{$parts[0]}px;margin-top:{$parts[1]}px;width:{$parts[2]}px;height:{$parts[3]}px;{$background}z-index:100;' onclick='window.open(\"{$loc}\")'><a target=_blank href={$loc}></a></div>"; } else { $content = "<div class=href_sensor style='cursor:pointer;position:absolute;margin-left:{$parts[0]}px;margin-top:{$parts[1]}px;width:{$parts[2]}px;height:{$parts[3]}px;{$background}z-index:100;' onclick='window.location=\"{$loc}\"'><a href={$parts[4]}></a></div>"; } $html = str_replace("{href{$varname}}", $content, $html); } }
function search_param() { if (self_q() == "search") { return arg(0); } }
function ContentTitle() { if (self_q() == "p") { $t = PageTitle(arg(0)); return $t; } else { if (self_q() == "news") { return "Новости"; } else { return ""; } } }