/** * function to get multilanguage strings * * This is actually a wrapper for ATK's atktext() method, for * use in templates. * * @author Ivo Jansch <*****@*****.**> * * Example: {atktext id="users.userinfo.description"} * {atktext id="userinfo.description" module="users"} * {atktext id="description" module="users" node="userinfo"} * */ function smarty_function_atktext($params, &$smarty) { if (!isset($params["id"])) { $params["id"] = $params[0]; } switch (substr_count($params["id"], ".")) { case 1: list($module, $id) = explode(".", $params["id"]); $str = atktext($id, $module, isset($params["node"]) ? $params["node"] : ''); break; case 2: list($module, $node, $id) = explode(".", $params["id"]); $str = atktext($id, $module, $node); break; default: $str = atktext($params["id"], atkArrayNvl($params, "module", ""), atkArrayNvl($params, "node", ""), atkArrayNvl($params, "lng", "")); } if (isset($params["filter"])) { $fn = $params["filter"]; $str = $fn($str); } // parse the rest of the params in the string atkimport("atk.utils.atkstringparser"); $parser = new atkStringParser($str); return $parser->parse($params); }
/** * Function for embedding a date control in html. * * @author Peter C. Verhage <*****@*****.**> */ function smarty_function_atkdatefield($params, &$smarty) { $name = isset($params['name']) ? $params['name'] : 'date'; $format = isset($params['format']) ? $params['format'] : atktext("date_format_edit", "atk", "", "", "", true); $mandatory = isset($params['mandatory']) && $params['mandatory'] || isset($params['obligatory']) && $params['obligatory']; $noweekday = isset($params['noweekday']) && $params['noweekday']; $calendar = isset($params['calendar']) && $params['calendar']; $time = isset($params['time']) ? $params['time'] : ($mandatory ? mktime() : NULL); $min = isset($params['min']) ? $params['min'] : 0; $max = isset($params['max']) ? $params['max'] : 0; if (is_array($time)) { $date = $time; } else { if ($time == NULL) { $date = NULL; } else { if (is_numeric($time)) { $date = getdate($time); $date = array('day' => $date['mday'], 'month' => $date['mon'], 'year' => $date['year']); } else { if (preg_match('/([0-9]{1,2})-([0-9]{1,2})-([0-9]{4})/', $time, $matches)) { $date = array('day' => (int) $matches[1], 'month' => (int) $matches[2], 'year' => $matches[3]); } else { $date = getdate(strtotime($time)); $date = array('day' => $date['mday'], 'month' => $date['mon'], 'year' => $date['year']); } } } } useattrib('atkdateattribute'); $attr = new atkDateAttribute($name, $format, '', $min, $max, ($noweekday ? AF_DATE_EDIT_NO_DAY : 0) | ($mandatory ? AF_OBLIGATORY : 0) | ($calendar ? 0 : AF_DATE_NO_CALENDAR)); $html = $attr->edit(array($name => $date)); return $html; }
function getCenterPiece(&$centerpiece, &$centerpiecelinks) { $user =& atkGetUser(); $theme =& atkinstance("atk.ui.atktheme"); // Set the dispatchfile for this menu based on the theme setting, or to the default if not set. // This makes sure that all calls to dispatch_url will generate a url for the main frame and not // within the menu itself. $dispatcher = $theme->getAttribute('dispatcher', atkconfig("dispatcher", "index.php")); // do not use atkSelf here! $c =& atkinstance("atk.atkcontroller"); $c->setPhpFile($dispatcher); if ($theme->getAttribute('useframes', true)) { $target = 'target="main"'; } else { $target = ""; } //$centerpiece = $centerpiecelinks['pim'] = href(dispatch_url("dashboard.mainboard", "start"), atktext("pim"), SESSION_NEW, false,$target); // change location link - if location_name is null there is only one location! if ($user['location_id'] !== null) { $current_location = atktext('current_location') . ': ' . $user['location_name']; $atktarget = "index.php?atknodetype=locations.location&atkaction=change&atklevel=0&atkprevlevel=0&atkselect=[atkprimkey]"; $params = array("atkfilter" => $filter, "atktarget" => $atktarget); $centerpiece = $centerpiecelinks['change_location'] = href(dispatch_url("locations.location", "select", $params), $current_location, SESSION_NEW, false, $target); } // if user settings is allowed put link to it if (is_allowed("loginmanager.settings", "edit") && substr($user['name'], 0, 4) != 'demo') { $centerpiece .= ' '; $centerpiece .= $centerpiecelinks['userprefs'] = href(dispatch_url("loginmanager.settings", "edit"), atktext("userprefs"), SESSION_NEW, false, $target); } }
function show_notification_window($content, $closebutton = true, $windowtitle = "") { if (!$windowtitle) { $windowtitle = atktext('notice'); } $content .= '<br>'; if ($closebutton == true) { $buttonlink = 'true'; } $page =& atknew("atk.ui.atkpage"); $ui =& atkinstance("atk.ui.atkui"); $output =& atkOutput::getInstance(); $page->register_style($ui->stylePath("style.css")); $res = $ui->renderBox(array("closebutton" => $buttonlink, "content" => $content), "error"); $page->addContent($res); $output->output($page->render($windowtitle)); $output->outputFlush(); }
// check autorefresh call if (atkConfig::getGlobal('session_autorefresh') && array_key_exists(atkConfig::getGlobal('session_autorefresh_key'), $_GET)) { die(session_id()); } atksecure(); $theme =& atkinstance('atk.ui.atktheme'); if (atkconfig("fullscreen")) { // Fullscreen mode. Use index.php as launcher, and launch app.php fullscreen. atksession(); atksecure(); $page =& atknew("atk.ui.atkpage"); $ui =& atkinstance("atk.ui.atkui"); $theme =& atkTheme::getInstance(); $output =& atkOutput::getInstance(); $page->register_style($theme->stylePath("style.css")); $page->register_script(atkconfig("atkroot") . "atk/javascript/launcher.js"); $content = '<script language="javascript">atkLaunchApp(); </script>'; $content .= '<br><br><a href="#" onClick="atkLaunchApp()">' . atktext('app_reopen') . '</a> ' . '<a href="#" onClick="window.close()">' . atktext('app_close') . '</a><br><br>'; $box = $ui->renderBox(array("title" => atktext("app_launcher"), "content" => $content)); $page->addContent($box); $output->output($page->render(atktext('app_launcher'), true)); $output->outputFlush(); } else { if ($theme->getAttribute('useframes', true)) { // Regular mode. app.php can be included directly. include "app.php"; } else { $indexpage =& atknew('atk.ui.atkindexpage'); $indexpage->generate(); } }
* @internal includes. */ $config_atkroot = "./"; include_once "atk.inc"; include_once "achievotools.inc"; atksession(); atksecure(); require "theme.inc"; $page =& atkinstance("atk.ui.atkpage"); $page->unregister_all_scripts(); $ui =& atkinstance("atk.ui.atkui"); $theme =& atkTheme::getInstance(); $output =& atkOutput::getInstance(); $page->register_style($theme->stylePath("style.css")); $page->register_stylecode("form{display: inline;}"); $page->register_style($theme->stylePath("top.css")); //Backwards compatible $content, that is what will render when the box.tpl is used instead of a top.tpl $username = getFullUsername(); $loggedin = atktext("logged_in_as", "atk") . ": <b>" . $username . "</b>"; $content = '<br>' . $loggedin . ' <a href="index.php?atklogout=1" target="_top">' . ucfirst(atktext("logout", "atk")) . '</a> '; $centerpiece = ""; $centerpiecelinks = array(); getCenterPiece($centerpiece, $centerpiecelinks); $content .= $centerpiece; $searchpiece = getSearchPiece(); $content .= " " . $searchpiece; $title = getAchievoTitle(); $top = $ui->renderBox(array("content" => $content, "logintext" => atktext("logged_in_as"), "logouttext" => ucfirst(atktext("logout", "atk")), "logoutlink" => "index.php?atklogout=1", "logouttarget" => "_top", "centerpiece" => $centerpiece, "centerpiece_links" => $centerpiecelinks, "searchpiece" => $searchpiece, "title" => $title, "user" => $username, "username" => $username), "top"); $page->addContent($top); $output->output($page->render(atktext("app_title"), true)); $output->outputFlush();
$ui =& atkinstance("atk.ui.atkui"); $theme =& atkTheme::getInstance(); $page->register_style($theme->stylePath("style.css")); $destination = "index.php?atklogout=true"; if (isset($ATK_VARS["atknodetype"]) && isset($ATK_VARS["atkaction"])) { $destination .= "&atknodetype=" . $ATK_VARS["atknodetype"] . "&atkaction=" . $ATK_VARS["atkaction"]; if (isset($ATK_VARS["atkselector"])) { $destination .= "&atkselector=" . $ATK_VARS["atkselector"]; } } $title = atktext("title_session_expired"); $contenttpl = '<br>%s<br><br><input type="button" onclick="top.location=\'%s\';" value="%s"><br><br>'; $content = sprintf($contenttpl, atktext("explain_session_expired"), str_replace("'", "\\'", $destination), atktext("relogin")); $box = $ui->renderBox(array("title" => $title, "content" => $content)); $page->addContent($box); $output->output($page->render(atktext("title_session_expired"), true)); } else { atksecure(); atkimport("atk.ui.atkpage"); $lockType = atkconfig("lock_type"); if (!empty($lockType)) { atklock(); } $flags = array_key_exists("atkpartial", $ATK_VARS) ? HTML_PARTIAL : HTML_STRICT; //Load controller if ($ATK_VARS["atkcontroller"] == "") { $controller =& atkinstance("atk.atkcontroller"); } else { $controller =& atkinstance($ATK_VARS["atkcontroller"]); } //Handle http request
* * The ATK lock javascript. This script allows us to extend the lock lease * for a certain record / item. * * @author Peter C. Verhage <*****@*****.**> * * @copyright (c)2000-2004 Ibuildings.nl BV * @license http://www.achievo.org/atk/licensing ATK Open Source License * * @version $Revision: 4845 $ * $Id: lock.js.php 6354 2009-04-15 02:41:21Z mvdam $ */ /** @internal some defines */ global $ATK_VARS; $id = (int) $ATK_VARS["id"]; $message = atktext("lock_expired"); $stack = $ATK_VARS["stack"]; ?> var atkLock = new Object(); /** * Initialize the lock. * @param identifier the lock ID */ function atkLockInit(identifier) { /* initialize */ atkLock.theIdentifier = identifier; atkLock.theSequence = 1; atkLock.isLocked = true; atkLock.type = (window.XMLHttpRequest || window.ActiveXObject) ? 'xml' : 'image';
$position = $menu->getPosition(); $scrolling = $menu->getScrollable() == MENU_SCROLLABLE ? FRAME_SCROLL_AUTO : FRAME_SCROLL_NO; if (isset($ATK_VARS["atknodetype"]) && isset($ATK_VARS["atkaction"])) { $destination = "dispatch.php?atknodetype=" . $ATK_VARS["atknodetype"] . "&atkaction=" . $ATK_VARS["atkaction"]; if (isset($ATK_VARS["atkselector"])) { $destination .= "&atkselector=" . $ATK_VARS["atkselector"]; } } else { $destination = "welcome.php"; } $frame_top_height = $theme->getAttribute('frame_top_height'); $frame_menu_width = $theme->getAttribute('frame_menu_width'); $topframe =& new atkFrame($frame_top_height ? $frame_top_height : "75", "top", "top.php", FRAME_SCROLL_NO, true); $mainframe =& new atkFrame("*", "main", $destination, FRAME_SCROLL_AUTO, true); $menuframe =& new atkFrame($position == MENU_LEFT || $position == MENU_RIGHT ? $frame_menu_width ? $frame_menu_width : 190 : $menu->getHeight(), "menu", "menu.php", $scrolling); $noframes = '<p>Your browser doesnt support frames, but this is required to run ' . atktext('app_title') . "</p>\n"; $root =& new atkRootFrameset(); if (atkconfig("top_frame")) { $outer =& new atkFrameSet("*", FRAMESET_VERTICAL, 0, $noframes); $outer->addChild($topframe); $root->addChild($outer); } else { $outer =& $root; $outer->m_noframes = $noframes; } $orientation = $position == MENU_TOP || $position == MENU_BOTTOM ? FRAMESET_VERTICAL : FRAMESET_HORIZONTAL; $wrapper =& new atkFrameSet("*", $orientation); if ($position == MENU_TOP || $position == MENU_LEFT) { $wrapper->addChild($menuframe); $wrapper->addChild($mainframe); } else {
* included in the distribution. * * This file is the skeleton main welcome file, which you can copy * to your application dir and modify if necessary. By default, it * displays a welcome message from the language file (app_description). * * @package atk * @subpackage skel * * @author Ivo Jansch <*****@*****.**> * * @copyright (c)2000-2004 Ibuildings.nl BV * @license http://www.achievo.org/atk/licensing ATK Open Source License * * @version $Revision: 4845 $ * $Id: welcome.php 6354 2009-04-15 02:41:21Z mvdam $ */ /** * @internal includes.. */ $config_atkroot = "./"; include_once "atk.inc"; $page =& atknew("atk.ui.atkpage"); $ui =& atkinstance("atk.ui.atkui"); $theme =& atkTheme::getInstance(); $output =& atkOutput::getInstance(); $page->register_style($theme->stylePath("style.css")); $box = $ui->renderBox(array("title" => atktext("app_shorttitle"), "content" => "<br><br>" . atktext("app_description") . "<br><br>")); $page->addContent($box); $output->output($page->render(atktext('app_shorttitle'), true)); $output->outputFlush();
$pass_ip = true; break; } } if (!$pass_ip) { $content = atktext('ip_not_allowed_ml'); $content .= '<br><br><center>IP: ' . $_SERVER[REMOTE_ADDR] . '</center>'; show_error_window($content, false); die; } } // check if user is suspended if ($db_is_suspended == 1) { $content = atktext('account_suspended_ml'); $content .= '<br><br>'; $content .= '<a href="index.php?atklogout=1">' . atktext('login_here_ml') . '</a>'; show_error_window($content, false); die; } } /* * run... */ $indexpage =& atknew('atk.ui.atkindexpage'); $indexpage->setUsername(getFullUsername()); $indexpage->setTitle(getTitle()); $indexpage->setTopSearchPiece(getSearchPiece()); $centerpiece = ""; $centerpiecelinks = array(); getCenterPiece($centerpiece, $centerpiecelinks); $indexpage->setTopCenterPieceLinks($centerpiecelinks);
function blank_report() { $content .= atktext('blank_report'); show_error_window($content); die; }
<?php /* * IP black list, separate by comma */ $black_ip_list_array = "\r\n\r\n255.255.255.255,\r\n0.0.0.0\r\n\r\n"; $black_ip_list = explode(",", $black_ip_list_array); foreach ($black_ip_list as $blackip) { if (trim($blackip) == $_SERVER[REMOTE_ADDR]) { $content = '<center><b>' . atktext('ip_blacklisted_ml'); $content .= '<br><br>IP: ' . $_SERVER[REMOTE_ADDR] . '</center>'; show_error_window($content, false); die; } }