コード例 #1
0
 function _get_mail_body($template_path)
 {
     $template = new template($template_path);
     $locale =& locale::instance();
     $date = new date();
     $template->set('date', $date->format($locale->get_short_date_format()));
     $cart =& cart::instance();
     $list =& $template->find_child('cart_items');
     $list->register_dataset($cart->get_items_array_dataset());
     $template->set('name', $this->dataspace->get('name'));
     $template->set('notes', $this->dataspace->get('notes'));
     $template->set('phone', $this->dataspace->get('phone'));
     $template->set('address', $this->dataspace->get('address'));
     $template->set('email', $this->dataspace->get('email'));
     ob_start();
     $template->display();
     $content = ob_get_contents();
     ob_end_clean();
     return $content;
 }
コード例 #2
0
ファイル: services.php プロジェクト: laiello/xiv
 function send_template_mail($to, $subject, $template, $headers = null)
 {
     $this->using('template');
     $param =& $this->using('param');
     $tpl = new template();
     $template = explode('/', $template);
     $tpl->load(TM_TEMPLATES_DIR . C_TEMPLATE . '/layout/views/' . $template[0] . '/' . $template[1]);
     $tpl->set($param->get_params(), true);
     $message = $tpl->output();
     $this->send_mail($to, $subject, $message, null, $headers);
 }
コード例 #3
0
ファイル: modtemplates.php プロジェクト: klich3/gPOS
function ModificarExtrasTemplate($id, $comentario, $paginas)
{
    $oTemplate = new template();
    if (!$oTemplate->Load($id)) {
        error(__FILE__ . __LINE__, "W: no pudo mostrareditar '{$id}'");
        return false;
    }
    $nombreoriginal = $oTemplate->get("Nombre");
    $oTemplate->set("Comentario", $comentario, FORCE);
    $oTemplate->set("Paginas", $paginas, FORCE);
    if ($oTemplate->Save()) {
        if (isVerbose()) {
            echo gas("aviso", _("Datos extra cambiados"));
        }
        $_SESSION["Template_{$nombreoriginal}"] = false;
        //invalida copia de sesion de template
    } else {
        echo gas("problema", _("No se puede cambiar dato"));
    }
}
コード例 #4
0
ファイル: view.php プロジェクト: zzlphp/Yaf_Sample
 /**
  * Processes a template and display the output.
  *
  * @param   string          $view_file
  * @param   array           $tpl_vars  (Optional)
  * @return  string
  */
 public function display($view_file, $tpl_vars = null)
 {
     if (file_exists($this->_P . $view_file)) {
         $body = file_get_contents($this->_P . $view_file);
         $body = str_replace('/VIEW_PATH/', $this->_P, $body);
         $this->_T->load($body);
         if (is_array($tpl_vars)) {
             $this->_T->set($tpl_vars);
         }
         $this->_T->display();
     }
 }
コード例 #5
0
 public function setShootAction()
 {
     $oBattle = new Battle();
     $oBattle->createMatrix();
     $sCoord = tools::getParametr('coord');
     $sRow = ucfirst(substr($sCoord, 0, 1));
     $iRow = ord($sRow) - $this->iFirstLetter;
     $iColumn = substr($sCoord, 1) - 1;
     template::set('status', $oBattle->setFire($iColumn, $iRow));
     $oBattle->saveField();
     template::set('matrix', $oBattle->printMatrix());
     template::show('layout');
 }
コード例 #6
0
ファイル: common.php プロジェクト: laiello/xiv
 protected function render($overwrite = false)
 {
     $param =& $this->using('param');
     if ($overwrite || !isset($this->rendered)) {
         $this->rendered = '';
     }
     if (file_exists($this->template_file . '.tpl')) {
         $tpl = new template();
         $tpl->load($this->template_file);
         $tpl->set($param->get_params(), null, false);
         $this->rendered .= $tpl->output();
     } else {
         trigger_error('Block template \'' . $this->template_file . '\' is missing.', E_USER_ERROR);
     }
     return $this->rendered;
 }
コード例 #7
0
    plugin_runphp('logoutprocess');
    define('isLogout', 1);
    setcookie('userid', '', time() - 3600);
    setcookie('userpsw', '', time() - 3600);
    catchsuccess($lnc[168], "{$lnc[163]}|index.php");
}
if ($job == 'applylink') {
    checkpermission('ApplyLink');
    $mycode1 = "<a href=\"{$config['blogurl']}\" target=\"_blank\" title=\"{$config['blogname']}\">{$config['blogname']}</a>";
    $mycode2 = "<a href=\"{$config['blogurl']}\" target=\"_blank\"><img src=\"{$config['bloglogo']}\"  title=\"{$config['blogname']}\" alt=\"{$config['blogname']}\" border=\"0\"/></a>";
    $mycode1 = htmlspecialchars($mycode1);
    $mycode2 = htmlspecialchars($mycode2);
    $t = new template();
    $actionnow = $lnc[109];
    $jobs = "login.php?job=doapplylink";
    $formbody .= $t->set('form_eachline', array('text' => "*{$lnc[169]}", 'formelement' => "<input type='text' class='text' size='20' name='sitename' />"));
    $formbody .= $t->set('form_eachline', array('text' => "*{$lnc[170]}", 'formelement' => "<input type='text'  class='text' size='30' name='siteurl' />"));
    $formbody .= $t->set('form_eachline', array('text' => $lnc[171], 'formelement' => "<input type='text'  class='text' size='30' name='sitelogo' /> {$lnc[172]}"));
    $formbody .= $t->set('form_eachline', array('text' => $lnc[173], 'formelement' => "<input type='text'  class='text' size='30' name='siteintro' /> {$lnc[174]}"));
    $formbody .= $t->set('form_eachline', array('text' => $lnc[175], 'formelement' => "{$lnc[176]}<br/><ul><li>{$lnc[177]}<br/><textarea class='text' cols='40' rows='2' name='sitemycode1'>{$mycode1}</textarea></li><li>{$lnc[178]}<br/><textarea class='text' cols='40' rows='2' name='sitemycode2'>{$mycode2}</textarea></li></ul>"));
    if ($config['applylinkvalidation'] == 1) {
        $rand = rand(0, 100000);
        $formbody .= $t->set('form_eachline', array('text' => $lnc[249], 'formelement' => "<span id='securityimagearea'><img src='inc/securitycode.php?rand={$rand}' alt='' title='{$lnc[250]}'/></span> <input name='securitycode' type='text' id='securitycode' size='16' class='text' /> {$lnc[251]} [<a href=\"javascript: refreshsecuritycode('securityimagearea', 'securitycode');\">{$lnc[283]}</a>]"));
    }
    $section_body_main = $t->set('register', array('title' => $actionnow, 'job' => $jobs, 'registerbody' => $formbody));
    announcebar();
    $bodymenu = $t->set('mainpage', array('pagebar' => $pagebar, 'iftoppage' => 'none', 'ifbottompage' => 'none', 'ifannouncement' => $ifannouncement, 'topannounce' => $topannounce, 'mainpart' => $section_body_main, 'currentpage' => '', 'previouspageurl' => '', 'nextpageurl' => '', 'turningpages' => '', 'totalpages' => '', 'previouspageexists' => '', 'nextpageexists' => ''));
}
if ($job == 'doapplylink') {
    checkpermission('ApplyLink');
    acceptrequest('sitename,siteurl,sitelogo,siteintro');
コード例 #8
0
ファイル: mod_tag.php プロジェクト: BGCX067/f2cont-svn-to-git
        }
        $tag_show[] = "<a href=\"{$urlref}\" title=\"{$lnc[188]}{$alltags['tagcounter'][$i]}\"><span style=\"font-size: {$bit_tag_size}px;\">{$eachtag}</span></a>";
    }
    if (is_array($tag_show)) {
        if ($mbcon['tagorder'] == '0') {
            shuffle($tag_show);
        }
        $tagshow = @implode(" &nbsp; ", $tag_show);
    } else {
        $tagshow = "{$lnc[189]}";
    }
    $m_b = new getblogs();
    $returnurl = "tag.php?page=%s";
    $pagebar = $m_b->make_pagebar($page, $mbcon['pagebaritems'], $returnurl, $alltagcounter, $tagperpage, 1);
    $t = new template();
    $section_tag = $t->set('taglist', array('tagcategory' => $lnc[190], 'tagcontent' => $tagshow, 'tagextra' => "<div align='right'>{$lnc[191]}</div>"));
    $section_body_main = $t->set('contentpage', array('title' => 'Tags', 'contentbody' => $section_tag));
    announcebar();
    $iftoppage = $mbcon['pagebarposition'] == 'down' ? 'none' : 'block';
    $ifbottompage = $mbcon['pagebarposition'] == 'up' ? 'none' : 'block';
    $bodymenu = $t->set('mainpage', array('pagebar' => $pagebar, 'iftoppage' => $iftoppage, 'ifbottompage' => $ifbottompage, 'ifannouncement' => $ifannouncement, 'topannounce' => $topannounce, 'mainpart' => $section_body_main, 'currentpage' => $pageitems['currentpage'], 'previouspageurl' => $pageitems['previouspageurl'], 'nextpageurl' => $pageitems['nextpageurl'], 'turningpages' => $pageitems['turningpages'], 'totalpages' => $pageitems['totalpages'], 'previouspageexists' => $pageitems['previouspageexists'], 'nextpageexists' => $pageitems['nextpageexists']));
    $pagetitle = "Tags - ";
}
if ($job == 'show') {
    acceptrequest('mode');
    if ($mode == 1 || $mode == 2) {
        $mbcon['tag_list'] = $mode - 1;
    } else {
        $mode = $mbcon['tag_list'] + 1;
    }
    $m_b = new getblogs();
コード例 #9
0
 function output_page($entry)
 {
     global $mbcon, $section_body, $permission, $adminlist, $userdetail, $config, $categories, $weather, $t, $section_bodys, $part, $template, $lnc;
     if (!@is_a($t, 'template')) {
         $t = new template();
     }
     $entrytitle = $entry['pagetitle'];
     $entrydate = zhgmdate("{$mbcon['timeformat']}", $entry['pagetime'] + 3600 * $config['timezone']);
     $entrytime = gmdate('H:i', $entry['pagetime'] + 3600 * $config['timezone']);
     list($entrydatey, $entrydatem, $entrydated) = explode('/', gmdate('Y/n/j', $entry['pagetime'] + 3600 * $config['timezone']));
     $entrydatemnamefull = gmdate('F', $entry['pagetime'] + 3600 * $config['timezone']);
     $entrydatemnameshort = gmdate('M', $entry['pagetime'] + 3600 * $config['timezone']);
     $tmp = $entry['pageauthor'];
     $entryauthor = $adminlist[$tmp];
     $entryauthor = "<a href=\"" . getlink_user($tmp) . "\" >{$entryauthor}</a>";
     $iftags = "none";
     $entry['pagecontent'] = @str_replace('[separator]', '', $entry['pagecontent']);
     $entrycontent = $this->getcontent($entry['pagecontent'], $entry['htmlstat'], $entry['ubbstat'], $entry['emotstat'], 1);
     $entrycontent = $this->keep_htmlcode_matches($entrycontent);
     //Start Template
     $section_bodys[] = $t->set('viewpage', array('entrytitle' => $entrytitle, 'entrydate' => $entrydate, 'entrytime' => $entrytime, 'entryauthor' => $entryauthor, 'entrycontent' => $entrycontent, 'entrytitletext' => $entry['pagetitle'], 'entrydatey' => $entrydatey, 'entrydatem' => $entrydatem, 'entrydated' => $entrydated));
     return $section_bodys;
 }
コード例 #10
0
ファイル: pager.php プロジェクト: laiello/xiv
 public function init($total_items, $order = null)
 {
     $this->using('template');
     $param =& $this->using('param');
     if (!is_array($order)) {
         $order = $order ? array($order) : array();
     }
     $sel_order = array();
     foreach ($order as $i => $v) {
         if (is_int($i)) {
             $o = explode(' ', $v);
             $sel_order[$o[0]] = $o[0];
         } else {
             $o = explode(' ', $i);
             $sel_order[$o[0]] = $v;
         }
     }
     reset($order);
     while (list($i) = each($order)) {
         if (is_int($i)) {
             $tmp = explode(' ', $order[$i]);
         } else {
             $tmp = explode(' ', $i);
         }
         $order[$i] = array('order_by' => $tmp[0], 'order_mode' => isset($tmp[1]) ? $tmp[1] : 'ASC');
     }
     $page = (int) $param->raw('page');
     if ($page < 1) {
         $page = 1;
     }
     $page--;
     $order_by = null;
     if ($param->raw('order_by')) {
         $raw_order_by = $param->raw('order_by');
         foreach ($order as $o) {
             if ($raw_order_by == $o['order_by']) {
                 $order_by = $raw_order_by;
             }
         }
     }
     if (!$order_by && $order) {
         reset($order);
         list($a, $b) = each($order);
         $order_by = $b['order_by'];
     }
     $order_mode = null;
     if ($param->raw('order_mode')) {
         $raw_order_mode = $param->raw('order_mode');
         if (preg_match('/^(desc|asc)$/i', $raw_order_mode)) {
             $order_mode = strtoupper($raw_order_mode);
         }
     }
     if (!$order_mode && $order) {
         reset($order);
         list($a, $b) = each($order);
         $order_mode = $b['order_mode'];
     }
     $begin = $page * $this->items_per_page;
     $end = $this->items_per_page;
     $this->sql_trailing = ($order_by ? "ORDER BY {$order_by} {$order_mode}" : null) . " LIMIT {$begin}, {$end}";
     $total_pages = ceil($total_items / $this->items_per_page);
     $tpl = new template('pager');
     $tpl->set(array('total_pages' => $total_pages, 'current_page' => $page + 1, 'page_size' => $this->items_per_page, 'order_by' => $order_by, 'order_mode' => $order_mode, 'sel_order_mode' => array('ASC' => __('Ascendent'), 'DESC' => __('Descendent')), 'sel_order_by' => $sel_order));
     $this->parent->param->set('pager', $tpl->output(), false);
 }
コード例 #11
0
ファイル: mod_view.php プロジェクト: JJYing/Anyway-Website
         unset($tmp_gp, $tmp_displayitem);
         $tmp_gp = $linkeachitem['linkgptoid'];
         if ($linkeachitem['linklogo']) {
             $displayitemlogo = "<img src=\"{$linkeachitem['linklogo']}\" alt=\"{$linkeachitem['linkname']}\" border=\"0\" />";
         } else {
             $displayitemlogo = '';
         }
         if (empty($rowcount[$tmp_gp])) {
             $rowcount[$tmp_gp] = 1;
             $alllinks[$tmp_gp] .= "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";
         }
         if ($rowcount[$tmp_gp] % $mbcon['linkperpage'] == 1) {
             $alllinks[$tmp_gp] .= "<tr valign=\"top\">";
         }
         $alllinks[$tmp_gp] .= "<td width=\"{$linkeachcloumn}\">\n";
         $alllinks[$tmp_gp] .= $t->set('eachlink', array('logo' => $displayitemlogo, 'title' => "<a href=\"{$linkeachitem['linkurl']}\" target=\"_blank\">{$linkeachitem['linkname']}</a>", 'desc' => $linkeachitem['linkdesc']));
         $alllinks[$tmp_gp] .= "</td>\n";
         if ($rowcount[$tmp_gp] % $mbcon['linkperpage'] == 0) {
             $alllinks[$tmp_gp] .= "</tr>";
         }
         $rowcount[$tmp_gp] += 1;
     }
 }
 if ($linkgp && is_array($linkgp)) {
     foreach ($linkgp as $linkgpeachitem) {
         unset($tmp_gp);
         $tmp_gp = $linkgpeachitem['linkgpid'];
         $alllinks[$tmp_gp] .= $alllinks[$tmp_gp] ? '</table>' : '';
         $displaygp[$tmp_gp] = $t->set('linkdiv', array('title' => $linkgpeachitem['linkgpname'], 'tablebody' => $alllinks[$tmp_gp]));
     }
 } else {
コード例 #12
0
ファイル: mod_visit.php プロジェクト: JJYing/Anyway-Website
        $alltags = $blog->getarraybyquery("SELECT * FROM `{$db_prefix}tags` WHERE `tagname` in ({$result})");
        for ($i = 0; $i < count($alltags['tagname']); $i++) {
            $eachtag_encoded = urlencode(urlencode($alltags['tagname'][$i]));
            $urlref = getlink_tags($eachtag_encoded);
            if ($mbcon['tagunderlinetospace'] == 1) {
                $alltags['tagname'][$i] = str_replace('_', ' ', $alltags['tagname'][$i]);
            }
            $tag_show[] = "<a href=\"{$urlref}\" title=\"{$lnc[188]}{$alltags['tagcounter'][$i]}\" rel=\"tag\">{$alltags['tagname'][$i]}</a>";
        }
        if (is_array($tag_show)) {
            $tagshow = @implode(" &nbsp; ", $tag_show);
        } else {
            $tagshow = $lnc[189];
        }
        $t = new template();
        $section_body_main[] = $t->set('taglist', array('tagcategory' => $lnc[230], 'tagcontent' => $tagshow, 'tagextra' => ''));
    }
    $iftoppage = $mbcon['pagebarposition'] == 'down' ? 'none' : 'block';
    $ifbottompage = $mbcon['pagebarposition'] == 'up' ? 'none' : 'block';
    $pagetitle = "{$lnc[225]} × ";
    $mainpart = $t->set('contentpage', array('title' => "{$lnc[224]} {$keyword}", 'contentbody' => @implode('', $section_body_main)));
    announcebar();
    $bodymenu = $t->set('mainpage', array('pagebar' => $pagebar, 'iftoppage' => $iftoppage, 'ifbottompage' => $ifbottompage, 'ifannouncement' => $ifannouncement, 'topannounce' => $topannounce, 'mainpart' => $mainpart, 'currentpage' => $pageitems['currentpage'], 'previouspageurl' => $pageitems['previouspageurl'], 'nextpageurl' => $pageitems['nextpageurl'], 'turningpages' => $pageitems['turningpages'], 'totalpages' => $pageitems['totalpages'], 'previouspageexists' => $pageitems['previouspageexists'], 'nextpageexists' => $pageitems['nextpageexists']));
}
if ($job == 'getcontentonly') {
    acceptrequest('blogid,blogpsw,way');
    $blogid = floor($blogid);
    if ($permission['SeeHiddenEntry'] != 1) {
        $partialquery = "SELECT * FROM `{$db_prefix}blogs` WHERE `blogid`='{$blogid}' AND `property`<'2' LIMIT 1";
    } else {
        $partialquery = "SELECT * FROM `{$db_prefix}blogs` WHERE `blogid`='{$blogid}' AND `property`<'3' LIMIT 1";
コード例 #13
0
ファイル: cp_user.php プロジェクト: BGCX067/f2cont-svn-to-git
     }
     if ($edituser['usergroup'] == 2) {
         $pluswarn = "<font color=red><b>{$lna[475]}</b></color><br/>";
     }
     $jobs = "saveuser";
     $t = new template();
     $formbody .= $t->set('form_eachline', array('text' => $lna[464], 'formelement' => $edituser['username'] . "<input type='hidden'  name='p[userid]' value='{$itemid}'/>"));
     $formbody .= $t->set('form_eachline', array('text' => $lna[476], 'formelement' => $lna[477]));
     $formbody .= $t->set('form_eachline', array('text' => $lna[478], 'formelement' => "<input type='password'  class='text' size='16' name='p[newpsw]' /> {$lna[479]}"));
     $formbody .= $t->set('form_eachline', array('text' => $lna[480], 'formelement' => "<input type='password'  class='text' size='16' name='p[confirmpsw]' /> {$lna[479]}"));
     $light = 'users';
     $showword = $lna[481];
 } else {
     $jobs = "savenewuser";
     $t = new template();
     $formbody .= $t->set('form_eachline', array('text' => $lna[464], 'formelement' => "<input type='text' class='text' size='16' name='p[username]' />"));
     $formbody .= $t->set('form_eachline', array('text' => $lna[482], 'formelement' => "<input type='password'  class='text' size='16' name='p[password]' />"));
     $formbody .= $t->set('form_eachline', array('text' => $lna[483], 'formelement' => "<input type='password' class='text' size='16' name='p[confirmpsw]' />"));
     $light = 'add';
     $showword = $lna[484];
 }
 foreach ($usergp as $i => $value) {
     if ($i == 0) {
         continue;
     }
     $selected = $i == $edituser['usergroup'] ? ' selected' : '';
     $puttingcates .= "<option value='{$i}'{$selected}>{$value}</option>";
 }
 $formbody .= $t->set('form_eachline', array('text' => $lna[463], 'formelement' => "<select name='p[usergroup]'>{$puttingcates}</select>"));
 $formbody .= $t->set('form_eachline', array('text' => $lna[485], 'formelement' => "<input type='text' class='text' size='16' name='p[email]' value='" . stripslashes($edituser['email']) . "'/>"));
 $formbody .= $t->set('form_eachline', array('text' => $lna[486], 'formelement' => "<input type='text' class='text' size='16' name='p[homepage]' value='" . stripslashes($edituser['homepage']) . "'/>"));
コード例 #14
0
ファイル: xuleditor.php プロジェクト: klich3/gPOS
     /*
     		//$Codigo = str_replace('\\"', '"',$Codigo);		
     		//$Codigo = str_replace("\\'", "'",$Codigo );
     		//$Codigo = str_replace("\\\\n", "\\n",$Codigo );
     		//$Codigo = str_replace("\\\\t", "\\t",$Codigo );
     		$Codigo = str_replace("\\\\", "\\",$Codigo );
     		$Codigo = str_replace("\\", "",$Codigo );		
     		
     		//str_replace("\\\'", "\\'",$Codigo )*/
     $Codigo = stripslashes($Codigo);
     error(0, "Info: llega del navegador '{$Codigo}'");
     if ($id and $Codigo) {
         if ($ot->Load($id)) {
             error(0, "Info: text:'" . $Codigo . "'");
             $oldnombre = $ot->get("Nombre");
             $ot->set("Nombre", $Nombre, FORCE);
             $ot->setCodigo($Codigo);
             $idTemplate = $id;
             $code = $Codigo;
             $ot->Save();
             $_SESSION["Template_{$oldnombre}"] = false;
         }
     }
     break;
 default:
     $id = $_GET["id"];
     if ($id) {
         if ($ot->Load($id)) {
             $code = $ot->getCodigo();
             $Nombre = $ot->getNombre();
             $idTemplate = $id;
コード例 #15
0
ファイル: index.php プロジェクト: BGCX067/f2cont-svn-to-git
//Scheduled publishing
scheduledpublish();
//Start Template Analyzing
$t = new template();
//Start Loading Modules
if (file_exists("inc/mod_{$act}.php")) {
    include "inc/mod_{$act}.php";
} else {
    $valid_plugins = @explode(',', $blogplugin['page']);
    if (@in_array($act, $valid_plugins) && is_file("plugin/{$act}/page.php")) {
        //Load whole page plugin
        include "plugin/{$act}/page.php";
        if ($plugin_closesidebar == 1) {
            $elements['mainpage'] = str_replace("class=\"content\"", "class=\"content-wide\"", $elements['mainpage']);
        }
        $bodymenu = $t->set('mainpage', array('pagebar' => '', 'iftoppage' => 'none', 'ifbottompage' => 'none', 'ifannouncement' => 'none', 'topannounce' => '', 'mainpart' => $plugin_return, 'previouspageexists' => '', 'nextpageexists' => ''));
    } else {
        include "inc/mod_main.php";
    }
}
//Section: <head>..<body>
$ajax_js = "<script type=\"text/javascript\" src=\"lang/{$langfront}/jslang.js?jsver={$codeversion}\"></script>\n";
$ajax_js .= "<script type=\"text/javascript\" src=\"images/js/ajax.js?jsver={$codeversion}\"></script>\n";
$ajax_js .= "<script type=\"text/javascript\" src=\"images/js/swfobject.js?jsver={$codeversion}\"></script>\n";
$shutajax = $config['closeajax'] == '1' ? 1 : 0;
$ajax_js .= "<script type=\"text/javascript\">\n//<![CDATA[\nvar moreimagepath=\"{$template['moreimages']}\";\nvar shutajax={$shutajax};\nvar absbaseurl='{$config['blogurl']}/';\n//]]>\n</script>";
$ajax_js .= "<link title=\"{$lnc[128]} {$config['blogname']}\" rel=\"search\"  type=\"application/opensearchdescription+xml\"  href=\"inc/opensearch.php\" />\n";
$ajax_js = plugin_walk('firstheader', $ajax_js);
include_once "inc/mod_basic.php";
include_once "data/mods.php";
$extraheader = $mbcon['extraheader'] . "\n" . @implode("\n", $section_prebody);
コード例 #16
0
ファイル: index.php プロジェクト: twelvefootguru/anApp
addIncludePath('./alib');
addIncludePath('./common');
addIncludePath('./php', TRUE);
include_once '../alib/iuser.inc';
include_once './common/functions.inc';
include_once './common/login.inc';
include_once './common/smartObjectDefs.inc';
// Connect to the db:
if (!is_object($db)) {
    $db = new idb($config->mainDB);
}
D::log('db');
D::v($db);
$login = new $config->loginModule();
if ($login->loggedIn || $config->allowNonLoggedIn) {
    global $user, $broker;
    $broker = new broker();
} elseif (stristr($_SERVER['REQUEST_URI'], 'api')) {
    $api = new publicAPI();
} else {
    $template = new template($config->loginTemplate);
    $template->set('title', $config->defaultTitle);
    $template->set('appName', $config->appName);
    $template->set('extLocation', $config->extLocation);
    $template->set('self', $config->self);
    if ($login->error && $login->error != 'Not logged in and not trying to log in.') {
        $template->set('badLogin', TRUE);
        $template->set('loginError', $login->error);
    }
    $template->display();
}