/
index.php
682 lines (624 loc) · 24.6 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
<?php
/******************************************************************
* Copyright 2011 Ktools.net LLC - All Rights Reserved
* http://www.ktools.net
* Created: 4-21-2011
* Modified: 4-21-2011
******************************************************************/
define('BASE_PATH',dirname(__FILE__)); // Define the base path
define('PAGE_ID','homepage'); // Page ID
define('ACCESS','public'); // Page access type - public|private
define('INIT_SMARTY',true); // Use Smarty
require_once BASE_PATH.'/assets/includes/session.php';
require_once BASE_PATH.'/assets/includes/initialize.php';
require_once BASE_PATH.'/assets/includes/commands.php';
require_once BASE_PATH.'/assets/includes/init.member.php';
require_once BASE_PATH.'/assets/includes/security.inc.php';
require_once BASE_PATH.'/assets/includes/language.inc.php';
require_once BASE_PATH.'/assets/includes/cart.inc.php';
require_once BASE_PATH.'/assets/includes/affiliate.inc.php';
require_once BASE_PATH.'/assets/classes/mediatools.php';
//define('META_TITLE',''); // Override page title, description, keywords and page encoding here
//define('META_DESCRIPTION','');
//define('META_KEYWORDS','');
//define('PAGE_ENCODING','');
require_once BASE_PATH.'/assets/includes/header.inc.php';
require_once BASE_PATH.'/assets/includes/errors.php';
unset($_SESSION['currentMode']); // Unset the gallery mode
$_SESSION['backButtonSession']['linkto'] = pageLink(); // Update the back button link session
$thumbMediaDetailsArray = array();
/*
* Featured galleries
*/
if($_SESSION['galleriesData'])
{
foreach(@$_SESSION['galleriesData'] as $key => $value) // Find subgalleries
{
if($value['album'] == 0 and $value['feature'] == 1)
{
$subGalleriesData[$key] = $value['gallery_id'];
$_SESSION['galleriesData'][$key]['galleryIcon'] = galleryIcon($key); // Get gallery icon details for subs if they exist
}
}
if(count($subGalleriesData) > 0)
{
$smarty->assign('galleriesData',$_SESSION['galleriesData']);
$smarty->assign('subGalleriesData',$subGalleriesData);
}
}
/*
* Homepage news
*/
if($config['settings']['hpnews'])
{
try
{
$featuredNewsResult = mysqli_query($db,
"
SELECT *
FROM {$dbinfo[pre]}news
WHERE homepage = 1
AND active = 1
AND add_date < '{$nowGMT}'
AND (expire_type = 0 OR expire_date > '{$nowGMT}')
ORDER BY sortorder,add_date DESC
"
);
$customNewsDate = new kdate;
$customNewsDate->setMemberSpecificDateInfo();
$customNewsDate->distime = 0;
while($featuredNews = mysqli_fetch_assoc($featuredNewsResult))
{
$featuredNews['title'] = ($featuredNews['title_'.$selectedLanguage]) ? $featuredNews['title_'.$selectedLanguage] : $featuredNews['title']; // Choose the correct language
$featuredNews['short'] = ($featuredNews['short_'.$selectedLanguage]) ? $featuredNews['short_'.$selectedLanguage] : $featuredNews['short']; // Choose the correct language
$featuredNews['seoTitle'] = cleanForSEO($featuredNews['title']); // Name cleaned for SEO usage
$parms['page'] = "news.php?id={$featuredNews[news_id]}"; // Link to page
if($modRewrite) $parms['page'].="&seoTitle={$featuredNews[seoTitle]}"; // Link to page with seoName added
$featuredNews['linkto'] = linkto($parms); // Create the link using SEO if needed
$featuredNews['display_date'] = $customNewsDate->showdate($featuredNews['add_date']); // Create a local time and date
$featuredNewsArray[] = $featuredNews;
}
$smarty->assign('featuredNewsRows',count($featuredNewsArray));
$smarty->assign('featuredNews',$featuredNewsArray);
}
catch(Exception $e)
{
die(exceptionError($e));
}
}
/*
* Get featured homepage prints
*/
if($config['settings']['hpprints'])
{
try
{
$featuredPrintsResult = mysqli_query($db,
"
SELECT *
FROM {$dbinfo[pre]}prints
LEFT JOIN {$dbinfo[pre]}perms
ON ({$dbinfo[pre]}prints.print_id = {$dbinfo[pre]}perms.item_id AND {$dbinfo[pre]}perms.perm_area = 'prints')
WHERE {$dbinfo[pre]}prints.active = 1
AND {$dbinfo[pre]}prints.homepage = 1
AND {$dbinfo[pre]}prints.deleted = 0
AND ({$dbinfo[pre]}prints.everyone = 1 OR {$dbinfo[pre]}perms.perm_value IN ({$memberPermissionsForDB}))
ORDER BY {$dbinfo[pre]}prints.sortorder
"
);
while($featuredPrints = mysqli_fetch_assoc($featuredPrintsResult))
$featuredPrintsArray[] = printsList($featuredPrints);
$smarty->assign('featuredPrintsRows',count($featuredPrintsArray));
$smarty->assign('featuredPrints',$featuredPrintsArray);
/*
if($returnRows = mysqli_num_rows($featuredPrintsResult))
{
while($featuredPrints = mysqli_fetch_assoc($featuredPrintsResult))
$featuredPrintsArray[] = printsList($featuredPrints);
$smarty->assign('featuredPrintsRows',$returnRows);
$smarty->assign('featuredPrints',$featuredPrintsArray);
}
*/
}
catch(Exception $e)
{
die(exceptionError($e));
}
}
/*
* Get featured homepage products
*/
if($config['settings']['hpprods'])
{
try
{
$featuredProductsResult = mysqli_query($db,
"
SELECT *
FROM {$dbinfo[pre]}products
LEFT JOIN {$dbinfo[pre]}perms
ON ({$dbinfo[pre]}products.prod_id = {$dbinfo[pre]}perms.item_id AND {$dbinfo[pre]}perms.perm_area = 'products')
WHERE {$dbinfo[pre]}products.active = 1
AND {$dbinfo[pre]}products.homepage = 1
AND {$dbinfo[pre]}products.deleted = 0
AND ({$dbinfo[pre]}products.everyone = 1 OR {$dbinfo[pre]}perms.perm_value IN ({$memberPermissionsForDB}))
AND ({$dbinfo[pre]}products.quantity = '' OR {$dbinfo[pre]}products.quantity > '0' OR {$dbinfo[pre]}products.product_type = 1)
ORDER BY {$dbinfo[pre]}products.sortorder
"
);
while($featuredProducts = mysqli_fetch_assoc($featuredProductsResult))
$featuredProductsArray[] = productsList($featuredProducts);
$smarty->assign('featuredProductsRows',count($featuredProductsArray));
$smarty->assign('featuredProducts',$featuredProductsArray);
/*
if($returnRows = mysqli_num_rows($featuredProductsResult))
{
while($featuredProducts = mysqli_fetch_assoc($featuredProductsResult))
$featuredProductsArray[] = productsList($featuredProducts);
$smarty->assign('featuredProductsRows',$returnRows);
$smarty->assign('featuredProducts',$featuredProductsArray);
}
*/
}
catch(Exception $e)
{
die(exceptionError($e));
}
}
/*
* Get featured homepage packages
*/
if($config['settings']['hppacks'])
{
try
{
$featuredPackagesResult = mysqli_query($db,
"
SELECT *
FROM {$dbinfo[pre]}packages
LEFT JOIN {$dbinfo[pre]}perms
ON ({$dbinfo[pre]}packages.pack_id = {$dbinfo[pre]}perms.item_id AND {$dbinfo[pre]}perms.perm_area = 'packages')
WHERE {$dbinfo[pre]}packages.active = 1
AND {$dbinfo[pre]}packages.homepage = 1
AND {$dbinfo[pre]}packages.deleted = 0
AND ({$dbinfo[pre]}packages.everyone = 1 OR {$dbinfo[pre]}perms.perm_value IN ({$memberPermissionsForDB}))
AND ({$dbinfo[pre]}packages.quantity = '' OR {$dbinfo[pre]}packages.quantity > '0')
ORDER BY {$dbinfo[pre]}packages.sortorder
"
);
while($featuredPackages = mysqli_fetch_assoc($featuredPackagesResult))
$featuredPackagesArray[] = packagesList($featuredPackages);
$smarty->assign('featuredPackagesRows',count($featuredPackagesArray));
$smarty->assign('featuredPackages',$featuredPackagesArray);
/*
if($returnRows = mysqli_num_rows($featuredPackagesResult))
{
while($featuredPackages = mysqli_fetch_assoc($featuredPackagesResult))
$featuredPackagesArray[] = packagesList($featuredPackages);
$smarty->assign('featuredPackagesRows',$returnRows);
$smarty->assign('featuredPackages',$featuredPackagesArray);
}
*/
}
catch(Exception $e)
{
die(exceptionError($e));
}
}
/*
* Get featured homepage collections
*/
if($config['settings']['hpcolls'])
{
try
{
$featuredCollectionsResult = mysqli_query($db,
"
SELECT *
FROM {$dbinfo[pre]}collections
LEFT JOIN {$dbinfo[pre]}perms
ON ({$dbinfo[pre]}collections.coll_id = {$dbinfo[pre]}perms.item_id AND {$dbinfo[pre]}perms.perm_area = 'collections')
WHERE {$dbinfo[pre]}collections.active = 1
AND {$dbinfo[pre]}collections.homepage = 1
AND {$dbinfo[pre]}collections.deleted = 0
AND ({$dbinfo[pre]}collections.everyone = 1 OR {$dbinfo[pre]}perms.perm_value IN ({$memberPermissionsForDB}))
AND ({$dbinfo[pre]}collections.quantity = '' OR {$dbinfo[pre]}collections.quantity > '0')
ORDER BY {$dbinfo[pre]}collections.sortorder
"
);
while($featuredCollections = mysqli_fetch_assoc($featuredCollectionsResult))
$featuredCollectionsArray[] = collectionsList($featuredCollections);
$smarty->assign('featuredCollectionsRows',count($featuredCollectionsArray));
$smarty->assign('featuredCollections',$featuredCollectionsArray);
/*
if($returnRows = mysqli_num_rows($featuredCollectionsResult))
{
while($featuredCollections = mysqli_fetch_assoc($featuredCollectionsResult))
$featuredCollectionsArray[] = collectionsList($featuredCollections);
$smarty->assign('featuredCollectionsRows',$returnRows);
$smarty->assign('featuredCollections',$featuredCollectionsArray);
}
*/
}
catch(Exception $e)
{
die(exceptionError($e));
}
}
/*
* Featured media
*/
if($config['settings']['hpfeaturedmedia'])
{
try
{
/*
$sql =
"
SELECT SQL_CALC_FOUND_ROWS *
FROM {$dbinfo[pre]}media
LEFT JOIN {$dbinfo[pre]}media_galleries
ON {$dbinfo[pre]}media.media_id = {$dbinfo[pre]}media_galleries.gmedia_id
WHERE {$dbinfo[pre]}media.featured = 1
AND {$dbinfo[pre]}media.active = 1
AND {$dbinfo[pre]}media.approval_status = 1
";
if($config['OverrideFMPerms'] == 0)
$sql .= " AND {$dbinfo[pre]}media_galleries.gallery_id IN ({$memberPermGalleriesForDB})"; // Check for correct member permissions unless overridden by tweak: $config['OverrideFMPerms']
$sql .= " GROUP BY {$dbinfo[pre]}media.media_id ORDER BY RAND()";
*/
$sql =
"
SELECT SQL_CALC_FOUND_ROWS *
FROM {$dbinfo[pre]}media
WHERE {$dbinfo[pre]}media.featured = 1
AND {$dbinfo[pre]}media.active = 1
AND {$dbinfo[pre]}media.approval_status = 1
"; // New 4.3.2
if($config['OverrideFMPerms'] == 0)
$sql .= " AND {$dbinfo[pre]}media.media_id IN (SELECT DISTINCT(gmedia_id) FROM {$dbinfo[pre]}media_galleries WHERE gallery_id IN ({$memberPermGalleriesForDB}))"; // Check for correct member permissions unless overridden by tweak: $config['OverrideFMPerms']
$sql .= " ORDER BY RAND()";
$featuredMedia = new mediaList($sql); // Create a new mediaList object
//echo $featuredMedia->getRows(); exit;
if($returnRows = $featuredMedia->getRows()) // Continue only if results are found
{
$featuredMedia->getMediaDetails(); // Run the getMediaDetails function to grab all the media file details
$featuredMedia->addThumbDetails = true; // Get the thumb details as part of the array
$featuredMediaArray = $featuredMedia->getMediaArray(); // Get the array of featured media
$featuredMediaDetailsFields = $featuredMedia->getDetailsFields('thumb');
if($featuredMediaDetailsFields) // Make sure they both exist before trying to combine them //$thumbMediaDetailsArray and
$thumbMediaDetailsArray = $thumbMediaDetailsArray + $featuredMediaDetailsFields; // Get the output for the details shown under thumbnails // Old getThumbMediaDetailsArray()
//echo 'tda: '.$thumbMediaDetailsArray; // Testing
//echo '<br>fa: '.$featuredMedia->getDetailsFields('thumb');
//exit;
foreach($featuredMediaArray as $key => $value) // Force title and description for featured
{
if($value['dsp_type'] == 'video')
{
// check for video file xxxxxxxxxxxxxx
$featuredMediaArray[$key]['sampleVideo'] = 1;
}
else
$featuredMediaArray[$key]['sampleVideo'] = 0;
$featuredMediaArray[$key]['title'] = getMediaDetails('title',$featuredMediaArray[$key]);
$featuredMediaArray[$key]['description'] = getMediaDetails('description',$featuredMediaArray[$key]);
}
$smarty->assign('featuredMediaRows',$returnRows); // Assign to smarty
$smarty->assign('featuredMedia',$featuredMediaArray); // Assign to smarty
$featuredOne = array_rand($featuredMediaArray); // Choose 1 random featured media from the array
$smarty->assign('featuredOne',$featuredOne);
}
}
catch(Exception $e)
{
die(exceptionError($e));
}
}
/*
* Newest media
*/
if($config['settings']['hpnewestmedia'] and $config['settings']['new_media_count'] > 0)
{
try
{
/*
$sql =
"
SELECT SQL_CALC_FOUND_ROWS *
FROM {$dbinfo[pre]}media
LEFT JOIN {$dbinfo[pre]}media_galleries
ON {$dbinfo[pre]}media.media_id = {$dbinfo[pre]}media_galleries.gmedia_id
WHERE {$dbinfo[pre]}media_galleries.gallery_id IN ({$memberPermGalleriesForDB})
AND {$dbinfo[pre]}media.active = 1
AND {$dbinfo[pre]}media.approval_status = 1
GROUP BY {$dbinfo[pre]}media.media_id
ORDER BY {$dbinfo[pre]}media.date_added DESC
LIMIT {$config[settings][new_media_count]}
";
*/
$sql =
"
SELECT SQL_CALC_FOUND_ROWS *
FROM {$dbinfo[pre]}media
WHERE {$dbinfo[pre]}media.active = 1
AND {$dbinfo[pre]}media.approval_status = 1
AND {$dbinfo[pre]}media.media_id IN (SELECT DISTINCT(gmedia_id) FROM {$dbinfo[pre]}media_galleries WHERE gallery_id IN ({$memberPermGalleriesForDB}))
ORDER BY {$dbinfo[pre]}media.date_added DESC
LIMIT {$config[settings][new_media_count]}
"; // New 4.3.2
$newestMedia = new mediaList($sql); // Create a new mediaList object
if($returnRows = $newestMedia->getRows()) // Continue only if results are found
{
//echo $returnRows; exit; // Testing
$newestMedia->getMediaDetails(); // Run the getMediaDetails function to grab all the media file details
$newestMedia->addThumbDetails = true; // Get the thumb details as part of the array
$newestMediaArray = $newestMedia->getMediaArray(); // Get the array of newest media
$newestMediaDetailsFields = $newestMedia->getDetailsFields('thumb');
if($newestMediaDetailsFields)
$thumbMediaDetailsArray = $thumbMediaDetailsArray + $newestMediaDetailsFields; // Get the output for the details shown under thumbnails
$smarty->assign('newestMediaRows',$returnRows); // Assign to smarty
$smarty->assign('newestMedia',$newestMediaArray); // Assign to smarty
}
}
catch(Exception $e)
{
die(exceptionError($e));
}
}
/*
* Random media
*/
if($config['settings']['hprandmedia'] and $config['settings']['random_media_count'] > 0)
{
try
{
/*
$sql =
"
SELECT SQL_CALC_FOUND_ROWS *
FROM {$dbinfo[pre]}media
WHERE {$dbinfo[pre]}media.active = 1
AND {$dbinfo[pre]}media.approval_status = 1
AND {$dbinfo[pre]}media.media_id IN (SELECT DISTINCT(gmedia_id) FROM {$dbinfo[pre]}media_galleries WHERE gallery_id IN ({$memberPermGalleriesForDB}))
ORDER BY RAND()
LIMIT {$config[settings][random_media_count]}
";
*/
/* START: New random function for home page random media - added in 4.6 */
$sql =
"
SELECT SQL_CALC_FOUND_ROWS media_id
FROM {$dbinfo[pre]}media
WHERE {$dbinfo[pre]}media.active = 1
AND {$dbinfo[pre]}media.approval_status = 1
AND {$dbinfo[pre]}media.media_id IN (SELECT DISTINCT(gmedia_id) FROM {$dbinfo[pre]}media_galleries WHERE gallery_id IN ({$memberPermGalleriesForDB}))
";
$tempResult = mysqli_query($db,$sql);
while($tempMedia = mysqli_fetch_array($tempResult))
$tempArray[$tempMedia['media_id']] = $tempMedia['media_id']; // Temporary Array
if($returnedTempRows = getRows())
{
if($config['settings']['random_media_count'] > $returnedTempRows)
$fetchAmount = $returnedTempRows;
else
$fetchAmount = $config['settings']['random_media_count'];
shuffle($tempArray);
$randIDs = array_slice($tempArray,0,$fetchAmount);
$flatRandIDs = implode(',',$randIDs);
}
else
$flatRandIDs = '0';
$sql =
"
SELECT SQL_CALC_FOUND_ROWS *
FROM {$dbinfo[pre]}media
WHERE {$dbinfo[pre]}media.active = 1
AND {$dbinfo[pre]}media.approval_status = 1
AND {$dbinfo[pre]}media.media_id IN ({$flatRandIDs})
ORDER BY RAND()
LIMIT {$config[settings][random_media_count]}
";
/* END: New random function for home page random media - added in 4.6 */
$randomMedia = new mediaList($sql); // Create a new mediaList object
if($returnRows = $randomMedia->getRows()) // Continue only if results are found
{
$randomMedia->getMediaDetails(); // Run the getMediaDetails function to grab all the media file details
$randomMedia->addThumbDetails = true; // Get the thumb details as part of the array
$randomMediaArray = $randomMedia->getMediaArray(); // Get the array of random media
$randomMediaDetailsFields = $randomMedia->getDetailsFields('thumb');
if($randomMediaDetailsFields)
$thumbMediaDetailsArray = $thumbMediaDetailsArray + $randomMediaDetailsFields; // Get the output for the details shown under thumbnails
$smarty->assign('randomMediaRows',$returnRows); // Assign to smarty
$smarty->assign('randomMedia',$randomMediaArray); // Assign to smarty
}
}
catch(Exception $e)
{
die(exceptionError($e));
}
}
/*
* Popular media
*/
if($config['settings']['hppopularmedia'] and $config['settings']['popular_media_count'] > 0)
{
try
{
/*
$sql =
"
SELECT SQL_CALC_FOUND_ROWS *
FROM {$dbinfo[pre]}media
LEFT JOIN {$dbinfo[pre]}media_galleries
ON {$dbinfo[pre]}media.media_id = {$dbinfo[pre]}media_galleries.gmedia_id
WHERE {$dbinfo[pre]}media_galleries.gallery_id IN ({$memberPermGalleriesForDB})
AND {$dbinfo[pre]}media.active = 1
AND {$dbinfo[pre]}media.approval_status = 1
GROUP BY {$dbinfo[pre]}media.media_id
ORDER BY {$dbinfo[pre]}media.views DESC
LIMIT {$config[settings][popular_media_count]}
";
*/
$sql =
"
SELECT SQL_CALC_FOUND_ROWS *
FROM {$dbinfo[pre]}media
WHERE {$dbinfo[pre]}media.active = 1
AND {$dbinfo[pre]}media.approval_status = 1
AND {$dbinfo[pre]}media.media_id IN (SELECT DISTINCT(gmedia_id) FROM {$dbinfo[pre]}media_galleries WHERE gallery_id IN ({$memberPermGalleriesForDB}))
ORDER BY {$dbinfo[pre]}media.views DESC
LIMIT {$config[settings][popular_media_count]}
"; // New 4.3.2
$popularMedia = new mediaList($sql); // Create a new mediaList object
if($returnRows = $popularMedia->getRows()) // Continue only if results are found
{
//echo "test: ".$returnRows; exit;
$popularMedia->getMediaDetails(); // Run the getMediaDetails function to grab all the media file details
$popularMedia->addThumbDetails = true; // Get the thumb details as part of the array
$popularMediaArray = $popularMedia->getMediaArray(); // Get the array of popular media
$popularMediaDetailsFields = $popularMedia->getDetailsFields('thumb');
if($popularMediaDetailsFields)
$thumbMediaDetailsArray = $thumbMediaDetailsArray + $popularMediaDetailsFields; // Get the output for the details shown under thumbnails
$smarty->assign('popularMediaRows',$returnRows); // Assign to smarty
$smarty->assign('popularMedia',$popularMediaArray); // Assign to smarty
}
}
catch(Exception $e)
{
die(exceptionError($e));
}
}
//print_r($featuredMediaDetailsArray);
//$thumbMediaDetailsArray = array_merge($featuredMediaDetailsArray,$newestMediaDetailsArray,$randomMediaDetailsArray,$popularMediaDetailsArray);
/*
* Get featured homepage promotions
*/
if($config['settings']['hppromos'])
{
try
{
$featuredPromotionsResult = mysqli_query($db,
"
SELECT *
FROM {$dbinfo[pre]}promotions
LEFT JOIN {$dbinfo[pre]}perms
ON ({$dbinfo[pre]}promotions.promo_id = {$dbinfo[pre]}perms.item_id AND {$dbinfo[pre]}perms.perm_area = 'promotions')
WHERE {$dbinfo[pre]}promotions.active = 1
AND {$dbinfo[pre]}promotions.homepage = 1
AND {$dbinfo[pre]}promotions.deleted = 0
AND ({$dbinfo[pre]}promotions.everyone = 1 OR {$dbinfo[pre]}perms.perm_value IN ({$memberPermissionsForDB}))
AND ({$dbinfo[pre]}promotions.quantity = '' OR {$dbinfo[pre]}promotions.quantity > '0')
ORDER BY {$dbinfo[pre]}promotions.sortorder
"
);
while($featuredPromotions = mysqli_fetch_assoc($featuredPromotionsResult))
$featuredPromotionsArray[] = promotionsList($featuredPromotions);
$smarty->assign('featuredPromotionsRows',count($featuredPromotionsArray));
$smarty->assign('featuredPromotions',$featuredPromotionsArray);
/*
if($returnRows = mysqli_num_rows($featuredPromotionsResult))
{
while($featuredPromotions = mysqli_fetch_assoc($featuredPromotionsResult))
$featuredPromotionsArray[] = promotionsList($featuredPromotions);
$smarty->assign('featuredPromotionsRows',$returnRows);
$smarty->assign('featuredPromotions',$featuredPromotionsArray);
}
*/
}
catch(Exception $e)
{
die(exceptionError($e));
}
}
/*
* Get featured homepage subscriptions
*/
if($config['settings']['hpsubs'] and $config['settings']['subscriptions'])
{
try
{
$featuredSubscriptionsResult = mysqli_query($db,
"
SELECT *
FROM {$dbinfo[pre]}subscriptions
LEFT JOIN {$dbinfo[pre]}perms
ON ({$dbinfo[pre]}subscriptions.sub_id = {$dbinfo[pre]}perms.item_id AND {$dbinfo[pre]}perms.perm_area = 'subscriptions')
WHERE {$dbinfo[pre]}subscriptions.active = 1
AND {$dbinfo[pre]}subscriptions.homepage = 1
AND {$dbinfo[pre]}subscriptions.deleted = 0
AND ({$dbinfo[pre]}subscriptions.everyone = 1 OR {$dbinfo[pre]}perms.perm_value IN ({$memberPermissionsForDB}))
ORDER BY {$dbinfo[pre]}subscriptions.sortorder
"
);
while($featuredSubscriptions = mysqli_fetch_assoc($featuredSubscriptionsResult))
$featuredSubscriptionsArray[] = subscriptionsList($featuredSubscriptions);
$smarty->assign('featuredSubscriptionsRows',count($featuredSubscriptionsArray));
$smarty->assign('featuredSubscriptions',$featuredSubscriptionsArray);
/*
if($returnRows = mysqli_num_rows($featuredSubscriptionsResult))
{
while($featuredSubscriptions = mysqli_fetch_assoc($featuredSubscriptionsResult))
$featuredSubscriptionsArray[] = subscriptionsList($featuredSubscriptions);
$smarty->assign('featuredSubscriptionsRows',$returnRows);
$smarty->assign('featuredSubscriptions',$featuredSubscriptionsArray);
}
*/
}
catch(Exception $e)
{
die(exceptionError($e));
}
}
/*
* Get featured homepage credits
*/
if($config['settings']['hpcredits'])
{
try
{
$featuredCreditsResult = mysqli_query($db,
"
SELECT *
FROM {$dbinfo[pre]}credits
LEFT JOIN {$dbinfo[pre]}perms
ON ({$dbinfo[pre]}credits.credit_id = {$dbinfo[pre]}perms.item_id AND {$dbinfo[pre]}perms.perm_area = 'credits')
WHERE {$dbinfo[pre]}credits.active = 1
AND {$dbinfo[pre]}credits.homepage = 1
AND {$dbinfo[pre]}credits.deleted = 0
AND ({$dbinfo[pre]}credits.everyone = 1 OR {$dbinfo[pre]}perms.perm_value IN ({$memberPermissionsForDB}))
ORDER BY {$dbinfo[pre]}credits.sortorder
"
);
while($featuredCredits = mysqli_fetch_assoc($featuredCreditsResult))
$featuredCreditsArray[] = creditsList($featuredCredits);
$smarty->assign('featuredCreditsRows',count($featuredCreditsArray));
$smarty->assign('featuredCredits',$featuredCreditsArray);
/*
if($returnRows = mysqli_num_rows($featuredCreditsResult))
{
while($featuredCredits = mysqli_fetch_assoc($featuredCreditsResult))
$featuredCreditsArray[] = creditsList($featuredCredits);
$smarty->assign('featuredCreditsRows',$returnRows);
$smarty->assign('featuredCredits',$featuredCreditsArray);
}
*/
}
catch(Exception $e)
{
die(exceptionError($e));
}
}
try
{
//print_r($thumbMediaDetailsArray);
//$smarty->assign('rolloverMediaDetails',$rolloverMediaDetailsArray);
$smarty->assign('thumbMediaDetails',$thumbMediaDetailsArray);
$smarty->display('index.tpl'); // Smarty template
}
catch(Exception $e)
{
die(exceptionError($e));
}
include BASE_PATH.'/assets/includes/debug.php';
if($db) mysqli_close($db); // Close any database connections
?>