예제 #1
0
function template_parse($str)
{
    global $CFG;
    $str = preg_replace("/\\<\\!\\-\\-\\[(.+?)\\]\\-\\-\\>/", "", $str);
    $str = preg_replace("/\\<\\!\\-\\-\\{(.+?)\\}\\-\\-\\>/s", "{\\1}", $str);
    $str = preg_replace("/\\{template\\s+([^\\}]+)\\}/", "<?php include template(\\1);?>", $str);
    $str = preg_replace("/\\{php\\s+(.+)\\}/", "<?php \\1?>", $str);
    $str = preg_replace("/\\{if\\s+(.+?)\\}/", "<?php if(\\1) { ?>", $str);
    $str = preg_replace("/\\{else\\}/", "<?php } else { ?>", $str);
    $str = preg_replace("/\\{elseif\\s+(.+?)\\}/", "<?php } else if(\\1) { ?>", $str);
    $str = preg_replace("/\\{\\/if\\}/", "<?php } ?>\r\n", $str);
    $str = preg_replace("/\\{loop\\s+(\\S+)\\s+(\\S+)\\}/", "<?php if(is_array(\\1)) { foreach(\\1 as \\2) { ?>", $str);
    $str = preg_replace("/\\{loop\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\}/", "<?php if(is_array(\\1)) { foreach(\\1 as \\2 => \\3) { ?>", $str);
    $str = preg_replace("/\\{\\/loop\\}/", "<?php } } ?>", $str);
    $str = preg_replace("/\\{([a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*\\(([^{}]*)\\))\\}/", "<?php echo \\1;?>", $str);
    $str = preg_replace("/<\\?php([^\\?]+)\\?>/es", "template_addquote('<?php\\1?>')", $str);
    $str = preg_replace("/\\{(\\\$[a-zA-Z_-ÿ][a-zA-Z0-9_\\+\\--ÿ]*)\\}/", "<?php echo \\1;?>", $str);
    $str = preg_replace("/\\{(\\\$[a-zA-Z0-9_\\[\\]\\'\"\$-ÿ]+)\\}/es", "template_addquote('<?php echo \\1;?>')", $str);
    $str = preg_replace("/\\{([A-Z_-ÿ][A-Z0-9_-ÿ]*)\\}/s", "<?php echo \\1;?>", $str);
    $str = preg_replace("/\\'([A-Za-z]+)\\[\\'([A-Za-z\\.]+)\\'\\](.?)\\'/s", "'\\1[\\2]\\3'", $str);
    $str = preg_replace("/(\r?\n)\\1+/", "\\1", $str);
    $str = str_replace("\t", '', $str);
    $str = "<?php defined('IN_DESTOON') or exit('Access Denied');?>" . $str;
    if ($CFG['template_trim']) {
        return strip_nr($str);
    }
    return $str;
}
예제 #2
0
function cache_write($file, $string, $dir = '')
{
    if (is_array($string)) {
        $string = "<?php defined('IN_DESTOON') or exit('Access Denied'); return " . strip_nr(var_export($string, true)) . "; ?>";
    }
    $file = $dir ? DT_CACHE . '/' . $dir . '/' . $file : DT_CACHE . '/' . $file;
    $strlen = file_put($file, $string);
    return $strlen;
}
예제 #3
0
                 $user_status = 0;
             }
         }
     } else {
         $user_status = 3;
     }
 } else {
     $user_status = $_userid ? 1 : 0;
 }
 if ($_username && $_username == $item['username']) {
     $user_status = 3;
 }
 if ($user_status == 3 && $item['username']) {
     $member = userinfo($item['username']);
 }
 $contact = strip_nr(ob_template('contact', 'chip'), true);
 echo 'Inner("contact", \'' . $contact . '\');';
 echo 'Inner("hits", \'' . $item['hits'] . '\');';
 $update = '';
 if ($item['totime'] && $item['totime'] < $DT_TIME && $item['status'] == 3) {
     $update .= ",status=4";
 }
 if ($member) {
     unset($item['areaid']);
     $update_user = update_user($member, $item);
     if ($update_user) {
         $db->query("UPDATE {$table} SET " . substr($update_user, 1) . " WHERE username='******'");
     }
 }
 include DT_ROOT . '/include/update.inc.php';
 if ($MOD['show_html'] && $task_item && $DT_TIME - @filemtime(DT_ROOT . '/' . $MOD['moduledir'] . '/' . $item['linkurl']) > $task_item) {
예제 #4
0
{
    return DT_ROOT . '/file/chat/' . substr($chatid, 0, 2) . '/' . $chatid . '.php';
}
switch ($action) {
    case 'send':
        $chatid or exit('ko');
        trim($word) or exit('ko');
        if ($MOD['chat_maxlen'] && strlen($word) > $MOD['chat_maxlen'] * 3) {
            exit('max');
        }
        $word = convert($word, 'UTF-8', DT_CHARSET);
        $word = stripslashes(trim($word));
        $word = strip_tags($word);
        $word = dsafe($word);
        $word = nl2br($word);
        $word = strip_nr($word);
        $word = str_replace('|', ' ', $word);
        if ($MOD['chat_file'] && $MG['upload']) {
            clear_upload($word);
        }
        $chat = $db->get_one("SELECT * FROM {$table} WHERE chatid='{$chatid}'");
        if ($chat) {
            $lastmsg = addslashes(dsubstr($word, 50));
            if ($chat['touser'] == $_username) {
                $sql = "fgettime={$DT_TIME},lasttime={$DT_TIME},lastmsg='{$lastmsg}'";
                if ($DT_TIME - $chat['freadtime'] > $chat_poll) {
                    $db->query("UPDATE {$DT_PRE}member SET chat=chat+1 WHERE username='******'fromuser']}'");
                    $sql .= ",fnew=fnew+1";
                }
                $db->query("UPDATE {$table} SET {$sql} WHERE chatid='{$chatid}'");
            } else {