function at_autourls_rewrite($display) { $autourls = atAutoGetVar("autourls"); $autourlsext = $autourls['extension']; if (!$autourlsext) { $autourlsext = "phtml"; } $search = array("'(?<!/)modules.php\\?name=News&file=article&sid=([0-9]*)'", "'(?<!/)modules.php\\?name=News&file=article&sid=([0-9]*)'", "'(?<!/)modules.php\\?name=Stories_Archive&sa=show_month&year=([0-9]*)&month=([0-9]*)&month_l=([a-zA-Z]*)'", "'(?<!/)modules.php\\?name=Stories_Archive'", "'(?<!/)modules.php\\?name=Downloads&d_op=getit&lid=([0-9]*)'", "'(?<!/)modules.php\\?name=Downloads&d_op=viewdownload&cid=([0-9]*)&min=([0-9]*)&orderby=titleA&show=([0-9]*)'", "'(?<!/)modules.php\\?name=Downloads&d_op=viewdownload&cid=([0-9]*)'", "'(?<!/)modules.php\\?name=Downloads&d_op=viewdownloaddetails&lid=([0-9]*)&ttitle=([§/:\\-\\'(){}.&=a-zA-Z0-9_ ]*)'", "'(?<!/)modules.php\\?name=(Downloads\")'", "'(?<!/)modules.php\\?name=Reviews&rop=showcontent&id=([0-9]*)'", "'(?<!/)modules.php\\?name=Reviews&rop=write_review'", "'(?<!/)modules.php\\?name=Reviews&rop=postcomment&id=([0-9]*)&title=([a-zA-Z0-9+]*)'", "'(?<!/)modules.php\\?name=Reviews&rop=mod_review&id=([0-9]*)'", "'(?<!/)modules.php\\?name=Reviews&rop=del_review&id_del=([0-9]*)'", "'(?<!/)modules.php\\?name=Reviews&rop=([a-zA-Z0-9]*)'", "'(?<!/)modules.php\\?name=Reviews'", "'(?<!/)modules.php\\?name=Submit_News'", "'(?<!/)modules.php\\?name=Topics'", "'(?<!/)modules.php\\?name=Top'", "'(?<!/)modules.php\\?name=FAQ'", "'(?<!/)modules.php\\?name=FAQ&myfaq=yes&id_cat=([0-9]*)&categories=([a-zA-Z0-9+]*)'", "'(?<!/)modules.php\\?name=Forums&file=viewtopic&t=([0-9]+)&postdays=([0-9]+)&postorder=asc&start=([0-9]+)'", "'(?<!/)modules.php\\?name=Forums&file=viewforum&f=([0-9]+)&topicdays=([0-9]+)&start=([0-9]+)'", "'(?<!/)modules.php\\?name=Content&pa=showpage&pid=([0-9]*)'", "'(?<!/)modules.php\\?name=Content&pa=list_pages_categories&cid=([0-9]*)'", "'(?<!/)modules.php\\?name=Forums&file=viewforum&f=([0-9]*)'", "'(?<!/)modules.php\\?name=Forums&file=viewtopic&t=([0-9]*)&start=([0-9]*)'", "'(?<!/)modules.php\\?name=Forums&file=viewtopic&(p|t)=([0-9]*)'", "'(?<!/)modules.php\\?name=Forums&file=index'", "'(?<!/)modules.php\\?name=Your_Account&op=userinfo&uname=([a-zA-Z0-9_-]*)'", "'(?<!/)modules.php\\?name=Your_Account&op=userinfo&uname=([a-zA-Z0-9_-]*)'", "'(?<!/)modules.php\\?op=modload&name=Web_Links&file=index&l_op=visit&lid=([0-9]*)'", "'(?<!/)modules.php\\?op=modload&name=Web_Links&file=index&l_op=viewlink&cid=([0-9]*)'", "'(?<!/)modules.php\\?name=Web_Links'"); $replace = array("article\\1." . $autourlsext, "article\\1." . $autourlsext, "archive-\\1-\\2-\\3." . $autourlsext, "archive." . $autourlsext, "downloads-file-\\1." . $autourlsext, "downloads-cats-\\1-\\2-\\3." . $autourlsext, "downloads-cat-\\1." . $autourlsext, "downloads-file-\\1-details-\\2." . $autourlsext, "downloads.html\"", "reviews-\\1." . $autourlsext, "reviews-new." . $autourlsext, "reviews-comment-\\1-\\2", "reviews-\\1-edit." . $autourlsext, "reviews-\\1-delete." . $autourlsext, "reviews-sortby-\\1." . $autourlsext, "reviews." . $autourlsext, "submit." . $autourlsext, "topics." . $autourlsext, "top." . $autourlsext, "faq." . $autourlsext, "faq-\\1-\\2." . $autourlsext, "postx\\1-\\2-\\3." . $autourlsext, "forumx\\1-\\2-\\3." . $autourlsext, "contentid-\\1." . $autourlsext, "content-cat-\\1." . $autourlsext, "forum\\1." . $autourlsext, "posts\\1-\\2." . $autourlsext, "post\\1\\2." . $autourlsext, "forums." . $autourlsext, "userinfo-\\1." . $autourlsext, "userinfo-\\1." . $autourlsext, "viewlink-\\1." . $autourlsext, "link-\\1." . $autourlsext, "links" . $autourlsext); $display = preg_replace($search, $replace, $display); return $display; }
function at_credits($vars) { extract($vars); $atpath = atAutoGetVar("atpath"); $credits = atAutoGetVar("credits"); $type = $credits['type']; if ($type == "text") { $link = _AT_POWERED; } else { $link = "<img border=\"0\" src=\"{$atpath}/images/at-powered.gif\" alt=\"" . _AT_POWERED . "\" width=\"100\" height=\"50\" />"; } echo "\n<div align=\"center\">\n" . "<a target=\"_blank\" href=\"http://www.spidean.com\">{$link}</a>\n" . "</div>\n"; }
function at_shortcut_icon($config) { extract($config); $favicon = atAutoGetVar("favicon"); $icon = $favicon['icon']; if (!$icon) { $icon = "favicon.ico"; } if (file_exists($imagepath . $icon)) { $icon = $imagepath . $icon; } echo "<!-- Add shortcut icon -->\n<link rel=\"SHORTCUT ICON\" href=\"{$icon}\"" . ($xhtml ? " />" : ">") . "\n"; }
function at_entrypage($vars) { session_start(); if (isset($_SESSION['entered'])) { return; } else { $_SESSION['entered'] = 1; } extract($vars); $entrypage = atAutoGetVar("entrypage"); $template = $entrypage['template']; $type = $entrypage['type']; switch ($type) { case "admin": if (!atIsAdminUser()) { return; } break; case "anonymous": if (atIsLoggedin()) { return; } break; case "loggedin": if (!atIsLoggedin()) { return; } break; } if (!$template) { $template = "entrypage.html"; } if (@file_exists($themepath . $template)) { $file = $themepath . $template; } elseif (@file_exists($atdir . "templates/{$template}")) { $file = $atdir . "templates/{$template}"; } else { return; } $HTML = atTemplatePrep($file, 1); $output = atCommandReplace($HTML, $command); atTemplateDisplay($output); atThemeExit(); }
function at_themesonadate($vars) { extract($vars); $themesonadate = atAutoGetVar("themesonadate"); if (!$themesonadate) { return; } foreach ($themesonadate['date'] as $k => $v) { $newarray[$v] = $themesonadate['theme'][$k] . ":" . $themesonadate['user'][$k]; } $themesonadate = $newarray; $now = time(); ksort($themesonadate); foreach ($themesonadate as $date => $theme) { $changedate = strtotime($date); if ($now >= $changedate) { $newtheme = $theme; } } atThemeSet($newtheme, $user); }
function at_themegroup($vars) { extract($vars); $themegroup = atAutoGetVar("themegroup"); if (!$themegroup) { return; } foreach ($themegroup['group'] as $k => $v) { $newarray[$v] = $themegroup['theme'][$k] . ":" . $themegroup['user'][$k]; } $themegroup = $newarray; ksort($themegroup); foreach ($themegroup as $group => $theme) { if (atIsInGroup($group)) { $parts = explode(":", $theme); $newtheme = $parts[0]; $user = $parts[1]; break; } } atThemeSet($newtheme, $user); }
function at_maintenance($vars) { extract($vars); $maintenance = atAutoGetVar("maintenance"); $template = $maintenance['template']; if (atISAdminUser() || eregi($GLOBALS['admin_file'], $_SERVER['PHP_SELF'])) { return; } if (!$template) { $template = "maintenance.html"; } if (@file_exists($themepath . "extras/{$template}")) { $file = $themepath . "extras/{$template}"; } elseif (@file_exists($atdir . "templates/{$template}")) { $file = $atdir . "templates/{$template}"; } else { return; } $HTML = atTemplatePrep($file, 1); $output = atCommandReplace($HTML, $command); atTemplateDisplay($output); atThemeExit(); }
function at_themelang($vars) { extract($vars); $themelang = atAutoGetVar("themelang"); if (!$themelang) { return; } foreach ($themelang['lang'] as $k => $v) { $newarray[$v] = $themelang['theme'][$k] . ":" . $themelang['user'][$k]; } $themelang = $newarray; $userlang = atGetLang(); ksort($themelang); foreach ($themelang as $lang => $theme) { if ($userlang == $lang) { $parts = explode(":", $theme); $newtheme = $parts[0]; $user = $parts[1]; break; } } atThemeSet($newtheme, $user); }
function atAdminThemeLinks($themedir, $title = "", $var, $submenu = 0) { $var = atExportVar($var); extract($var); atAdminHeader(); if ($thememod && $thememod != "default") { if (!$modops) { $modops = "default"; } if ($title) { $title = "{$themedir} > {$thememod} > {$modops} > {$title}"; } else { $title = "{$themedir} > {$thememod} > {$modops}"; } $submenu = 1; } else { if ($title) { $title = "{$themedir} > {$title}"; } else { $title = $themedir; } $modops = ""; } $adminlinks = "" . AT_ADMINPAGE . "?module=AutoTheme"; echo "<div align=\"center\"><b>{$title}</b></div><br />\n"; atAdminOpenTable(); echo "<div align=\"center\">\n" . "[ <a href=\"{$adminlinks}&op=general&themedir=" . htmlentities(urlencode($themedir)) . "\">" . _AT_THEMEDEF . "</a> | " . "<a href=\"{$adminlinks}&op=modmain&themedir=" . htmlentities(urlencode($themedir)) . "\">" . _AT_CUSTMODULES . "</a> | " . "<a href=\"{$adminlinks}&op=ablocks&themedir=" . htmlentities(urlencode($themedir)) . "\">" . _AT_AUTOBLOCKS . "</a> | " . "<a href=\"{$adminlinks}&op=cmdedit&themedir=" . htmlentities(urlencode($themedir)) . "\">" . _AT_COMMANDS . "</a> ]<br />"; $autoconfig = atGetAutoConfig(); extract($autoconfig); if (!($ext = atAutoGetVar("extra"))) { $ext = atExtraScan($extradir); } if (!$ext) { return; } ksort($ext); foreach ($ext as $id => $info) { if ($info['themeadmin'] && function_exists($info['themeadmin']) && $autoextra[$id]) { echo "[ <a href=\"" . AT_ADMINPAGE . "?module=AutoTheme&op=extraops&extraname=" . htmlentities(urlencode($id)) . "&themedir=" . htmlentities(urlencode($themedir)) . "\">" . $info['name'] . "</a> ]"; } } echo "</div>\n"; atAdminCloseTable(); echo "<br />"; if ($submenu) { if (!$thememod) { $thememod = "default"; } atAdminOpenTable(); echo "<div align=\"center\">\n" . "[ <a href=\"{$adminlinks}&op=blockmain&themedir=" . htmlentities(urlencode($themedir)) . "&thememod=" . htmlentities(urlencode($thememod)) . "&modops=" . htmlentities(urlencode($modops)) . "\">" . _AT_CUSTBLOCKS . "</a> | " . "<a href=\"{$adminlinks}&op=cmsblocks&themedir=" . htmlentities(urlencode($themedir)) . "&thememod=" . htmlentities(urlencode($thememod)) . "&modops=" . htmlentities(urlencode($modops)) . "\">" . _AT_BLOCKCONTROL . "</a> ]<br />"; foreach ($ext as $id => $info) { if ($info['modadmin'] && function_exists($info['modadmin']) && $autoextra[$id]) { echo "[ <a href=\"{$adminlinks}&op=extraops&extraname=" . htmlentities(urlencode($id)) . "&themedir=" . htmlentities(urlencode($themedir)) . "&thememod=" . htmlentities(urlencode($thememod)) . "&modops=" . htmlentities(urlencode($modops)) . "\">" . $info['name'] . "</a> ]"; } } echo "</div>"; atAdminCloseTable(); echo "<br />"; } }
<?php // Extra command for all platforms // //atRunningSetVar("autoprint", "AutoPrint"); $autoprint = atAutoGetVar("autoprint"); $atpath = atAutoGetVar("atpath"); $theme = $autoprint["theme"]; if (!$theme) { $theme = "AutoPrint"; } $thispage = $_SERVER['PHP_SELF']; if ($_SERVER['PHP_SELF'] == "modules.php") { $thispage = "index.php"; } $urlend = $_SERVER['QUERY_STRING'] ? "?" . $_SERVER['QUERY_STRING'] . "&" : "?"; $thisurl = $thispage . $urlend . "theme={$theme}"; $thisurl = htmlentities($thisurl); if (file_exists($themepath . "images/print.gif")) { $thisimage = $themepath . "images/print.gif"; } if (file_exists($atpath . "images/print.gif")) { $thisimage = $atpath . "images/print.gif"; } if (isset($thisimage)) { $printimage = '<img src="' . $thisimage . '" alt="' . _AT_PRINTERFRIENDLYPAGE . '" border="0"> '; } else { $printimage = ""; } atRunningSetVar("printimage", $printimage); atRunningSetVar("thisurl", $thisurl);
function atCompileClear() { $compiledir = atAutoGetVar('compiledir'); if ($handle = @opendir($compiledir)) { while (false !== ($file = @readdir($handle))) { @unlink($compiledir . $file); } closedir($handle); } if (function_exists('atcacheclear')) { atCacheClear(); } }