コード例 #1
0
ファイル: live.php プロジェクト: cdlabal/doc
function generate_live($page)
{
    global $options, $multilanguage, $output_language, $base, $base_path, $mode;
    $mode = 'Live';
    if ($multilanguage) {
        $b = explode('/', clean_url($page, "Live"));
        $output_language = $b[0];
    }
    $file = clean_url_to_file($page);
    if (!is_file($file)) {
        $file = FALSE;
    }
    return generate_page($file);
}
コード例 #2
0
ファイル: static.php プロジェクト: cdlabal/doc
function generate_static_branch($tree, $current_dir)
{
    global $docs_path, $output_path;
    $p = $output_path;
    if ($current_dir !== '') {
        $p .= '/' . clean_url($current_dir);
        $current_dir .= '/';
    }
    if (!is_dir($p)) {
        @mkdir($p);
    }
    foreach ($tree as $key => $node) {
        if (is_array($node)) {
            generate_static_branch($node, $current_dir . $key);
        } else {
            $html = generate_page($docs_path . '/' . $current_dir . $node);
            file_put_contents($p . "/" . clean_url($node), $html);
        }
    }
}
コード例 #3
0
            } else {
                $tpl->assign('ITEM_CLASS', 'content2');
            }
            $sum_web += $web_trf;
            $sum_ftp += $ftp_trf;
            $sum_mail += $smtp_trf;
            $sum_pop += $pop_trf;
            $tpl->assign(array('DATE' => date($date_formt, strtotime($year . "-" . $month . "-" . $i)), 'WEB_TRAFFIC' => sizeit($web_trf), 'FTP_TRAFFIC' => sizeit($ftp_trf), 'SMTP_TRAFFIC' => sizeit($smtp_trf), 'POP3_TRAFFIC' => sizeit($pop_trf), 'ALL_TRAFFIC' => sizeit($web_trf + $ftp_trf + $smtp_trf + $pop_trf)));
            $tpl->parse('TRAFFIC_TABLE_ITEM', '.traffic_table_item');
            $counter++;
        }
        $tpl->assign(array('MONTH' => $month, 'YEAR' => $year, 'DOMAIN_ID' => $domain_id, 'ALL_WEB_TRAFFIC' => sizeit($sum_web), 'ALL_FTP_TRAFFIC' => sizeit($sum_ftp), 'ALL_SMTP_TRAFFIC' => sizeit($sum_mail), 'ALL_POP3_TRAFFIC' => sizeit($sum_pop), 'ALL_ALL_TRAFFIC' => sizeit($sum_web + $sum_ftp + $sum_mail + $sum_pop)));
        $tpl->parse('TRAFFIC_TABLE', 'traffic_table');
    }
}
/*
 *
 * static page messages.
 *
 */
gen_admin_menu($tpl);
$tpl->assign(array('TR_DOMAIN_STATISTICS' => tr('Domain statistics'), 'TR_MONTH' => tr('Month'), 'TR_YEAR' => tr('Year'), 'TR_SHOW' => tr('Show'), 'TR_WEB_TRAFFIC' => tr('Web traffic'), 'TR_FTP_TRAFFIC' => tr('FTP traffic'), 'TR_SMTP_TRAFFIC' => tr('SMTP traffic'), 'TR_POP3_TRAFFIC' => tr('POP3/IMAP traffic'), 'TR_ALL_TRAFFIC' => tr('All traffic'), 'TR_ALL' => tr('All'), 'TR_DAY' => tr('Day')));
gen_select_lists($tpl, $month, $year);
generate_page($tpl, $domain_id);
gen_page_message($tpl);
$tpl->parse('PAGE', 'page');
$tpl->prnt();
if (isset($cfg['DUMP_GUI_DEBUG'])) {
    dump_gui_debug();
}
unset_messages();
コード例 #4
0
ファイル: create.php プロジェクト: kawf/kawf
if (empty($error) && $_POST['submit'] && !$create_disabled && !$banned_ip) {
    if (!$user->create()) {
        if (!$user->email) {
            $error .= "The email address '{$email}' is taken. Perhaps you forgot your password?\n";
        }
        if (!$user->name) {
            $error .= "The name '{$name}' is taken\n";
        } else {
            if (!$user->shortname) {
                $error .= "The name '{$name}' is too similar to a name already taken\n";
            }
        }
    } else {
        $tpl->set_var("error", "");
        $tpl->set_var("form", "");
    }
} else {
    if (empty($error)) {
        $tpl->set_var("success", "");
    }
}
$tpl->set_var("NAME", $name);
$tpl->set_var("EMAIL", $email);
if (!empty($error)) {
    $tpl->set_var("success", "");
    $tpl->set_var("ERROR", preg_replace("/\n/", "<p>\n", $error));
} else {
    $tpl->set_var("error", "");
}
print generate_page('Create Account', $tpl->parse("content", "create"));
コード例 #5
0
ファイル: preferences.php プロジェクト: kawf/kawf
if (empty($error)) {
    $tpl->set_var("error", "");
} else {
    $tpl->set_var("ERROR", $error);
}
if (empty($user->signature)) {
    $tpl->set_var("signature", "");
}
$tpl->set_var("SIGNATURE_COOKED", nl2brPre::out($user->signature));
$tpl->set_var("SIGNATURE", htmlspecialchars($user->signature, ENT_SUBSTITUTE));
$tpl->set_var("THREADSPERPAGE", $user->threadsperpage);
$tpl->set_var("TEXT", $text);
$tpl->set_var("PAGE", htmlspecialchars($_REQUEST['page'], ENT_QUOTES));
$tpl->set_var("USER_TOKEN", $user->token());
foreach ($tz_to_name as $tz) {
    $selected = "";
    if ($user->timezone == $tz) {
        $selected = " selected=\"selected\"";
    }
    $tpl->set_var("TIMEZONE", $tz);
    $tpl->set_var("TIMEZONE_SELECTED", $selected);
    $tpl->parse("_timezone", "timezone", true);
}
/* todo: translate date_default_timezone_get() into something we know */
if (isset($user->timezone)) {
    $tpl->set_var(str_replace("/", "_", $user->timezone), " selected=\"selected\"");
} else {
    $tpl->set_var("US_Pacific", " selected=\"selected\"");
}
print generate_page('Preferences', $tpl->parse("CONTENT", "preferences"));
コード例 #6
0
        //while
    }
}
function clear_log()
{
    global $sql;
    if (isset($_POST['uaction']) && $_POST['uaction'] === 'clear_log') {
        $query = <<<SQL_QUERY
            delete
                from
            log
SQL_QUERY;
        $rs = exec_query($sql, $query, array());
    }
}
/*
 *
 * static page messages.
 *
 */
gen_admin_menu($tpl);
clear_log();
generate_page($tpl);
$tpl->assign(array('TR_ADMIN_LOG' => tr('Admin Log'), 'TR_CLEAR_LOG' => tr('Clear log'), 'TR_DATE' => tr('Date'), 'TR_MESSAGE' => tr('Message')));
//gen_page_message($tpl);
$tpl->parse('PAGE', 'page');
$tpl->prnt();
if (isset($cfg['DUMP_GUI_DEBUG'])) {
    dump_gui_debug();
}
unset_messages();
コード例 #7
0
ファイル: showtracking.php プロジェクト: kawf/kawf
        if ($count >= $start && $count < $end) {
            parse_row($yatt, $block, "row" . ($i & 1), $t['thread']);
            $i++;
        }
        $count++;
    }
} else {
    $yatt->set('messages', "<font size=\"+1\">No tracked messages in this forum</font><br>");
    $yatt->parse($block . ".row");
}
$yatt->parse($block);
if ($new) {
    $yatt->parse("header.update_all");
    $yatt->parse("footer.update_all");
}
$yatt->parse("header");
$yatt->parse("footer");
print generate_page("Your tracked threads in " . $forum['name'], $yatt->output());
function parse_row($yatt, $block, $class, $thread, $collapse = false)
{
    $messages = gen_thread($thread, $collapse);
    if (!$messages) {
        return false;
    }
    $yatt->set('class', $class);
    $yatt->set('messages', $messages);
    $yatt->set('threadlinks', gen_threadlinks($thread, $collapse));
    $yatt->parse("{$block}.row");
    return true;
}
// vim: sw=2
コード例 #8
0
ファイル: showforum.php プロジェクト: kawf/kawf
    } while ($thread = $sth->fetch());
    $sth->closeCursor();
}
if (!process_tthreads(true)) {
    $tpl->set_var("tracked_threads", "");
}
if (!$tthreadsshown) {
    $tpl->set_var("update_all", "");
}
if (!$numshown) {
    $tpl->set_var($table_block, "<font size=\"+1\">No messages in this forum</font><br>");
}
/*
$row = db_query_first("select count(*) from f_visits where UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(tstamp) <= 15 * 60 and aid != 0");
$active_users = $row ? $row[0] : 0;
$row = db_query_first("select count(*) from f_visits where UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(tstamp) <= 15 * 60 and aid = 0");
$active_guests = $row ? $row[0] : 0;
*/
$tpl->set_var(array("ACTIVE_USERS" => $active_users, "ACTIVE_GUESTS" => $active_guests));
unset($thread);
require_once "postform.inc";
render_postform($tpl, "post", $user);
$meta_robots = false;
if ($robots_meta_tag) {
    $meta_robots = 'noindex';
    if (isset($forum['option']['ExternallySearchable'])) {
        $meta_robots = 'follow,index';
    }
}
print generate_page($forum['name'], $tpl->parse("content", "showforum"), false, $meta_robots);
// vim: sw=2
コード例 #9
0
ファイル: user_statistics.php プロジェクト: gOOvER/EasySCP
} else {
    if (isset($_GET['month']) && isset($_GET['year'])) {
        $month = intval($_GET['month']);
        $year = intval($_GET['year']);
    }
}
if (!is_numeric($rid) || !is_numeric($month) || !is_numeric($year)) {
    user_goto('./reseller_statistics.php');
}
// static page messages
gen_logged_from($tpl);
$tpl->assign(array('TR_PAGE_TITLE' => tr('EasySCP - Admin/Reseller User Statistics'), 'TR_RESELLER_USER_STATISTICS' => tr('Reseller users table'), 'TR_MONTH' => tr('Month'), 'TR_YEAR' => tr('Year'), 'TR_SHOW' => tr('Show'), 'TR_NO_DOMAINS' => tr('This reseller has no domains yet.'), 'TR_DOMAIN_NAME' => tr('Domain'), 'TR_TRAFF' => tr('Traffic<br />usage'), 'TR_DISK' => tr('Disk<br />usage'), 'TR_WEB' => tr('Web<br />traffic'), 'TR_FTP_TRAFF' => tr('FTP<br />traffic'), 'TR_SMTP' => tr('SMTP<br />traffic'), 'TR_POP3' => tr('POP3/IMAP<br />traffic'), 'TR_SUBDOMAIN' => tr('Subdomain'), 'TR_ALIAS' => tr('Alias'), 'TR_MAIL' => tr('Mail'), 'TR_FTP' => tr('FTP'), 'TR_SQL_DB' => tr('SQL<br />database'), 'TR_SQL_USER' => tr('SQL<br />user'), 'VALUE_NAME' => $name, 'VALUE_RID' => $rid));
gen_reseller_mainmenu($tpl, 'reseller/main_menu_statistics.tpl');
gen_reseller_menu($tpl, 'reseller/menu_statistics.tpl');
gen_select_lists($tpl, $month, $year);
generate_page($tpl, $rid, $name);
gen_page_message($tpl);
if ($cfg->DUMP_GUI_DEBUG) {
    dump_gui_debug($tpl);
}
$tpl->display($template);
unset_messages();
/**
 * @param EasySCP_TemplateEngine $tpl
 * @param int $reseller_id
 * @param string $reseller_name
 */
function generate_page($tpl, $reseller_id, $reseller_name)
{
    $sql = EasySCP_Registry::get('Db');
    $cfg = EasySCP_Registry::get('Config');
コード例 #10
0
    if ($traff_percent > 100) {
        $traff_percent = 100;
    }
    if ($disk_percent > 100) {
        $disk_percent = 100;
    }
    if ($row % 2 == 0) {
        $tpl->assign(array('ITEM_CLASS' => 'content'));
    } else {
        $tpl->assign(array('ITEM_CLASS' => 'content2'));
    }
    $tpl->assign(array('RESELLER_NAME' => $reseller_name, 'RESELLER_ID' => $reseller_id, 'MONTH' => $crnt_month, 'YEAR' => $crnt_year, 'TRAFF_SHOW_PERCENT' => $traff_show_percent, 'TRAFF_PERCENT' => $traff_percent, 'TRAFF_USED' => make_hr($utraff_current), 'TRAFF_CURRENT' => make_hr($rtraff_current), 'TRAFF_MAX' => $rtraff_max ? make_hr($rtraff_max) : tr('unlimited'), 'DISK_SHOW_PERCENT' => $disk_show_percent, 'DISK_PERCENT' => $disk_percent, 'DISK_USED' => make_hr($udisk_current), 'DISK_CURRENT' => make_hr($rdisk_current), 'DISK_MAX' => $rdisk_max ? make_hr($rdisk_max) : tr('unlimited'), 'DMN_USED' => $udmn_current, 'DMN_CURRENT' => $rdmn_current, 'DMN_MAX' => $rdmn_max ? $rdmn_max : tr('unlimited'), 'SUB_USED' => $usub_current, 'SUB_CURRENT' => $rsub_current, 'SUB_MAX' => $rsub_max ? $rsub_max : tr('unlimited'), 'ALS_USED' => $uals_current, 'ALS_CURRENT' => $rals_current, 'ALS_MAX' => $rals_max ? $rals_max : tr('unlimited'), 'MAIL_USED' => $umail_current, 'MAIL_CURRENT' => $rmail_current, 'MAIL_MAX' => $rmail_max ? $rmail_max : tr('unlimited'), 'FTP_USED' => $uftp_current, 'FTP_CURRENT' => $rftp_current, 'FTP_MAX' => $rftp_max ? $rftp_max : tr('unlimited'), 'SQL_DB_USED' => $usql_db_current, 'SQL_DB_CURRENT' => $rsql_db_current, 'SQL_DB_MAX' => $rsql_db_max ? $rsql_db_max : tr('unlimited'), 'TR_OF' => tr('of'), 'SQL_USER_USED' => $usql_user_current, 'SQL_USER_CURRENT' => $rsql_user_current, 'SQL_USER_MAX' => $rsql_user_max ? $rsql_user_max : tr('unlimited')));
    $tpl->parse('RESELLER_ENTRY', '.reseller_entry');
}
/*
 *
 * static page messages.
 *
 */
$crnt_month = '';
$crnt_year = '';
gen_admin_menu($tpl);
generate_page(&$tpl);
$tpl->assign(array('TR_RESELLER_STATISTICS' => tr('Reseller statistics table'), 'TR_MONTH' => tr('Month'), 'TR_YEAR' => tr('Year'), 'TR_SHOW' => tr('Show'), 'TR_RESELLER_NAME' => tr('Reseller name'), 'TR_TRAFF' => tr('Traffic'), 'TR_DISK' => tr('Disk'), 'TR_DOMAIN' => tr('Domain'), 'TR_SUBDOMAIN' => tr('Subdomain'), 'TR_ALIAS' => tr('Alias'), 'TR_MAIL' => tr('Mail'), 'TR_FTP' => tr('FTP'), 'TR_SQL_DB' => tr('SQL database'), 'TR_SQL_USER' => tr('SQL user')));
gen_page_message($tpl);
$tpl->parse('PAGE', 'page');
$tpl->prnt();
if (isset($cfg['DUMP_GUI_DEBUG'])) {
    dump_gui_debug();
}
unset_messages();
コード例 #11
0
ファイル: domain_statistics.php プロジェクト: gOOvER/EasySCP
$month = date('m');
$year = date('Y');
if (isset($_POST['month']) && isset($_POST['year'])) {
    $year = intval($_POST['year']);
    $month = intval($_POST['month']);
} else {
    if (isset($_GET['month']) && isset($_GET['year'])) {
        $month = intval($_GET['month']);
        $year = intval($_GET['year']);
    }
}
if (!is_numeric($domain_id) || !is_numeric($month) || !is_numeric($year)) {
    user_goto('reseller_statistics.php');
}
gen_select_lists($tpl, $month, $year);
generate_page($tpl, $month, $year, $domain_id);
// static page messages
$tpl->assign(array('TR_PAGE_TITLE' => tr('EasySCP - Domain Statistics Data'), 'TR_RESELLER_STATISTICS' => tr('Reseller statistics table'), 'TR_RESELLER_USER_STATISTICS' => tr('Reseller users table'), 'TR_DOMAIN_STATISTICS' => tr('Domain statistics'), 'TR_MONTH' => tr('Month'), 'TR_YEAR' => tr('Year'), 'TR_SHOW' => tr('Show'), 'TR_WEB_TRAFFIC' => tr('Web traffic'), 'TR_FTP_TRAFFIC' => tr('FTP traffic'), 'TR_SMTP_TRAFFIC' => tr('SMTP traffic'), 'TR_POP3_TRAFFIC' => tr('POP3/IMAP traffic'), 'TR_ALL_TRAFFIC' => tr('All traffic'), 'TR_ALL' => tr('All'), 'TR_DAY' => tr('Day')));
gen_admin_mainmenu($tpl, 'admin/main_menu_statistics.tpl');
gen_admin_menu($tpl, 'admin/menu_statistics.tpl');
gen_page_message($tpl);
if ($cfg->DUMP_GUI_DEBUG) {
    dump_gui_debug($tpl);
}
$tpl->display($template);
unset_messages();
function get_domain_trafic($from, $to, $domain_id)
{
    $sql = EasySCP_Registry::get('Db');
    $query = "\n\t\tSELECT\n\t\t\tIFNULL(SUM(`dtraff_web_in`), 0) AS web_dr_in,\n\t\t\tIFNULL(SUM(`dtraff_web_out`), 0) AS web_dr_out,\n\t\t\tIFNULL(SUM(`dtraff_ftp_in`), 0) AS ftp_dr_in,\n\t\t\tIFNULL(SUM(`dtraff_ftp_out`), 0) AS ftp_dr_out,\n\t\t\tIFNULL(SUM(`dtraff_mail`), 0) AS mail_dr,\n\t\t\tIFNULL(SUM(`dtraff_pop`), 0) AS pop_dr\n\t\tFROM\n\t\t\t`domain_traffic`\n\t\tWHERE\n\t\t\t`domain_id` = ?\n\t\tAND\n\t\t\t`dtraff_time` >= ?\n\t\tAND\n\t\t\t`dtraff_time` <= ?\n\t";
    $rs = exec_query($sql, $query, array($domain_id, $from, $to));
コード例 #12
0
ファイル: tracking.php プロジェクト: kawf/kawf
            $forumcount++;
            $numshown++;
        }
    }
    if ($forumcount > 0) {
        if ($forumupdated) {
            $tpl->parse("_update_all", "update_all");
        } else {
            $tpl->set_var("_update_all", "");
        }
    }
    if ($forumcount) {
        if (!$first) {
            $tpl->parse("_hr", "hr", true);
        }
        $first = false;
        /* HACK: ugly */
        unset($tpl->varkeys['forum_header']);
        unset($tpl->varvals['forum_header']);
        $tpl->set_file("forum_header", array("forum/" . $forum['shortname'] . ".tpl", "forum/generic.tpl"));
        $tpl->parse("FORUM_HEADER", "forum_header");
        $tpl->parse("_block", $table_block, true);
    }
}
$sth->closeCursor();
if (!$numshown) {
    $tpl->set_var("_block", "<font size=\"+1\">No updated threads</font><br>");
}
$tpl->set_var("token", $user->token());
print generate_page('Your Tracked Threads', $tpl->parse("CONTENT", "tracking"));
// vim: sw=2
コード例 #13
0
            $url = html_entity_decode($url);
            // if url use https protocol change it to http
            if (!preg_match('!^https?://!i', $url)) {
                $url = 'http://' . $url;
            }
        }
        $article = new Article();
        $article->setUrl($url);
        if (!$article->isAlreadyExists()) {
            if ($article->retrieveContent()) {
                if ($article->readiIt(isset($_GET['debug']))) {
                    $article->modifyContent();
                    $article->saveContent();
                }
            }
        } else {
            $article = Article::getArticle($url);
            // only for debug
            if ($article->readiIt(isset($_GET['debug']))) {
                $article->modifyContent();
                $article->saveContent();
            }
        }
        if ($article && $article->isLoaded()) {
            generate_page($article->getUrl(), $article->getTitle(), $article->getFinalContent());
            //generate_page($url,$r->articleTitle->innerHTML,$r->articleContent->innerHTML);
        } else {
            echo "Error unable to get link : " . $url;
        }
    }
}
コード例 #14
0
ファイル: finish.php プロジェクト: kawf/kawf
                 */
                if ($user->status == 'Create') {
                    $user->status("Active");
                    $user->update();
                }
                $user->setcookie();
                $success = "forgot_password";
        }
    }
    $tpl->set_var("form", "");
}
if (isset($error)) {
    foreach ($errors as $code) {
        if ($error != $code) {
            $tpl->set_var($code, "");
        }
    }
} else {
    $tpl->set_var("error", "");
}
if (isset($success)) {
    foreach ($successes as $code) {
        if ($success != $code) {
            $tpl->set_var($code, "");
        }
    }
} else {
    $tpl->set_var("success", "");
}
print generate_page('Finish Account Creation', $tpl->parse("content", "finish"));
コード例 #15
0
ファイル: server_statistic.php プロジェクト: gOOvER/EasySCP
$template = 'admin/server_statistic.tpl';
global $month, $year;
if (isset($_GET['month']) && isset($_GET['year'])) {
    $year = intval($_GET['year']);
    $month = intval($_GET['month']);
} else {
    if (isset($_POST['month']) && isset($_POST['year'])) {
        $year = intval($_POST['year']);
        $month = intval($_POST['month']);
    } else {
        $month = date('m');
        $year = date('Y');
    }
}
gen_select_lists($tpl, $month, $year);
generate_page($month, $year);
// static page messages
$tpl->assign(array('TR_PAGE_TITLE' => tr('EasySCP - Admin/Server statistics'), 'TR_SERVER_STATISTICS' => tr('Server statistics'), 'TR_MONTH' => tr('Month'), 'TR_YEAR' => tr('Year'), 'TR_SHOW' => tr('Show'), 'TR_DAY' => tr('Day'), 'TR_WEB_IN' => tr('Web in'), 'TR_WEB_OUT' => tr('Web out'), 'TR_SMTP_IN' => tr('SMTP in'), 'TR_SMTP_OUT' => tr('SMTP out'), 'TR_POP_IN' => tr('POP3/IMAP in'), 'TR_POP_OUT' => tr('POP3/IMAP out'), 'TR_OTHER_IN' => tr('Other in'), 'TR_OTHER_OUT' => tr('Other out'), 'TR_ALL_IN' => tr('All in'), 'TR_ALL_OUT' => tr('All out'), 'TR_ALL' => tr('All')));
gen_admin_mainmenu($tpl, 'admin/main_menu_statistics.tpl');
gen_admin_menu($tpl, 'admin/menu_statistics.tpl');
gen_page_message($tpl);
if ($cfg->DUMP_GUI_DEBUG) {
    dump_gui_debug($tpl);
}
$tpl->display($template);
unset_messages();
function get_server_trafic($from, $to)
{
    $sql = EasySCP_Registry::get('Db');
    $query = "\n\t\tSELECT\n\t\t\tIFNULL(SUM(`bytes_in`), 0) AS sbin,\n\t\t\tIFNULL(SUM(`bytes_out`), 0) AS sbout,\n\t\t\tIFNULL(SUM(`bytes_mail_in`), 0) AS smbin,\n\t\t\tIFNULL(SUM(`bytes_mail_out`), 0) AS smbout,\n\t\t\tIFNULL(SUM(`bytes_pop_in`), 0) AS spbin,\n\t\t\tIFNULL(SUM(`bytes_pop_out`), 0) AS spbout,\n\t\t\tIFNULL(SUM(`bytes_web_in`), 0) AS swbin,\n\t\t\tIFNULL(SUM(`bytes_web_out`), 0) AS swbout\n\t\tFROM\n\t\t\t`server_traffic`\n\t\tWHERE\n\t\t\t`traff_time` > ? AND `traff_time` <= ?\n\t";
    $rs = exec_query($sql, $query, array($from, $to));
コード例 #16
0
ファイル: login.php プロジェクト: kawf/kawf
if (!isset($page)) {
    $page = "/";
}
$tpl->set_var("PAGE", $page);
if (isset($_POST['login']) && isset($_POST['email'])) {
    $email = $_POST['email'];
    $password = $_POST['password'];
    $tpl->set_var("EMAIL", $email);
    $user = new AccountUser();
    $user->find_by_email($email);
    if (!$user->valid() || !$user->checkpassword($password)) {
        $message = "Invalid password for {$email}\n";
    } else {
        if ($tou_available && !$_REQUEST["tou_agree"]) {
            $message = "You must agree to the Terms Of Use\n";
        } else {
            $user->setcookie();
            header("Location: {$page}");
            exit;
        }
    }
} else {
    $tpl->set_var("EMAIL", "");
}
if (isset($message) && !empty($message)) {
    $tpl->set_var("MESSAGE", $message);
} else {
    $tpl->set_var("message", "");
}
print generate_page('Login', $tpl->parse("content", "login"));
コード例 #17
0
ファイル: post.php プロジェクト: kawf/kawf
            $bytes = strlen($msg['message']) - 1024;
            $plural = $bytes == 1 ? '' : 's';
            $e_message .= "...\n\nMessage continues for another {$bytes} byte{$plural}\n";
        }
        $tpl->set_var(array("THREAD_SUBJECT" => $t_subject, "USER_NAME" => $user->name, "HOST" => $_url, "FORUM_NAME" => $forum['name'], "FORUM_SHORTNAME" => $forum['shortname'], "MSG_MID" => $msg['mid'], "MAIL_MSG_SUBJECT" => $msg['subject'], "MAIL_MSG_MESSAGE" => $e_message, "PHPVERSION" => phpversion()));
        do {
            $uuser = new ForumUser($track['aid']);
            $tpl->set_var("EMAIL", $uuser->email);
            $e_message = $tpl->parse("MAIL", "mail");
            $e_message = textwrap($e_message, 78, "\n");
            mailfrom("followup-" . $track['aid'] . "@" . $bounce_host, $uuser->email, $e_message);
        } while ($track = $sth->fetch());
    }
    $sth->closeCursor();
    /* $_page set by main.php from $_REQUEST */
    if (!isset($_page) || empty($_page)) {
        $tpl->set_var("refresh_page", "");
    }
    /* FIXME: Dumb workaround */
    /* ??? why are we not getting $_page from $tpl here, like we do for $_domain
     * here and $_page in showforum and tracking? */
    unset($tpl->varkeys["PAGE"]);
    unset($tpl->varvals["PAGE"]);
    $_domain = $tpl->get_var("DOMAIN");
    unset($tpl->varkeys["DOMAIN"]);
    unset($tpl->varvals["DOMAIN"]);
    $tpl->set_var(array("MSG_MID" => $msg['mid'], "PAGE" => $_page, "DOMAIN" => $_domain, "form" => ""));
}
$tpl->parse("PREVIEW", "message");
print generate_page('Post Message', $tpl->parse("CONTENT", "post"));
// vim: sw=2
コード例 #18
0
ファイル: directory.php プロジェクト: kawf/kawf
<?php

require_once "page-yatt.inc.php";
$dir = new YATT();
$dir->load("{$template_dir}/directory.yatt");
$sth = db_query("select fid,name,shortname from f_forums where options like '%Searchable%' order by name");
for ($i = 0; $row = $sth->fetch(); $i++) {
    $dir->set("r", $i & 1);
    $fid = $row['fid'];
    /* should only count active and off-topic, but its too slow */
    try {
        $row2 = db_query_first("select count(*) from f_messages{$fid}");
        $count = $row2 ? $row2[0] : NULL;
    } catch (PDOException $e) {
        $count = NULL;
    }
    $dir->set("count", $count);
    $dir->set("row", $row);
    $dir->parse("dir.row");
}
$sth->closeCursor();
$dir->parse("dir");
print generate_page('Directory', $dir->output());
コード例 #19
0
ファイル: showmessage.php プロジェクト: kawf/kawf
    } else {
        $tpl->set_var("CLASS", "row0");
    }
}
$tpl->set_var("THREAD", $threadmsg);
$tpl->set_var("THREADLINKS", $threadlinks);
/* create a new message based on current for postform */
$nmsg['msg'] = $nmsg['subject'] = $nmsg['urltext'] = $nmsg['video'] = "";
$nmsg['aid'] = $msg['aid'];
$nmsg['pmid'] = $msg['mid'];
/* new pmid is current message */
$nmsg['tid'] = $msg['tid'];
$nmsg['ip'] = $remote_addr;
if (preg_match("/^Re:/i", $msg['subject'], $sregs)) {
    $nmsg['subject'] = $msg['subject'];
}
/*
else
  $nmsg['subject'] = "Re: " . $msg['subject'];
*/
render_postform($tpl, "post", $user, $nmsg);
$tpl->parse("MESSAGE", "message");
$meta_robots = false;
if ($robots_meta_tag) {
    $meta_robots = 'noindex';
    if (isset($forum['option']['ExternallySearchable'])) {
        $meta_robots = 'follow,index';
    }
}
print generate_page($msg['subject'], $tpl->parse("CONTENT", "showmessage"), false, $meta_robots);
コード例 #20
0
ファイル: edit.php プロジェクト: kawf/kawf
    }
    if (!empty($nmsg['video'])) {
        $new[] = "video: " . $nmsg['video'];
    }
    $diff .= diff($old, $new);
    /* IMAGEURL HACK - prepend before insert */
    /* for diffing and for entry into the db */
    $nmsg = image_url_hack_insert($nmsg);
    /* Add it into the database */
    $iid = mid_to_iid($mid);
    if (!isset($iid)) {
        err_not_found("message {$mid} has no iid");
        exit;
    }
    $sql = "update f_messages{$iid} set name = ?, email = ?, flags = ?, subject = ?, " . "message = ?, url = ?, urltext = ?, video = ?, state = ?, " . "changes = CONCAT(changes, 'Edited by ', ?, '/', ?, ' at ', NOW(), ' from ', ?, '\n', ?, '\n') " . "where mid = ?";
    db_exec($sql, array($nmsg['name'], $nmsg['email'], $nmsg['flags'], $nmsg['subject'], $nmsg['message'], $nmsg['url'], $nmsg['urltext'], $nmsg['video'], $nmsg['state'], $user->name, $user->aid, $remote_addr, $diff, $mid));
    $sql = "replace into f_updates ( fid, mid ) values ( ?, ? )";
    db_exec($sql, array($forum['fid'], $mid));
    /* update user post counts and f_indexes */
    if ($state_changed) {
        msg_state_changed($forum['fid'], $msg, $nmsg['state']);
    }
    if ($track_thread) {
        track_thread($forum['fid'], $nmsg['tid'], $send_email ? "SendEmail" : "");
    } else {
        untrack_thread($forum['fid'], $nmsg['tid']);
    }
    $tpl->set_var("MSG_MID", $mid);
}
print generate_page('Edit Message', $tpl->parse("CONTENT", "edit"));
// vim:sw=2
コード例 #21
0
function index_page($ccap_policy)
{
    global $good_index_template, $bad_index_template, $ccap_callback_url, $fail_sim, $ccap_api_good;
    $ccap_policy->reset();
    $check_config_response = $ccap_policy->check_config($ccap_callback_url);
    $config_good = $check_config_response['passed'];
    $fail_message = '';
    if (!$config_good and $fail_sim) {
        // If the config only bad because of failure simulation?
        // Save API
        $check_config_html = $check_config_response['html'];
        $bad_api = $ccap_policy->api;
        // Try with good credentials
        $ccap_policy->api = $ccap_api_good;
        $check_config_response = $ccap_policy->check_config($ccap_callback_url);
        $config_good = $check_config_response['passed'];
        // Switch back
        $ccap_policy->api = $bad_api;
        if ($config_good) {
            $fail_message = "\n                <h2>Failed Configuration</h2>\n                <p>The simulated failure is causing the configuraton check to\n                fail.  The failed configuration is:</p>" . str_replace("h1>", "h3>", $check_config_html);
        }
    }
    if ($config_good) {
        $template = $good_index_template;
        $new_settings_form = new_settings_form();
    } else {
        $template = $bad_index_template;
        $new_settings_form = '';
    }
    $tags = array('TITLE' => 'Welcome to the Confident CAPTCHA Explorer', 'HEAD_SCRIPT' => '', 'NEW_SETTINGS_FORM' => $new_settings_form, 'IN_PAGE_URL' => url(array('with_callback' => '1')), 'AT_POST_URL' => url(array('with_callback' => '0')), 'FAIL_MESSAGE' => $fail_message);
    $index_page = generate_page($template, $tags);
    return $index_page;
}
コード例 #22
0
ファイル: delete.php プロジェクト: kawf/kawf
}
require_once "strip.inc";
require_once "message.inc";
$tpl->set_file(array("del" => "delete.tpl", "message" => "message.tpl", "forum_header" => array("forum/" . $forum['shortname'] . ".tpl", "forum/generic.tpl")));
$tpl->set_block("del", "disabled");
message_set_block($tpl);
$tpl->set_var("FORUM_NAME", $forum['name']);
$tpl->set_var("FORUM_SHORTNAME", $forum['shortname']);
$tpl->parse("FORUM_HEADER", "forum_header");
$iid = mid_to_iid($mid);
if (!isset($iid)) {
    echo "Invalid message!\n";
    exit;
}
$sql = "select * from f_messages{$iid} where mid = ?";
$msg = db_query_first($sql, array($mid));
if ($msg['aid'] != $user->aid) {
    echo "This message does not belong to you!\n";
    exit;
}
if (!isset($forum['option']['PostEdit'])) {
    $tpl->set_var(array("image" => "", "preview" => "", "form" => "", "accept" => ""));
    print generate_page('Delete Message Denied', $tpl->parse("CONTENT", "disabled"));
    exit;
}
$tpl->set_var("disabled", "");
render_message($tpl, $msg, $user);
$tpl->set_var("PAGE", $_page);
$tpl->parse("PREVIEW", "message");
print generate_page('Delete Message', $tpl->parse("CONTENT", "del"));
コード例 #23
0
ファイル: acctedit.php プロジェクト: kawf/kawf
    $email_tid = $user->verify_email($update_email);
    if (!$email_tid) {
        $error .= "The email address '{$update_email}' is already used by another account\n";
    }
}
if (empty($error)) {
    if (($user->status == 'Suspended' || $user->status == 'Deleted') && (isset($user->update['name']) || isset($update_email))) {
        echo "You are suspended or deleted and not allowed to change your screen name or email address\n";
        exit;
    }
    if (!isset($user->update['name'])) {
        $tpl->set_var("name", "");
    }
    if (!isset($user->update['password'])) {
        $tpl->set_var("password", "");
    }
    if (!isset($update_email)) {
        $tpl->set_var("email", "");
    } else {
        $tpl->set_var(array("TID" => $email_tid, "NEWEMAIL" => $update_email));
    }
    $tpl->set_var("error", "");
} else {
    $tpl->set_var("name", "");
    $tpl->set_var("email", "");
    $tpl->set_var("password", "");
    $tpl->set_var("ERROR", nl2br($error));
}
$tpl->set_var("token", $user->token());
print generate_page('Edit Account', $tpl->parse("content", "edit"));
コード例 #24
0
ファイル: forgotpassword.php プロジェクト: kawf/kawf
$tpl->set_block("forgotpassword", "unknown");
$page = $_REQUEST['page'];
if (!isset($page)) {
    $page = "/";
}
/* FIXME: Dumb workaround */
unset($tpl->varkeys["PAGE"]);
unset($tpl->varvals["PAGE"]);
$tpl->set_var("PAGE", $page);
/* forgotpassword might get a POST with submit/email, or
   a simple GET with email */
if (isset($_REQUEST['email'])) {
    $email = $_REQUEST['email'];
    $tpl->set_var("EMAIL", $email);
    $user = new AccountUser();
    $user->find_by_email($email);
    if (!$user->valid()) {
        $tpl->set_var("success", "");
    } else {
        $user->forgotpassword();
        $user->update();
        $tpl->set_var("unknown", "");
        $tpl->set_var("form", "");
    }
} else {
    $tpl->set_var("EMAIL", "");
    $tpl->set_var("unknown", "");
    $tpl->set_var("success", "");
}
print generate_page('Forgot Password', $tpl->parse("content", "forgotpassword"));
コード例 #25
0
ファイル: showthread.php プロジェクト: kawf/kawf
    global $tpl;
    /* hack to get current page */
    $mtpl = new Template($template_dir, "comment");
    $mtpl->set_file("message", "message.tpl");
    message_set_block($mtpl);
    $iid = mid_to_iid($msg['mid']);
    if (isset($iid)) {
        $sql = "update f_messages{$iid} set views = views + 1 where mid = ?";
        db_exec($sql, array($msg['mid']));
    }
    $uuser = new ForumUser($msg['aid']);
    $mtpl->set_var("parent", "");
    render_message($mtpl, $msg, $user, $uuser);
    /* in threaded mode, subject is a link. override MSG_SUBJECT set above. */
    $mtpl->set_var("MSG_SUBJECT", "<a href=\"../msgs/" . $msg['mid'] . ".phtml\" name=\"" . $msg['mid'] . "\">" . $msg['subject'] . "</a>");
    $mtpl->set_var("FORUM_SHORTNAME", $forum['shortname']);
    $mtpl->set_var("PAGE", $tpl->get_var('PAGE'));
    $mtpl->parse("MESSAGE", "message");
    return $mtpl->get_var("MESSAGE");
}
$messagestr = list_thread(print_message, $messages, $tree, reset($tree), $thread);
$tpl->set_var("MESSAGES", $messagestr);
$meta_robots = false;
if ($robots_meta_tag) {
    $meta_robots = 'noindex';
    if (isset($forum['option']['ExternallySearchable'])) {
        $meta_robots = 'follow,index';
    }
}
print generate_page($forum['name'], $tpl->parse("CONTENT", "showthread"), false, $meta_robots);