Ejemplo n.º 1
0
            setQuery("CREATE TABLE `style` (\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t  `name` varchar(30) NOT NULL,\n\t\t\t  `css` varchar(30) NOT NULL,\n\t\t\t  `primarycolor` varchar(30) NOT NULL,\n\t\t\t  `secondarycolor` varchar(30) NOT NULL,\n\t\t\t  `backgroundcolor` varchar(30) NOT NULL,\n\t\t\t  `scrollbar` varchar(30) NOT NULL,\n\t\t\t  `markup` varchar(30) NOT NULL,\n\t\t\t  PRIMARY KEY (`id`)\n\t\t\t) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1");
            setQuery("INSERT INTO `style` (`id`, `name`, `css`, `primarycolor`, `secondarycolor`, `backgroundcolor`, `scrollbar`, `markup`) VALUES\n\t\t\t(1, 'Standard', 'standard.css', '#428BCA', '#EDF9FC', '#FFFFFF', 'dark-thick', 'highlight.xcode.css')");
            setQuery("DROP TABLE IF EXISTS `user`");
            setQuery("CREATE TABLE `user` (\n\t\t\t  `username` varchar(20) NOT NULL,\n\t\t\t  `display_name` varchar(30) NOT NULL,\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t  `password` varchar(255) NOT NULL,\n\t\t\t  `online` int(11) NOT NULL DEFAULT '0',\n\t\t\t  `status` int(11) NOT NULL DEFAULT '1',\n\t\t\t  `status_message` varchar(100) NOT NULL,\n\t\t\t  `image` int(11) DEFAULT NULL,\n\t\t\t  `is_typing` int(11) NOT NULL DEFAULT '0',\n\t\t\t  `language` int(11) NOT NULL DEFAULT '1',\n\t\t\t  `mute_sounds` int(11) NOT NULL DEFAULT '0',\n\t\t\t  `last_activity` int(11) NOT NULL DEFAULT '0',\n\t\t\t  `style` int(11) NOT NULL DEFAULT '1',\n\t\t\t  PRIMARY KEY (`id`)\n\t\t\t) ENGINE=InnoDB DEFAULT CHARSET=latin1");
            setQuery('INSERT INTO `user` (`username`, `display_name`, `password`, `status_message`) VALUES 
				("' . strtolower($connection->real_escape_string($_POST['username'])) . '", "' . $connection->real_escape_string($_POST["display"]) . '", "' . password_hash($connection->real_escape_string($_POST['password']), PASSWORD_DEFAULT) . '", "")');
            setQuery("DROP TABLE IF EXISTS `user_session`");
            setQuery("CREATE TABLE `user_session` (\n\t\t\t  `id` int(11) NOT NULL,\n\t\t\t  `token` varchar(255) DEFAULT NULL\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=latin1");
            setQuery("DROP TABLE IF EXISTS `edited_message`");
            setQuery("CREATE TABLE `edited_message` (\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t  `message` int(11) NOT NULL,\n\t\t\t  `timestamp` int(11) NOT NULL,\n\t\t\t  PRIMARY KEY(`id`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=latin1");
            setQuery("DROP TABLE IF EXISTS `language`");
            setQuery("CREATE TABLE `language` (\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t  `name` varchar(30) DEFAULT NULL,\n\t\t\t  `local_name` varchar(30) DEFAULT NULL,\n\t\t\t  PRIMARY KEY(`id`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=latin1");
            setQuery('INSERT INTO `language` (`name`, `local_name`) VALUES ("english", "English")');
            setQuery('INSERT INTO `language` (`name`, `local_name`) VALUES ("norwegian", "Norsk")');
            //Write to .ini file
            createIniFile($_POST["ip"], $_POST["db_user"], $_POST["db_password"], $_POST["db_name"]);
            // Redirect browser
            header("Location: ./index.php");
            //Delete this file upon completion
            //unlink(__FILE__);
        }
    }
}
?>

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta http-equiv="content-type" content="text/html; charset=UTF-8">
		<meta charset="utf-8">
		<title>Install Svada Chat Client</title>
Ejemplo n.º 2
0
foreach ($jso->emotes as $text => $image) {
    $images[$text] = $image->image_id;
}
/*
 * If our container folder already exists, remove the old theme file. To spare
 * bandwidth, we will only re-download images if they do not exist.
 */
if (is_dir(PIDGIN_HOME . '/SpazTwitch')) {
    if (file_exists(PIDGIN_HOME . '/SpazTwitch/theme')) {
        unlink(PIDGIN_HOME . '/SpazTwitch/theme');
    }
} elseif (!mkdir(PIDGIN_HOME . '/SpazTwitch', 0755, true)) {
    die('Failed to create location.');
}
$dirPath = realpath(PIDGIN_HOME . '/SpazTwitch');
$conf = createIniFile($dirPath);
$conf->fwrite('[default]' . PHP_EOL);
foreach ($images as $keyword => $imageID) {
    $line = "{$imageID}.png\t\t{$keyword}" . PHP_EOL;
    $conf->fwrite($line);
    /*
     * Download the image file.
     */
    $imgFile = preg_replace('/{image_id}/', $imageID, $templateUrl);
    /*
     * PHP cannot handle URIs without protocol, so add http.
     */
    if (substr($imgFile, 0, 2) == '//') {
        $imgFile = 'http:' . $imgFile;
    }
    /*