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: 683: 684: 685: 686: 687: 688: 689: 690: 691: 692: 693: 694: 695: 696: 697: 698: 699: 700: 701: 702: 703: 704: 705: 706: 707: 708: 709: 710: 711: 712: 713: 714: 715: 716: 717: 718: 719: 720: 721: 722: 723: 724: 725: 726: 727: 728: 729: 730: 731: 732: 733: 734: 735: 736: 737: 738: 739: 740: 741: 742: 743: 744: 745: 746: 747: 748: 749: 750: 751: 752: 753: 754: 755: 756: 757: 758: 759: 760: 761: 762: 763: 764: 765: 766: 767: 768: 769: 770: 771: 772: 773: 774: 775: 776: 777: 778: 779: 780: 781: 782: 783: 784: 785: 786: 787: 788: 789: 790: 791: 792: 793: 794: 795: 796: 797: 798: 799: 800: 801: 802: 803: 804: 805: 806: 807: 808: 809: 810: 811: 812: 813: 814: 815: 816: 817: 818: 819: 820: 821: 822: 823: 824: 825: 826: 827: 828: 829: 830: 831: 832: 833: 834: 835: 836: 837: 838: 839: 840: 841: 842: 843: 844: 845: 846: 847: 848: 849: 850: 851: 852: 853: 854: 855: 856: 857: 858: 859: 860: 861: 862: 863: 864: 865: 866: 867: 868: 869: 870: 871: 872: 873: 874: 875: 876: 877: 878: 879: 880: 881: 882: 883: 884: 885: 886: 887: 888: 889: 890: 891: 892: 893: 894: 895: 896: 897: 898: 899: 900: 901: 902:
<?php
if (!defined('SMF'))
die('No direct access...');
function Who()
{
global $context, $scripturl, $txt, $modSettings, $memberContext, $smcFunc;
isAllowedTo('who_view');
if (empty($modSettings['who_enabled']))
fatal_lang_error('who_off', false);
loadTemplate('Who');
loadLanguage('Who');
$sort_methods = array(
'user' => 'mem.real_name',
'time' => 'lo.log_time'
);
$show_methods = array(
'members' => '(lo.id_member != 0)',
'guests' => '(lo.id_member = 0)',
'all' => '1=1',
);
$context['sort_methods'] = array(
'user' => $txt['who_user'],
'time' => $txt['who_time'],
);
$context['show_methods'] = array(
'all' => $txt['who_show_all'],
'members' => $txt['who_show_members_only'],
'guests' => $txt['who_show_guests_only'],
);
if (!empty($modSettings['show_spider_online']) && ($modSettings['show_spider_online'] == 2 || allowedTo('admin_forum')) && !empty($modSettings['spider_name_cache']))
{
$show_methods['spiders'] = '(lo.id_member = 0 AND lo.id_spider > 0)';
$show_methods['guests'] = '(lo.id_member = 0 AND lo.id_spider = 0)';
$context['show_methods']['spiders'] = $txt['who_show_spiders_only'];
}
elseif (empty($modSettings['show_spider_online']) && isset($_SESSION['who_online_filter']) && $_SESSION['who_online_filter'] == 'spiders')
unset($_SESSION['who_online_filter']);
if (isset($_REQUEST['sort']) && isset($sort_methods[$_REQUEST['sort']]))
{
$context['sort_by'] = $_SESSION['who_online_sort_by'] = $_REQUEST['sort'];
$sort_method = $sort_methods[$_REQUEST['sort']];
}
elseif (isset($_SESSION['who_online_sort_by']))
{
$context['sort_by'] = $_SESSION['who_online_sort_by'];
$sort_method = $sort_methods[$_SESSION['who_online_sort_by']];
}
else
{
$context['sort_by'] = $_SESSION['who_online_sort_by'] = 'time';
$sort_method = 'lo.log_time';
}
$context['sort_direction'] = isset($_REQUEST['asc']) || (isset($_REQUEST['sort_dir']) && $_REQUEST['sort_dir'] == 'asc') ? 'up' : 'down';
$conditions = array();
if (!allowedTo('moderate_forum'))
$conditions[] = '(COALESCE(mem.show_online, 1) = 1)';
if (isset($_REQUEST['submit_top']) && isset($_REQUEST['show_top']))
$_REQUEST['show'] = $_REQUEST['show_top'];
if (isset($_REQUEST['show']) && isset($show_methods[$_REQUEST['show']]))
$context['show_by'] = $_SESSION['who_online_filter'] = $_REQUEST['show'];
elseif (isset($_SESSION['who_online_filter']))
$context['show_by'] = $_SESSION['who_online_filter'];
else
$context['show_by'] = 'members';
$conditions[] = $show_methods[$context['show_by']];
$request = $smcFunc['db_query']('', '
SELECT COUNT(*)
FROM {db_prefix}log_online AS lo
LEFT JOIN {db_prefix}members AS mem ON (lo.id_member = mem.id_member)' . (!empty($conditions) ? '
WHERE ' . implode(' AND ', $conditions) : ''),
array(
)
);
list ($totalMembers) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
$context['page_index'] = constructPageIndex($scripturl . '?action=who;sort=' . $context['sort_by'] . ($context['sort_direction'] == 'up' ? ';asc' : '') . ';show=' . $context['show_by'], $_REQUEST['start'], $totalMembers, $modSettings['defaultMaxMembers']);
$context['start'] = $_REQUEST['start'];
$request = $smcFunc['db_query']('', '
SELECT
lo.log_time, lo.id_member, lo.url, lo.ip AS ip, mem.real_name,
lo.session, mg.online_color, COALESCE(mem.show_online, 1) AS show_online,
lo.id_spider
FROM {db_prefix}log_online AS lo
LEFT JOIN {db_prefix}members AS mem ON (lo.id_member = mem.id_member)
LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = CASE WHEN mem.id_group = {int:regular_member} THEN mem.id_post_group ELSE mem.id_group END)' . (!empty($conditions) ? '
WHERE ' . implode(' AND ', $conditions) : '') . '
ORDER BY {raw:sort_method} {raw:sort_direction}
LIMIT {int:offset}, {int:limit}',
array(
'regular_member' => 0,
'sort_method' => $sort_method,
'sort_direction' => $context['sort_direction'] == 'up' ? 'ASC' : 'DESC',
'offset' => $context['start'],
'limit' => $modSettings['defaultMaxMembers'],
)
);
$context['members'] = array();
$member_ids = array();
$url_data = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$actions = $smcFunc['json_decode']($row['url'], true);
if ($actions === false)
continue;
$context['members'][$row['session']] = array(
'id' => $row['id_member'],
'ip' => allowedTo('moderate_forum') ? inet_dtop($row['ip']) : '',
'time' => strtr(timeformat($row['log_time']), array($txt['today'] => '', $txt['yesterday'] => '')),
'timestamp' => forum_time(true, $row['log_time']),
'query' => $actions,
'is_hidden' => $row['show_online'] == 0,
'id_spider' => $row['id_spider'],
'color' => empty($row['online_color']) ? '' : $row['online_color']
);
$url_data[$row['session']] = array($row['url'], $row['id_member']);
$member_ids[] = $row['id_member'];
}
$smcFunc['db_free_result']($request);
loadMemberData($member_ids);
$memberContext[0] = array(
'id' => 0,
'name' => $txt['guest_title'],
'group' => $txt['guest_title'],
'href' => '',
'link' => $txt['guest_title'],
'email' => $txt['guest_title'],
'is_guest' => true
);
$spiderContext = array();
if (!empty($modSettings['show_spider_online']) && ($modSettings['show_spider_online'] == 2 || allowedTo('admin_forum')) && !empty($modSettings['spider_name_cache']))
{
foreach ($smcFunc['json_decode']($modSettings['spider_name_cache'], true) as $id => $name)
$spiderContext[$id] = array(
'id' => 0,
'name' => $name,
'group' => $txt['spiders'],
'href' => '',
'link' => $name,
'email' => $name,
'is_guest' => true
);
}
$url_data = determineActions($url_data);
$context['page_title'] = $txt['who_title'];
$context['linktree'][] = array(
'url' => $scripturl . '?action=who',
'name' => $txt['who_title']
);
foreach ($context['members'] as $i => $member)
{
if ($member['id'] != 0)
$member['id'] = loadMemberContext($member['id']) ? $member['id'] : 0;
$memberContext[$member['id']]['ip'] = $member['ip'];
$context['members'][$i]['action'] = isset($url_data[$i]) ? $url_data[$i] : array('label' => 'who_hidden', 'class' => 'em');
if ($member['id'] == 0 && isset($spiderContext[$member['id_spider']]))
$context['members'][$i] += $spiderContext[$member['id_spider']];
else
$context['members'][$i] += $memberContext[$member['id']];
}
$context['can_send_pm'] = allowedTo('pm_send');
$context['can_send_email'] = allowedTo('send_email_to_members');
$context['disabled_fields'] = isset($modSettings['disabled_profile_fields']) ? array_flip(explode(',', $modSettings['disabled_profile_fields'])) : array();
}
function determineActions($urls, $preferred_prefix = false)
{
global $txt, $user_info, $modSettings, $smcFunc;
if (!allowedTo('who_view'))
return array();
loadLanguage('Who');
$allowedActions = array(
'admin' => array('moderate_forum', 'manage_membergroups', 'manage_bans', 'admin_forum', 'manage_permissions', 'send_mail', 'manage_attachments', 'manage_smileys', 'manage_boards', 'edit_news'),
'ban' => array('manage_bans'),
'boardrecount' => array('admin_forum'),
'calendar' => array('calendar_view'),
'corefeatures' => array('admin_forum'),
'editnews' => array('edit_news'),
'featuresettings' => array('admin_forum'),
'languages' => array('admin_forum'),
'logs' => array('admin_forum'),
'mailing' => array('send_mail'),
'mailqueue' => array('admin_forum'),
'maintain' => array('admin_forum'),
'manageattachments' => array('manage_attachments'),
'manageboards' => array('manage_boards'),
'managecalendar' => array('admin_forum'),
'managesearch' => array('admin_forum'),
'managesmileys' => array('manage_smileys'),
'membergroups' => array('manage_membergroups'),
'mlist' => array('view_mlist'),
'moderate' => array('access_mod_center', 'moderate_forum', 'manage_membergroups'),
'modsettings' => array('admin_forum'),
'news' => array('edit_news', 'send_mail', 'admin_forum'),
'optimizetables' => array('admin_forum'),
'packages' => array('admin_forum'),
'paidsubscribe' => array('admin_forum'),
'permissions' => array('manage_permissions'),
'postsettings' => array('admin_forum'),
'regcenter' => array('admin_forum', 'moderate_forum'),
'repairboards' => array('admin_forum'),
'reports' => array('admin_forum'),
'scheduledtasks' => array('admin_forum'),
'search' => array('search_posts'),
'search2' => array('search_posts'),
'securitysettings' => array('admin_forum'),
'sengines' => array('admin_forum'),
'serversettings' => array('admin_forum'),
'setcensor' => array('moderate_forum'),
'setreserve' => array('moderate_forum'),
'stats' => array('view_stats'),
'theme' => array('admin_forum'),
'viewerrorlog' => array('admin_forum'),
'viewmembers' => array('moderate_forum'),
);
call_integration_hook('who_allowed', array(&$allowedActions));
if (!is_array($urls))
$url_list = array(array($urls, $user_info['id']));
else
$url_list = $urls;
$topic_ids = array();
$profile_ids = array();
$board_ids = array();
$data = array();
foreach ($url_list as $k => $url)
{
$actions = $smcFunc['json_decode']($url[0], true);
if ($actions === false)
continue;
if (isset($actions['action']) && ($actions['action'] == 'admin' || $actions['action'] == 'moderate') && isset($actions['area']))
$actions['action'] = $actions['area'];
if (!isset($actions['action']) || $actions['action'] == 'display')
{
if (isset($actions['topic']))
{
$data[$k] = array('label' => 'who_hidden', 'class' => 'em');
$topic_ids[(int) $actions['topic']][$k] = $txt['who_topic'];
}
elseif (isset($actions['board']))
{
$data[$k] = array('label' => 'who_hidden', 'class' => 'em');
$board_ids[$actions['board']][$k] = $txt['who_board'];
}
else
$data[$k] = $txt['who_index'];
}
elseif ($actions['action'] == '')
$data[$k] = $txt['who_index'];
else
{
if ($actions['action'] == 'profile')
{
if (empty($actions['u']))
$actions['u'] = $url[1];
$data[$k] = array('label' => 'who_hidden', 'class' => 'em');
$profile_ids[(int) $actions['u']][$k] = $actions['u'] == $url[1] ? $txt['who_viewownprofile'] : $txt['who_viewprofile'];
}
elseif (($actions['action'] == 'post' || $actions['action'] == 'post2') && empty($actions['topic']) && isset($actions['board']))
{
$data[$k] = array('label' => 'who_hidden', 'class' => 'em');
$board_ids[(int) $actions['board']][$k] = isset($actions['poll']) ? $txt['who_poll'] : $txt['who_post'];
}
elseif (isset($actions['sa']) && isset($txt['whoall_' . $actions['action'] . '_' . $actions['sa']]))
$data[$k] = $preferred_prefix && isset($txt[$preferred_prefix . $actions['action'] . '_' . $actions['sa']]) ? $txt[$preferred_prefix . $actions['action'] . '_' . $actions['sa']] : $txt['whoall_' . $actions['action'] . '_' . $actions['sa']];
elseif (isset($txt['whoall_' . $actions['action']]))
$data[$k] = $preferred_prefix && isset($txt[$preferred_prefix . $actions['action']]) ? $txt[$preferred_prefix . $actions['action']] : $txt['whoall_' . $actions['action']];
elseif (isset($txt['whotopic_' . $actions['action']]))
{
$topic = (int) (isset($actions['topic']) ? $actions['topic'] : (isset($actions['from']) ? $actions['from'] : 0));
$data[$k] = array('label' => 'who_hidden', 'class' => 'em');
$topic_ids[$topic][$k] = $txt['whotopic_' . $actions['action']];
}
elseif (isset($txt['whopost_' . $actions['action']]))
{
$msgid = (int) (isset($actions['msg']) ? $actions['msg'] : (isset($actions['quote']) ? $actions['quote'] : 0));
$result = $smcFunc['db_query']('', '
SELECT m.id_topic, m.subject
FROM {db_prefix}messages AS m
' . ($modSettings['postmod_active'] ? 'INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic AND t.approved = {int:is_approved})' : '') . '
WHERE m.id_msg = {int:id_msg}
AND {query_see_message_board}' . ($modSettings['postmod_active'] ? '
AND m.approved = {int:is_approved}' : '') . '
LIMIT 1',
array(
'is_approved' => 1,
'id_msg' => $msgid,
)
);
list ($id_topic, $subject) = $smcFunc['db_fetch_row']($result);
$data[$k] = sprintf($txt['whopost_' . $actions['action']], $id_topic, $subject);
$smcFunc['db_free_result']($result);
if (empty($id_topic))
$data[$k] = array('label' => 'who_hidden', 'class' => 'em');
}
elseif (allowedTo('moderate_forum') && isset($txt['whoadmin_' . $actions['action']]))
$data[$k] = $txt['whoadmin_' . $actions['action']];
elseif (isset($allowedActions[$actions['action']]))
{
if (allowedTo($allowedActions[$actions['action']]) && !empty($txt['whoallow_' . $actions['action']]))
$data[$k] = $txt['whoallow_' . $actions['action']];
elseif (in_array('moderate_forum', $allowedActions[$actions['action']]))
$data[$k] = $txt['who_moderate'];
elseif (in_array('admin_forum', $allowedActions[$actions['action']]))
$data[$k] = $txt['who_admin'];
else
$data[$k] = array('label' => 'who_hidden', 'class' => 'em');
}
elseif (!empty($actions['action']))
$data[$k] = $txt['who_generic'] . ' ' . $actions['action'];
else
$data[$k] = array('label' => 'who_unknown', 'class' => 'em');
}
if (isset($actions['error']))
{
loadLanguage('Errors');
if (isset($txt[$actions['error']]))
$error_message = str_replace('"', '"', empty($actions['who_error_params']) ? $txt[$actions['error']] : vsprintf($txt[$actions['error']], $actions['who_error_params']));
elseif ($actions['error'] == 'guest_login')
$error_message = str_replace('"', '"', $txt['who_guest_login']);
else
$error_message = str_replace('"', '"', $actions['error']);
if (!empty($error_message))
$data[$k] .= ' <span class="main_icons error" title="' . $error_message . '"></span>';
}
if (count($integrate_actions = call_integration_hook('integrate_whos_online', array($actions))) > 0)
{
foreach ($integrate_actions as $integrate_action)
{
if (!empty($integrate_action))
{
$data[$k] = $integrate_action;
if (isset($actions['topic']) && isset($topic_ids[(int) $actions['topic']][$k]))
$topic_ids[(int) $actions['topic']][$k] = $integrate_action;
if (isset($actions['board']) && isset($board_ids[(int) $actions['board']][$k]))
$board_ids[(int) $actions['board']][$k] = $integrate_action;
if (isset($actions['u']) && isset($profile_ids[(int) $actions['u']][$k]))
$profile_ids[(int) $actions['u']][$k] = $integrate_action;
break;
}
}
}
}
if (!empty($topic_ids))
{
$result = $smcFunc['db_query']('', '
SELECT t.id_topic, m.subject
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
WHERE {query_see_topic_board}
AND t.id_topic IN ({array_int:topic_list})' . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}' : '') . '
LIMIT {int:limit}',
array(
'topic_list' => array_keys($topic_ids),
'is_approved' => 1,
'limit' => count($topic_ids),
)
);
while ($row = $smcFunc['db_fetch_assoc']($result))
{
foreach ($topic_ids[$row['id_topic']] as $k => $session_text)
$data[$k] = sprintf($session_text, $row['id_topic'], censorText($row['subject']));
}
$smcFunc['db_free_result']($result);
}
if (!empty($board_ids))
{
$result = $smcFunc['db_query']('', '
SELECT b.id_board, b.name
FROM {db_prefix}boards AS b
WHERE {query_see_board}
AND b.id_board IN ({array_int:board_list})
LIMIT {int:limit}',
array(
'board_list' => array_keys($board_ids),
'limit' => count($board_ids),
)
);
while ($row = $smcFunc['db_fetch_assoc']($result))
{
foreach ($board_ids[$row['id_board']] as $k => $session_text)
$data[$k] = sprintf($session_text, $row['id_board'], $row['name']);
}
$smcFunc['db_free_result']($result);
}
$allow_view_own = allowedTo('is_not_guest');
$allow_view_any = allowedTo('profile_view');
if (!empty($profile_ids) && ($allow_view_any || $allow_view_own))
{
$result = $smcFunc['db_query']('', '
SELECT id_member, real_name
FROM {db_prefix}members
WHERE id_member IN ({array_int:member_list})
LIMIT ' . count($profile_ids),
array(
'member_list' => array_keys($profile_ids),
)
);
while ($row = $smcFunc['db_fetch_assoc']($result))
{
if (!$allow_view_any && ($user_info['id'] != $row['id_member']))
continue;
foreach ($profile_ids[$row['id_member']] as $k => $session_text)
$data[$k] = sprintf($session_text, $row['id_member'], $row['real_name']);
}
$smcFunc['db_free_result']($result);
}
call_integration_hook('whos_online_after', array(&$urls, &$data));
if (!is_array($urls))
return isset($data[0]) ? $data[0] : false;
else
return $data;
}
function Credits($in_admin = false)
{
global $context, $smcFunc, $forum_copyright, $txt, $user_info;
loadLanguage('Who');
if ($in_admin)
{
$context[$context['admin_menu_name']]['tab_data'] = array(
'title' => $txt['support_credits_title'],
'help' => '',
'description' => '',
);
}
$context['credits'] = array(
array(
'pretext' => $txt['credits_intro'],
'title' => $txt['credits_team'],
'groups' => array(
array(
'title' => $txt['credits_groups_pm'],
'members' => array(
'Michele "Illori" Davis',
'Jessica "Suki" González',
'Will "Kindred" Wagner',
),
),
array(
'title' => $txt['credits_groups_dev'],
'members' => array(
'Jon "Sesquipedalian" Stovell',
'Jessica "Suki" González',
'John "live627" Rayes',
'Jeremy "SleePy" Darwood',
'Shawn Bulen',
'Aaron van Geffen',
'Antechinus',
'Bjoern "Bloc" Kristiansen',
'Brad "IchBin™" Grow',
'Colin Schoen',
'emanuele',
'Hendrik Jan "Compuart" Visser',
'Juan "JayBachatero" Hernandez',
'Karl "RegularExpression" Benson',
'Matthew "Labradoodle-360" Kerle',
$user_info['is_admin'] ? 'Matt "Grudge" Wolf' : 'Grudge',
'Michael "Oldiesmann" Eshom',
'Michael "Thantos" Miller',
'Norv',
'Peter "Arantor" Spicer',
'Selman "[SiNaN]" Eser',
'Shitiz "Dragooon" Garg',
'Theodore "Orstio" Hildebrandt',
'Thorsten "TE" Eurich',
'winrules',
),
),
array(
'title' => $txt['credits_groups_support'],
'members' => array(
'Aleksi "Lex" Kilpinen',
'br360',
'GigaWatt',
'Will "Kindred" Wagner',
'lurkalot',
'Steve',
'ziycon',
'Adam Tallon',
'Bigguy',
'Bruno "margarett" Alves',
'CapadY',
'ChalkCat',
'Chas Large',
'Duncan85',
'gbsothere',
'JimM',
'Justyne',
'Kat',
'Kevin "greyknight17" Hou',
'Krash',
'Mashby',
'Michael Colin Blaber',
'Michele "Illori" Davis',
'Old Fossil',
'S-Ace',
'Storman™',
'Wade "sησω" Poulsen',
'xenovanis',
),
),
array(
'title' => $txt['credits_groups_customize'],
'members' => array(
'Sami "SychO" Mazouz',
'Gary M. Gadsdon',
'Diego Andrés',
'Jonathan "vbgamer45" Valentin',
'Brannon "B" Hall',
'Gwenwyfar',
'Jack "akabugeyes" Thorsen',
'Jason "JBlaze" Clemons',
'Jessica "Suki" González',
'Joey "Tyrsson" Smith',
'Kays',
'NanoSector',
'Ricky.',
'Russell "NEND" Najar',
'SA™',
),
),
array(
'title' => $txt['credits_groups_docs'],
'members' => array(
'Irisado',
'AngelinaBelle',
'Chainy',
'Graeme Spence',
'Joshua "groundup" Dickerson',
),
),
array(
'title' => $txt['credits_groups_internationalizers'],
'members' => array(
'Francisco "d3vcho" Domínguez',
'Nikola "Dzonny" Novaković',
'Robert Monden',
'Relyana',
),
),
array(
'title' => $txt['credits_groups_marketing'],
'members' => array(
'Adish "(F.L.A.M.E.R)" Patel',
'Bryan "Runic" Deakin',
'Marcus "cσσкιє мσηѕтєя" Forsberg',
'Mert "Antes" Alınbay',
'Ralph "[n3rve]" Otowo',
),
),
array(
'title' => $txt['credits_groups_site'],
'members' => array(
'Jeremy "SleePy" Darwood',
),
),
array(
'title' => $txt['credits_groups_servers'],
'members' => array(
'Derek Schwab',
'Michael Johnson',
'Liroy van Hoewijk',
),
),
),
),
);
if (!empty($txt['translation_credits']))
$context['credits'][] = array(
'title' => $txt['credits_groups_translation'],
'groups' => array(
array(
'title' => $txt['credits_groups_translation'],
'members' => $txt['translation_credits'],
),
),
);
$context['credits'][] = array(
'title' => $txt['credits_special'],
'posttext' => $txt['credits_anyone'],
'groups' => array(
array(
'title' => $txt['credits_groups_consultants'],
'members' => array(
'albertlast',
'Brett Flannigan',
'Mark Rose',
'René-Gilles "Nao 尚" Deberdt',
'tinoest',
$txt['credits_code_contributors'],
),
),
array(
'title' => $txt['credits_groups_beta'],
'members' => array(
$txt['credits_beta_message'],
),
),
array(
'title' => $txt['credits_groups_translators'],
'members' => array(
$txt['credits_translators_message'],
),
),
array(
'title' => $txt['credits_groups_founder'],
'members' => array(
'Unknown W. "[Unknown]" Brackets',
),
),
array(
'title' => $txt['credits_groups_orignal_pm'],
'members' => array(
'Jeff Lewis',
'Joseph Fung',
'David Recordon',
),
),
array(
'title' => $txt['credits_in_memoriam'],
'members' => array(
'Crip',
'K@',
'metallica48423',
'Paul_Pauline',
),
),
),
);
$context['credits_software_graphics'] = array(
'graphics' => array(
'<a href="http://p.yusukekamiyamane.com/">Fugue Icons</a> | © 2012 Yusuke Kamiyamane | These icons are licensed under a Creative Commons Attribution 3.0 License',
'<a href="https://techbase.kde.org/Projects/Oxygen/Licensing#Use_on_Websites">Oxygen Icons</a> | These icons are licensed under <a href="http://www.gnu.org/copyleft/lesser.html">GNU LGPLv3</a>',
),
'software' => array(
'<a href="https://jquery.org/">JQuery</a> | © John Resig | Licensed under <a href="https://github.com/jquery/jquery/blob/master/LICENSE.txt">The MIT License (MIT)</a>',
'<a href="https://briancherne.github.io/jquery-hoverIntent/">hoverIntent</a> | © Brian Cherne | Licensed under <a href="https://en.wikipedia.org/wiki/MIT_License">The MIT License (MIT)</a>',
'<a href="https://www.sceditor.com/">SCEditor</a> | © Sam Clarke | Licensed under <a href="https://en.wikipedia.org/wiki/MIT_License">The MIT License (MIT)</a>',
'<a href="http://wayfarerweb.com/jquery/plugins/animadrag/">animaDrag</a> | © Abel Mohler | Licensed under <a href="https://en.wikipedia.org/wiki/MIT_License">The MIT License (MIT)</a>',
'<a href="https://github.com/mzubala/jquery-custom-scrollbar">jQuery Custom Scrollbar</a> | © Maciej Zubala | Licensed under <a href="http://en.wikipedia.org/wiki/MIT_License">The MIT License (MIT)</a>',
'<a href="http://slippry.com/">jQuery Responsive Slider</a> | © booncon ROCKETS | Licensed under <a href="http://en.wikipedia.org/wiki/MIT_License">The MIT License (MIT)</a>',
'<a href="https://github.com/ichord/At.js">At.js</a> | © chord.luo@gmail.com | Licensed under <a href="https://github.com/ichord/At.js/blob/master/LICENSE-MIT">The MIT License (MIT)</a>',
'<a href="https://github.com/ttsvetko/HTML5-Desktop-Notifications">HTML5 Desktop Notifications</a> | © Tsvetan Tsvetkov | Licensed under <a href="https://github.com/ttsvetko/HTML5-Desktop-Notifications/blob/master/License.txt">The Apache License Version 2.0</a>',
'<a href="https://github.com/enygma/gauth">GAuth Code Generator/Validator</a> | © Chris Cornutt | Licensed under <a href="https://github.com/enygma/gauth/blob/master/LICENSE">The MIT License (MIT)</a>',
'<a href="https://github.com/enyo/dropzone">Dropzone.js</a> | © Matias Meno | Licensed under <a href="http://en.wikipedia.org/wiki/MIT_License">The MIT License (MIT)</a>',
'<a href="https://github.com/matthiasmullie/minify">Minify</a> | © Matthias Mullie | Licensed under <a href="http://en.wikipedia.org/wiki/MIT_License">The MIT License (MIT)</a>',
'<a href="https://github.com/true/php-punycode">PHP-Punycode</a> | © True B.V. | Licensed under <a href="http://en.wikipedia.org/wiki/MIT_License">The MIT License (MIT)</a>',
),
'fonts' => array(
'<a href="https://fontlibrary.org/en/font/anonymous-pro"> Anonymous Pro</a> | © 2009 | This font is licensed under the SIL Open Font License, Version 1.1',
'<a href="https://fontlibrary.org/en/font/consolamono"> ConsolaMono</a> | © 2012 | This font is licensed under the SIL Open Font License, Version 1.1',
'<a href="https://fontlibrary.org/en/font/phennig"> Phennig</a> | © 2009-2012 | This font is licensed under the SIL Open Font License, Version 1.1',
),
);
$context['credits_modifications'] = array();
if (($mods = cache_get_data('mods_credits', 86400)) === null)
{
$mods = array();
$request = $smcFunc['db_query']('substring', '
SELECT version, name, credits
FROM {db_prefix}log_packages
WHERE install_state = {int:installed_mods}
AND credits != {string:empty}
AND SUBSTRING(filename, 1, 9) != {string:patch_name}',
array(
'installed_mods' => 1,
'patch_name' => 'smf_patch',
'empty' => '',
)
);
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$credit_info = $smcFunc['json_decode']($row['credits'], true);
$copyright = empty($credit_info['copyright']) ? '' : $txt['credits_copyright'] . ' © ' . $smcFunc['htmlspecialchars']($credit_info['copyright']);
$license = empty($credit_info['license']) ? '' : $txt['credits_license'] . ': ' . (!empty($credit_info['licenseurl']) ? '<a href="' . $smcFunc['htmlspecialchars']($credit_info['licenseurl']) . '">' . $smcFunc['htmlspecialchars']($credit_info['license']) . '</a>' : $smcFunc['htmlspecialchars']($credit_info['license']));
$version = $txt['credits_version'] . ' ' . $row['version'];
$title = (empty($credit_info['title']) ? $row['name'] : $smcFunc['htmlspecialchars']($credit_info['title'])) . ': ' . $version;
$mod_name = empty($credit_info['url']) ? $title : '<a href="' . $credit_info['url'] . '">' . $title . '</a>';
$mods[] = $mod_name . (!empty($license) ? ' | ' . $license : '') . (!empty($copyright) ? ' | ' . $copyright : '');
}
cache_put_data('mods_credits', $mods, 86400);
}
$context['credits_modifications'] = $mods;
$context['copyrights'] = array(
'smf' => sprintf($forum_copyright, SMF_FULL_VERSION, SMF_SOFTWARE_YEAR),
'mods' => array(
),
);
call_integration_hook('integrate_credits');
if (!$in_admin)
{
loadTemplate('Who');
$context['sub_template'] = 'credits';
$context['robot_no_index'] = true;
$context['page_title'] = $txt['credits'];
}
}
?>