root/offers.php

Revision 321, 21.9 kB (checked in by Nafania, 1 year ago)

--

Line 
1 <?php</span>
2 <span class="code-lang">$root_path = './';
3 require ($root_path . 'include/config.php');
4 require ($root_path . 'include/functions_check.php');
5 require ($root_path . 'include/functions_selects.php');
6
7 $userdata = session_pagestart($user_ip);
8 init_userprefs($userdata);
9 loggedinorreturn();
10
11 $action = request_var('action', '');</span>
12 <span class="code-lang">
13 if ( isset($_GET['id']) && !$action ) {
14     $action = 'offer_view';
15 }
16
17 switch ( $action ) {
18     case 'delete':
19         require_once($root_path . 'include/functions_delete.php');
20         $ids_ary = request_var('id', array(0=>0));
21         $ids = array();
22         if ( sizeof($ids_ary) ) {
23             $sql = 'SELECT userid, id FROM ' . OFFERS_TABLE . ' WHERE id IN (' . implode(', ', $ids_ary) . ')';
24             $result = $db->sql_query($sql);
25
26             while ( $row = $db->sql_fetchrow($result) ) {
27                 if ( $row['userid'] != $userdata['uid'] && $userdata['class'] < UC_MODERATOR) {
28                     continue;
29                 }
30                 $ids[] = $row['id'];
31             }
32
33             delete_offer($ids);
34             meta_refresh(3, append_sid($root_path . 'offers.php'));
35             trigger_error($lang['offer_deleted']);
36         }
37         else {
38             redirect ( append_sid($root_path . 'offers.php'));
39         }
40
41     break;
42
43     case 'edit':
44         $id = request_var('id', 0);
45         $sql = 'SELECT * FROM ' . OFFERS_TABLE . ' WHERE id = ' . $id;
46         $result = $db->sql_query($sql);
47         if ( !$row = $db->sql_fetchrow($result) ) {
48               trigger_error(sprintf($lang['invalid_id'], $id));
49          }
50          if ( $userdata['uid'] != $row['userid'] && $userdata['class'] < UC_MODERATOR ) {
51                 trigger_error($lang['access_denied']);
52          }
53
54         if ( isset($_POST['submit_edit']) ) {
55             $category = request_var('category', 0);
56             $title = request_var('title', '');
57             $descr = request_var('descr', '');
58
59                if (!$title || !$descr ) {
60                    trigger_error($lang['post_something']);
61                }
62                if ( !check_category_id($category) ) {
63                    trigger_error( sprintf($lang['invalid_id'], $category) );
64                }
65                $sql = 'UPDATE ' . OFFERS_TABLE . ' SET  ' . $db->sql_build_array('UPDATE', array('category' => $category,
66                                                                                       'name' => $title,
67                                                                                       'descr' => $descr)) . ' WHERE id = ' . $id;
68                $db->sql_query($sql);
69                redirect( append_sid('offers.php?id=' . $id));
70         }
71         else {
72             $template->assign_vars(array(
73                'S_FORM_ACTION' => append_sid('offers.php'),
74                'ID' => $id,
75                'NAME' => $row['name'],
76                'EDIT_OFFER' => sprintf($lang['edit_offer'], $row['name']),
77                'CATS_SELECT' => categories_select($row['category']),
78                'DESCR' => $row['descr']
79             ));
80
81             stdhead (sprintf($lang['edit_offer'], $row['name']));
82             $template->set_filenames(array(
83                 'body' => 'offers_edit_body.html'
84             ));
85             stdfoot();
86         }
87     break;
88
89     case 'vote':
90         $id = request_var('voteid', 0);
91
92         $sql = 'SELECT offerid FROM ' . OFFERS_VOTES_TABLE . ' WHERE offerid = ' . $id . ' AND userid = ' . $userdata['uid'];
93
94         $result = $db->sql_query($sql);
95         if ( $row = $db->sql_fetchrow($result) ) {
96             trigger_error($lang['dupe_vote']);
97          }
98          else {
99                $sql = 'UPDATE ' . OFFERS_TABLE . ' SET votes = votes + 1 WHERE id= ' . $id;
100                $db->sql_query($sql);
101                $sql = 'INSERT INTO ' . OFFERS_VOTES_TABLE . ' (offerid, userid) VALUES(' . $id . ', ' . $userdata['uid'] . ')';
102                $db->sql_query($sql);
103
104             meta_refresh(3, append_sid($root_path . 'offers.php?id=' . $id));
105                trigger_error($lang['sucefully_voted']);
106         }
107     break;
108
109     case 'reset':
110         $id = request_var('id', 0);
111
112         $sql = 'SELECT userid, filledby, o.name, user_reputation, user_reputation_level, user_rank_id, uid
113                FROM ' . OFFERS_TABLE . ' o, ' . USERS_TABLE . ' u
114                WHERE u.uid = o.userid
115                AND id = ' . $id;
116         $result = $db->sql_query($sql);
117         if ( !($row = $db->sql_fetchrow($result)) ) {
118             trigger_error(sprintf($lang['invalid_id'], $id));
119         }
120         if ( $userdata['uid'] == $row['userid'] || $userdata['class'] >= UC_MODERATOR || $userdata['uid'] == $row['filledby'] ) {
121                 $sql = 'UPDATE ' . OFFERS_TABLE . ' SET filled = 0, filledby = 0 WHERE id = ' . $id;
122                 $db->sql_query($sql);
123
124                 update_reputation($row, SIMPATY_FILL_OFFER, 0);
125
126              meta_refresh(3, append_sid($root_path . 'offers.php?id=' . $id));
127
128                 trigger_error(sprintf($lang['offer_succefully_reset'], $row['name']));
129         }
130         else {
131                 trigger_error($lang['access_denied']);
132         }
133     break;
134
135     case 'filled':
136         if ( $userdata['class'] < $config['min_class_allow_upload'] ) {
137             trigger_error($lang['access_denied']);
138          }
139
140          $id = request_var('offerid', 0);
141          $filledurl = request_var('filledurl', '');
142
143         $sql = 'SELECT userid, filledby, name FROM ' . OFFERS_TABLE . ' WHERE id = ' . $id;
144         $result = $db->sql_query($sql);
145         if ( !$row = $db->sql_fetchrow($result) ) {
146             trigger_error(sprintf($lang['invalid_id'], $id));
147         }
148
149         $offer_name = $row['name'];
150
151         if ( $seo->seo_opt['url_rewrite'] ) {
152             $filled_torrent_id = $seo->get_url_info('details', $filledurl, 'id');
153         }
154         else {
155             preg_match('/details.php\?id=([0-9]+)/', $filledurl, $matches);
156             $filled_torrent_id = ( !empty($matches[1]) ? (int) $matches[1] : 0 );
157         }
158
159         if ( !$filled_torrent_id ) {
160             trigger_error($lang['invalid_url_for_uploaded_torrent']);
161         }
162
163         $sql = 'SELECT name, category FROM ' . TORRENTS_TABLE . ' WHERE fid = ' . $filled_torrent_id;
164         $result = $db->sql_query($sql);
165         if ( !$row = $db->sql_fetchrow($result) ) {
166             trigger_error($lang['invalid_url_for_uploaded_torrent']);
167         }
168         $torrent_name = censor_text($row['name']);
169         $cats = $cache->obtain_cats();
170
171         $cat_id = $row['category'];
172         $cat_parent_id = ( isset($cats[$cats[$cat_id]['cat_parent']]['cat_id']) ? $cats[$cats[$cat_id]['cat_parent']]['cat_id'] : 0 );
173
174         // www.phpBB-SEO.com SEO TOOLKIT BEGIN
175         if ( $cat_parent_id ) {
176             $seo->set_url($cats[$cat_parent_id]['cat_name'], $cat_parent_id, $seo->seo_static['browse']);
177             $seo->set_parent($cat_id, $seo->seo_static['browse'], $cat_parent_id, $seo->seo_static['browse']);
178         }
179
180         $seo->set_url($cats[$cat_id]['cat_name'], $cat_id, $seo->seo_static['browse']);
181
182         $seo->set_parent($filled_torrent_id, $seo->seo_static['details'], $cat_id, $seo->seo_static['browse']);
183
184         $seo->set_url($torrent_name, $filled_torrent_id, $seo->seo_static['details']);
185
186         $seo->set_user_url($userdata['name'], $userdata['uid']);
187         // www.phpBB-SEO.com SEO TOOLKIT END
188
189         if ( $seo->seo_opt['url_rewrite'] ) {
190             $u_offer = append_sid($root_path . 'offers.php?id=' . $id);
191             $u_offer = $seo->drop_sid($u_offer);
192             $u_userdetails = append_sid($root_path . 'userdetails.php?id=' . $userdata['uid']);
193             $u_userdetails = $seo->drop_sid($u_userdetails);
194             $u_details = append_sid($root_path . 'details.php?id=' . $filled_torrent_id);
195             $u_details = $seo->drop_sid($u_details);
196         }
197         else {
198             $base_url = generate_base_url();
199             $u_offer = $base_url . '/offers.php?id=' . $id;
200             $u_userdetails = $base_url . '/userdetails.php?id=' . $userdata['uid'];
201             $u_details = $base_url . '/details.php?id=' . $filled_torrent_id;
202         }
203
204         $sql = 'SELECT o.userid, u.language, u.name, u.email, u.notifs, u.language, u.class
205                 FROM ' . OFFERS_VOTES_TABLE . ' o, ' . USERS_TABLE . ' u
206                 WHERE o.offerid = ' . $id . ' AND o.userid = u.uid';
207         $result = $db->sql_query($sql);
208
209         $pm_ary = array();
210
211         while ( $arr = $db->sql_fetchrow($result) ) {
212             require_once($root_path . 'languages/lang_' . $arr['language'] . '/lang_pms.php');
213
214             $pm_ary[] = array(
215                 'sender' => 0,
216                 'receiver' => $arr['userid'],
217                 'msg' => sprintf($lang['pm_offer_filled_body'], $u_offer, $offer_name, $u_userdetails, $userdata['name'], $u_details, $torrent_name),
218                 'subject' => $lang['pm_offer_filled_subject'],
219                 'name' => $arr['name'],
220                 'email' => $arr['email'],
221                 'notifs' => $arr['notifs'],
222                 'language' => $arr['language'],
223                 'class' => $arr['class']
224             );
225         }
226
227         send_pm($pm_ary);
228
229         $sql = 'UPDATE ' . OFFERS_TABLE . ' SET filled = ' . $filled_torrent_id . ', filledby = ' . $userdata['uid'] . ' WHERE id = ' . $id;
230         $db->sql_query($sql);
231
232         update_reputation($userdata, SIMPATY_FILL_OFFER, 1);
233
234         trigger_error(sprintf($lang['offer_succefully_filled'], $id, append_sid($root_path . 'details.php?id=' . $filled_torrent_id), $torrent_name, append_sid('offers.php?action=reset&amp;id=' . $id) ));
235     break;
236
237     case 'voteview':
238
239         $id = request_var('offerid', 0);
240
241         $sql = 'SELECT COUNT(ov.id) AS count, o.name
242                 FROM ' . OFFERS_VOTES_TABLE . ' ov, ' . OFFERS_TABLE . ' o
243                 WHERE ov.offerid = ' . $id . ' AND ov.offerid = o.id
244                 GROUP BY o.id';
245         $result = $db->sql_query($sql);
246         $count = ( $row = $db->sql_fetchrow($result) ) ? $row['count'] : 0;
247
248         $perpage = 20;
249         list($pagertop, $pagerbottom, $offset, $limit) = pager($perpage, $count, 'offers.php?action=voteview&amp;offerid=' . $id . '&amp;');
250
251          $sql = 'SELECT u.uid, u.name, u.downloaded, u.uploaded, u.class
252                 FROM ' . OFFERS_VOTES_TABLE . ' ov, ' . OFFERS_TABLE . ' o, ' . USERS_TABLE . ' u
253                 WHERE ov.offerid = ' . $id . ' AND ov.offerid = o.id AND ov.userid = u.uid';
254         $result = $db->sql_query_limit($sql, $limit, $offset);
255
256         $template->assign_vars(array(
257                 'TRACKER_URL' => generate_base_url(),
258                 'U_VOTE' => append_sid('offers.php?action=vote&amp;voteid=' . $id),
259                 'PAGERTOP' => $pagertop,
260                 'PAGERBOTTOM' => $pagerbottom,
261                 'ID' => $id,
262                 'L_VOTES_VIEW' => sprintf($lang['votes_view'], $row['name'])
263         ));
264
265         while ( $row = $db->sql_fetchrow($result) ) {
266             $ratio = get_ratio($row['uploaded'], $row['downloaded']);
267
268             $template->assign_block_vars('voters_row', array(
269                     'U_USERDETAILS' => append_sid('userdetails.php?id=' . $row['uid']),
270                     'RATIO' => $ratio,
271                     'RATIO_COLOR' => get_ratio_color($ratio),
272                     'UPLOADED'=> mksize($row['uploaded']),
273                     'DOWNLOADED' => mksize($row['downloaded']),
274                     'USERNAME' => get_user_class_color($row['class'],$row['name'])
275             ));
276         }
277
278         stdhead();
279         $template->set_filenames(array(
280             'body' => 'votesview.html'
281         ));
282         stdfoot();
283     break;
284
285     case 'offer_view':
286
287         $id = request_var('id', 0);
288
289         $sql = 'SELECT o.*, c.name AS cat_name, u.name AS username
290                 FROM ' . OFFERS_TABLE . ' o, ' . CATEGORIES_TABLE . ' c, ' . USERS_TABLE . ' u
291                 WHERE o.id = ' . $id . ' AND o.category = c.id AND o.userid = u.uid';
292         $result = $db->sql_query($sql);
293
294         if ( !$row = $db->sql_fetchrow($result) ) {
295             trigger_error (sprintf($lang['invalid_id'], $id));
296         }
297
298         /* */
299         require ($root_path . 'include/bbcode/bbcode.lib.php');
300         require ($root_path . 'include/functions_post.php');
301         /* */
302
303         if ( $row['userid'] <> ANONYMOUS ) {
304             $oferer_name = $row['username'];
305             // www.phpBB-SEO.com SEO TOOLKIT BEGIN
306             $seo->set_user_url($oferer_name, $row['userid']);
307             // www.phpBB-SEO.com SEO TOOLKIT END
308             $u_oferer = append_sid($root_path . 'userdetails.php?id=' . $row['userid']);
309         }
310         else {
311             $oferer_name = '<i>' . $lang['unknown'] . '</i>';
312             $u_oferer = '';
313         }
314
315         $bb_code = new bbcode($row['descr']);
316         $description = $bb_code->get_html();
317         $description = censor_text($description);
318
319         if ( $userdata['class'] >= UC_MODERATOR || $userdata['uid'] == $row['userid'] ) {
320             $template->assign_block_vars('switch_edit_section', array());
321         }
322
323         if ( !$row['filled'] ) {
324             $template->assign_block_vars('switch_vote_section', array());
325         }
326
327         if ( !$row['filled'] && ( $userdata['class'] >= $config['min_class_allow_upload'] )) {
328             $template->assign_block_vars('switch_fill_offer', array());
329         }
330
331         set_tracking(TYPE_OFFER, $id);
332
333         if ( $row['comments'] ) {
334             list($pagertop, $pagerbottom, $offset, $limit) = pager($config['posts_per_page'], $row['comments'], 'offers.php?id=' . $id . '&amp;', array( 'reverse' => 1 ));
335
336             commenttable(TYPE_OFFER, $id, $row['userid'], $offset, $limit);
337         }
338         else {
339             $pagertop = $pagerbottom = '';
340         }
341
342         $sql = 'SELECT checkcomm_view_status FROM ' . COMMENTS_NOTIFY_TABLE . ' WHERE checkcomm_userid = ' . $userdata['uid'] . ' AND checkcomm_for_id = ' . $id . ' AND checkcomm_type = ' . TYPE_OFFER;
343         $result = $db->sql_query($sql);
344         $checkcomm = $db->sql_fetchrow($result);
345         if ( $checkcomm ) {
346             if ( !$checkcomm['checkcomm_view_status'] ) {
347                 $sql_priority = ($db_type == 'mysql') ? ' LOW_PRIORITY' : '';
348                 $sql = 'UPDATE' . $sql_priority . ' ' . COMMENTS_NOTIFY_TABLE . ' SET  checkcomm_view_status = ' . VIEW_STATUS_VIEWED . ', checkcomm_notify_status = ' . NOTIFY_STATUS_UN_NOTIFIED . ' WHERE checkcomm_userid = ' . $userdata['uid'] . ' AND checkcomm_for_id = ' . $id . ' AND checkcomm_type = ' . TYPE_OFFER;
349                 $db->sql_query($sql);
350             }
351             $check = '<a href="' . append_sid($root_path . 'comment.php?type=' . TYPE_OFFER . '&amp;action=checkoff&amp;tid=' . $id) . '">' . $lang['checkcomm_off'] . '</a>';
352         }
353         else {
354             $check = '<a href="' . append_sid($root_path . 'comment.php?type=' . TYPE_OFFER . '&amp;action=check&amp;tid=' . $id) . '">' . $lang['checkcomm_on'] . '</a>';
355         }
356
357         $template->assign_vars(array(
358             'U_OFFERER' => $u_oferer,
359             'U_VOTE' => append_sid('offers.php?action=vote&amp;voteid=' . $id),
360             'U_VOTES' => append_sid('offers.php?action=voteview&amp;offerid=' . $id),
361             'U_DELETE' => append_sid('offers.php?action=delete&amp;id[]=' . $id),
362             'U_RESET' => append_sid('offers.php?action=reset&amp;id=' . $id),
363             'U_EDIT' => append_sid('offers.php?action=edit&amp;id=' . $id),
364             'S_FORM_ACTION' => append_sid('offers.php'),
365             'FILL_OFFER_DESCR' => sprintf($lang['fill_request_descr'], generate_base_url()),
366             'ID' => $id,
367             'OFFER_DETAILS' => sprintf($lang['offer_details'], $row['name']),
368             'OFFER_NAME' => censor_text($row['name']),
369             'DESCRIPTION' => $description,
370             'ADDED' => create_date($row['added']),
371             'TYPE' => $row['cat_name'],
372             'OFERER_ID' => $row['userid'],
373             'OFERER_NAME' => $oferer_name,
374             'VOTES' => $row['votes'],
375             'COMMENTS_COUNT' => $row['comments'],
376
377             'U_ADD_COMMENT' => append_sid($root_path . 'comment.php?type=' . TYPE_OFFER . '&amp;action=add&amp;tid=' . $id ),
378             'CHECK' => $check,
379             'PAGERTOP' => $pagertop,
380             'PAGERBOTTOM' => $pagerbottom
381         ));
382
383         stdhead(sprintf($lang['offer_details'], $row['name']));
384
385         $template->set_filenames(array(
386             'body' => 'offers_view_body.html'
387         ));
388         stdfoot();
389
390     break;
391
392     default:
393         require_once ($root_path . 'include/functions_search.php');
394
395         $cats = $cache->obtain_cats();
396         $cat = request_var('cat', 0);
397         $oid = request_var('oid', 0);
398         $sort = request_var('sort', '');
399         $searchstr = request_var('s', '');
400         $search_ids = array();
401         $count = 0;
402
403         $cleansearchstr = searchfield($searchstr);
404         if ( empty($searchstr) ) {
405             unset($cleansearchstr);
406         }
407
408         $pagertop = '';
409         $pagerbottom = '';
410
411         $search_arr = $where = array();
412
413
414         if ( $cat ) {
415             $wherecatina = array();
416             if ( isset($cats[$cat]) ) {
417                 if ( $cats[$cat]['cat_parent'] ) {
418                     $wherecatina[] = $cat;
419                 }
420                 //no cat parent, try to get all child cats
421                 else {
422                     foreach ( $cats AS $_key => $_ary ) {
423                         if ( $_ary['cat_parent'] == $cat ) {
424                             $wherecatina[] = $_key;
425                         }
426                     }
427                     $wherecatina[] = $cat;
428                 }
429             }
430             $where[] = 'o.category IN (' . implode(', ', $wherecatina) . ')';
431             $search_arr[] = 'cat=' . $cat;
432         }
433
434         if( $oid ) {
435             $where[] = 'o.userid = ' . $oid;
436             $search_arr[] = 'rid=' . $oid;
437         }
438
439         if ( isset($cleansearchstr) ) {
440             $search_ids = search_text_in_db($searchstr, 'SELECT o.id FROM ' . OFFERS_TABLE . ' o', 'o.name');
441
442             if ( $count = sizeof($search_ids) ) {
443                 $where[] = 'o.id IN (' . implode(', ', $search_ids) . ')';
444             }
445             $search_arr[] = 's=' . urlencode($cleansearchstr);
446         }
447
448         $search_arr = implode('&amp;', $search_arr);
449         $search_arr = ( $search_arr ? $search_arr . '&amp;' : '' );
450
451         $where_sql = implode(' AND ', $where);
452         $where_sql = ( $where_sql ? 'WHERE ' . $where_sql : '' );
453
454         $sort_ary = array(
455             'votes' => 'o.votes DESC',
456             'comments' => 'o.comments DESC',
457             'name' => 'o.name ASC',
458             'offerer' => 'u.name ASC',
459             'filled' => 'o.filled DESC',
460             'added' => 'o.added DESC',
461         );
462
463         $sort_sql = 'o.filled DESC, o.added DESC';
464
465         foreach ( $sort_ary AS $sort_type => $_sort_sql ) {
466             if ( $sort == $sort_type ) {
467                 $sort_sql = $_sort_sql;
468             }
469
470             $template->assign_vars(array(
471                 'U_SORT_' . strtoupper($sort_type) => append_sid('offers.php?' . $search_arr . 'sort=' . $sort_type)
472             ));
473         }
474
475          if ( $userdata['class'] < UC_MODERATOR ) {
476              $moderator = false;
477          }
478          else {
479              $moderator = true;
480          }
481
482         if ( !isset($cleansearchstr)) {
483             $sql = 'SELECT COUNT(*) AS count FROM ' . OFFERS_TABLE . ' o ' . $where_sql;
484             $result = $db->sql_query($sql);
485             $count = ( $row = $db->sql_fetchrow($result) ) ? intval($row['count']) : 0;
486         }
487
488         if ( $count ) {
489             $where_sql = ( $where_sql ? $where_sql . ' AND o.userid = u.uid' : 'WHERE o.userid = u.uid');
490             $perpage = ( $userdata['torrentsperpage'] ? $userdata['torrentsperpage'] : 30 );
491
492             list($pagertop, $pagerbottom, $offset, $limit) = pager($perpage, $count, 'offers.php?' . $search_arr . 'sort=' . $sort . '&amp;' );
493
494             $sql = 'SELECT u.name AS username, u.class, o.id, o.userid, o.name, o.added, o.votes, o.comments, o.filled, o.filledby, u2.name AS filledby_username, o.category, t.name AS torrent_name, t.category AS t_category
495                     FROM ' . OFFERS_TABLE . ' o
496                     LEFT JOIN ' . USERS_TABLE . ' u2 ON o.filledby = u2.uid
497                     LEFT JOIN ' . TORRENTS_TABLE . ' t ON o.filled = t.fid,
498                     ' . USERS_TABLE . ' u ' . $where_sql . ' ORDER BY ' . $sort_sql;
499             $result = $db->sql_query_limit($sql, $limit, $offset);
500         }
501
502         $cats_select = categories_select($cat, 'cat', true);
503
504         $offer_actions = array('reset', 'delete');
505         $offer_action_options = '';
506         foreach ( $offer_actions AS $_null => $action ) {
507             $offer_action_options .= '<option value="' . $action . '">' . $lang[$action] . '</option>';
508         }
509
510         $template->assign_vars(array(
511             'S_FORM_ACTION' => append_sid('offers.php'),
512             'U_DO_OFFER' => ( $userdata['class'] >= $config['min_class_allow_upload'] ? append_sid('upload.php?type=offer') : '' ),
513             'U_MY_OFFERS' => append_sid('offers.php?oid=' . $userdata['uid']),
514             'USER_ID' => $userdata['uid'],
515             'PAGERTOP' => $pagertop,
516             'PAGERBOTTOM' => $pagerbottom,
517             'CATS_SELECT' => $cats_select,
518             'SEARCH_VALUE' => $searchstr,
519             'USED_SEARCH' => isset($cleansearchstr),
520             'HAVE_SEARCH_RESULTS' => ( $count ? true : false ),
521             'CAN_MODERATE' => $moderator,
522             'S_MOD_FORM_ACTION' => append_sid('modtask.php?action=mass_offers_action'),
523             'OFFER_ACTION_OPTIONS' => $offer_action_options
524         ));
525
526         if ( $count ) {
527             while ( $row = $db->sql_fetchrow($result) ) {
528
529                 // www.phpBB-SEO.com SEO TOOLKIT BEGIN
530                 if ( $row['filled'] ) {
531                     $cat_id = $row['t_category'];
532                     $cat_parent_id = ( isset($cats[$cats[$cat_id]['cat_parent']]['cat_id']) ? $cats[$cats[$cat_id]['cat_parent']]['cat_id'] : 0 );
533
534                     if ( $cat_parent_id ) {
535                         $seo->set_url($cats[$cat_parent_id]['cat_name'], $cat_parent_id, $seo->seo_static['browse']);
536                         $seo->set_parent($cat_id, $seo->seo_static['browse'], $cat_parent_id, $seo->seo_static['browse']);
537                     }
538
539                     $seo->set_url($cats[$cat_id]['cat_name'], $cat_id, $seo->seo_static['browse']);
540
541                     $seo->set_parent($row['filled'], $seo->seo_static['details'], $cat_id, $seo->seo_static['browse']);
542
543                     $seo->set_url($row['torrent_name'], $row['filled'], $seo->seo_static['details']);
544                 }
545                 $seo->set_user_url($row['username'], $row['userid']);
546                 // www.phpBB-SEO.com SEO TOOLKIT END
547
548                 $addedby_username = ( $row['userid'] ? get_user_class_color($row['class'], $row['username']) : '<i>' . $lang['unknown'] . '</i>' );
549                 $filled = ( $row['filled'] ? append_sid($root_path . 'details.php?id=' . $row['filled']) : '');
550                 $comment = ( $row['comments'] ? '<a href="' . append_sid('offers.php?id=' . $row['id']) . '#startcomments"><b>' . $row['comments'] . '</b></a>' : 0);
551                 $vote_link = ($row['filled'] ? '' : '<a href="' . append_sid('offers.php?action=vote&amp;voteid=' . $row['id']) . '">' . $lang['vote'] . '</a>' );
552
553                 $cat_name_display = ( isset($cats[$cats[$row['category']]['cat_parent']]['cat_name']) ? '<a href="' . append_sid('offers.php?cat=' . $cats[$cats[$row['category']]['cat_parent']]['cat_id']) . '">' . $cats[$cats[$row['category']]['cat_parent']]['cat_name'] . '</a> -> <a href="' . append_sid('offers.php?cat=' . $row['category']) . '">' . $cats[$row['category']]['cat_name'] . '</a>' : '' );
554
555                 $template->assign_block_vars('offers_row', array(
556                     'U_CAT' => append_sid('offers.php?cat=' . $row['category']),
557                     'U_OFFER' => ( $filled ? $filled : append_sid('offers.php?id=' . $row['id']) ),
558                     'U_OFFERER' => append_sid($root_path . 'userdetails.php?id=' . $row['userid']),
559                     'U_VOTES' => append_sid('offers.php?action=voteview&amp;offerid=' . $row['id']),
560                     'CAT_NAME_DISPLAY' => $cat_name_display,
561                     'FILLED_COLOR' => ( $filled ? 'background-color:#00CC33;' : '' ),
562                     'ADDEDBY_ID' => $row['userid'],
563                     'ADDEDBY_USERNAME' => $addedby_username,
564                     'FILLED_LINK' => $filled,
565                     'COMMENT_LINK' => $comment,
566                     'CAT_ID' => $row['category'],
567                     'CAT_IMG' => $cats[$row['category']]['cat_pic'],
568                     'CAT_NAME' => $cats[$row['category']]['cat_name'],
569                     'ID' => $row['id'],
570                     'NAME' => censor_text($row['name']),
571                     'ADDED' => create_date($row['added']),
572                     'VOTES' => $row['votes'],
573                     'VOTE_LINK' => $vote_link
574                 ));
575             }
576         }
577
578         stdhead($lang['offers']);
579         $template->set_filenames(array(
580             'body' => 'offers_body.html'
581         ));
582         stdfoot();
583     break;
584 }
585 ?>
586
Note: See TracBrowser for help on using the browser.