forked from PHPFusion/PHPFusion
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweblinks.php
More file actions
executable file
·125 lines (121 loc) · 5.86 KB
/
weblinks.php
File metadata and controls
executable file
·125 lines (121 loc) · 5.86 KB
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
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) PHP-Fusion Inc
| https://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: weblinks.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "maincore.php";
require_once THEMES."templates/header.php";
include LOCALE.LOCALESET."weblinks.php";
if (isset($_GET['weblink_id']) && isnum($_GET['weblink_id'])) {
$res = 0;
if ($data = dbarray(dbquery("SELECT weblink_url,weblink_cat FROM ".DB_WEBLINKS." WHERE weblink_id='".$_GET['weblink_id']."'"))) {
$cdata = dbarray(dbquery("SELECT weblink_cat_access FROM ".DB_WEBLINK_CATS." WHERE weblink_cat_id='".$data['weblink_cat']."'"));
if (checkgroup($cdata['weblink_cat_access'])) {
$res = 1;
$result = dbquery("UPDATE ".DB_WEBLINKS." SET weblink_count=weblink_count+1 WHERE weblink_id='".$_GET['weblink_id']."'");
redirect($data['weblink_url']);
}
}
if ($res == 0) {
redirect(FUSION_SELF);
}
}
add_to_title($locale['global_200'].$locale['400']);
if (!isset($_GET['cat_id']) || !isnum($_GET['cat_id'])) {
opentable($locale['400']);
$result = dbquery("SELECT weblink_cat_id, weblink_cat_name, weblink_cat_description FROM ".DB_WEBLINK_CATS." ".(multilang_table("WL") ? "WHERE weblink_cat_language='".LANGUAGE."' AND" : "WHERE")." ".groupaccess('weblink_cat_access')." ORDER BY weblink_cat_name");
$rows = dbrows($result);
if ($rows != 0) {
$counter = 0;
$columns = 2;
echo "<div class='row m-0'>\n";
while ($data = dbarray($result)) {
$image = get_image('folder');
$num = dbcount("(weblink_cat)", DB_WEBLINKS, "weblink_cat='".$data['weblink_cat_id']."'");
if ($counter != 0 && ($counter%$columns == 0)) {
echo "</div>\n<div class='row m-0'>\n";
}
echo "<div class='col-xs-12 col-sm-6 col-md-6 col-lg-6 p-t-20'>\n";
echo "<div class='media'>\n";
echo "<a class='pull-left flleft' href='".FUSION_SELF."?cat_id=".$data['weblink_cat_id']."'>\n";
echo "<img class='media-object' src='".$image."' alt='".$data['weblink_cat_name']."'>\n";
echo "</a>\n";
echo "<div class='media-body'>\n";
echo "<h4 class='media-heading'><a href='".FUSION_SELF."?cat_id=".$data['weblink_cat_id']."'>".$data['weblink_cat_name']."</a> <span class='small'>$num</span></h4>\n";
if ($data['weblink_cat_description'] != "") {
echo "<span class='small'>".$data['weblink_cat_description']."</span>";
}
echo "</div>\n</div>\n";
echo "</div>\n";
$counter++;
}
echo "</div>\n";
} else {
echo "<div style='text-align:center'><br />\n".$locale['430']."<br /><br />\n</div>\n";
}
closetable();
} else {
$res = 0;
$result = dbquery("SELECT weblink_cat_name, weblink_cat_sorting, weblink_cat_access FROM ".DB_WEBLINK_CATS." ".(multilang_table("WL") ? "WHERE weblink_cat_language='".LANGUAGE."' AND" : "WHERE")." weblink_cat_id='".$_GET['cat_id']."'");
if (dbrows($result) != 0) {
$cdata = dbarray($result);
if (checkgroup($cdata['weblink_cat_access'])) {
$res = 1;
add_to_title($locale['global_201'].$cdata['weblink_cat_name']);
// go for breadcrumbs.
echo "<ol class='breadcrumb'>\n";
echo "<li><a href='".BASEDIR."weblinks.php'>".$locale['400']."</a></li>\n";
echo "<li>".$cdata['weblink_cat_name']."</a></li>\n";
echo "</ol>\n";
opentable($locale['400'].": ".$cdata['weblink_cat_name']);
$rows = dbcount("(weblink_id)", DB_WEBLINKS, "weblink_cat='".$_GET['cat_id']."'");
if (!isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) {
$_GET['rowstart'] = 0;
}
if ($rows != 0) {
$result = dbquery("SELECT weblink_id, weblink_name, weblink_description, weblink_datestamp, weblink_count FROM ".DB_WEBLINKS." WHERE weblink_cat='".$_GET['cat_id']."' ORDER BY ".$cdata['weblink_cat_sorting']." LIMIT ".$_GET['rowstart'].",".$settings['links_per_page']);
$numrows = dbrows($result);
$i = 1;
while ($data = dbarray($result)) {
if ($data['weblink_datestamp']+604800 > time()+($settings['timeoffset']*3600)) {
$new = " <span class='label label-success m-r-10'>".$locale['410']."</span>";
} else {
$new = "";
}
echo "<aside class='display-inline-block ".($i > 1 ? 'm-t-20' : '' )."' style='width:100%;'>\n";
echo "<h4><a href='".BASEDIR."weblinks.php?cat_id=".$_GET['cat_id']."&weblink_id=".$data['weblink_id']."' target='_blank'><strong>".$data['weblink_name']."</strong></a></h4>\n";
echo $new;
echo "<span class='text-lighter display-inline m-r-20'><strong>".$locale['411']."</strong> ".showdate("shortdate", $data['weblink_datestamp'])."</span>\n";
echo "<span class='text-lighter display-inline'><strong>".$locale['412']."</strong> ".$data['weblink_count']."</span>\n";
if ($data['weblink_description'] != "") echo "<div class='weblink-text text-smaller'>".nl2br(stripslashes($data['weblink_description']))."</div>\n";
echo "</aside>\n";
$i++;
}
closetable();
if ($rows > $settings['links_per_page']) {
echo "<div class='text-center m-t-10' align='center'>\n".makepagenav($_GET['rowstart'], $settings['links_per_page'], $rows, 3, BASEDIR."weblinks.php?cat_id=".$_GET['cat_id']."&")."\n</div>\n";
}
} else {
echo $locale['431']."\n";
closetable();
}
}
}
if ($res == 0) {
redirect(FUSION_SELF);
}
}
require_once THEMES."templates/footer.php";
?>