function db_get_template($tpl_name, &$tpl_source, &$smarty_obj)
{
    global $db, $error, $node, $error_messages;
    $template_id = preg_replace('/\\.tpl$/', '', $tpl_name);
    //from now on module names need not to be numeric!
    if (!is_numeric($template_id)) {
        $template_id = nodes::getNodeIdByName($tpl_name);
        if (!is_numeric($template_id)) {
            $error = $error_messages['NOT_NUMERIC'];
            return false;
        }
    }
    if (is_numeric($template_id)) {
        $tpl_source = nodes::getNodeById($template_id, empty($_SESSION['user_id']) ? "" : $_SESSION['user_id']);
    }
    $template_name = $tpl_source['node_name'];
    $template_signature = 'TEMPLATE /k/' . base_convert($template_id, 10, 36) . ' /id/' . $template_id . ' [' . $template_name . ']';
    $tpl_source = "\n\n<!--  BEGIN {$template_signature}  -->\n\n" . $tpl_source['node_content'] . "\n\n<!--  END {$template_signature}  -->\n\n";
    // return true on success, false to generate failure notification
    return (bool) $tpl_source;
}
Example #2
0
    //	$smarty->assign('bookstyl',	isset($_SESSION['bookstyl'])	? $_SESSION['bookstyl']		:'');
    $smarty->assign('f**k', isset($_SESSION['f**k']) ? $_SESSION['f**k'] : '');
    $smarty->assign('mail_notify', isset($_SESSION['mail_notify']) ? $_SESSION['mail_notify'] : '');
    $smarty->assign('friend', isset($_SESSION['friend']) ? $_SESSION['friend'] : '');
    $smarty->assign('friends', isset($_SESSION['friend']) ? $_SESSION['friend'] : '');
    $smarty->assign('anticsrf', isset($_SESSION['anticsrf']) ? $_SESSION['anticsrf'] : NULL);
    $smarty->assign('_POST', isset($_POST) ? $_POST : '');
    //XXX
    $smarty->assign('cube_vector', $_SESSION['cube_vector']);
    //    $new_mail = $newmailset->getInt('user_mail');
    //    if ($new_mail > 0)
    //        $smarty->assign('new_mail',  $new_mail);
    //    $smarty->assign('new_mail_name', $newmailset->getString('mail_sender'));
    //    $smarty->assign('user_k',        $newmailset->getInt('user_k'));
    //    $smarty->assign('k_wallet',      $newmailset->getInt('k_wallet'));
}
error_log("LOG: event: {$event}, node_id: {$node_id}, template_id: {$template_id}");
require_once INCLUDE_DIR . "eventz/{$event}.inc";
// Event is executed, now get $referer_id
$referer_id = "";
if (preg_match('/id\\/(\\d+)/', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "", $match)) {
    $referer_id = $match[1];
} elseif (preg_match('/name\\/(.*?)\\/?$/', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "", $match)) {
    $referer_id = nodes::getNodeIdByName($match[1]);
}
// creating neural network + updating node counters
nodes::update_nodes(isset($_SESSION['user_id']) ? $_SESSION['user_id'] : "", $node_id, $referer_id);
$time = substr(Time() + substr(MicroTime(), 0, 8) - $timer_start, 0, 7);
$smarty->assign('generation_time', $time);
echo $content;
// end of displaying