Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser
- header('Location: ../');
- exit;
- }
- function qa_get_mysql_user_column_type()
- {
- // Set this before anything else
- return 'VARCHAR(255)';
- }
- function qa_get_login_links($relative_url_prefix, $redirect_back_to_url)
- {
- // Until you edit this function, don't show login, register or logout links
- return array(
- 'login' => 'http://www.site.org/cgi-bin/community.cgi',
- 'register' => 'http://www.site.org/cgi-bin/community.cgi?do=user_signup',
- 'logout' => 'http://www.site.org/cgi-bin/community.cgi?do=user_logout',
- );
- }
- function qa_get_logged_in_user()
- {
- // Until you edit this function, nobody is ever logged in
- if (isset($_COOKIE['Community_Sesssion'])) {
- $session_id =$_COOKIE['Community_Sesssion'];
- //Define Connection Within Function
- $conn = mysql_connect("localhost",'my_user','my_pass');
- mysql_select_db('the_db', $conn);
- $result = mysql_query("SELECT sess_user_fk FROM comm_sessions WHERE sess_id='".mysql_real_escape_string($session_id)."'");
- while($person = mysql_fetch_array($result)) {
- $person_id = $person['sess_user_fk'];
- }
- if ($person_id) {
- $glinks_connection = mysql_connect("localhost",'my_user','my_pass');
- mysql_select_db('my_db', $conn);
- $result2 = mysql_fetch_assoc(
- mysql_query(
- "SELECT Username,Email FROM glinks_Users WHERE user_id_fk = '".mysql_real_escape_string($person_id, $glinks_connection)."'",
- $glinks_connection
- )
- );
- if (is_array($result2)) {
- return array(
- 'userid' => $result2['Username'],
- 'publicusername' => $result2['Username'],
- 'email' => $result2['Email'],
- 'level' => ($result2['Username']=='the_admin_user') ? QA_USER_LEVEL_ADMIN : QA_USER_LEVEL_BASIC
- );
- }
- mysql_close($glinks_connection);
- }
- }
- return null;
- }
- function qa_get_user_email($userid)
- {
- // Until you edit this function, always return null
- return null;
- }
- function qa_get_userids_from_public($publicusernames)
- {
- return null;
- }
- function qa_get_public_from_userids($userids)
- {
- // Until you edit this function, always return null
- $useridtopublic=array();
- foreach ($userids as $userid) {
- $useridtopublic[$userid]=$userid;
- }
- return $useridtopublic;
- return null;
- }
- function qa_get_logged_in_user_html($logged_in_user, $relative_url_prefix)
- {
- $publicusername=$logged_in_user['publicusername'];
- return '<a href="'.qa_path_html('user/'.$publicusername).'" class="qa-user-link">'.htmlspecialchars($publicusername).'</a>';
- }
- function qa_get_users_html($userids, $should_include_link, $relative_url_prefix)
- {
- // By default, show the public username linked to the Q2A profile page for each user
- $useridtopublic=qa_get_public_from_userids($userids);
- $usershtml=array();
- foreach ($userids as $userid) {
- $publicusername=$useridtopublic[$userid];
- $usershtml[$userid]=htmlspecialchars($publicusername);
- if ($should_include_link)
- $usershtml[$userid]='<a href="'.qa_path_html('user/'.$publicusername).'" class="qa-user-link">'.$usershtml[$userid].'</a>';
- }
- return $usershtml;
- }
- function qa_avatar_html_from_userid($userid, $size, $padding)
- {
- return null; // show no avatars by default
- }
- function qa_user_report_action($userid, $action)
- {
- // do nothing by default
- }
- /*
- Omit PHP closing tag to help avoid accidental output
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement