Example #1
0
     if (isset($_FILES['avatar'])) {
         $avatar_flnm = basename($_FILES['avatar']['name']);
         $avatar_name = substr(bin2hex(md5($avatar_flnm . time(), true)), 0, 6);
         $ext = explode('.', $avatar_flnm);
         $avatar = "avatars/{$avatar_name}.{$ext[1]}";
         if (!move_uploaded_file($_FILES['avatar']['tmp_name'], $avatar)) {
             $avatar = 'inc/images/no-avatar.png';
         }
     } else {
         $avatar = 'inc/images/no-avatar.png';
     }
 } else {
     $avatar = "http://www.gravatar.com/avatar.php?size=50&gravatar_id=" . bin2hex(md5(trim($_POST['email']), true));
 }
 sql_query("INSERT INTO feeds VALUES (" . sql_autoid('feeds') . "," . "'" . sql_escape($_POST['url']) . "'," . "'" . sql_escape($_POST['email']) . "'," . "'{$avatar}'," . "0," . "'" . date('Y-m-d') . "');");
 sql_query("INSERT INTO users VALUES (" . sql_autoid('users') . "," . "'" . sql_escape($_POST['email']) . "'," . "'" . md5($_POST['pass']) . "'," . "'" . sql_escape($_POST['name']) . "'," . "'feed_owner');");
 sleep(1);
 refresh_cache();
 if (!sql_query) {
     $error = "An error occured. Try again later.";
 } else {
     $msg = "Your submission has been saved, you will be notified about when (if) your feed will be approved.";
     $to_notifiy = get_setting_value('reg_notifiy');
     if ($to_notifiy == 'on') {
         $admin_mail = sql_query("SELECT email FROM users WHERE role_level='admin';");
         $admin_mail = $admin_mail['email'];
         $mail_cont = nl2br("Someone has submited feed on <a href=\"" . get_home_link() . "\">" . get_title() . "</a> with following details:\n\t\t\t\t\t\n\t\t\t\t\tFeed URL: {$_POST['url']}\n\t\t\t\t\tSubmitters email: <a href=\"mailto:{$_POST['email']}\">{$_POST['email']}</a>\n\t\t\t\t\t---\n\t\t\t\t\tPowered by <a href=\"http://planetoid-project.org\">Planetoid</a>" . PLANETOID_VERSION . " - Generated on " . date('r'));
         mail($admin_mail, "Planetoid adminstration", $mail_cont, "From: Planetoid <*****@*****.**> \r\n" . "Content-Type: text/html; charset=UTF-8\r\n" . "X-Mailer: PHP/" . phpversion());
     }
 }
 // 			sql_close();
ini_set('session.gc_maxlifetime', 1209600);
ini_set('session.use_only_cookies', 1);
session_name('planetoid_admin');
session_start();
if ($_GET['ajax'] == 'true') {
    $ajax = true;
}
if (isset($_SESSION['uid']) && $_SESSION['ulevel'] == 'admin') {
    if (isset($_GET['dir'])) {
        require '../config.php';
        require '../planetoid.php';
        if ($ajax) {
            require 'plugins-functions.php';
        }
        $dir = sql_escape($_GET['dir']);
        sql_query("INSERT INTO settings VALUES (" . sql_autoid('settings') . ", 'plugin_{$dir}:active', 'true');");
        if (file_exists("../inc/plugins/{$dir}/activate.php")) {
            require_once "../inc/plugins/{$dir}/activate.php";
        }
        if ($ajax) {
            $links = str_replace("'", "\\'", generate_manage_links($dir));
            echo "\$('#{$dir}-row td:last').html('{$links}').parent().Highlight(500, '#64b31b');";
        } else {
            header("Location: {$_GET['r_to']}");
        }
        sql_close();
    } else {
        if ($ajax) {
            echo 'alert("An error occured.\\nTry again later.");';
        } else {
            header("Location: {$_GET['r_to']}?failed=true");
Example #3
0
function plugin_prepare_db($rows, $plugin_name)
{
    while (list($name, $value) = each($rows)) {
        sql_query("INSERT INTO settings VALUES (" . sql_autoid('settings') . ", 'plugin_{$plugin_name}:{$name}', '{$value}');");
    }
}
Example #4
0
    }
}
if (!$doing) {
    $n = 0;
    do {
        $start_caching = time();
        if (SQL_TYPE == 'pgsql') {
            $db_link = pg_connect('host=' . SQL_HOST . ' port=' . SQL_PORT . ' dbname=' . SQL_DB_NAME . ' user='******' password='******'Could not connect: ' . pg_last_error());
        } else {
            if (SQL_TYPE == 'mysql') {
                $db_link = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS) or die('Could not connect: ' . mysql_error());
                mysql_select_db(SQL_DB_NAME) or die('Fatal error: Failed to open connection to MySQL!<br/>Check your configuration');
            }
        }
        if ($n = 0) {
            sql_query("INSERT INTO settings VALUES(" . sql_autoid('settings') . ", 'pcron', 'true');");
        } else {
            sql_query("UPDATE settings SET value='true' WHERE name='pcron';");
        }
        $feeds = array();
        $feeds_d = array();
        $feeds_q = sql_get_array("SELECT * FROM feeds;");
        for ($n = 0; $n < count($feeds_q); $n++) {
            $feed = $feeds_q[$n];
            if ($feed['approved'] == 1) {
                $feeds[] = $feed['url'];
            }
            $feeds_d[] = $feed;
        }
        cache(serialize($feeds), $feeds_ch);
        cache(serialize($feeds_d), $feeds_d_ch);
Example #5
0
sql_action("INSERT INTO settings VALUES (" . sql_autoid('settings') . ", 'description', '" . sql_escape($_POST['desc']) . "');");
sleep(1);
sql_action("INSERT INTO settings VALUES (" . sql_autoid('settings') . ", 'base_url', '" . sql_escape($_POST['dir']) . "');");
sql_action("INSERT INTO settings VALUES (" . sql_autoid('settings') . ", 'base_link', '" . sql_escape($_POST['link']) . "');");
sql_action("INSERT INTO settings VALUES (" . sql_autoid('settings') . ", 'show_reg_button', 'on');");
sleep(1);
sql_action("INSERT INTO settings VALUES (" . sql_autoid('settings') . ", 'reg_notify', 'on');");
sql_action("INSERT INTO settings VALUES (" . sql_autoid('settings') . ", 'theme_dir_name', 'default');");
sql_action("INSERT INTO settings VALUES (" . sql_autoid('settings') . ", 'posts_num', '0');");
sleep(1);
sql_action("INSERT INTO settings VALUES (" . sql_autoid('settings') . ", 'date_format', 'j\\<\\s\\u\\p\\>S\\<\\/\\s\\u\\p\\> M Y');");
sql_action("INSERT INTO settings VALUES (" . sql_autoid('settings') . ", 'title_regexp', '');");
sql_action("INSERT INTO settings VALUES (" . sql_autoid('settings') . ", 'content_regexp', '');");
sleep(1);
sql_action("INSERT INTO settings VALUES (" . sql_autoid('settings') . ", 'install_time', '" . time() . "');");
sql_action("INSERT INTO settings VALUES (" . sql_autoid('settings') . ", 'installed', 'true');");
sql_close();
?>

		<strong>Congratulations! Planetoid has been successfully installed!</strong>
		<hr/>
			Proceed to:
			<ul>
				<li><a href="cron.php?to=./&amp;force_rdr=true"><?php 
echo $_POST['title'];
?>
 homepage</a></li>
				<li><a href="admin/">Admin pages</a></li>
			</ul>
			<hr/>
			<div class="info">
Example #6
0
 include '../planetoid.php';
 if ($ajax) {
     include 'feeds-functions.php';
 }
 if (isset($_FILES['avatar'])) {
     $avatar_flnm = basename($_FILES['avatar']['name']);
     $avatar_name = substr(md5($avatar_flnm . time()), 0, 6);
     $ext = explode('.', $avatar_flnm);
     $avatar = "avatars/{$avatar_name}.{$ext[1]}";
     if (!move_uploaded_file($_FILES['avatar']['tmp_name'], '../' . $avatar)) {
         $avatar = 'inc/images/no-avatar.png';
     }
 } else {
     $avatar = 'inc/images/no-avatar.png';
 }
 $insert = sql_query("INSERT INTO feeds VALUES (" . sql_autoid('feeds') . ", '" . sql_escape($_POST['url']) . "', '" . sql_escape($_POST['email']) . "', '{$avatar}', " . sql_escape($_POST['approved']) . ", '" . date('Y-m-d') . "');");
 if (!$insert) {
     if ($ajax) {
         echo "alert('An error occured.');";
     } else {
         header("Location: {$_POST['r_to']}?e=true");
     }
     exit(1);
 }
 if ($ajax) {
     sleep(1);
     $id = sql_action("SELECT id FROM feeds WHERE url='" . sql_escape($_POST['url']) . "';");
     $id = $id['id'];
     $links = generate_manage_links($id, $feed['approved']);
     $manage = $links['manage'];
     $new_note = $links['new_note'];