Пример #1
0
/**
 * jmd_img_selector preferences
 *
 * @param string $event
 * @param string $step
 */
function jmd_img_selector($event, $step)
{
    global $jmdImgSel, $path_to_site, $prefs;
    $out = '<div id="jmd_img_selector" style="width: 500px; margin: 0 auto">';
    if ($step === 'update') {
        $settings = array('tbWidth' => gps('tbWidth'), 'tbHeight' => gps('tbHeight'), 'imgWidth' => gps('imgWidth'), 'imgHeight' => gps('imgHeight'));
        foreach ($settings as $key => $value) {
            $jmdImgSel->upsertPref($key, $value);
        }
        $msg = $jmdImgSel->gTxt('prefs_updated');
    }
    if ($step === 'css') {
        $css = <<<CSS
//inc <img_sel.css>
CSS;
        safe_insert("txp_css", "name='jmd_img_selector', css='" . base64_encode($css) . "'");
        $msg = $jmdImgSel->gTxt('css_created');
    }
    pageTop($jmdImgSel->gTxt('prefs'), isset($msg) ? $msg : '');
    // Preferences
    $out .= form(fieldset(fieldset($jmdImgSel->input('pref_width', 'tbWidth') . $jmdImgSel->input('pref_height', 'tbHeight'), $jmdImgSel->gTxt('tb_legend')) . fieldset($jmdImgSel->input('pref_width', 'imgWidth') . $jmdImgSel->input('pref_height', 'imgHeight'), $jmdImgSel->gTxt('img_legend')) . fInput('submit', 'update', $jmdImgSel->gTxt('update')) . eInput('jmd_img_selector') . sInput('update'), $jmdImgSel->gTxt('prefs_legend')));
    // Check if CSS file exists
    $rs = safe_field('name', 'txp_css', 'name="jmd_img_selector"');
    if (empty($rs)) {
        $out .= form(fieldset(fInput('submit', 'submit', $jmdImgSel->gTxt('create_css')) . eInput('jmd_img_selector') . sInput('css'), $jmdImgSel->gTxt('css_legend')));
    }
    echo $out;
}
Пример #2
0
function check_privs()
{
    global $txp_user;
    $privs = safe_field("privs", "txp_users", "`name`='{$txp_user}'");
    $args = func_get_args();
    if (!in_array($privs, $args)) {
        exit(pageTop('Restricted') . '<p style="margin-top:3em;text-align:center">' . gTxt('restricted_area') . '</p>');
    }
}
Пример #3
0
function jmd_sitemap($event, $step)
{
    global $prefs;
    $sitemap = new JMD_Sitemap();
    // Generate sitemap
    if ($step == ('create' || 'edit' || 'update')) {
        $excluded = gps('exclude');
        if ($excluded) {
            $excluded = serialize($excluded);
            $prefs['jmd_sitemap_exclude'] = $excluded;
            safe_update("txp_prefs", "val = '{$excluded}'", "name = 'jmd_sitemap_exclude'");
        }
        $sitemap->writeSitemap();
    }
    // Extensions tab
    if ($event == 'jmd_sitemap') {
        pageTop('jmd_sitemap', $step ? _jmd_sitemap_gtxt('sitemap_updated') : '');
        echo '<div id="jmd_sitemap" style="width: 350px; margin: 0 auto">';
        // File errors
        if (file_exists($sitemap->filename)) {
            if (!is_writable($sitemap->filename)) {
                $fileError = _jmd_sitemap_gtxt('error_not_writable');
            }
        } else {
            $fileError = _jmd_sitemap_gtxt('error_doesnt_exist');
        }
        if (isset($fileError)) {
            echo tag($sitemap->filename . ' ' . $fileError, 'p', ' class="not-ok"');
        }
        $out = '<label for="exclude">' . _jmd_sitemap_gtxt('exclude_sections') . ':</label><br/>
            <select id="exclude" name="exclude[]" multiple="multiple"
                size="5" style="width: 150px; margin: 3px 0 10px">';
        // Exclude sections
        $exclude = $prefs['jmd_sitemap_exclude'];
        $exclude = unserialize($exclude);
        $sections = safe_column("name", "txp_section", "name != 'default'");
        foreach ($sections as $section) {
            $out .= '<option name="' . $section . '"';
            // Select excluded
            if (in_array($section, $exclude)) {
                $out .= ' selected="selected"';
            }
            $out .= ">{$section}</option>";
        }
        $out .= '</select><br/>';
        echo form($out . tag(_jmd_sitemap_gtxt('update_sitemap'), 'button') . eInput('jmd_sitemap') . sInput('update'));
        echo '</div><!--//jmd_sitemap-->';
    }
}
Пример #4
0
/**
 * Parses the form "jmd_dashboard".
 *
 * @param string $event
 * @param string $step
 */
function jmd_dashboard($event, $step)
{
    pageTop(gTxt('jmd_dashboard_tab'));
    include_once txpath . DS . 'publish.php';
    if (empty($GLOBALS['pretext'])) {
        $GLOBALS['pretext'] = array('id' => '', 'q' => '');
    }
    $contents = safe_field("Form", "txp_form", "name = 'jmd_dashboard'");
    if ($contents === FALSE) {
        $contents = <<<FORM
<h1 style="text-align:center">
    Hey, you haven&#8217;t customized jmd_dashboard yet.
    <a href="?event=form&amp;step=form_edit&amp;name=jmd_dashboard">
        Do it now!
    </a>
</h1>

<div style="margin: 0 auto; width: 400px;">
    <h1>
        <txp:site_name/>: Last modified on <txp:jmd_dashboard_lastmod/>
    </h1>

    <h2>Recently published articles</h2>
    <txp:article_custom break="li" wraptag="ul">
        <txp:title/> &#8211;
        <txp:jmd_dashboard_edit>
            edit #<txp:article_id/>
        </txp:jmd_dashboard_edit>
    </txp:article_custom>

    <h2>Recent comments</h2>
    <txp:recent_comments break="li" wraptag="ul">
        <txp:comment_message/> &#8211; <txp:comment_name link="0"/>
        (<txp:jmd_dashboard_edit type="comment">edit</txp:jmd_dashboard_edit>)
    </txp:recent_comments>
</div>
FORM;
        safe_insert("txp_form", "Form='" . doSlash($contents) . "',\n            type='misc', name='jmd_dashboard'");
    }
    echo parse($contents);
}
Пример #5
0
/**
 * Interface for the CSV import.
 *
 * @param string $event
 * @param string $step
 */
function jmd_csv($event, $step)
{
    global $jmd_csv, $file_base_path;
    ob_start('jmd_csv_head');
    $jmd_csv = new JMD_CSV();
    if ($step === 'import') {
        $file = gps('file');
        if ($file) {
            $handle = fopen($file_base_path . DS . $file, 'r');
            if ($handle) {
                $jmd_csv->import($handle, gps('status'));
                $msg = gTxt('jmd_csv_imported');
            } else {
                $msg = gTxt('jmd_csv_file_error');
            }
        }
    }
    pageTop('jmd_csv', isset($msg) ? $msg : '');
    $gTxt = 'gTxt';
    $out = <<<EOD
<fieldset id="jmd_csv">
    <legend>{$gTxt('jmd_csv_import_csv')}</legend>
    <div>
        <label>{$gTxt('jmd_csv_file')}
            {$jmd_csv->fileList()}
        </label>
    </div>
    <div>
        <label>{$gTxt('import_status')}
            {$jmd_csv->statusList()}
        </label>
    </div>
    <button type="submit">{$gTxt('jmd_csv_import')}</button>
</fieldset>
EOD;
    echo form($out . eInput('jmd_csv') . sInput('import'));
}
Пример #6
0
function ipban_list($message = '')
{
    pageTop(gTxt('list_banned_ips'), $message);
    $rs = safe_rows_start("*", "txp_discuss_ipban", "1 order by date_banned desc");
    if ($rs) {
        echo startTable('list'), tr(hCell('Date banned') . hCell('ip') . hCell('Name used') . hCell('Banned for') . td());
        while ($a = nextRow($rs)) {
            extract($a);
            $unbanlink = '<a href="?event=discuss' . a . 'step=ipban_unban' . a . 'ip=' . $ip . '">unban</a>';
            $datebanned = date("Y-m-d", strtotime($date_banned));
            $messagelink = '<a href="?event=discuss' . a . 'step=discuss_edit' . a . 'discussid=' . $banned_on_message . '">' . $banned_on_message . '</a>';
            echo tr(td($datebanned) . td($ip) . td($name_used) . td($messagelink) . td($unbanlink));
        }
        echo endTable();
    } else {
        echo graf(gTxt('no_ips_banned'), ' align="center"');
    }
}
Пример #7
0
<?php

$title = '文件管理页面';
$iswap = true;
include "../includes/common.php";
pageTop();
if ($_GET['a'] == '') {
    main0();
} elseif ($_GET['a'] == '1') {
    main1();
} elseif ($_GET['a'] == 'api') {
    api_about();
}
function fileList()
{
    global $DB;
    $key = $_REQUEST['key'];
    $ba = urlencode('查看列表');
    $n = $DB->count("SELECT count(*) from udisk WHERE 1");
    echo "<div class='title'>文件列表(共有{$n}个文件)</div>";
    echo "<a href=\"admin.php?a=1&act={$ba}&key={$key}\">刷新列表</a><br/>";
    global $pagesize;
    $numrows = $n;
    $pages = intval($numrows / $pagesize);
    if ($numrows % $pagesize) {
        $pages++;
    }
    if (isset($_GET['page'])) {
        $page = intval($_GET['page']);
    } else {
        $page = 1;
Пример #8
0
function missing_section_file()
{
    global $txpcfg;
    pageTop('missing section placeholder');
    $name = gps('name');
    $out = array(startTable("edit"), tr(tda(graf(gTxt('section_warning_part1') . ' ' . strong($name) . ' ' . gTxt('section_warning_part2') . ' ' . $txpcfg['doc_root'] . ' ' . gTxt('section_warning_part3') . ':') . graf('<textarea cols="50" rows="7">' . file_snip($name) . '</textarea>') . graf(gTxt('section_warning_part4') . ' <code>.htaccess</code> ' . gTxt('section_warning_part5') . ' ' . $txpcfg['doc_root'] . ' ' . gTxt('section_warning_part6') . ':') . graf('<textarea cols="50" rows="4">' . htaccess_snip($name) . '</textarea>'), ' width="500px"')), endTable());
    echo join('', $out);
}
Пример #9
0
/**
 * Requires privileges from a user.
 *
 * @deprecated in 4.3.0
 * @see        require_privs()
 * @package    User
 */
function check_privs()
{
    trigger_error(gTxt('deprecated_function_with', array('{name}' => __FUNCTION__, '{with}' => 'require_privs')), E_USER_NOTICE);
    global $txp_user;
    $privs = safe_field("privs", "txp_users", "name='" . doSlash($txp_user) . "'");
    $args = func_get_args();
    if (!in_array($privs, $args)) {
        exit(pageTop('Restricted') . '<p style="margin-top:3em;text-align:center">' . gTxt('restricted_area') . '</p>');
    }
}
Пример #10
0
    pageBottom();
    exit;
}
date_default_timezone_set("Europe/London");
$stuff = "Submitted " . date('l dS \\of F Y h:i:s A') . "\n";
ob_start();
print_r($_POST);
$stuff .= ob_get_contents();
ob_end_clean();
if ($_SERVER['SERVER_NAME'] == "www.dur.ac.uk") {
    $ouremail = "*****@*****.**";
} else {
    $ouremail = "*****@*****.**";
}
mail($ouremail, "Booking for harp course", $stuff, "From: {$ouremail}");
pageTop("Thanks for booking");
$message = <<<EOT
_Thanks for your booking request_

We can confirm your place on the Harp Course once we have received
your deposit of 50.00 GBP.
EOT;
switch ($_POST['payment']) {
    case "paypal":
        $message .= <<<EOT

You said you would pay by paypal, which you can do as follows

1.  Go to http://www.paypal.co.uk
2.  Log In (if you've already used PayPal) or Sign up (if not)
3.  Click on 'Send Money' just to the right of 'My Account'
Пример #11
0
function ipban_list($message = '')
{
    global $event;
    pageTop(gTxt('list_banned_ips'), $message);
    echo '<h1 class="txp-heading">' . gTxt('banned_ips') . '</h1>';
    echo '<div id="' . $event . '_banned_control" class="txp-control-panel">';
    echo graf(sLink('discuss', 'discuss_list', gTxt('list_discussions')), ' class="txp-buttons"');
    echo '</div>';
    $rs = safe_rows_start('*, unix_timestamp(date_banned) as uBanned', 'txp_discuss_ipban', "1 = 1 order by date_banned desc");
    if ($rs and numRows($rs) > 0) {
        echo '<div id="' . $event . '_ban_container" class="txp-container">' . startTable('', '', 'txp-list') . n . '<thead>' . tr(hCell(gTxt('date_banned'), '', ' class="date banned"') . hCell(gTxt('IP'), '', ' class="ip"') . hCell(gTxt('name_used'), '', ' class="name"') . hCell(gTxt('banned_for'), '', ' class="id"')) . n . '</thead>';
        echo '<tbody>';
        while ($a = nextRow($rs)) {
            extract($a);
            echo tr(td(gTime($uBanned), '', 'date banned') . td(txpspecialchars($ip) . n . '[<a class="action-ban" href="?event=discuss' . a . 'step=ipban_unban' . a . 'ip=' . txpspecialchars($ip) . a . '_txp_token=' . form_token() . '">' . gTxt('unban') . '</a>]', '', 'ip') . td(txpspecialchars($name_used), '', 'name') . td('<a href="?event=discuss' . a . 'step=discuss_edit' . a . 'discussid=' . $banned_on_message . '">' . $banned_on_message . '</a>', '', 'id'));
        }
        echo '</tbody>' . endTable() . '</div>';
    } else {
        echo graf(gTxt('no_ips_banned'), ' class="indicator"');
    }
}
 /**
  * Render options page
  * @param  string $event the event being called
  * @param  string $step  the step being called
  */
 public function render_prefs($event, $step)
 {
     if ($step === 'update') {
         $this->update_prefs();
     }
     pageTop(gTxt('Multiple Image Upload'));
     // todo: show preflight/sanity errors if any
     // Generate Preferences Table
     $out = hed(gTxt('Multiple Image Upload - Preferences'), 1);
     $out .= startTable($this->prefix('preferences'), 'center', 5);
     foreach (self::$preferences as $key => $pref) {
         $out .= $this->render_pref($key, $pref);
     }
     // render save button
     $out .= tr(tdcs(eInput('plugin_prefs.' . self::$slug) . sInput('update') . fInput('submit', 'save', gTxt('save_button'), 'publish'), 3, '', 'nolin'));
     $out .= endtable();
     echo form($out);
 }
Пример #13
0
function ipban_list($message = '')
{
    global $event;
    pageTop(gTxt('list_banned_ips'), $message);
    echo hed(gTxt('banned_ips'), 1, array('class' => 'txp-heading'));
    echo n . '<div id="' . $event . '_banned_control" class="txp-control-panel">' . graf(sLink('discuss', 'discuss_list', gTxt('list_discussions')), ' class="txp-buttons"') . n . '</div>';
    $rs = safe_rows_start('*, unix_timestamp(date_banned) as uBanned', 'txp_discuss_ipban', "1 = 1 order by date_banned desc");
    if ($rs and numRows($rs) > 0) {
        echo n . tag_start('div', array('id' => $event . '_ban_container', 'class' => 'txp-container')) . n . tag_start('div', array('class' => 'txp-listtables')) . n . tag_start('table', array('class' => 'txp-list')) . n . tag_start('thead') . tr(hCell(gTxt('date_banned'), '', ' scope="col" class="txp-list-col-banned date"') . hCell(gTxt('IP'), '', ' scope="col" class="txp-list-col-ip"') . hCell(gTxt('name_used'), '', ' scope="col" class="txp-list-col-name"') . hCell(gTxt('banned_for'), '', ' scope="col" class="txp-list-col-id"')) . n . tag_end('thead') . n . tag_start('tbody');
        while ($a = nextRow($rs)) {
            extract($a);
            echo tr(hCell(gTime($uBanned), '', ' scope="row" class="txp-list-col-banned date"') . td(txpspecialchars($ip) . sp . span('[', array('aria-hidden' => 'true')) . href(gTxt('unban'), array('event' => 'discuss', 'step' => 'ipban_unban', 'ip' => $ip, '_txp_token' => form_token()), array('class' => 'action-ban')) . span(']', array('aria-hidden' => 'true')), '', 'txp-list-col-ip') . td(txpspecialchars($name_used), '', 'txp-list-col-name') . td(href($banned_on_message, '?event=discuss' . a . 'step=discuss_edit' . a . 'discussid=' . $banned_on_message), '', 'txp-list-col-id'));
        }
        echo n . tag_end('tbody') . n . tag_end('table') . n . tag_end('div') . n . tag_end('div');
    } else {
        echo graf(gTxt('no_ips_banned'), ' class="indicator"');
    }
}
Пример #14
0
<?php

include "../harpfunctions.php";
$inputEmail = $_REQUEST['inputEmail'];
if (!filter_var($inputEmail, FILTER_VALIDATE_EMAIL)) {
    pageTop("Please supply a valid email address so I can respond to you. ");
    print "{$inputEmail} is no good. Please <a href='booking.php'>try again</a>";
    pageBottom();
    exit;
}
date_default_timezone_set("Europe/London");
$stuff = "Submitted " . date('l dS \\of F Y h:i:s A') . "\n";
ob_start();
print_r($_POST);
$stuff .= ob_get_contents();
ob_end_clean();
$ouremail = "*****@*****.**";
mail($ouremail, "Quotation request", $stuff, "From: {$ouremail}");
pageTop("Quotation request");
print "<h1>Thanks for your interest</h1>\n";
print "<p class='lead'>I'll get back to you as soon as possible</p>\n";
print "<div><img src='../images/portrait/louise_livvy_2.jpg'></img></div>\n";
pageBottom();
?>

 function mem_self_register($event, $step)
 {
     global $prefs;
     extract($prefs);
     if ($event != 'self-reg') {
         return;
     }
     pageTop('Self Registration', '');
     if ($step == 'install') {
         echo mem_self_register_install();
     } else {
         if ($step == 'preinstall') {
             $mem_xtra_columns = mem_get_extra_user_columns();
             $mem_admin_name = !empty($mem_admin_name) ? $mem_admin_name : 'Admin';
             $mem_admin_email = !empty($mem_admin_email) ? $mem_admin_email : '*****@*****.**';
             $mem_new_use_priv = !empty($mem_new_use_priv) ? $mem_new_use_priv : '0';
             $use_ign_input = '';
             // is ign_password_protect loaded on the system?
             if (load_plugin('ign_password_protect') || isset($mem_use_ign_db) && $mem_use_ign_db) {
                 $mem_use_ign_db = !empty($mem_use_ign_db) ? $mem_use_ign_db : '0';
                 $use_ign_input = yesnoradio('use_ign_db', $mem_use_ign_db);
             }
             $xtra_columns = mem_get_extra_user_columns();
             $has_address = in_array('address', $xtra_columns);
             $has_phone = in_array('phone', $xtra_columns);
             $add_address_input = yesnoradio('add_address', '0');
             $add_phone_input = yesnoradio('add_phone', '0');
             echo form(eInput('self-reg') . sInput('install') . startTable('edit') . tr(fLabelCell('admin_name') . tda(fInput('text', 'admin_name', $mem_admin_name, 'edit'))) . tr(fLabelCell('admin_email') . tda(fInput('text', 'admin_email', $mem_admin_email, 'edit'))) . tr(fLabelCell('new_user_priv') . tda(priv_levels('new_user_priv', $mem_new_use_priv))) . tr(fLabelCell('use_ign_db') . tda($use_ign_input)) . ($has_address ? '' : tr(fLabelCell('add_address_field') . tda($add_address_input))) . ($has_phone ? '' : tr(fLabelCell('add_phone_field') . tda($add_phone_input))) . tr(td() . td(fInput("submit", 'submit', mem_self_gTxt('install'), "Publish"), 2)) . endTable());
         } else {
             echo '<div><a href="?event=self-reg&step=preinstall">' . mem_self_gTxt('install') . '</a></div>';
         }
     }
 }
Пример #16
0
function ipban_list($message = '')
{
    global $event;
    pageTop(gTxt('list_banned_ips'), $message);
    $rs = safe_rows_start('*, unix_timestamp(date_banned) as uBanned', 'txp_discuss_ipban', "1 = 1 order by date_banned desc");
    if ($rs and numRows($rs) > 0) {
        echo '<div id="' . $event . '_ban_container" class="txp-container txp-list">' . startTable('list', '', 'list') . n . '<thead>' . tr(hCell(gTxt('date_banned'), '', ' class="date banned"') . hCell(gTxt('IP'), '', ' class="ip"') . hCell(gTxt('name_used'), '', ' class="name"') . hCell(gTxt('banned_for'), '', ' class="id"') . hCell('', '', ' class="actions"')) . n . '</thead>';
        echo '<tbody>';
        $ctr = 1;
        while ($a = nextRow($rs)) {
            extract($a);
            echo tr(td(safe_strftime('%d %b %Y %I:%M %p', $uBanned), 100, 'date banned') . td($ip, 100, 'ip') . td($name_used, 100, 'name') . td('<a href="?event=discuss' . a . 'step=discuss_edit' . a . 'discussid=' . $banned_on_message . '">' . $banned_on_message . '</a>', 100, 'id') . td('<a class="action-ban" href="?event=discuss' . a . 'step=ipban_unban' . a . 'ip=' . $ip . '">' . gTxt('unban') . '</a>', '', 'actions'), ' class="' . ($ctr % 2 == 0 ? 'even' : 'odd') . '"');
            $ctr++;
        }
        echo '</tbody>' . endTable() . '</div>';
    } else {
        echo graf(gTxt('no_ips_banned'), ' class="indicator"');
    }
}
Пример #17
0
function require_privs($res, $user = '')
{
    if (!has_privs($res, $user)) {
        exit(pageTop('Restricted') . '<p class="restricted-area">' . gTxt('restricted_area') . '</p>');
    }
}
Пример #18
0
function ipban_list($message = '')
{
    pageTop(gTxt('list_banned_ips'), $message);
    $rs = safe_rows_start('*, unix_timestamp(date_banned) as uBanned', 'txp_discuss_ipban', "1 = 1 order by date_banned desc");
    if ($rs and numRows($rs) > 0) {
        echo startTable('list') . tr(hCell(gTxt('date_banned')) . hCell(gTxt('IP')) . hCell(gTxt('name_used')) . hCell(gTxt('banned_for')) . hCell());
        while ($a = nextRow($rs)) {
            extract($a);
            echo tr(td(safe_strftime('%d %b %Y %I:%M %p', $uBanned), 100) . td($ip, 100) . td($name_used, 100) . td('<a href="?event=discuss' . a . 'step=discuss_edit' . a . 'discussid=' . $banned_on_message . '">' . $banned_on_message . '</a>', 100) . td('<a href="?event=discuss' . a . 'step=ipban_unban' . a . 'ip=' . $ip . '">' . gTxt('unban') . '</a>'));
        }
        echo endTable();
    } else {
        echo graf(gTxt('no_ips_banned'), ' class="indicator"');
    }
}
Пример #19
0
function require_privs($res, $user = '')
{
    if (!has_privs($res, $user)) {
        exit(pageTop('Restricted') . '<p style="margin-top:3em;text-align:center">' . gTxt('restricted_area') . '</p>');
    }
}
Пример #20
0
<?php

// make a symbolic link to this file and it will render the markdown
// in the corresponding .txt file
include "harpfunctions.php";
$fname = str_replace(".php", ".txt", $_SERVER['SCRIPT_FILENAME']);
$file = file($fname);
$title = $file[0];
if (substr($title, 0, 1) == "<") {
    $title = "Home";
}
$filecontents = implode("", $file);
pageTop($title);
ob_start();
eval("?>{$filecontents}");
$stuff = ob_get_contents();
ob_end_clean();
print Markdown($stuff);
pageBottom();