· 8 years ago · Feb 26, 2018, 03:50 AM
1<?php
2include_once('common.php');
3if( installed() && (empty($_GET['act']) || empty($_GET['cat'])) )
4 header("Location: $PSZ_APP_webpath/");
5if( installed() && isset($_GET['cat']) && $_GET['cat']!=$PSZ_APP_reset_code )
6 header("Location: $PSZ_APP_webpath/");
7
8$ajax_return_error = "{\"error\": 1, \"message\": \"PSZ_APP_alert('%s', '%s')\"}";
9$ajax_return_success = "{\"success\": 1, \"url\": \"%s\"}";
10
11// ajax post
12if( is_ajax_request() || (isset($_GET['act']) && $_GET['act']=='reset' && $_GET['cat']==$PSZ_APP_reset_code) )
13{
14 $quick_reinstallation = false;
15 //$site_domain = get_site_domain();
16 $site_domain = $_POST['domain'];
17
18 // theme
19 $themes = array(
20 array('gomymobi: FREE', ',1,2,5,6,7,8,9,13,'),
21 array('Premium Services', ',1,2,6,7,10,13,'),
22 array('Material Portfolio', ',2,4,6,7,8,10,11,13,'),
23 array('Great Products', ',1,2,4,6,7,8,9,10,11,13,'),
24 array('Tasteeee', ',1,2,8,12,'),
25 array('Gold Product', ',2,4,8,'),
26 array('Digital Studio', ',1,2,6,13,'),
27 array('App Coming Soon', ',1,2,7,13,'),
28 array('Blue App', ',1,2,7,13,'),
29 array('Blue Display', ',1,2,4,7,13,'),
30
31 array('Vintage Business', ',2,3,4,13,'),
32 array('My Resume', ',1,4,6,12,'),
33 array('Solid Company', ',2,4,7,13,'),
34 array('Converting Landing Pages', ',2,4,5,6,7,8,11,13,'),
35 array('Green Homepage', ',2,4,6,13,'),
36 array('Red Clean Portfolio', ',2,4,5,13,'),
37 array('Domainer', ',1,2,5,6,7,9,12,13,'),
38 array('Engage', ',1,2,4,5,8,13,'),
39 array('Photo Blog', ',4,8,13,'),
40 array('Grape App Landing', ',1,2,7,13,'),
41 array('Guide Landing Page', ',2,5,6,7,8,10,11,13,'),
42 array('Hold: Amazing Resume', ',4,8,12,13,'),
43 array('Hydrogen: Photo Gallery', ',2,4,5,13,'),
44 array('KreFolio: Startup Agency', ',1,2,4,5,6,7,8,13,'),
45 array('Light: Clean Homepage', ',2,3,4,6,13,'),
46 array('Magazine: Personal News', ',3,4,6,13,'),
47 array('Oleose: App Landing Page', ',1,2,7,13,'),
48 array('Outline: App Showcase', ',1,2,7,13,'),
49 array('Seven: App Landing Page', ',1,2,5,13,'),
50 array('Shield: Agency One Page', ',1,2,4,7,13,'),
51 array('Sprint: Light Portfolio', ',2,4,5,7,8,13,'),
52 array('Union: Project Team', ',1,2,4,5,13,'),
53 array('Aesthetic: PRO Business', ',2,4,6,13,'),
54
55 );
56 /*array('One Page', 'Themes with 1 built-in page only'), // $i=1
57 array('Business', 'Themes mainly built for onlines businesses or companies'),
58 array('Simply', 'Very nice but simple themes'),
59 array('Portfolio', 'Themes used to to create the stunning portfolio sites'),
60
61 array('Red', ''), // 5
62 array('Green', ''),
63 array('Blue', ''),
64 array('Orange', ''),
65 array('Grey', ''),
66 array('Pink', ''), // 10
67 array('Purple', ''),
68 array('Dark', ''),
69 array('Light', '')*/
70
71 if( $_GET['act']=='reset' && $_GET['cat']==$PSZ_APP_reset_code )
72 {
73 if( $_GET['cat']=='YOUR_SECRET_CODE_TO_REINSTALL_SYSTEM' || !$is_super_admin )
74 {
75 $pTemplate->assign_vars(array(
76 'ERROR_WORD' => 'Oops :’)',
77 'ERROR_TITLE' => __('Access denied'),
78 'ERROR_BODY' => __('You need the super administative privilege to access this area'),
79 'SYS_COPYRIGHT_TEXT'=> get_copyright()
80 ));
81
82 $pContent = $pTemplate->pparse_file( "template/errors.html" );
83 die( $pTemplate->pparse($pContent) );
84 }
85
86 $quick_reinstallation = true;
87
88 // replace with your correct information
89 $_POST = array(
90 'dbhost' => 'localhost', // database server
91 'dbname' => 'dbname', // database name on above database server
92 'dbuser' => 'dbuser', // database user granted on above database name
93 'dbpasswd' => 'dbpasswd', // password of above database user
94
95 'fullname' => 'SAdmin', // name of super administrative account
96 'email' => "hello@gomymobi.com", // email of super administrative account
97 'password' => "hello@gomymobi.com", // password of super administrative account
98 'rpassword' => "hello@gomymobi.com", // reenter password of super administrative account
99 'import_sample_data' => 1,
100 );
101
102 delete_file($PSZ_APP_TRANSACTION_LOGS . $PSZ_APP_SYS['payment']['log_file'] . '.txt');
103 }
104 //print_r($PSZ_APP_SYS);exit;
105
106 foreach($_POST as $k=>$v)
107 {
108 if( ($_POST[$k] = trim($v))=='' )
109 die( sprintf($ajax_return_error, __('Error'), __('Please fill all required fields')) );
110 }
111 //print_r($_POST);exit;
112
113 // validate email
114 if( !is_email($_POST['email']) )
115 die( sprintf($ajax_return_error, __('Email is Invalid'), __('Please check your email address again')) );
116
117 // validate password
118 if( $_POST['password'] != $_POST['rpassword'] )
119 die( sprintf($ajax_return_error, __('Passwords are not Matched'), __('Please check your passwords again')) );
120
121 $import_sample_data = $_POST['import_sample_data'];
122
123 // no error, setup
124 $keep_going_without_db = true;
125 $dbhost = $_POST['dbhost'];
126 $dbname = $_POST['dbname'];
127 $dbuser = $_POST['dbuser'];
128 $dbpasswd = $_POST['dbpasswd'];
129
130 include_once($PSZ_APP_root_dir . 'includes/db.mysqli.php');
131 //$db = new sql_db( $dbhost, $dbuser, $dbpasswd, $dbname, false );
132
133 if( !$db->mysqli )
134 {
135 if( $quick_reinstallation )
136 error_db_connection();
137
138 die( sprintf($ajax_return_error, __('Error'), __('Could not connect to the database')) );
139 }
140 else
141 {
142 $table_sql = array();
143 $table_sql[] = "CREATE TABLE IF NOT EXISTS `$PSZ_TABLE_FRONTPAGES` (
144 `id` mediumint(11) NOT NULL AUTO_INCREMENT,
145 `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
146 `slug` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
147 `user_id` int(11) NOT NULL,
148 `active` tinyint(1) NOT NULL DEFAULT '1',
149 `settings` text COLLATE utf8_unicode_ci,
150 `activated_time` int(11) NOT NULL DEFAULT '0',
151 `uploaded_time` int(11) NOT NULL DEFAULT '0',
152 `updated_time` int(11) NOT NULL DEFAULT '0',
153 `deleted_time` int(11) NOT NULL DEFAULT '0',
154 PRIMARY KEY (`id`),
155 UNIQUE KEY `slug` (`slug`)
156 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
157 $table_sql[] = "CREATE TABLE IF NOT EXISTS `$PSZ_TABLE_PAYMENTS` (
158 `id` int(11) NOT NULL AUTO_INCREMENT,
159 `transaction_id` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
160 `status` varchar(30) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
161 `type` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
162 `buyer_id` int(11) NOT NULL,
163 `seller_id` int(11) NOT NULL DEFAULT '0',
164 `item_id` int(11) unsigned NOT NULL COMMENT 'plan_id / theme_id',
165 `amount` float NOT NULL DEFAULT '0',
166 `currency` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
167 `period` tinyint(1) NOT NULL COMMENT 'plan period / theme prices',
168 `paid_time` int(11) NOT NULL DEFAULT '0',
169 `expire_time` int(11) NOT NULL DEFAULT '0',
170 `auto_renew` tinyint(1) NOT NULL DEFAULT '1',
171 `active` tinyint(1) NOT NULL DEFAULT '1',
172 PRIMARY KEY (`id`),
173 UNIQUE KEY `transaction_id` (`transaction_id`)
174 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
175 $table_sql[] = "CREATE TABLE IF NOT EXISTS `$PSZ_TABLE_PLANS` (
176 `id` mediumint(6) NOT NULL AUTO_INCREMENT,
177 `name` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
178 `settings` text COLLATE utf8_unicode_ci,
179 `active` tinyint(1) NOT NULL DEFAULT '1',
180 `created_time` int(11) NOT NULL DEFAULT '0',
181 `updated_time` int(11) NOT NULL DEFAULT '0',
182 `user_id` mediumint(11) NOT NULL DEFAULT '0',
183 PRIMARY KEY (`id`)
184 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
185 $table_sql[] = "CREATE TABLE IF NOT EXISTS `$PSZ_TABLE_PLAN_OPTIONS` (
186 `id` mediumint(9) NOT NULL AUTO_INCREMENT,
187 `name` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
188 `slug` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
189 `description` text COLLATE utf8_unicode_ci,
190 `type` tinyint(1) DEFAULT NULL,
191 `sorting` mediumint(2) DEFAULT NULL,
192 PRIMARY KEY (`id`),
193 UNIQUE KEY `name` (`name`)
194 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
195 $table_sql[] = "CREATE TABLE IF NOT EXISTS `$PSZ_TABLE_PLUGINS` (
196 `id` mediumint(6) NOT NULL AUTO_INCREMENT,
197 `name` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
198 `version` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
199 `slug` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
200 `settings` text COLLATE utf8_unicode_ci,
201 `author` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
202 `homepage` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
203 `user_id` mediumint(9) NOT NULL DEFAULT '0',
204 `created_time` int(11) NOT NULL DEFAULT '0',
205 `updated_time` int(11) NOT NULL DEFAULT '0',
206 `activated_time` int(11) NOT NULL DEFAULT '0',
207 PRIMARY KEY (`id`)
208 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
209 $table_sql[] = "CREATE TABLE IF NOT EXISTS `$PSZ_TABLE_SITES` (
210 `id` int(11) NOT NULL AUTO_INCREMENT,
211 `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
212 `subdomain` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
213 `domain` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
214 `FTP_settings` text COLLATE utf8_unicode_ci,
215 `shop_id` int(11) NOT NULL DEFAULT '0',
216 `user_id` int(11) NOT NULL,
217 `theme_id` int(11) NOT NULL,
218 `created_time` int(11) NOT NULL DEFAULT '0',
219 `updated_time` int(11) NOT NULL DEFAULT '0',
220 `published_time` int(11) NOT NULL DEFAULT '0',
221 `deleted_time` int(11) NOT NULL DEFAULT '0',
222 `total_visits` int(11) NOT NULL DEFAULT '0',
223 `total_pageviews` int(11) NOT NULL DEFAULT '0',
224 PRIMARY KEY (`id`),
225 UNIQUE KEY `subdomain` (`subdomain`)
226 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
227 $table_sql[] = "CREATE TABLE IF NOT EXISTS `$PSZ_TABLE_SITES_TRAFFIC` (
228 `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
229 `site_id` int(11) NOT NULL,
230 `user_id` int(11) NOT NULL,
231 `date` int(8) NOT NULL COMMENT 'Ymd',
232 `visit` int(11) NOT NULL DEFAULT '0',
233 `pageview` int(11) NOT NULL DEFAULT '1',
234 PRIMARY KEY (`id`),
235 UNIQUE KEY `site_id` (`site_id`,`date`)
236 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
237 $table_sql[] = "CREATE TABLE IF NOT EXISTS `$PSZ_TABLE_LOGS` (
238 `id` int(11) NOT NULL AUTO_INCREMENT,
239 `user_id` int(11) NOT NULL,
240 `item_id` int(11) NOT NULL,
241 `log_type` mediumint(3) NOT NULL,
242 `time` int(11) NOT NULL,
243 PRIMARY KEY (`id`)
244 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
245 $table_sql[] = "CREATE TABLE IF NOT EXISTS `$PSZ_TABLE_THEMES` (
246 `id` mediumint(11) NOT NULL AUTO_INCREMENT,
247 `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
248 `slug` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
249 `category` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
250 `user_id` int(11) NOT NULL,
251 `downloadable` tinyint(1) NOT NULL DEFAULT '0',
252 `status` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'for moderation: pending / passed',
253 `price_per_time` float unsigned NOT NULL DEFAULT '0',
254 `price_lifetime` float unsigned NOT NULL DEFAULT '0',
255 `uploaded_time` int(11) NOT NULL DEFAULT '0',
256 `updated_time` int(11) NOT NULL DEFAULT '0',
257 `published_time` int(11) NOT NULL DEFAULT '0',
258 `deleted_time` int(11) NOT NULL DEFAULT '0',
259 `total_creations` int(11) NOT NULL DEFAULT '0',
260 `total_previews` int(11) NOT NULL DEFAULT '0',
261 PRIMARY KEY (`id`),
262 UNIQUE KEY `slug` (`slug`)
263 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
264 $table_sql[] = "CREATE TABLE IF NOT EXISTS `$PSZ_TABLE_THEME_CATEGORIES` (
265 `id` int(9) NOT NULL AUTO_INCREMENT,
266 `name` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
267 `slug` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
268 `description` text COLLATE utf8_unicode_ci,
269 `sorting` mediumint(5) NOT NULL,
270 PRIMARY KEY (`id`),
271 UNIQUE KEY `name` (`name`)
272 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
273 $table_sql[] = "CREATE TABLE IF NOT EXISTS `$PSZ_TABLE_USERS` (
274 `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
275 `email` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
276 `email_payout` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
277 `fullname` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
278 `password` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
279 `account_type` tinyint(1) NOT NULL DEFAULT '1',
280 `plan_id` mediumint(6) NOT NULL DEFAULT '1',
281 `avatar` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
282 `settings` text COLLATE utf8_unicode_ci,
283 `require_password` tinyint(1) NOT NULL DEFAULT '1',
284 `verify` tinyint(1) NOT NULL DEFAULT '0',
285 `code` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
286 `active` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'user is active or disabled',
287 `registered_time` int(11) NOT NULL DEFAULT '0',
288 `last_login` int(11) NOT NULL DEFAULT '0',
289 `login_fail` tinyint(2) NOT NULL DEFAULT '0',
290 `login_locked_time` int(11) NOT NULL DEFAULT '0',
291 PRIMARY KEY (`email`),
292 UNIQUE KEY `id` (`id`)
293 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
294
295 // v.1.4
296 $table_sql[] = "CREATE TABLE IF NOT EXISTS `$PSZ_TABLE_STORES` (
297 `id` int(11) NOT NULL AUTO_INCREMENT,
298 `site_id` int(11) NOT NULL,
299 `user_id` int(11) NOT NULL,
300 `shop_theme_id` int(9) NOT NULL DEFAULT '1',
301 `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
302 `slug` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
303 `phones` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
304 `email` varchar(80) COLLATE utf8_unicode_ci DEFAULT NULL,
305 `status` tinyint(1) NOT NULL DEFAULT '1',
306 `payment` text COLLATE utf8_unicode_ci,
307 `shipping_cost` float NOT NULL DEFAULT '0',
308 `currency` char(3) COLLATE utf8_unicode_ci NOT NULL,
309 `currency_position` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
310 `sign_thousand` char(1) COLLATE utf8_unicode_ci NOT NULL,
311 `sign_decimal` char(1) COLLATE utf8_unicode_ci NOT NULL,
312 `decimals` tinyint(1) NOT NULL DEFAULT '2',
313 `created_time` int(11) NOT NULL DEFAULT '0',
314 `updated_time` int(11) NOT NULL DEFAULT '0',
315 `published_time` int(11) NOT NULL DEFAULT '0',
316 `deleted_time` int(11) NOT NULL DEFAULT '0',
317 `logo` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
318 `favicon` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
319 `title` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
320 `description` text COLLATE utf8_unicode_ci NOT NULL,
321 `keywords` text COLLATE utf8_unicode_ci NOT NULL,
322 `custom_header` text COLLATE utf8_unicode_ci NOT NULL,
323 `custom_footer` text COLLATE utf8_unicode_ci NOT NULL,
324 `options` longtext COLLATE utf8_unicode_ci,
325 `widgets` longtext COLLATE utf8_unicode_ci,
326 `visits` int(11) NOT NULL DEFAULT '0',
327 `pageviews` int(11) NOT NULL DEFAULT '0',
328 PRIMARY KEY (`id`),
329 UNIQUE KEY `site_id` (`site_id`,`user_id`)
330 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
331 $table_sql[] = "CREATE TABLE IF NOT EXISTS `$PSZ_TABLE_STORE_CATEGORIES` (
332 `id` int(11) NOT NULL AUTO_INCREMENT,
333 `shop_id` int(11) NOT NULL,
334 `user_id` int(11) NOT NULL,
335 `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
336 `slug` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
337 `icon` text COLLATE utf8_unicode_ci,
338 `parent` int(11) NOT NULL DEFAULT '0',
339 `active` tinyint(1) NOT NULL DEFAULT '1',
340 `pageviews` int(11) NOT NULL,
341 `description` text COLLATE utf8_unicode_ci NOT NULL,
342 `sorting` tinyint(2) NOT NULL DEFAULT '1',
343 `created_time` int(11) NOT NULL DEFAULT '0',
344 `updated_time` int(11) NOT NULL DEFAULT '0',
345 PRIMARY KEY (`id`),
346 UNIQUE KEY `shop_id` (`shop_id`,`user_id`,`name`)
347 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
348 $table_sql[] = "CREATE TABLE IF NOT EXISTS `$PSZ_TABLE_STORE_ITEMS` (
349 `id` int(11) NOT NULL AUTO_INCREMENT,
350 `shop_id` int(11) NOT NULL,
351 `user_id` int(11) NOT NULL,
352 `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
353 `slug` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
354 `summary` text COLLATE utf8_unicode_ci,
355 `description` text COLLATE utf8_unicode_ci NOT NULL,
356 `stock` tinyint(1) NOT NULL DEFAULT '1',
357 `featured` tinyint(1) NOT NULL DEFAULT '0',
358 `active` tinyint(1) NOT NULL DEFAULT '1',
359 `item_type` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
360 `item_sold` mediumint(6) NOT NULL DEFAULT '0',
361 `price_regular` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
362 `price_sale` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
363 `schedule_start` datetime DEFAULT NULL,
364 `schedule_end` datetime DEFAULT NULL,
365 `parent` int(11) DEFAULT NULL,
366 `sold_single` tinyint(1) NOT NULL DEFAULT '0',
367 `price_subscription` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
368 `subscription_per` char(1) COLLATE utf8_unicode_ci DEFAULT NULL,
369 `subscription_period` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
370 `subscription_for` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL,
371 `signup_fee` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
372 `trial` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
373 `trial_period` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
374 `digital` tinyint(1) NOT NULL DEFAULT '0',
375 `shipping_cost` float NOT NULL DEFAULT '0',
376 `downloadable` tinyint(1) NOT NULL DEFAULT '0',
377 `download_type` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
378 `files` text COLLATE utf8_unicode_ci NOT NULL,
379 `sorting` mediumint(6) NOT NULL DEFAULT '0',
380 `review` tinyint(1) NOT NULL DEFAULT '1',
381 `images` text COLLATE utf8_unicode_ci NOT NULL,
382 `created_time` int(11) NOT NULL DEFAULT '0',
383 `updated_time` int(11) NOT NULL DEFAULT '0',
384 `published_time` int(11) NOT NULL,
385 `deleted_time` int(11) NOT NULL DEFAULT '0',
386 `pageviews` int(11) NOT NULL DEFAULT '0',
387 PRIMARY KEY (`id`),
388 UNIQUE KEY `shop_id` (`shop_id`,`user_id`,`name`)
389 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
390 $table_sql[] = "CREATE TABLE IF NOT EXISTS `$PSZ_TABLE_STORE_ORDERS` (
391 `id` int(11) NOT NULL AUTO_INCREMENT,
392 `shop_id` int(11) NOT NULL,
393 `user_id` int(11) NOT NULL,
394 `member_id` int(11) NOT NULL DEFAULT '0',
395 `key` char(17) COLLATE utf8_unicode_ci NOT NULL,
396 `transaction_id` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
397 `buyer` text COLLATE utf8_unicode_ci,
398 `items` longtext COLLATE utf8_unicode_ci,
399 `payment` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
400 `payment_detail` text COLLATE utf8_unicode_ci NOT NULL,
401 `total` float NOT NULL,
402 `ship` text COLLATE utf8_unicode_ci NOT NULL,
403 `notes` text COLLATE utf8_unicode_ci NOT NULL,
404 `status` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
405 `created_time` int(11) NOT NULL,
406 `updated_time` int(11) NOT NULL DEFAULT '0',
407 `processed_time` int(11) NOT NULL DEFAULT '0',
408 `deleted_time` int(11) NOT NULL DEFAULT '0',
409 PRIMARY KEY (`id`),
410 UNIQUE KEY `key` (`key`)
411 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
412 $table_sql[] = "CREATE TABLE IF NOT EXISTS `$PSZ_TABLE_STORE_PAGES` (
413 `id` int(11) NOT NULL AUTO_INCREMENT,
414 `shop_id` int(11) NOT NULL,
415 `user_id` int(11) NOT NULL,
416 `name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
417 `slug` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
418 `short` text COLLATE utf8_unicode_ci NOT NULL,
419 `full` text COLLATE utf8_unicode_ci NOT NULL,
420 `active` tinyint(1) NOT NULL DEFAULT '1',
421 `sorting` mediumint(6) NOT NULL DEFAULT '0',
422 `pageviews` int(11) unsigned NOT NULL,
423 `created_time` int(11) NOT NULL,
424 `updated_time` int(11) NOT NULL DEFAULT '0',
425 `published_time` int(11) NOT NULL DEFAULT '0',
426 `deleted_time` int(11) NOT NULL DEFAULT '0',
427 PRIMARY KEY (`id`),
428 UNIQUE KEY `unique` (`shop_id`,`user_id`,`name`)
429 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
430 $table_sql[] = "CREATE TABLE IF NOT EXISTS `$PSZ_TABLE_STORE_TAGS` (
431 `id` int(11) NOT NULL AUTO_INCREMENT,
432 `shop_id` int(11) NOT NULL,
433 `user_id` int(11) NOT NULL,
434 `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
435 `slug` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
436 `pageviews` int(11) NOT NULL,
437 `created_time` int(11) NOT NULL,
438 `updated_time` int(11) NOT NULL DEFAULT '0',
439 PRIMARY KEY (`id`),
440 UNIQUE KEY `unique` (`shop_id`,`user_id`,`name`)
441 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
442 $table_sql[] = "CREATE TABLE IF NOT EXISTS `$PSZ_TABLE_STORE_TERMS` (
443 `id` int(11) NOT NULL AUTO_INCREMENT,
444 `hosted_id` int(11) NOT NULL COMMENT 'item id',
445 `value_id` int(11) NOT NULL COMMENT 'tag / category id',
446 `type` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
447 `created_time` int(11) NOT NULL DEFAULT '0',
448 PRIMARY KEY (`id`),
449 UNIQUE KEY `term` (`hosted_id`,`value_id`,`type`)
450 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
451 //$table_sql[] = "";
452
453 $logs = array();
454 $setup_time = time();
455 $logs[] = "INSERT INTO $PSZ_TABLE_LOGS(`user_id`, `item_id`, `log_type`, `time`) VALUES(1, 0, $PSZ_LOG_SYS_SETTING_UPDATED, $setup_time)";
456
457 // add plans
458 $plans = array(
459 1 => array(__('FREE'), 'YToyMTp7aToxO3M6NDoiRlJFRSI7aToyO3M6MjE6IkJ1aWxkIHlvdXIgZW1waXJlIE5PVyI7aTozO3M6NzI6IkVuam95IG91ciBtb2Rlcm4gdG9vbHMgdG8gY3JlYXRlIHlvdXIgYnVzaW5lc3Mgc2l0ZSBmb3IgRlJFRSBmb3JldmVyPGJyPiI7aTo0O3M6MToiMSI7aTo1O3M6MToiMCI7aTo2O3M6MToiMCI7aTo3O3M6MToiMCI7aTo4O3M6MToiMCI7aTo5O3M6MToiMSI7aToxMDtzOjE6IjEiO2k6MTI7czo4OiJKb2luIE5PVyI7aToxMztzOjI6Im5tIjtpOjE0O3M6NDoiYmx1ZSI7aToxNTtzOjQ6ImJsdWUiO2k6MTE7czoxOiIwIjtpOjE2O3M6MToiMCI7aToxNztzOjE6IjAiO2k6MTg7czoxOiIwIjtpOjE5O3M6MToiMCI7aToyMDtzOjE6IjEiO2k6MjE7czoxOiIwIjt9'),
460 2 => array(__('Starter'), 'YToyNTp7aToxO3M6NzoiU3RhcnRlciI7aToyO3M6MjM6IkJlc3QgZm9yIFNtYWxsIEJ1c2luZXNzIjtpOjM7czo3NzoiUHJlc2VudCB5b3VyIGJ1c2luZXNzIHRvIHRoZSB3b3JsZCB3aXRob3V0IGtub3dpbmcgY29kaW5nICZhbXA7IGRlc2lnbiBza2lsbHMiO2k6NDtzOjE6IjUiO2k6NTtzOjE6IjQiO2k6NjtzOjI6IjEwIjtpOjc7czoyOiIxOCI7aTo4O3M6MjoiMjUiO2k6OTtzOjE6IjAiO2k6MTA7czoxOiIxIjtpOjEyO3M6MTE6IkdldCBTdGFydGVkIjtpOjEzO3M6MjoibGciO2k6MTQ7czoxNToicmVkLXRodW5kZXJiaXJkIjtpOjE1O3M6MTI6InJlZC1mbGFtaW5nbyI7aToxMTtzOjE6IjAiO2k6MTY7czoxOiIxIjtpOjE3O3M6MToiMSI7aToxODtpOjE7aToxOTtzOjE6IjEiO2k6MjA7czoxOiIxIjtpOjIxO3M6MToiMSI7aToyMjtpOjE7aToyMztpOjEwO2k6MjQ7aTo1O2k6MjU7aTo1MDt9'),
461 3 => array(__('Business +'), 'YToyNTp7aToxO3M6MTA6IkJ1c2luZXNzICsiO2k6MjtzOjIwOiJGb3IgeW91ciBPbmxpbmUgU2hvcCI7aTozO3M6MTA1OiJFYXN5IHdheSB0byBidWlsZCB5b3VyIG9ubGluZSBzaG9wICZhbXA7IGdyZWF0IHNvbHV0aW9uIHRvIHNlbGwgeW91ciBhd2Vzb21lIHByb2R1Y3QgdG8gdGhlIHdvcmxkPGJyPjxicj4iO2k6NDtzOjM6IjEwMCI7aTo1O3M6MjoiMTAiO2k6NjtzOjI6IjI0IjtpOjc7czoyOiIzOSI7aTo4O3M6MjoiNjYiO2k6OTtzOjE6IjAiO2k6MTA7czoxOiIxIjtpOjEyO3M6MTA6IkJ1aWxkIFNob3AiO2k6MTM7czoyOiJsZyI7aToxNDtzOjE1OiJncmVlbi10dXJxdW9pc2UiO2k6MTU7czoxMjoiZ3JlZW4tanVuZ2xlIjtpOjExO3M6MToiMSI7aToxNjtzOjE6IjEiO2k6MTc7czoxOiIxIjtpOjE4O2k6MTtpOjE5O3M6MToiMSI7aToyMDtzOjE6IjEiO2k6MjE7czoxOiIxIjtpOjIyO2k6MTAwO2k6MjM7aTowO2k6MjQ7aTowO2k6MjU7aTowO30='),
462 4 => array(__('UNLIMITED'), 'YToyNTp7aToxO3M6OToiVU5MSU1JVEVEIjtpOjI7czoyNDoiRm9yIGdvbXltb2JpJ3MgUmVzZWxsZXJzIjtpOjM7czoxMTA6IkFjY2VzcyBVTkxJTUlURUQgaGlnaC1wb3dlcmVkIHRvb2xzIHRvIG1heGltaXplIHlvdXIgYnVzaW5lc3MnIGVmZmljaWVuY3kgYW5kIHByb2ZpdHMgd2l0aCBnb215bW9iaSdzIHBsYXRmb3JtIjtpOjQ7czoxOiIwIjtpOjU7czoyOiIxNSI7aTo2O3M6MjoiMzkiO2k6NztzOjI6IjY5IjtpOjg7czoyOiI5OSI7aTo5O3M6MjoiMTUiO2k6MTA7czoxOiIwIjtpOjEyO3M6NzoiQnV5IE5PVyI7aToxMztzOjI6ImxnIjtpOjE0O3M6MTM6InB1cnBsZS1zZWFuY2UiO2k6MTU7czoxMzoicHVycGxlLW1lZGl1bSI7aToxMTtzOjE6IjAiO2k6MTY7czoxOiIxIjtpOjE3O3M6MToiMSI7aToxODtpOjE7aToxOTtzOjE6IjEiO2k6MjA7czoxOiIxIjtpOjIxO3M6MToiMSI7aToyMjtpOjA7aToyMztpOjA7aToyNDtpOjA7aToyNTtpOjA7fQ==')
463
464 );
465 foreach($plans as $k=>$plan)
466 {
467 $table_sql[] = "INSERT INTO $PSZ_TABLE_PLANS(`id`, `name`, `settings`, `created_time`, `user_id`) VALUES(" . $k . ", '".$plan[0]."', '".$plan[1]."', ".$setup_time.", 1);";
468 $logs[] = "INSERT INTO $PSZ_TABLE_LOGS(`user_id`, `item_id`, `log_type`, `time`) VALUES(1, $k, $PSZ_LOG_PLAN_CREATED, $setup_time)";
469 }
470
471 // add plan options
472 $plans_options = array(
473 array(__('Name'), __('Name of plan'), 2),
474 array(__('Sub heading'), __('Sub heading for Name'), 2),
475 array(__('Plan Description'), '', 3),
476 array(__('Maximum sites'), __('Number of sites members may create'), 1),
477 array(__('Monthly'), __('Monthly price'), 1),
478 array(__('3 Months'), __('Price for 3 months plan'), 1),
479 array(__('6 Months'), __('Price for 6 months plan'), 1),
480 array(__('Annual'), __('Annual price'), 1),
481 array(__('Price for First Month'), __('0: FREE for First Month'), 1),
482 array(__(' Apply First Price to all periods '), __(' Apply "%s" to all periods '), 4),
483 array(__('Featured'), __('This plan is featured?'), 4),
484 array(__('Buy Button'), __('Label for Buy button'), 2),
485 array(__('Button Size'), 'lg=Large\r\nnm=Normal\r\nsm=Small\r\nxs=Extra Small', 5),
486 array(__('Button Color'), 'blue\r\nblue-hoki\r\nblue-steel\r\nblue-madison\r\nblue-chambray\r\nblue-ebonyclay\r\n\r\ngreen\r\ngreen-meadow\r\ngreen-seagreen\r\ngreen-turquoise\r\ngreen-haze\r\ngreen-jungle\r\n\r\nred\r\nred-pink\r\nred-sunglo\r\nred-intense\r\nred-thunderbird\r\nred-flamingo\r\n\r\nyellow\r\nyellow-gold\r\nyellow-casablanca\r\nyellow-crusta\r\nyellow-lemon\r\nyellow-saffron\r\n\r\npurple\r\npurple-plum\r\npurple-medium\r\npurple-studio\r\npurple-wisteria\r\npurple-seance\r\n\r\ngrey\r\ngrey-cascade\r\ngrey-silver\r\ngrey-steel\r\ngrey-cararra\r\ngrey-gallery', 5),
487 array(__('Box Color'), 'blue\r\nblue-madison\r\nblue-chambray\r\nblue-ebonyclay\r\nblue-hoki\r\nblue-steel\r\nblue-soft\r\nblue-dark\r\nblue-sharp\r\n\r\ngreen\r\ngreen-meadow\r\ngreen-seagreen\r\ngreen-turquoise\r\ngreen-haze\r\ngreen-jungle\r\ngreen-sharp\r\ngreen-soft\r\n\r\ngrey\r\ngrey-steel\r\ngrey-cararra\r\ngrey-gallery\r\ngrey-cascade\r\ngrey-silver\r\ngrey-salsa\r\ngrey-salt\r\ngrey-mint\r\n\r\nred\r\nred-pink\r\nred-sunglo\r\nred-intense\r\nred-thunderbird\r\nred-flamingo\r\nred-soft\r\nred-haze\r\n\r\nyellow\r\nyellow-gold\r\nyellow-casablanca\r\nyellow-crusta\r\nyellow-lemon\r\nyellow-saffron\r\n\r\npurple\r\npurple-medium\r\npurple-plum\r\npurple-studio\r\npurple-wisteria\r\npurple-seance\r\npurple-intense\r\npurple-sharp\r\npurple-soft', 5),
488 array(__('Custom Private Domain'), '', 4),
489 array(__('Site Traffic Counter'), '', 4),
490 array(__('Online Shop'), '', 4),
491 array(__('Live Chat Support'), '', 4),
492 array(__('Email Support'), '', 4),
493 array(__('No Ads'), '', 4),
494 array(__('Maximum stores'), __('Number of stores members may open'), 1),
495 array(__('Maximum products'), __('Number of products per store members may create'), 1),
496 array(__('Maximum categories'), __('Number of categories per store members may create'), 1),
497 array(__('Maximum tags'), __('Number of tags per store members may create'), 1),
498 );
499 $i = 1;
500 foreach($plans_options as $plans_option)
501 {
502 $table_sql[] = "INSERT INTO `$PSZ_TABLE_PLAN_OPTIONS`(`id`, `name`, `slug`, `description`, `type`, `sorting`) VALUES(" . $i . ", '".$plans_option[0]."', '".url_rewrite($plans_option[0])."', '".$plans_option[1]."', ".$plans_option[2].", ".$i++.");";
503 $logs[] = "INSERT INTO $PSZ_TABLE_LOGS(`user_id`, `item_id`, `log_type`, `time`) VALUES(1, $i, $PSZ_LOG_PLAN_OPTION_CREATED, $setup_time)";
504 }
505
506 // frontpage
507 $frontpage_name = __('Frontpage One');
508 $table_sql[] = "INSERT INTO $PSZ_TABLE_FRONTPAGES(`id`, `name`, `slug`, `user_id`, `active`, `settings`, `activated_time`, `uploaded_time`) VALUES(1, '" . $frontpage_name . "', '" . url_rewrite($frontpage_name) . "', 1, 1, 'YToyOntzOjU6ImNvbG9yIjtzOjU6ImdyZWVuIjtzOjEzOiJtZW51X3Bvc2l0aW9uIjtzOjM6InRvcCI7fQ==', ".$setup_time.", ".$setup_time.");";
509 $logs[] = "INSERT INTO $PSZ_TABLE_LOGS(`user_id`, `item_id`, `log_type`, `time`) VALUES(1, 1, $PSZ_LOG_FRONTPAGE_UPLOADED, $setup_time)";
510
511 // theme categories
512 $theme_categories = array(
513 array('One Page', 'Themes with 1 built-in page only'), // $i=1
514 array('Business', 'Themes mainly built for onlines businesses or companies'),
515 array('Simply', 'Very nice but simple themes'),
516 array('Portfolio', 'Themes used to to create the stunning portfolio sites'),
517
518 array('Red', ''), // 5
519 array('Green', ''),
520 array('Blue', ''),
521 array('Orange', ''),
522 array('Grey', ''),
523 array('Pink', ''), // 10
524 array('Purple', ''),
525 array('Dark', ''),
526 array('Light', '')
527 );
528 $i = 1;
529 foreach($theme_categories as $theme_category)
530 {
531 $table_sql[] = "INSERT INTO $PSZ_TABLE_THEME_CATEGORIES(`id`, `name`, `slug`, `description`, `sorting`) VALUES($i, '$theme_category[0]', '" . url_rewrite($theme_category[0]) . "', '" . $theme_category[1] . "', $i);";
532 $logs[] = "INSERT INTO $PSZ_TABLE_LOGS(`user_id`, `item_id`, `log_type`, `time`) VALUES(1, $i, $PSZ_LOG_THEME_CAT_CREATED, $setup_time)";
533 $i++;
534 }
535
536 $i = 1;
537 $sample_commercial_theme_id = 0;
538 foreach($themes as $theme)
539 {
540 $theme_dir = url_rewrite($theme[0]);
541
542 if( file_exists("installer-sample-data/themes/$theme_dir") )
543 {
544 $table_sql[] = "INSERT INTO $PSZ_TABLE_THEMES(`id`, `name`, `slug`, `category`, `user_id`, `status`, `uploaded_time`, `published_time`) VALUES($i, '" . $theme[0] . "', '$theme_dir', '" . $theme[1] . "', 1, 'passed', ".$setup_time.", ".$setup_time.");";
545 $logs[] = "INSERT INTO $PSZ_TABLE_LOGS(`user_id`, `item_id`, `log_type`, `time`) VALUES(1, $i, $PSZ_LOG_THEME_UPLOADED, $setup_time)";
546 $i++;
547 }
548 }
549
550 if( $import_sample_data )
551 {
552 $sample_commercial_theme_id = $i;
553 $theme_name = __('gomymobi: Commercial');
554 $table_sql[] = "INSERT INTO $PSZ_TABLE_THEMES(`id`, `name`, `slug`, `category`, `user_id`, `status`, `price_per_time`, `price_lifetime`, `uploaded_time`, `published_time`) VALUES($sample_commercial_theme_id, '" . $theme_name . "', 'gomymobi-commercial', ',1,3,5,6,7,8,9,13,', 1, 'passed', 1, 10, ".$setup_time.", ".$setup_time.");";
555
556 // update total_creations of theme FREE
557 $table_sql[] = "UPDATE $PSZ_TABLE_THEMES SET total_creations=3 WHERE id=1";
558
559 $logs[] = "INSERT INTO $PSZ_TABLE_LOGS(`user_id`, `item_id`, `log_type`, `time`) VALUES(1, $sample_commercial_theme_id, $PSZ_LOG_THEME_UPLOADED, $setup_time)";
560 }
561
562 // admin account
563 $table_sql[] = "INSERT INTO $PSZ_TABLE_USERS(`id`, `email`, `email_payout`, `fullname`, `password`, `account_type`, `plan_id`, `require_password`, `verify`, `active`, `registered_time`) VALUES(1, '$_POST[email]', 'billing@$site_domain', '$_POST[fullname]', '".md5($_POST['password'])."', $PSZ_TYPE_ADMIN, 4, 1, 1, 1, ".$setup_time.");";
564 $logs[] = "INSERT INTO $PSZ_TABLE_LOGS(`user_id`, `item_id`, `log_type`, `time`) VALUES(1, 1, $PSZ_LOG_ADMIN_CREATED_USER, $setup_time)";
565
566 // user accounts
567 if( $import_sample_data )
568 {
569 $user_accounts = array(
570 array("free.plan@$site_domain", __('Free Plan'), 1),
571 array("starter.plan@$site_domain", __('Starter Plan'), 2),
572 array("business.plan@$site_domain", __('Business+ Plan'), 3),
573 array("unlimited.plan@$site_domain", __('ULIMITED Plan'), 4),
574 array("expired.user@$site_domain", __('Expired User'), 2)
575 );
576 $i = 2;
577 foreach($user_accounts as $user)
578 {
579 $table_sql[] = "INSERT INTO $PSZ_TABLE_USERS(`id`, `email`, `fullname`, `password`, `account_type`, `plan_id`, `require_password`, `verify`, `active`, `registered_time`) VALUES($i, '$user[0]', '$user[1]', '".md5($user[0])."', $PSZ_TYPE_MEMBER, $user[2], 1, 1, 1, ".$setup_time.");";
580 $logs[] = "INSERT INTO $PSZ_TABLE_LOGS(`user_id`, `item_id`, `log_type`, `time`) VALUES(1, $i, $PSZ_LOG_ADMIN_CREATED_USER, $setup_time)";
581 $i++;
582 }
583
584 // payments & sites & traffic
585 $payments = array(
586 array(strtoupper(PSZ_Random_String(4)), 'paid', 'plan', 2, 0, 1, 1, 'USD', 4, $setup_time, strtotime("+1 year", $setup_time), 1, 1),
587 array(PSZ_Random_String(), 'completed', 'plan', 3, 0, 2, 0, '', 4, $setup_time, strtotime("+1 year", $setup_time), 1, 1),
588 array(strtoupper(PSZ_Random_String(4)), 'paid', 'plan', 5, 0, 4, 15, 'USD', 1, $setup_time, strtotime("+1 month", $setup_time), 1, 1),
589 array(strtoupper(PSZ_Random_String(4)), 'paid', 'plan', 6, 0, 2, 4, 'USD', 1, strtotime("-40 days", $setup_time), $setup_time, 0, 0),
590 array(strtoupper(PSZ_Random_String(4)), 'paid', 'theme', 3, 1, $sample_commercial_theme_id, 1, 'USD', $THEME_PERIOD_PER_TIME, $setup_time, 0, 0, 1),
591 array(strtoupper(PSZ_Random_String(4)), 'paid', 'theme', 5, 1, $sample_commercial_theme_id, 10, 'USD', $THEME_PERIOD_LIFETIME, $setup_time, 0, 1, 1)
592 );
593 foreach($payments as $payment)
594 {
595 $table_sql[] = "INSERT INTO $PSZ_TABLE_PAYMENTS(`transaction_id`, `status`, `type`, `buyer_id`, `seller_id`, `item_id`, `amount`, `currency`, `period`, `paid_time`, `expire_time`, `auto_renew`, `active`) VALUES('$payment[0]', '$payment[1]', '$payment[2]', $payment[3], $payment[4], $payment[5], $payment[6], '$payment[7]', $payment[8], $payment[9], $payment[10], $payment[11], $payment[12]);";
596 $logs[] = "INSERT INTO $PSZ_TABLE_LOGS(`user_id`, `item_id`, `log_type`, `time`) VALUES($payment[3], $payment[5], $PSZ_LOG_PAYMENT_PLAN_CREATED, $setup_time)";
597 }
598
599 // traffic
600 $today = date('j');
601 $visit_1 = $visit_2 = $visit_3 = $pageview_1 = $pageview_2 = $pageview_3 = 0;
602 for($i=1; $i<=$today; $i++)
603 {
604 $traffic_date = date('Ym') . str_pad($i, 2, '0', STR_PAD_LEFT);
605
606 // site 1 from free user, traffic counter is disabled
607 /* $visit = rand(100, 300);
608 $pageview = rand(400, 1200);
609 $visit_1 += $visit;
610 $pageview_1 += $pageview;
611 $table_sql[] = "INSERT INTO $PSZ_TABLE_SITES_TRAFFIC(`site_id`, `user_id`, `date`, `visit`, `pageview`) VALUES(1, 2, $traffic_date, $visit, $pageview);"; */
612
613 $visit = rand(100, 300);
614 $pageview = rand(400, 1200);
615 $visit_2 += $visit;
616 $pageview_2 += $pageview;
617 $table_sql[] = "INSERT INTO $PSZ_TABLE_SITES_TRAFFIC(`site_id`, `user_id`, `date`, `visit`, `pageview`) VALUES(2, 3, $traffic_date, $visit, $pageview);";
618
619 $visit = rand(100, 300);
620 $pageview = rand(400, 1200);
621 $visit_3 += $visit;
622 $pageview_3 += $pageview;
623 $table_sql[] = "INSERT INTO $PSZ_TABLE_SITES_TRAFFIC(`site_id`, `user_id`, `date`, `visit`, `pageview`) VALUES(3, 6, $traffic_date, $visit, $pageview);";
624 }
625
626 // sites
627 $sites = array(
628 array('Romantic Restaurant', 'restaurant', 2, $visit_1, $pageview_1, 0),
629 array('Cinema', 'cinema', 3, $visit_2, $pageview_2, 1),
630 array('Expired Site', 'expired-site', 6, $visit_3, $pageview_3, 0),
631 );
632 $i = 1;
633 foreach($sites as $site)
634 {
635 $table_sql[] = "INSERT INTO $PSZ_TABLE_SITES(`name`, `subdomain`, `user_id`, `theme_id`, `created_time`, `published_time`, `total_visits`, `total_pageviews`, `shop_id`) VALUES('$site[0]', '$site[1]', $site[2], 1, $setup_time, $setup_time, $site[3], $site[4], $site[5]);";
636 $logs[] = "INSERT INTO $PSZ_TABLE_LOGS(`user_id`, `item_id`, `log_type`, `time`) VALUES($site[2], $i, $PSZ_LOG_SITE_CREATED, $setup_time)";
637 $logs[] = "INSERT INTO $PSZ_TABLE_LOGS(`user_id`, `item_id`, `log_type`, `time`) VALUES($site[2], $i, $PSZ_LOG_SITE_PUBLISHED, $setup_time)";
638 $i++;
639 }
640
641 // store
642 $store_id = 1;
643 $store_site_id = 2;
644 $store_user_id = 3;
645 $store_payment = 'a:3:{s:4:"bacs";a:4:{s:6:"enable";s:1:"1";s:5:"title";s:20:"Direct Bank Transfer";s:11:"description";s:176:"Make your payment directly into our bank account. Please use your Order ID as the payment reference. Your order will not be shipped until the funds have cleared in our account.";s:8:"accounts";a:2:{i:0;a:3:{s:4:"name";s:23:"Ticket Account Holder 1";s:6:"number";s:6:"223344";s:4:"bank";a:4:{s:4:"name";s:11:"Bank Name 1";s:4:"code";s:5:"CODE1";s:4:"iban";s:0:"";s:5:"swift";s:6:"SWIFT1";}}i:1;a:3:{s:4:"name";s:23:"Ticket Account Holder 2";s:6:"number";s:6:"445566";s:4:"bank";a:4:{s:4:"name";s:11:"Bank Name 2";s:4:"code";s:5:"CODE2";s:4:"iban";s:5:"IBAN2";s:5:"swift";s:6:"SWIFT2";}}}}s:6:"paypal";a:7:{s:6:"enable";s:1:"1";s:7:"sandbox";s:1:"1";s:5:"title";s:6:"PayPal";s:11:"description";s:85:"Pay via PayPal; you can pay with your credit card if you do not have a PayPal account";s:5:"email";s:20:"billing@gomymobi.com";s:3:"pdt";s:59:"5tzXORMp-DzzyAdTsl1QmX3QSc7h1mJDtpHYqb58Ce2jhVoz4Rpm-TKPfUi";s:6:"prefix";s:13:"GTICKET-6717-";}s:3:"cod";a:3:{s:6:"enable";s:1:"1";s:5:"title";s:16:"Cash on Delivery";s:11:"description";s:28:"Pay with cash upon delivery.";}}';
646 $options = 'a:2:{s:6:"social";a:2:{s:7:"heading";s:0:"";s:3:"url";a:16:{s:8:"facebook";s:27:"//www.facebook.com/gomymobi";s:7:"twitter";s:26:"//www.twitter.com/gomymobi";s:6:"google";s:69:"//plus.google.com/b/115321894007687351440/115321894007687351440/posts";s:8:"linkedin";s:0:"";s:7:"youtube";s:50:"//www.youtube.com/channel/UCh1A9Ll1zfNOzjRSh45g9nA";s:9:"instagram";s:0:"";s:9:"pinterest";s:0:"";s:6:"reddit";s:0:"";s:11:"stumbleupon";s:0:"";s:5:"skype";s:0:"";s:6:"tumblr";s:0:"";s:6:"github";s:0:"";s:8:"dribbble";s:0:"";s:7:"behance";s:0:"";s:7:"spotify";s:0:"";s:7:"dropbox";s:0:"";}}s:14:"theme_settings";a:12:{s:11:"theme_color";s:5:"green";s:12:"header_fixed";s:1:"1";s:17:"header_menu_pages";s:1:"1";s:15:"header_menu_new";s:1:"1";s:12:"featured_box";s:8:"homepage";s:14:"featured_width";s:4:"100%";s:15:"featured_height";s:5:"450px";s:12:"discount_box";s:3:"all";s:14:"discount_title";s:14:"In Discounting";s:11:"related_box";s:1:"1";s:13:"related_title";s:16:"Related Products";s:12:"footer_color";s:4:"dark";}}';
647 $widgets = array (
648 0 =>
649 array (
650 0 =>
651 array (
652 'type' => 'category',
653 'title' => 'List',
654 'dropdown' => '0',
655 'show_counts' => '1',
656 'treeview' => '0',
657 ),
658 ),
659 1 =>
660 array (
661 0 =>
662 array (
663 'type' => 'text',
664 'title' => 'About Us',
665 'content' => '<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam sit nonummy nibh euismod tincidunt ut laoreet dolore magna aliquarm erat
666 sit volutpat. Nostrud exerci tation ullamcorper suscipit lobortis nisl aliquip commodo consequat. </p><p><br></p><p>Duis autem vel eum iriure dolor vulputate velit esse molestie
667 at dolore.</p>',
668 ),
669 ),
670 2 =>
671 array (
672 0 =>
673 array (
674 'type' => 'page',
675 'title' => 'Information',
676 'sortby' => 'name',
677 ),
678 ),
679 3 =>
680 array (
681 0 =>
682 array (
683 'type' => 'text',
684 'title' => 'Latest Tweets',
685 'content' => '<a class="twitter-timeline" href="https://twitter.com/gomymobi">Tweets by gomymobi</a> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>',
686 ),
687 ),
688 4 =>
689 array (
690 0 =>
691 array (
692 'type' => 'text',
693 'title' => 'Our Contacts',
694 'content' => '<p>28, Lorem Lis Street, Park Ave, California, US<br/>
695 Phone: 1800 323 3456<br/>
696 Email: <b>hello@gomymobi.com</b></p>',
697 ),
698 ),
699);
700 $widgets = serialize($widgets);
701
702 $table_sql[] = "INSERT INTO $PSZ_TABLE_STORES(`site_id`, `user_id`, `name`, `slug`, `phones`, `email`, `status`, `payment`, `currency`, `currency_position`, `sign_thousand`, `sign_decimal`, `decimals`, `created_time`, `published_time`, `logo`, `favicon`, `title`, `options`, `widgets`) VALUES($store_site_id, $store_user_id, 'Sell Movie Tickets Online', 'ticket', '1900.1800', 'support@sellmoviesticket.com', 1, '$store_payment', 'USD', 'right', ',', '.', 2, $setup_time, $setup_time, 'http://www.gomymobi.com/app/uploads/media/public/logos/cinema.png', 'http://www.gomymobi.com/app/uploads/media/public/logos/cinema.png', 'Sell Movie Tickets Online', '$options', '$widgets');";
703 $logs[] = "INSERT INTO $PSZ_TABLE_LOGS(`user_id`, `item_id`, `log_type`, `time`) VALUES($store_user_id, $store_id, $PSZ_LOG_SHOP_CREATED, $setup_time)";
704
705 // store category
706 $categories = array('3D', 'IMAX', 'Genre');
707 $i = 1;
708 foreach($categories as $category)
709 {
710 $table_sql[] = "INSERT INTO $PSZ_TABLE_STORE_CATEGORIES(`id`, `shop_id`, `user_id`, `name`, `slug`, `created_time`) VALUES($i, $store_id, $store_user_id, '$category', '" . url_rewrite($category) . "', $setup_time)";
711 $logs[] = "INSERT INTO $PSZ_TABLE_LOGS(`user_id`, `item_id`, `log_type`, `time`) VALUES($store_user_id, $i, $PSZ_LOG_SHOP_CAT_CREATED, $setup_time)";
712 $i++;
713 }
714
715 // 3D category term for Resident Evil
716 $table_sql[] = "INSERT INTO $PSZ_TABLE_STORE_TERMS(`hosted_id`, `value_id`, `type`, `created_time`) VALUES(1, 1, 'category', $setup_time)";
717
718 $categories = array('Action', 'Horror');
719 foreach($categories as $category)
720 {
721 $table_sql[] = "INSERT INTO $PSZ_TABLE_STORE_CATEGORIES(`id`, `shop_id`, `user_id`, `name`, `slug`, `parent`, `created_time`) VALUES($i, $store_id, $store_user_id, '$category', '" . url_rewrite($category) . "', 3, $setup_time)";
722 $table_sql[] = "INSERT INTO $PSZ_TABLE_STORE_TERMS(`hosted_id`, `value_id`, `type`, `created_time`) VALUES(1, $i, 'category', $setup_time)";
723 $logs[] = "INSERT INTO $PSZ_TABLE_LOGS(`user_id`, `item_id`, `log_type`, `time`) VALUES($store_user_id, $i, $PSZ_LOG_SHOP_CAT_CREATED, $setup_time)";
724 $i++;
725 }
726
727 // category terms for xXx: Return of Xander Cage
728 $table_sql[] = "INSERT INTO $PSZ_TABLE_STORE_TERMS(`hosted_id`, `value_id`, `type`, `created_time`) VALUES(2, 2, 'category', $setup_time)";
729 $table_sql[] = "INSERT INTO $PSZ_TABLE_STORE_TERMS(`hosted_id`, `value_id`, `type`, `created_time`) VALUES(2, 4, 'category', $setup_time)";
730
731 // category terms for Monster Trucks
732 $table_sql[] = "INSERT INTO $PSZ_TABLE_STORE_TERMS(`hosted_id`, `value_id`, `type`, `created_time`) VALUES(3, 1, 'category', $setup_time)";
733 $table_sql[] = "INSERT INTO $PSZ_TABLE_STORE_TERMS(`hosted_id`, `value_id`, `type`, `created_time`) VALUES(3, 4, 'category', $setup_time)";
734
735 // store items
736 $items = array(
737 array('Resident Evil: The Final Chapter', '<p>Picking up immediately after the events in Resident Evil: Retribution, Alice is the only survivor of what was meant to be humanity's final stand against the undead. Now, she must return to where the nightmare began - The Hive in Raccoon City, where the Umbrella Corporation is gathering its forces for a final strike against the only remaining survivors of the apocalypse.</p>', '<p>Picking up immediately after the events in Resident Evil: Retribution, Alice is the only survivor of what was meant to be humanity's final stand against the undead. Now, she must return to where the nightmare began - The Hive in Raccoon City, where the Umbrella Corporation is gathering its forces for a final strike against the only remaining survivors of the apocalypse.</p><p class="starringLabel" style="border: 0px; font-size: 12px; vertical-align: baseline; padding: 0px; margin: 15px 0px 0px; font-weight: bold; color: rgb(96, 96, 96) !important; line-height: 15px; display: block; font-family: Arial, Tahoma, Verdana; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);">Starring<br>Milla Jovovich, Ali Larter, Shawn Roberts, Ruby Rose, Eoin Macken</p><div class="movieDatailsStaring" style="border: 0px; font-size: 12px; vertical-align: baseline; margin-top: -4px; display: block; line-height: 16px; color: rgb(0, 0, 0); font-family: Arial, Tahoma, Verdana; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"></div><p><br></p><p align="center"><iframe class="note-video-clip" src="//www.youtube.com/embed/hfby7XwoBl0" frameborder="0" height="360" width="640"></iframe><br></p><ul style="border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(215, 212, 212); border-left-color: initial; border-image: initial; font-size: 12px; vertical-align: baseline; padding: 0px; margin-top: -8px; color: rgb(0, 0, 0); font-family: Arial, Tahoma, Verdana; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><li class="nobullet tight" style="border: 0px; font-size: 12px; vertical-align: baseline; margin: 0px; padding: 6.39063px 22.3906px; list-style: none; color: rgb(0, 0, 0); line-height: 12px; float: left; width: 595.188px;"><div class="detailName" style="border: 0px; font-size: 12px; vertical-align: baseline; width: 154px; float: left; font-family: Arial, Tahoma, Verdana; line-height: 16px;">Run Time</div><div class="detailContent" style="border: 0px; font-size: 12px; vertical-align: baseline; float: right; width: 368px; text-align: right; line-height: 16px;">1 hr. 45 min.</div></li><li class="alt nobullet tight" style="border: 0px; font-size: 12px; vertical-align: baseline; margin: 0px; padding: 6.39063px 22.3906px; list-style: none; color: rgb(0, 0, 0); line-height: 12px; float: left; width: 595.188px; background: rgb(228, 228, 227);"><div class="detailName" style="border: 0px; font-size: 12px; vertical-align: baseline; width: 154px; float: left; font-family: Arial, Tahoma, Verdana; line-height: 16px;">In Theaters</div><div class="detailContent" style="border: 0px; font-size: 12px; vertical-align: baseline; float: right; width: 368px; text-align: right; line-height: 16px;">Friday, January 27, 2017-Nationwide</div></li><li class="nobullet tight" style="border: 0px; font-size: 12px; vertical-align: baseline; margin: 0px; padding: 6.39063px 22.3906px; list-style: none; color: rgb(0, 0, 0); line-height: 12px; float: left; width: 595.188px;"><div class="detailName" style="border: 0px; font-size: 12px; vertical-align: baseline; width: 154px; float: left; font-family: Arial, Tahoma, Verdana; line-height: 16px;">MPAA Rating</div><div class="detailContent" style="border: 0px; font-size: 12px; vertical-align: baseline; float: right; width: 368px; text-align: right; line-height: 16px;">(R), for sequences of violence throughout</div></li><li class="alt nobullet tight" style="border: 0px; font-size: 12px; vertical-align: baseline; margin: 0px; padding: 6.39063px 22.3906px; list-style: none; color: rgb(0, 0, 0); line-height: 12px; float: left; width: 595.188px; background: rgb(228, 228, 227);"><div class="detailName" style="border: 0px; font-size: 12px; vertical-align: baseline; width: 154px; float: left; font-family: Arial, Tahoma, Verdana; line-height: 16px;">Genre</div><div class="detailContent" style="border: 0px; font-size: 12px; vertical-align: baseline; float: right; width: 368px; text-align: right; line-height: 16px;">Action/Adventure</div></li><li class="nobullet tight" style="border: 0px; font-size: 12px; vertical-align: baseline; margin: 0px; padding: 6.39063px 22.3906px; list-style: none; color: rgb(0, 0, 0); line-height: 12px; float: left; width: 595.188px;"><div class="detailName" style="border: 0px; font-size: 12px; vertical-align: baseline; width: 154px; float: left; font-family: Arial, Tahoma, Verdana; line-height: 16px;">Producer(s)</div><div class="detailContent" style="border: 0px; font-size: 12px; vertical-align: baseline; float: right; width: 368px; text-align: right; line-height: 16px;">Jeremy Bolt, Paul W.S. Anderson, Robert Kulzer, Samuel Hadida</div></li><li class="alt nobullet tight" style="border: 0px; font-size: 12px; vertical-align: baseline; margin: 0px; padding: 6.39063px 22.3906px; list-style: none; color: rgb(0, 0, 0); line-height: 12px; float: left; width: 595.188px; background: rgb(228, 228, 227);"><div class="detailName" style="border: 0px; font-size: 12px; vertical-align: baseline; width: 154px; float: left; font-family: Arial, Tahoma, Verdana; line-height: 16px;">Director(s)</div><div class="detailContent" style="border: 0px; font-size: 12px; vertical-align: baseline; float: right; width: 368px; text-align: right; line-height: 16px;">Paul W.S. Anderson</div></li><li class="nobullet tight" style="border: 0px; font-size: 12px; vertical-align: baseline; margin: 0px; padding: 6.39063px 22.3906px; list-style: none; color: rgb(0, 0, 0); line-height: 12px; float: left; width: 595.188px;"><div class="detailName" style="border: 0px; font-size: 12px; vertical-align: baseline; width: 154px; float: left; font-family: Arial, Tahoma, Verdana; line-height: 16px;">Writer(s)</div><div class="detailContent" style="border: 0px; font-size: 12px; vertical-align: baseline; float: right; width: 368px; text-align: right; line-height: 16px;">Paul W.S. Anderson</div></li><li class="alt nobullet tight" style="border: 0px; font-size: 12px; vertical-align: baseline; margin: 0px; padding: 6.39063px 22.3906px; list-style: none; color: rgb(0, 0, 0); line-height: 12px; float: left; width: 595.188px; background: rgb(228, 228, 227);"><div class="detailName" style="border: 0px; font-size: 12px; vertical-align: baseline; width: 154px; float: left; font-family: Arial, Tahoma, Verdana; line-height: 16px;">Studio</div><div class="detailContent" style="border: 0px; font-size: 12px; vertical-align: baseline; float: right; width: 368px; text-align: right; line-height: 16px;">Sony Pictures</div></li><li class="nobullet tight" style="border: 0px; font-size: 12px; vertical-align: baseline; margin: 0px; padding: 6.39063px 22.3906px; list-style: none; color: rgb(0, 0, 0); line-height: 12px; float: left; width: 595.188px;"><div class="detailName" style="border: 0px; font-size: 12px; vertical-align: baseline; width: 154px; float: left; font-family: Arial, Tahoma, Verdana; line-height: 16px;">Format(s)</div><div class="detailContent" style="border: 0px; font-size: 12px; vertical-align: baseline; float: right; width: 368px; text-align: right; line-height: 16px;">2D</div></li></ul><p><br></p>', "http://www.gomymobi.com/app/uploads/media/public/posters/Resident-Evil-The-Final-Chapter.jpg\r\nhttp://www.gomymobi.com/app/uploads/media/public/posters/Resident-Evil-The-Final-Chapter-2.jpg\r\nhttp://www.gomymobi.com/app/uploads/media/public/posters/Resident-Evil-The-Final-Chapter-3.jpg", 2),
738 array('xXx: Return of Xander Cage', '<p>Xander Cage is left for dead after an incident, though he secretly returns to action for a new, tough assignment with his handler Augustus Gibbons.<br></p>', '<p align="center"><iframe class="note-video-clip" src="//www.youtube.com/embed/MQEFmHsseaU" frameborder="0" height="360" width="640"></iframe><br></p>', 'http://www.gomymobi.com/app/uploads/media/public/posters/xxx-return-of-xander-cage.jpg', 0),
739 array('Monster Trucks', '<p>Looking for any way to get away from the life and town he was born into, Tripp (Lucas Till), a high school senior, builds a Monster Truck from bits and pieces of scrapped cars. After an accident at a nearby oil-drilling site displaces a strange and subterranean creature with a taste and a talent for speed, Tripp may have just found the key to getting out of town and a most unlikely friend.<br></p>', '<p align="center"><iframe class="note-video-clip" src="//www.youtube.com/embed/uQrj2M-2Uiw" frameborder="0" height="360" width="640"></iframe><br></p>', 'http://www.gomymobi.com/app/uploads/media/public/posters/Monster-Trucks-Squid.jpg', 0)
740 );
741 $i = 1;
742 foreach($items as $item)
743 {
744 $table_sql[] = "INSERT INTO $PSZ_TABLE_STORE_ITEMS(`id`, `shop_id`, `user_id`, `name`, `slug`, `summary`, `description`, `featured`, `item_type`, `price_regular`, `shipping_cost`, `images`, `item_sold`, `created_time`, `published_time`) VALUES($i, $store_id, $store_user_id, '$item[0]', '" . url_rewrite($item[0]) . "', '$item[1]', '$item[2]', 1, 'single', '20', '5', '$item[3]', $item[4], $setup_time, $setup_time)";
745 $logs[] = "INSERT INTO $PSZ_TABLE_LOGS(`user_id`, `item_id`, `log_type`, `time`) VALUES($store_user_id, $i, $PSZ_LOG_SHOP_ITEM_CREATED, $setup_time)";
746 $i++;
747 }
748 $items = array(
749 array(
750 'name' => 'Membership Accesses',
751 'sold' => 0,
752 'summary' => '<p>Pay monthly / yearly to watch unlimited movies.</p>',
753 'type' => 'group',
754 'parent' => 0,
755 'price_subscription' => '',
756 'subscription_per' => '',
757 'subscription_period' => '',
758 'subscription_for' => '',
759 'signup_fee' => '',
760 'trial' => '',
761 'trial_period' => '',
762 'digital' => 1,
763 'downloadable' => 0,
764 'files' => ''),
765 array(
766 'name' => 'VIP: Monthly',
767 'sold' => 1,
768 'summary' => '<p>Pay monthly to watch your favorite movies.<br></p>',
769 'type' => 'subscription',
770 'parent' => 4,
771 'price_subscription' => 9,
772 'subscription_per' => 1,
773 'subscription_period' => 'month',
774 'subscription_for' => 0,
775 'signup_fee' => 3,
776 'trial' => 1,
777 'trial_period' => 'week',
778 'digital' => 1,
779 'downloadable' => 1,
780 'files' => 'http://www.gomymobi.com/app/uploads/media/stores/stores-starter.plan@gomymobi.com/VIP-monthly.zip')
781 );
782 foreach($items as $item)
783 {
784 $table_sql[] = "INSERT INTO $PSZ_TABLE_STORE_ITEMS(`id`, `shop_id`, `user_id`, `name`, `slug`, `item_sold`, `summary`, `item_type`, `parent`, `price_subscription`, `subscription_per`, `subscription_period`, `subscription_for`, `signup_fee`, `trial`, `trial_period`, `digital`, `downloadable`, `files`, `images`, `created_time`, `published_time`) VALUES($i, $store_id, $store_user_id, '$item[name]', '" . url_rewrite($item['name']) . "', '$item[sold]', '$item[summary]', '$item[type]', '$item[parent]', '$item[price_subscription]', '$item[subscription_per]', '$item[subscription_period]', '$item[subscription_for]', '$item[signup_fee]', '$item[trial]', '$item[trial_period]', $item[digital], $item[downloadable], '$item[files]', 'http://www.gomymobi.com/app/uploads/media/public/posters/Movies-Membership-Card.jpg', $setup_time, $setup_time)";
785 $logs[] = "INSERT INTO $PSZ_TABLE_LOGS(`user_id`, `item_id`, `log_type`, `time`) VALUES($store_user_id, $i, $PSZ_LOG_SHOP_ITEM_CREATED, $setup_time)";
786 $i++;
787 }
788
789 // store tag
790 $items = array('Resident Evil', 'Raccoon City', 'Umbrella Corporation');
791 $i = 1;
792 foreach($items as $item)
793 {
794 $table_sql[] = "INSERT INTO $PSZ_TABLE_STORE_TAGS(`id`, `shop_id`, `user_id`, `name`, `slug`, `created_time`) VALUES($i, $store_id, $store_user_id, '$item', '" . url_rewrite($item) . "', $setup_time)";
795 $table_sql[] = "INSERT INTO $PSZ_TABLE_STORE_TERMS(`hosted_id`, `value_id`, `type`, `created_time`) VALUES(1, $i, 'tag', $setup_time)";
796 $logs[] = "INSERT INTO $PSZ_TABLE_LOGS(`user_id`, `item_id`, `log_type`, `time`) VALUES($store_user_id, $i, $PSZ_LOG_SHOP_TAG_CREATED, $setup_time)";
797 $i++;
798 }
799
800 // store page
801 $table_sql[] = "INSERT INTO $PSZ_TABLE_STORE_PAGES(`shop_id`, `user_id`, `name`, `slug`, `short`, `full`, `created_time`, `published_time`) VALUES($store_id, $store_user_id, 'About us', 'about-us', 'About us', '<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam sit nonummy nibh euismod tincidunt ut laoreet dolore magna aliquarm erat sit volutpat. Nostrud exerci tation ullamcorper suscipit lobortis nisl aliquip commodo consequat.</p>', $setup_time, $setup_time)";
802 $logs[] = "INSERT INTO $PSZ_TABLE_LOGS(`user_id`, `item_id`, `log_type`, `time`) VALUES($store_user_id, $i, $PSZ_LOG_SHOP_PAGE_CREATED, $setup_time)";
803
804 // store order
805 $items = array(
806 array(
807 'key' => strtoupper(PSZ_Random_String(17)),
808 'transaction_id' => strtoupper(PSZ_Random_String(17)),
809 'buyer' => 'a:3:{s:8:"fullname";s:15:"Yoshie Dahlberg";s:5:"email";s:20:"test.buyer@gmail.com";s:5:"phone";s:9:"1800.1900";}',
810 'items' => 'a:1:{i:0;a:5:{s:2:"id";s:1:"1";s:4:"name";s:32:"Resident Evil: The Final Chapter";s:19:"purchase_unit_price";i:20;s:8:"quantity";s:1:"2";s:13:"shipping_cost";s:1:"5";}}',
811 'payment' => 'paypal',
812 'total' => 50,
813 'ship' => 'a:6:{s:8:"fullname";s:15:"Yoshie Dahlberg";s:5:"email";s:20:"test.buyer@gmail.com";s:5:"phone";s:9:"1800.1900";s:3:"fax";s:0:"";s:7:"company";s:0:"";s:7:"address";a:2:{i:1;s:34:"28 Lorem Lis Street, New York, USA";i:2;s:0:"";}}',
814 'notes' => '',
815 'status' => 'completed',
816 'created_time' => $setup_time,
817 'processed_time' => $setup_time),
818 array(
819 'key' => strtoupper(PSZ_Random_String(17)),
820 'transaction_id' => '',
821 'buyer' => 'a:3:{s:8:"fullname";s:17:"Clementine Cadden";s:5:"email";s:20:"test.buyer@gmail.com";s:5:"phone";s:9:"1800.1900";}',
822 'items' => 'a:2:{i:0;a:5:{s:2:"id";s:1:"2";s:4:"name";s:26:"xXx: Return of Xander Cage";s:19:"purchase_unit_price";i:20;s:8:"quantity";s:1:"1";s:13:"shipping_cost";s:1:"5";}i:1;a:5:{s:2:"id";s:1:"3";s:4:"name";s:14:"Monster Trucks";s:19:"purchase_unit_price";i:20;s:8:"quantity";s:1:"1";s:13:"shipping_cost";s:1:"5";}}',
823 'payment' => 'cod',
824 'total' => 50,
825 'ship' => 'a:6:{s:8:"fullname";s:17:"Clementine Cadden";s:5:"email";s:20:"test.buyer@gmail.com";s:5:"phone";s:9:"1800.1900";s:3:"fax";s:0:"";s:7:"company";s:0:"";s:7:"address";a:2:{i:1;s:46:"28, Lorem Lis Street, Park Ave, California, US";i:2;s:0:"";}}',
826 'notes' => 'Call us before delivery',
827 'status' => 'pending',
828 'created_time' => $setup_time,
829 'processed_time' => 0),
830 array(
831 'key' => strtoupper(PSZ_Random_String(17)),
832 'transaction_id' => '',
833 'buyer' => 'a:3:{s:8:"fullname";s:14:"Monthly Unpaid";s:5:"email";s:20:"test.buyer@gmail.com";s:5:"phone";s:0:"";}',
834 'items' => 'a:1:{i:0;a:10:{s:2:"id";s:1:"5";s:4:"name";s:12:"VIP: Monthly";s:19:"purchase_unit_price";i:9;s:8:"quantity";s:1:"1";s:16:"subscription_per";s:1:"1";s:19:"subscription_period";s:5:"month";s:16:"subscription_for";s:1:"0";s:10:"signup_fee";s:1:"3";s:5:"trial";s:1:"1";s:12:"trial_period";s:4:"week";}}',
835 'payment' => 'paypal',
836 'total' => 3,
837 'ship' => '',
838 'notes' => 'Must pay to see downloadable materials.',
839 'status' => 'pending',
840 'created_time' => $setup_time,
841 'processed_time' => 0),
842 array(
843 'key' => strtoupper(PSZ_Random_String(17)),
844 'transaction_id' => strtoupper(PSZ_Random_String(17)),
845 'buyer' => 'a:3:{s:8:"fullname";s:12:"Monthly Paid";s:5:"email";s:20:"test.buyer@gmail.com";s:5:"phone";s:0:"";}',
846 'items' => 'a:1:{i:0;a:10:{s:2:"id";s:1:"5";s:4:"name";s:12:"VIP: Monthly";s:19:"purchase_unit_price";s:1:"9";s:8:"quantity";s:1:"1";s:16:"subscription_per";s:1:"1";s:19:"subscription_period";s:5:"month";s:16:"subscription_for";s:1:"0";s:10:"signup_fee";s:1:"3";s:5:"trial";s:1:"1";s:12:"trial_period";s:4:"week";}}',
847 'payment' => 'bacs',
848 'total' => 3,
849 'ship' => '',
850 'notes' => '',
851 'status' => 'completed',
852 'created_time' => $setup_time,
853 'processed_time' => $setup_time),
854 );
855 $i = 1;
856 foreach($items as $item)
857 {
858 $table_sql[] = "INSERT INTO $PSZ_TABLE_STORE_ORDERS(`id`, `shop_id`, `user_id`, `key`, `transaction_id`, `buyer`, `items`, `payment`, `total`, `ship`, `notes`, `status`, `created_time`, `processed_time`) VALUES($i, $store_id, $store_user_id, '$item[key]', '$item[transaction_id]', '$item[buyer]', '$item[items]', '$item[payment]', '$item[total]', '$item[ship]', '$item[notes]', '$item[status]', $item[created_time], $item[processed_time])";
859 $logs[] = "INSERT INTO $PSZ_TABLE_LOGS(`user_id`, `item_id`, `log_type`, `time`) VALUES($store_user_id, $i, $PSZ_LOG_SHOP_ORDER_RECIEVED, $setup_time)";
860 $i++;
861 }
862 }
863
864 // drop all tables first
865 $db->sql_query("DROP TABLE IF EXISTS $PSZ_TABLE_FRONTPAGES, $PSZ_TABLE_PAYMENTS, $PSZ_TABLE_PLANS, $PSZ_TABLE_PLAN_OPTIONS, $PSZ_TABLE_SITES, $PSZ_TABLE_SITES_TRAFFIC, $PSZ_TABLE_LOGS, $PSZ_TABLE_THEMES, $PSZ_TABLE_THEME_CATEGORIES, $PSZ_TABLE_USERS, $PSZ_TABLE_STORES, $PSZ_TABLE_STORE_CATEGORIES, $PSZ_TABLE_STORE_ITEMS, $PSZ_TABLE_STORE_ORDERS, $PSZ_TABLE_STORE_TAGS, $PSZ_TABLE_STORE_PAGES, $PSZ_TABLE_STORE_TERMS;");
866
867 // run queries
868 foreach($table_sql as $sql) {
869 $db->sql_query($sql);
870 }
871 foreach($logs as $sql) {
872 $db->sql_query($sql);
873 }
874
875 // install SQL only
876 //die(sprintf($ajax_return_success, $PSZ_APP_webpath . '/account/login/'));
877
878 // delete current dirs
879 $data_dirs = array($PSZ_DIR_FRONTPAGE, $PSZ_TABLE_THEMES, $PSZ_DIR_UPLOAD, $PSZ_DIR_SITES_LIVE, $PSZ_DIR_SITES_BUILDING);
880 foreach($data_dirs as $dir) {
881 xdelete($dir);
882
883 new_folder("installer-sample-data/$dir");
884 }
885
886 // restore sample data
887 if( $import_sample_data ) {
888 reset($data_dirs);
889 foreach($data_dirs as $dir)
890 xcopy("installer-sample-data/$dir", $PSZ_APP_root_dir . $dir);
891 }
892 else {
893 for($i=0; $i<3; $i++)
894 xcopy("installer-sample-data/$data_dirs[$i]", $PSZ_APP_root_dir . $data_dirs[$i]);
895
896 // delete commercial theme
897 xdelete('themes/gomymobi-commercial');
898
899 // create dirs
900 new_folder($PSZ_DIR_SITES_LIVE);
901 new_folder($PSZ_DIR_SITES_BUILDING);
902 }
903
904 // write configs to system file
905 $sys_file_content = file_get_contents( $PSZ_APP_FILE_DB_DEFAULT_CONFIG );
906 $sys_default_settings = get_default_app_settings();
907 $sys_default_settings['sys']['domain'] = $_POST['domain'];
908 $sys_default_settings['sys']['site_name'] = $_POST['domain'];
909
910 if( !new_file($PSZ_APP_FILE_SYS_LIVE_CONFIG, str_replace(
911 array('{{DB_HOST}}', '{{DB_NAME}}', '{{DB_USER}}', '{{DB_PASSWD}}', '{{SYS_DEFAULTS}}'),
912 array($dbhost, $dbname, $dbuser, $dbpasswd, base64_encode(serialize($sys_default_settings))),
913 $sys_file_content))
914 )
915 die( sprintf($ajax_return_error, __('Error'), __('Could not write system configurations to file.')) );
916
917 // create htaccess file & robots.txt
918 $site_protocol = 'http' . (is_SSL() ? 's' : '');
919 $system_robots_file = 'User-agent: *
920
921Sitemap: ' . $site_protocol . '://www.{{SITE_DOMAIN_WITHOUT_WWW}}/sitemap/';
922
923 new_file(
924 '../robots.txt',
925 str_replace( '{{SITE_DOMAIN_WITHOUT_WWW}}', $_POST['domain'], $system_robots_file)
926 );
927 new_file(
928 '../.htaccess',
929 str_replace_array(array(
930 '{{SITE_DOMAIN_WITHOUT_WWW}}' => addcslashes($_POST['domain'], '.'),
931 '{{APP_PATH}}' => $PSZ_APP_webpath,
932 '{{PROTOCOL}}' => $site_protocol,
933 '{{SSL_REDIRECT_SETTINGS}}' => ''
934 ),
935 file_get_contents('includes/htaccess_pattern_settings.config')
936 )
937 );
938
939 // destroy current session, to delete states
940 setcookie($PSZ_APP_COOKIE_REMEMBER, false, -1, '/');
941 session_destroy();
942
943 // success
944 die(sprintf($ajax_return_success, $PSZ_APP_webpath . '/account/login/'));
945 }
946 exit;
947}
948 /*$dbhost = 'localhost';
949 $dbname = 'onlinepl_mainop';
950 $dbuser = 'onlinepl_mainop';
951 $dbpasswd = 'G[[@Kr$FSM@v';
952
953 include_once($PSZ_APP_root_dir . 'includes/db.mysqli.php');*/
954
955/*if( isset($_GET['skip']) && $_GET['skip']=='ziparchive' )
956 $skip_ziparchive = true;*/
957
958$pTemplate->assign_vars(array(
959 'DOMAIN' => get_site_domain($_SERVER['SERVER_NAME'])
960));
961
962$pContent = $pTemplate->pparse_file( "$PSZ_DIR_BIZ_TEMPLATE/install.html" );
963//echo $pTemplate->pparse($pContent);
964die( $pTemplate->pparse($pContent, true, true, true) );
965exit;
966?>