source: trunk/smf/infoarena.php @ 1184

Revision 1176, 2.4 KB checked in by adrian.budau, 2 months ago (diff)

Visitors can now post on blog, but a recaptcha will be requested
everytime for them. Fixed some css
http://reviewboard.infoarena.ro/r/191/

  • Property svn:eol-style set to native
Line 
1<?php
2
3// link some infoarena API
4//
5// WARNING:
6// This is really dirty practice! We can't do anything but hope there are
7// no serious name clashes between infoarena and SMF.
8// Somebody, please code some namespaces in PHP!
9
10define("IA_FROM_SMF", true);
11
12require_once(IA_ROOT_DIR . 'common/common.php');
13require_once(IA_ROOT_DIR . 'common/external_libs/recaptchalib.php');
14require_once(IA_ROOT_DIR . 'common/log.php');
15check_requirements();
16require_once(IA_ROOT_DIR . 'common/security.php');
17require_once(IA_ROOT_DIR . 'www/utilities.php');
18require_once(IA_ROOT_DIR . 'www/identity.php');
19
20// init SMF hooks to integrate with infoarena
21// These are native integration features built into SMF. Sweet!
22$ia_integration = array(
23    'integrate_verify_user'  => 'ia_verify_user',
24    'securityDisable'        => true,
25    'databaseSession_enable' => false,
26    'theme_default'          => 1,
27);
28
29define("SMF_INTEGRATION_SETTINGS", serialize($ia_integration));
30
31// Determine which SMF user is logged based on infoarena
32// identity information.
33// This is an integration hook.
34function ia_verify_user() {
35    global $identity_user;
36    global $db_prefix;
37
38    if (!$identity_user) {
39        // When infoarena session is no longer active,
40        // destroy any SMF session still hanging active
41        global $cookiename;
42        unset($_COOKIE[$cookiename]);
43        unset($_SESSION['login_'.$cookiename]);
44
45        return false;
46    }
47
48    // relate ia_user with SMF member
49    $result = db_query("
50                SELECT ID_MEMBER
51                FROM {$db_prefix}members
52                WHERE memberName = '" . addslashes($identity_user['username']) . "'
53                LIMIT 1", __FILE__, __LINE__);
54    $member_id = null;
55    list($member_id) = mysql_fetch_row($result);
56    mysql_free_result($result);
57
58    if ($member_id) {
59        return $member_id;
60    }
61    else {
62        global $webmaster_email;
63        fatal_error("Utilizatorul {$identity_user['username']} nu are "
64                    ."echivalent in SMF! Va rugam sa contactati "
65                    ."administratorul la adresa "
66                    .$webmaster_email);
67    }
68}
69
70// Call this function whenever you want to make sure a feature is disabled
71// because of integration with infoarena.
72function ia_disabled() {
73    // Feature disabled for integration with infoarena
74    log_print('This feature was disabled for integration with infoarena.');
75    log_backtrace();
76    die();
77}
78
79?>
Note: See TracBrowser for help on using the repository browser.