<?php
/**
 *	Kolor
 *
 *	Theme by: Art Ramadani
 *	Developed by: Arlind Nushi
 *
 *	www.mobanbus.cn
 */
	
/* Setup Theme For the first time */
function kolor_activate_theme()
{
	global $wpdb;
	
	/* SQL Tables to Create */
	require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
	
	$prefix = $wpdb->prefix;
	
	$sql = "CREATE TABLE `{$prefix}laborator_simpleads` (
  `simplead_id` int(11) NOT NULL AUTO_INCREMENT,
  `group_id` int(11) NOT NULL,
  `url` longtext NOT NULL,
  `clicks` int(11) NOT NULL DEFAULT '0',
  `ad_image` longtext NOT NULL,
  `title` varchar(255) NOT NULL,
  PRIMARY KEY (`simplead_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;


CREATE TABLE `{$prefix}laborator_simpleads_groups` (
  `group_id` int(11) NOT NULL AUTO_INCREMENT,
  `group_name` varchar(255) NOT NULL,
  PRIMARY KEY (`group_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;";

	# Excute Query
	dbDelta($sql);
	
	# Redirect to Kolor Options Page
	wp_redirect(admin_url("admin.php?page=kolor_options&theme_activated=true"));
}