コード例 #1
0
ファイル: submit.php プロジェクト: hackingman/LinkX
function lxShConfirm()
{
    global $DB, $C, $L, $t;
    if (isset($_REQUEST['id'])) {
        $confirmation = $DB->Row('SELECT * FROM lx_link_confirms WHERE confirmation_id=?', array($_REQUEST['id']));
        // Valid code, confirm link
        if ($confirmation) {
            // Get category
            $category = $DB->Row('SELECT * FROM lx_link_cats JOIN lx_categories USING (category_id) WHERE link_id=?', array($confirmation['link_id']));
            // Set status
            $status = 'active';
            if ($category['status'] == 'approval') {
                $status = 'pending';
            }
            $DB->Update('UPDATE lx_links SET status=? WHERE link_id=?', array($status, $confirmation['link_id']));
            $DB->Update('DELETE FROM lx_link_confirms WHERE link_id=?', array($confirmation['link_id']));
            $link = $DB->Row('SELECT * FROM lx_links JOIN lx_link_fields USING (link_id) WHERE lx_links.link_id=?', array($confirmation['link_id']));
            // Update category link count
            if ($status == 'active') {
                $DB->Update('UPDATE lx_categories SET links=links+1 WHERE category_id=?', array($category['category_id']));
            }
            unset($link['password']);
            // Get user defined fields
            $fields =& GetUserLinkFields($link);
            // Show confirmation page
            $t->assign_by_ref('user_fields', $fields);
            $t->assign_by_ref('link', $link);
            $t->assign('status', $status);
            $t->display('submit-added.tpl');
            flush();
            // Send e-mail to appropriate administrators
            $result = $DB->Query('SELECT * FROM lx_administrators');
            while ($admin = $DB->NextRow($result)) {
                if ($admin['notifications'] & E_LINK_ADD) {
                    SendMail($admin['email'], 'email-admin-link-add.tpl', $t);
                }
            }
            $DB->Free($result);
            return;
        }
    }
    $t->assign('error', $L['INVALID_CONFIRMATION']);
    $t->display('error-nice.tpl');
}
コード例 #2
0
if (!defined('LINKX')) {
    die("Access denied");
}
$defaults = array('status' => 'active', 'type' => 'regular');
if (!isset($_REQUEST['analyzed'])) {
    $_REQUEST = array_merge($_REQUEST, $defaults);
}
// Get settings from last import
if (!is_array($_REQUEST['fields'])) {
    $last_import = GetValue('last_import');
    if ($last_import != null) {
        $_REQUEST['fields'] = unserialize($last_import);
    }
}
$fields = explode('|', FileReadLine("{$GLOBALS['BASE_DIR']}/data/{$filename}"));
$user_fields =& GetUserLinkFields();
$jscripts = array('includes/calendar.js');
$csses = array('includes/calendar.css');
include_once 'includes/header.php';
include_once 'includes/menu.php';
?>

<script language="JavaScript">
var popup = null;

$(function()
{
    if( $('#category_id').val() != '' )
    {
        updateSelected($('#category_id').val(), '#category_id');
    }