Example #1
0
include "../include.php";
if ($posting) {
    if (isset($_POST['order'])) {
        $counter = 1;
        foreach ($_POST['order'] as $link_id) {
            db_query('UPDATE spotlight SET precedence = ' . $counter . ' WHERE id = ' . $link_id);
            $counter++;
        }
        die(drawSpotlight());
    } else {
        $id = db_enter('spotlight', 'title url precedence');
        if ($uploading && file_ext($_FILES["userfile"]['name']) == 'jpg') {
            define('DIRECTORY_ROOT', $_SERVER['DOCUMENT_ROOT']);
            define('DIRECTORY_WRITE', '/uploads');
            $image = format_image($_FILES["userfile"]["tmp_name"], 'jpg');
            $image = format_image_resize($image, 320, 320);
            file_put('/uploads/spotlight/' . $id . '.jpg', $image);
        }
        url_change();
    }
} elseif (!empty($_GET['id']) && url_action('delete')) {
    db_query('DELETE FROM spotlight WHERE id = ' . $_GET['id']);
    url_query_drop('action,id');
}
drawTop();
?>
<table cellspacing="1" class="left draggable spotlight">
	<thead>
		<?php 
echo drawHeaderRow(false, 5, "new", "#bottom");
?>
Example #2
0
    }
}
echo '</ul>';
//fix table data
echo draw_h3('Fix Table Data');
echo '<ul>';
//null passwords
db_query('UPDATE users SET language_id = 1');
db_query('UPDATE users SET email = "*****@*****.**" WHERE id = 1');
echo draw_li('passwords have been nulled');
//fix images
$users = db_table('SELECT id, image_large FROM users WHERE image_large IS NOT NULL');
foreach ($users as $u) {
    db_query('UPDATE users SET 
			image_medium = ' . format_binary(format_image_resize($u['image_large'], 135)) . ',
			image_small = ' . format_binary(format_image_resize($u['image_large'], 50)) . '	
		WHERE id = ' . $u['id']);
}
echo draw_li('images have been fixed');
//pages url should only be page name
db_query('UPDATE pages SET is_active = 1');
$pages = db_table('SELECT id, url FROM pages WHERE url LIKE "%/%"');
if ($pages) {
    foreach ($pages as $p) {
        $pageparts = explode('/', $p['url']);
        $p['url'] = trim($pageparts[count($pageparts) - 1]);
        db_query('UPDATE pages SET url = "' . $p['url'] . '" WHERE id = ' . $p['id']);
    }
    echo draw_li('corrected ' . count($pages) . ' pages');
} else {
    echo draw_li('pages are all correct');
Example #3
0
include '../include.php';
if ($posting) {
    //debug();
    //check to make sure email not already assigned to an active user
    if (!$editing && ($id = db_grab('SELECT id FROM users WHERE is_active = 1 AND email = "' . $_POST['email'] . '"'))) {
        url_change('view.php?id=' . $id);
    }
    langTranslatePost('bio,title');
    if (!getOption('languages')) {
        $_POST['language_id'] = 1;
    }
    if ($uploading) {
        $_POST['image_large'] = format_image_resize(file_get_uploaded('image_large'), 240);
        $_POST['image_medium'] = format_image_resize($_POST['image_large'], 135);
        $_POST['image_small'] = format_image_resize($_POST['image_large'], 50);
    }
    //check for long distance codes
    if (getOption('staff_ldcode')) {
        if ($_POST['officeID'] == 1) {
            if (!url_id() || !db_grab('SELECT longDistanceCode FROM users WHERE id = ' . url_id())) {
                //user doesn't have a long distance code but needs one
                if (!($code = db_grab('SELECT l.code FROM ldcodes l WHERE (SELECT COUNT(*) FROM users u WHERE u.longDistanceCode = l.code AND u.is_active = 1) = 0'))) {
                    error_hande('out of codes', 'the intranet is out of long distance codes to assign to new users, such as for ' . $_POST['firstname'] . ' ' . $_POST['lastname']);
                } else {
                    $_POST['longDistanceCode'] = $code;
                }
            }
        }
    }
    $id = db_save('users');