function notify_summary()
 {
     global $database, $user;
     $total_notifications = 0;
     $notify_array = array();
     // CHECK THAT USER EXISTS
     if (is_object($user) && $user->user_exists && $user->user_info['user_hasnotifys']) {
         // BUILD NOTIFICATION QUERY
         $notify_query = "\r\n        (\r\n          SELECT \r\n            '0' AS notify_grouped,\r\n            count(se_notifys.notify_id) AS total_notifications, \r\n            se_notifytypes.notifytype_id, \r\n            se_notifytypes.notifytype_desc, \r\n            se_notifytypes.notifytype_icon, \r\n            se_notifytypes.notifytype_url, \r\n            se_notifys.notify_urlvars, \r\n            se_notifys.notify_text \r\n          FROM se_notifys \r\n          LEFT JOIN se_notifytypes \r\n          ON se_notifys.notify_notifytype_id=se_notifytypes.notifytype_id \r\n          WHERE \r\n            notify_user_id='{$user->user_info['user_id']}'\r\n          AND\r\n            notifytype_group=1\r\n          GROUP BY se_notifys.notify_notifytype_id\r\n        ) UNION ALL (\r\n          SELECT \r\n            se_notifys.notify_object_id AS notify_grouped,\r\n            count(se_notifys.notify_id) AS total_notifications, \r\n            se_notifytypes.notifytype_id, \r\n            se_notifytypes.notifytype_desc, \r\n            se_notifytypes.notifytype_icon, \r\n            se_notifytypes.notifytype_url, \r\n            se_notifys.notify_urlvars, \r\n            se_notifys.notify_text \r\n          FROM se_notifys \r\n          LEFT JOIN se_notifytypes \r\n          ON se_notifys.notify_notifytype_id=se_notifytypes.notifytype_id \r\n          WHERE \r\n            notify_user_id='{$user->user_info['user_id']}' \r\n          AND\r\n            notifytype_group=0\r\n          GROUP BY se_notifys.notify_notifytype_id, se_notifys.notify_object_id\r\n        )\r\n      ";
         // GET NOTIFICATIONS
         $notifys = $database->database_query($notify_query);
         while ($notify = $database->database_fetch_assoc($notifys)) {
             // REGISTER PRELOADED TEXT
             SE_Language::_preload($notify['notifytype_desc']);
             // GET URL VARS
             $urlvars = unserialize($notify['notify_urlvars']);
             $notify_url = vsprintf($notify['notifytype_url'], $urlvars);
             // GET DESC TEXT VARS
             $notify_text = unserialize($notify['notify_text']);
             // ADD THIS NOTIFICATION TO OUTPUT ARRAY
             $total_notifications += $notify['total_notifications'];
             $notify_array[] = array('notifytype_id' => $notify['notifytype_id'], 'notify_grouped' => $notify['notify_grouped'], 'notify_icon' => $notify['notifytype_icon'], 'notify_url' => $notify_url, 'notify_desc' => $notify['notifytype_desc'], 'notify_text' => $notify_text, 'notify_total' => $notify['total_notifications']);
         }
     }
     // RETURN LIST OF NOTIFICATIONS
     return array('total' => (int) $total_notifications, 'total_grouped' => (int) count($notify_array), 'notifys' => $notify_array);
 }
function send_systememail($systememail, $recipient_email, $replace = array(), $bcc = FALSE)
{
    global $setting, $database;
    // RETRIEVE EMAIL INFO
    $email = $database->database_fetch_assoc($database->database_query("SELECT * FROM se_systememails WHERE systememail_name='{$systememail}' LIMIT 1"));
    SE_Language::_preload_multi($email['systememail_subject'], $email['systememail_body']);
    SE_Language::load();
    // GET/DECODE SUBJECT AND MESSAGE
    $subject = htmlspecialchars_decode(SE_Language::_get($email['systememail_subject']), ENT_QUOTES);
    $message = htmlspecialchars_decode(SE_Language::_get($email['systememail_body']), ENT_QUOTES);
    // REPLACE VARIABLES IN SUBJECT AND MESSAGE
    $subject = vsprintf($subject, $replace);
    $message = vsprintf($message, $replace);
    // ENCODE SUBJECT FOR UTF8
    $subject = "=?UTF-8?B?" . base64_encode($subject) . "?=";
    // REPLACE CARRIAGE RETURNS WITH BREAKS
    $message = str_replace("\n", "<br>", $message);
    // SET HEADERS
    $sender = "{$setting['setting_email_fromname']} <{$setting['setting_email_fromemail']}>";
    $headers = "MIME-Version: 1.0" . "\n";
    $headers .= "Content-type: text/html; charset=utf-8" . "\n";
    $headers .= "Content-Transfer-Encoding: 8bit" . "\n";
    $headers .= "From: {$sender}" . "\n";
    $headers .= "Return-Path: {$sender}" . "\n";
    $headers .= "Reply-To: {$sender}\n";
    // IF BCC, SET TO AND BCC
    if ($bcc) {
        $headers .= "Bcc: {$recipient_email}\n";
        $recipient_email = "*****@*****.**";
    }
    // SEND MAIL
    mail($recipient_email, $subject, $message, $headers);
    return true;
}
function search_blog()
{
    global $database, $url, $results_per_page, $p, $search_text, $t, $search_objects, $results, $total_results;
    // CONSTRUCT QUERY
    $sql = "\r\n    SELECT\r\n      se_blogentries.blogentry_id,\r\n      se_blogentries.blogentry_title,\r\n      se_blogentries.blogentry_body,\r\n      se_users.user_id,\r\n      se_users.user_username,\r\n      se_users.user_photo,\r\n      se_users.user_fname,\r\n      se_users.user_lname\r\n    FROM\r\n      se_blogentries,\r\n      se_users,\r\n      se_levels\r\n    WHERE\r\n      se_blogentries.blogentry_user_id=se_users.user_id &&\r\n      se_users.user_level_id=se_levels.level_id &&\r\n      (\r\n        se_blogentries.blogentry_search='1' ||\r\n        se_levels.level_blog_search='0'\r\n      ) \r\n  ";
    $sql .= " && MATCH (`blogentry_title`, `blogentry_body`) AGAINST ('{$search_text}' IN BOOLEAN MODE)";
    /*
    $sql .= " && (
          blogentry_title LIKE '%$search_text%' ||
          blogentry_body LIKE '%$search_text%'
        )
    ";
    */
    // GET TOTAL ENTRIES
    $sql2 = $sql . " LIMIT 201";
    $resource = $database->database_query($sql2);
    $total_entries = $database->database_num_rows($resource);
    // IF NOT TOTAL ONLY
    if ($t == "blog") {
        // MAKE BLOG PAGES
        $start = ($p - 1) * $results_per_page;
        $limit = $results_per_page + 1;
        // SEARCH BLOGS
        $sql3 = $sql . " ORDER BY blogentry_id DESC LIMIT {$start}, {$limit}";
        $resource = $database->database_query($sql3);
        while ($blogentry_info = $database->database_fetch_assoc($resource)) {
            // CREATE AN OBJECT FOR AUTHOR
            $profile = new se_user();
            $profile->user_info['user_id'] = $blogentry_info['user_id'];
            $profile->user_info['user_username'] = $blogentry_info['user_username'];
            $profile->user_info['user_photo'] = $blogentry_info['user_photo'];
            $profile->user_info['user_fname'] = $blogentry_info['user_fname'];
            $profile->user_info['user_lname'] = $blogentry_info['user_lname'];
            $profile->user_displayname();
            // IF EMPTY TITLE
            if (!trim($blogentry_info['blogentry_title'])) {
                $blogentry_info['blogentry_title'] = SE_Language::get(589);
            }
            $blogentry_info['blogentry_body'] = cleanHTML($blogentry_info['blogentry_body'], '');
            // IF BODY IS LONG
            if (strlen($blogentry_info['blogentry_body']) > 150) {
                $blogentry_info['blogentry_body'] = substr($blogentry_info['blogentry_body'], 0, 147) . "...";
            }
            $result_url = $url->url_create('blog_entry', $blogentry_info['user_username'], $blogentry_info['blogentry_id']);
            $result_name = 1500118;
            $result_desc = 1500119;
            $results[] = array('result_url' => $result_url, 'result_icon' => './images/icons/blog_blog48.gif', 'result_name' => $result_name, 'result_name_1' => $blogentry_info['blogentry_title'], 'result_desc' => $result_desc, 'result_desc_1' => $url->url_create('profile', $blogentry_info['user_username']), 'result_desc_2' => $profile->user_displayname, 'result_desc_3' => $blogentry_info['blogentry_body']);
        }
        // SET TOTAL RESULTS
        $total_results = $total_entries;
    }
    // SET ARRAY VALUES
    SE_Language::_preload_multi(1500118, 1500119, 1500120);
    if ($total_albums > 200) {
        $total_albums = "200+";
    }
    $search_objects[] = array('search_type' => 'blog', 'search_lang' => 1500120, 'search_total' => $total_entries);
}
function send_systememail($systememail, $recipient_email, $replace = array(), $bcc = FALSE)
{
    global $setting, $database, $setting_smtp_email;
    $setting_email_query = $database->database_query("SELECT * FROM se_settings_email LIMIT 1");
    $setting_smtp_email = $database->database_fetch_assoc($setting_email_query);
    // RETRIEVE EMAIL INFO
    $email = $database->database_fetch_assoc($database->database_query("SELECT * FROM se_systememails WHERE systememail_name='{$systememail}' LIMIT 1"));
    SE_Language::_preload_multi($email['systememail_subject'], $email['systememail_body']);
    SE_Language::load();
    // GET/DECODE SUBJECT AND MESSAGE
    $subject = htmlspecialchars_decode(SE_Language::_get($email['systememail_subject']), ENT_QUOTES);
    $message = htmlspecialchars_decode(SE_Language::_get($email['systememail_body']), ENT_QUOTES);
    // REPLACE VARIABLES IN SUBJECT AND MESSAGE
    $subject = vsprintf($subject, $replace);
    $message = vsprintf($message, $replace);
    // ENCODE SUBJECT FOR UTF8
    $subject = "=?UTF-8?B?" . base64_encode($subject) . "?=";
    // REPLACE CARRIAGE RETURNS WITH BREAKS
    $message = str_replace("\n", "<br>", $message);
    // SET HEADERS
    $sender = "{$setting['setting_email_fromname']} <{$setting['setting_email_fromemail']}>";
    $headers = "MIME-Version: 1.0" . "\n";
    $headers .= "Content-type: text/html; charset=utf-8" . "\n";
    $headers .= "Content-Transfer-Encoding: 8bit" . "\n";
    $headers .= "From: {$sender}" . "\n";
    $headers .= "Return-Path: {$sender}" . "\n";
    $headers .= "Reply-To: {$sender}\n";
    // IF BCC, SET TO AND BCC
    if ($bcc) {
        $headers .= "Bcc: {$recipient_email}\n";
        $recipient_email = "*****@*****.**";
    }
    // SEND MAIL
    if ($setting_smtp_email['email_method'] == "mail") {
        mail($recipient_email, $subject, $message, $headers);
    } elseif ($setting_smtp_email['email_method'] == "smtp") {
        $mailer = new PHPMailer();
        $mailer->IsSMTP();
        $mailer->Subject = $subject;
        $mailer->From = $setting['setting_email_fromemail'];
        $mailer->FromName = $setting['setting_email_fromname'];
        $mailer->MsgHTML($message);
        $mailer->AddAddress($recipient_email);
        $mailer->Host = $setting_smtp_email['smtp_host'];
        $mailer->Username = $setting_smtp_email['smtp_user'];
        $mailer->Password = $setting_smtp_email['smtp_pass'];
        $mailer->Port = $setting_smtp_email['smtp_port'];
        if ($setting_smtp_email['smtp_port'] == 465) {
            $mailer->SMTPSecure = "ssl";
        } else {
            $mailer->SMTPSecure = "";
        }
        $mailer->Send();
    }
    return true;
}
function search_poll()
{
    global $database, $url, $results_per_page, $p, $search_text, $t, $search_objects, $results, $total_results;
    // CONSTRUCT QUERY
    $sql = "\r\n    SELECT\r\n      se_polls.poll_id,\r\n      se_polls.poll_title,\r\n      se_users.user_id,\r\n      se_users.user_username,\r\n      se_users.user_photo,\r\n      se_users.user_fname,\r\n      se_users.user_lname\r\n    FROM\r\n      se_polls,\r\n      se_users,\r\n      se_levels\r\n    WHERE\r\n      se_polls.poll_user_id=se_users.user_id &&\r\n      se_users.user_level_id=se_levels.level_id &&\r\n      (\r\n        se_polls.poll_search='1' ||\r\n        se_levels.level_poll_search='0'\r\n      ) &&\r\n      (\r\n        poll_title LIKE '%{$search_text}%' ||\r\n        poll_desc LIKE '%{$search_text}%' ||\r\n        poll_options LIKE '%{$search_text}%'\r\n      )\r\n  ";
    // GET TOTAL ENTRIES
    $total_polls = $database->database_num_rows($database->database_query($sql . " LIMIT 201"));
    // IF NOT TOTAL ONLY
    if ($t == "poll") {
        // MAKE POLL PAGES
        $start = ($p - 1) * $results_per_page;
        $limit = $results_per_page + 1;
        // SEARCH POLLS
        $sql .= " ORDER BY se_polls.poll_id DESC LIMIT {$start}, {$limit}";
        $resource = $database->database_query($sql) or die($database->database_error());
        while ($poll_info = $database->database_fetch_assoc($resource)) {
            // CREATE AN OBJECT FOR AUTHOR
            $profile = new se_user();
            $profile->user_info['user_id'] = $poll_info['user_id'];
            $profile->user_info['user_username'] = $poll_info['user_username'];
            $profile->user_info['user_fname'] = $poll_info['user_fname'];
            $profile->user_info['user_lname'] = $poll_info['user_lname'];
            $profile->user_info['user_photo'] = $poll_info['user_photo'];
            $profile->user_displayname();
            $result_url = $url->url_create('poll', $poll_info['user_username'], $poll_info['poll_id']);
            $result_name = 2500112;
            $result_desc = 2500113;
            // IF EMPTY TITLE
            if (!trim($poll_info['poll_title'])) {
                SE_Language::_preload(589);
                SE_Language::load();
                $poll_info['poll_title'] = SE_Language::_get(589);
            }
            $results[] = array('result_url' => $result_url, 'result_icon' => './images/icons/poll_poll48.gif', 'result_name' => $result_name, 'result_name_1' => $poll_info['poll_title'], 'result_desc' => $result_desc, 'result_desc_1' => $url->url_create('profile', $profile->user_info['user_username']), 'result_desc_2' => $profile->user_displayname, 'result_desc_3' => $poll_info['poll_desc']);
        }
        // SET TOTAL RESULTS
        $total_results = $total_polls;
    }
    // SET ARRAY VALUES
    SE_Language::_preload_multi(2500111, 2500112, 2500113);
    if ($total_polls > 200) {
        $total_polls = "200+";
    }
    $search_objects[] = array('search_type' => 'poll', 'search_lang' => 2500111, 'search_total' => $total_polls);
}
function search_documents()
{
    global $database, $url, $results_per_page, $p, $search_text, $t, $search_objects, $results, $total_results;
    // START TO QUERY BUILD
    $sql = "\r\n    SELECT\r\n      se_documents.document_id,\r\n      se_documents.document_title,\r\n      se_documents.document_slug,\r\n      se_documents.document_description,\r\n      se_users.user_id,\r\n      se_users.user_username,\r\n      se_users.user_photo,\r\n      se_users.user_fname,\r\n      se_users.user_lname\r\n    FROM\r\n      se_documents \r\n      INNER JOIN \r\n       se_users \r\n       ON se_documents.document_user_id=se_users.user_id\r\n      INNER JOIN\r\n       se_levels\r\n      ON se_users.user_level_id=se_levels.level_id \r\n      LEFT JOIN\r\n\t       se_document_tags\r\n\t       ON se_documents.document_id = se_document_tags.document_id\r\n\t    LEFT JOIN se_documenttags\r\n\t       ON se_document_tags.tag_id = se_documenttags.id  \r\n    WHERE\r\n\r\n      (\r\n        se_documents.document_search='1' ||\r\n        se_levels.level_document_search='0'\r\n      ) &&\r\n      (\r\n        document_title LIKE '%{$search_text}%' ||\r\n        document_description LIKE '%{$search_text}%' ||\r\n        document_fulltext LIKE '%{$search_text}%' ||\r\n        tag_name LIKE '%{$search_text}%'\r\n      )\r\n      &&\r\n      (\r\n        se_documents.document_approved='1'\r\n      )\r\n      &&\r\n      (\r\n        se_documents.document_publish='1'\r\n      )\r\n      &&\r\n      (\r\n        se_documents.document_status='1'\r\n      )\r\n     GROUP BY se_documents.document_id \r\n  ";
    // GET TOTAL DOCUMNETS
    $total_documents = $database->database_num_rows($database->database_query($sql . " LIMIT 201"));
    // IF NOT TOTAL ONLY
    if ($t == "document") {
        //  DOCUMENTS PAGES
        $start = ($p - 1) * $results_per_page;
        $limit = $results_per_page + 1;
        // SEARCH DOCUMENTS
        $sql .= " ORDER BY se_documents.document_id DESC LIMIT {$start}, {$limit}";
        $resource = $database->database_query($sql) or die($database->database_error());
        while ($document_info = $database->database_fetch_assoc($resource)) {
            // CREATE AN OBJECT FOR AUTHOR
            $profile = new se_user();
            $profile->user_info['user_id'] = $document_info['user_id'];
            $profile->user_info['user_username'] = $document_info['user_username'];
            $profile->user_info['user_fname'] = $document_info['user_fname'];
            $profile->user_info['user_lname'] = $document_info['user_lname'];
            $profile->user_info['user_photo'] = $document_info['user_photo'];
            $profile->user_displayname();
            $result_url = $url->url_create("document", $document_info['user_username'], $document_info['document_id'], $document_info['document_slug']);
            $result_name = 650003007;
            $result_desc = 650003008;
            $results[] = array('result_url' => $result_url, 'result_icon' => './images/icons/document60.gif', 'result_name' => $result_name, 'result_name_1' => $document_info['document_title'], 'result_desc' => $result_desc, 'result_desc_1' => $url->url_create('profile', $profile->user_info['user_username']), 'result_desc_2' => $profile->user_displayname, 'result_desc_3' => $document_info['document_description']);
        }
        // SET TOTAL RESULTS
        $total_results = $total_documents;
    }
    // SET ARRAY VALUES
    SE_Language::_preload_multi(650003009, 650003007, 650003008);
    if ($total_documents > 200) {
        $total_documents = "200+";
    }
    $search_objects[] = array('search_type' => 'document', 'search_lang' => 650003009, 'search_total' => $total_documents);
}
<?php

// ENSURE THIS IS BEING INCLUDED IN AN SE SCRIPT
if (!defined('SE_PAGE')) {
    exit;
}
//include_once "./lang/lang_".$global_lang."_education.php";
include_once "./include/class_radcodes.php";
include_once "./include/class_education.php";
include_once "./include/functions_education.php";
SE_Language::_preload_multi(11040101, 11040102, 11040103);
SE_Language::load();
// SET MAIN MENU VARS
//$plugin_vars[menu_main] = Array('file' => 'search_education.php', 'title' => 11020106);
// SET USER MENU VARS
if ($user->level_info[level_education_allow] == 1) {
    $plugin_vars[menu_user] = array('file' => 'user_education.php', 'icon' => 'education16.gif', 'title' => 11040102);
}
// SET PROFILE MENU VARS
if ($owner->level_info[level_education_allow] == 1 && $page == "profile") {
    $rc_education = new rc_education($owner->user_info[user_id]);
    $educations = $rc_education->get_educations();
    $educations = $rc_education->build_searchable_fields($educations);
    $total_educations = count($educations);
    $smarty->assign('educations', $educations);
    $smarty->assign('total_educations', $total_educations);
    // SET PROFILE MENU VARS
    if ($total_educations > 0) {
        // DETERMINE WHERE TO SHOW ALBUMS
        $level_education_profile = explode(",", $owner->level_info[level_education_profile]);
        if (!in_array($owner->user_info[user_profile_education], $level_education_profile)) {
 function comment_post($comment_body, $comment_secure, $object_title = "", $object_owner = "", $object_owner_id = 0, $object_privacy = "")
 {
     global $database, $user, $owner, $setting, $actions, $notify, $url;
     $comment_id = 0;
     $comment_date = time();
     // RETRIEVE AND CHECK SECURITY CODE IF NECESSARY
     if ($setting['setting_comment_code']) {
         // NOW IN HEADER
         $code_found = false;
         if (@$_SESSION['code'] == $comment_secure) {
             $code_found = true;
         }
         if (!empty($_SESSION['codes']) && is_array($_SESSION['codes'])) {
             foreach ($_SESSION['codes'] as $index => $code_info) {
                 if ($code_info['code'] == $comment_secure) {
                     $code_found = true;
                     unset($_SESSION['codes'][$index]);
                 }
             }
         }
         if (!$code_found) {
             $this->is_error = 1;
         }
         //session_start();
         //$code = $_SESSION['code'];
         //if($code == "") { $code = randomcode(); }
         //if($comment_secure != $code) { $this->is_error = 1; }
     }
     // MAKE SURE COMMENT BODY IS NOT EMPTY - ADD BREAKS AND CENSOR
     $comment_body = cleanHTML(censor($comment_body), $setting['setting_comment_html'], array("style"));
     $comment_body = preg_replace('/(\\r\\n?)/', "\n", $comment_body);
     $comment_body = str_replace("\n", "<br>", $comment_body);
     $comment_body = preg_replace('/(<br>){3,}/is', '<br><br>', $comment_body);
     $comment_body = str_replace("'", "\\'", $comment_body);
     if (!trim($comment_body)) {
         $this->is_error = 1;
         $comment_body = "";
     }
     // ADD COMMENT IF NO ERROR
     if (!$this->is_error) {
         $resource = $database->database_query("\r\n        INSERT INTO `se_{$this->comment_type}comments` (\r\n          `{$this->comment_type}comment_{$this->comment_identifier}`,\r\n          `{$this->comment_type}comment_authoruser_id`,\r\n          `{$this->comment_type}comment_date`,\r\n          `{$this->comment_type}comment_body`\r\n        ) VALUES (\r\n          '{$this->comment_identifying_value}',\r\n          '{$user->user_info['user_id']}',\r\n          '{$comment_date}',\r\n          '{$comment_body}'\r\n        )\r\n      ");
         $comment_id = $database->database_insert_id();
         // New handling - total cached in parent table
         if ($resource && $this->comment_parent_type && $this->comment_parent_identifier) {
             $database->database_query("\r\n          UPDATE\r\n            `se_{$this->comment_parent_type}`\r\n          SET\r\n            `{$this->comment_parent_identifier}_totalcomments`=`{$this->comment_parent_identifier}_totalcomments`+1\r\n          WHERE\r\n            `{$this->comment_identifier}`='{$this->comment_identifying_value}'\r\n          LIMIT\r\n            1\r\n        ");
         }
         // INSERT ACTION IF USER EXISTS
         if ($user->user_exists) {
             $commenter = $user->user_displayname;
             $comment_body_encoded = strip_tags($comment_body);
             if (strlen($comment_body_encoded) > 250) {
                 $comment_body_encoded = substr($comment_body_encoded, 0, 247) . "...";
             }
             $comment_body_encoded = str_replace(array("<br>", "<br />"), " ", $comment_body_encoded);
             $actions->actions_add($user, $this->comment_type . "comment", array($user->user_info['user_username'], $user->user_displayname, $owner->user_info['user_username'], $owner->user_displayname, $comment_body_encoded, $this->comment_identifying_value, $object_title, $object_owner_id), array(), 0, false, $object_owner, $object_owner_id, $object_privacy);
         } else {
             SE_Language::_preload(835);
             SE_Language::load();
             $commenter = SE_Language::_get(835);
         }
         // SEND PROFILE COMMENT NOTIFICATION IF COMMENTER IS NOT OWNER
         if ($owner->user_info['user_id'] != $user->user_info['user_id']) {
             $notifytype = $notify->notify_add($owner->user_info['user_id'], $this->comment_type . "comment", $this->comment_identifying_value, array($owner->user_info['user_username'], $this->comment_identifying_value, $object_owner_id), array($object_title));
             $object_url = $url->url_base . vsprintf($notifytype['notifytype_url'], array($owner->user_info['user_username'], $this->comment_identifying_value));
             $owner->user_settings();
             if ($owner->usersetting_info['usersetting_notify_' . $this->comment_type . 'comment']) {
                 send_systememail($this->comment_type . "comment", $owner->user_info['user_email'], array($owner->user_displayname, $commenter, "<a href=\"{$object_url}\">{$object_url}</a>"));
             }
         }
     }
     return array('comment_id' => $comment_id, 'comment_body' => $comment_body, 'comment_date' => $comment_date);
 }
    // AN ERROR OCCURED SEND THE DATA BACK
    $blogentry_info = array('blogentry_id' => $blogentry_id, 'blogentry_title' => $blogentry_title, 'blogentry_body' => $blogentry_body, 'blogentry_blogentrycat_id' => $blogentry_blogentrycat_id, 'blogentry_search' => $blogentry_search, 'blogentry_privacy' => $blogentry_privacy, 'blogentry_comments' => $blogentry_comments, 'blogentry_trackbacks' => $blogentry_trackbacks);
}
// GET BLOG ENTRY CATEGORIES
$blogentrycats_array = $blog->blog_category_list($user->user_info['user_id']);
// GET PREVIOUS PRIVACY SETTINGS
$level_blog_privacy = unserialize($user->level_info['level_blog_privacy']);
rsort($level_blog_privacy);
for ($c = 0; $c < count($level_blog_privacy); $c++) {
    $lvar = user_privacy_levels($level_blog_privacy[$c]);
    if ($lvar) {
        SE_Language::_preload($privacy_options[$level_blog_privacy[$c]] = $lvar);
    }
}
$level_blog_comments = unserialize($user->level_info['level_blog_comments']);
rsort($level_blog_comments);
for ($c = 0; $c < count($level_blog_comments); $c++) {
    $lvar = user_privacy_levels($level_blog_comments[$c]);
    if ($lvar) {
        SE_Language::_preload($comment_options[$level_blog_comments[$c]] = $lvar);
    }
}
// CONVERT HTML CHARACTERS BACK
$blogentry_info['blogentry_body'] = str_replace("\r\n", "", htmlspecialchars_decode($blogentry_info['blogentry_body']));
// ASSIGN VARIABLES AND SHOW NEW BLOGENTRY PAGE
$smarty->assign('blogentry_info', $blogentry_info);
$smarty->assign('blogentrycats', $blogentrycats_array);
$smarty->assign('privacy_options', $privacy_options);
$smarty->assign('comment_options', $comment_options);
$smarty->assign('comments_total', $comments_total);
include "footer.php";
Exemple #10
0
<?php

// ENSURE THIS IS BEING INCLUDED IN AN SE SCRIPT
defined('SE_PAGE') or exit;
// INCLUDE GROUP FILES
include "./include/class_group.php";
include "./include/functions_group.php";
// PRELOAD LANGUAGE
SE_Language::_preload(2000007);
// SET MENU VARS
if ($user->user_exists && (int) $user->level_info['level_group_allow'] & 1 || !$user->user_exists && $setting['setting_permission_group']) {
    $plugin_vars['menu_main'] = array('file' => 'browse_groups.php', 'title' => 2000007);
}
if ((int) $user->level_info['level_group_allow'] & 2) {
    $plugin_vars['menu_user'] = array('file' => 'user_group.php', 'icon' => 'group_group16.gif', 'title' => 2000007);
}
// SET WHAT'S NEW PAGE UPDATES
if ($user->level_info['level_group_allow'] & 1 && $page == "user_home") {
    // GET GROUP SUBSCRIPTIONS
    $group_subscribes = array();
    $group_subscribe_query = $database->database_query("SELECT se_groupsubscribes.groupsubscribe_time, se_groups.group_id, se_groups.group_title, count(se_groupcomments.groupcomment_id) AS total_comments FROM se_groupsubscribes LEFT JOIN se_groups ON se_groupsubscribes.groupsubscribe_group_id=se_groups.group_id LEFT JOIN se_groupcomments ON se_groups.group_id=se_groupcomments.groupcomment_group_id AND se_groupcomments.groupcomment_date>se_groupsubscribes.groupsubscribe_time WHERE se_groupsubscribes.groupsubscribe_user_id='{$user->user_info['user_id']}' GROUP BY se_groups.group_id ORDER BY se_groups.group_title");
    $total_group_subscribes = $database->database_num_rows($group_subscribe_query);
    while ($subscribe_info = $database->database_fetch_assoc($group_subscribe_query)) {
        $subscribe_info['total_photos'] = $database->database_num_rows($database->database_query("SELECT NULL FROM se_groupmedia INNER JOIN se_groupalbums ON se_groupmedia.groupmedia_groupalbum_id=se_groupalbums.groupalbum_id AND se_groupalbums.groupalbum_group_id='{$subscribe_info['group_id']}' WHERE se_groupmedia.groupmedia_date>'{$subscribe_info['groupsubscribe_time']}'"));
        $subscribe_info['total_posts'] = $database->database_num_rows($database->database_query("SELECT NULL FROM se_groupposts INNER JOIN se_grouptopics ON se_groupposts.grouppost_grouptopic_id=se_grouptopics.grouptopic_id AND se_grouptopics.grouptopic_group_id='{$subscribe_info['group_id']}' WHERE se_groupposts.grouppost_date>'{$subscribe_info['groupsubscribe_time']}'"));
        $group_subscribes[] = $subscribe_info;
    }
    // ASSIGN GROUP SUBSCRIPTION SMARY VARIABLE
    $smarty->assign('group_subscribes', $group_subscribes);
    $smarty->assign('total_group_subscribes', $total_group_subscribes);
    // SET PROFILE MENU VARS
<?php

// ENSURE THIS IS BEING INCLUDED IN AN SE SCRIPT
defined('SE_PAGE') or exit;
// INCLUDE FUNCTION FILE
include_once "./include/functions_document.php";
// INCLUDE CLASS FILE
include_once "./include/class_document.php";
// PRELOAD LANGUAGE
SE_Language::_preload(650003010);
$query = "SELECT * FROM se_document_parameters";
$params = $database->database_fetch_assoc($database->database_query($query));
// SET MAIN MENU VARS
if (!$user->user_exists && $params[permission_document] || $user->user_exists && $user->level_info['level_document_allow']) {
    $plugin_vars['menu_main'] = array('file' => 'browse_documents.php', 'title' => 650003010);
}
// SET USER MENU VARS
if ($user->user_exists && $user->level_info['level_document_allow']) {
    $plugin_vars[menu_user] = array('file' => 'user_documents.php', 'icon' => 'document16.gif', 'title' => 650003010);
}
// SET PROFILE MENU VARS
if ($owner->level_info['level_document_allow'] && $page == "profile") {
    //SHOWING A DOCUMENT TAB IF THE USER HAS ATLEAST ONE DOCUMENT
    if ($page == "profile") {
        if (isset($_POST['p'])) {
            $p = $_POST['p'];
        } elseif (isset($_GET['p'])) {
            $p = $_GET['p'];
        } else {
            $p = 1;
        }
Exemple #12
0
        $database->database_query("UPDATE se_users SET user_language_id='{$user->user_info['user_language_id']}' WHERE user_id='{$user->user_info['user_id']}' LIMIT 1");
    }
    if (!$user->user_exists && $setting['setting_lang_anonymous']) {
        $lang_id = (int) $_GET['lang_id'];
    }
    if ($lang_id) {
        setcookie('se_language_anonymous', $lang_id, time() + 99999999, "/");
        $_COOKIE['se_language_anonymous'] = $lang_id;
    }
}
SE_Language::select($user);
if (SE_Language::info('language_setlocale')) {
    $multi_language = 1;
    setlocale(LC_TIME, SE_Language::info('language_setlocale'));
}
header("Content-Language: " . SE_Language::info('language_code'));
// CREATE ACTIONS CLASS
$actions = new se_actions();
// CREATE NOTIFICATION CLASS
$notify = new se_notify();
// CREATE ADS CLASS
$ads = new se_ads();
// Define SE_PAGE_AJAX in your page before the header include to not load ads or update page views
if (!defined('SE_PAGE_AJAX') && ($page == "chat_frame" || $page == "chat_ajax" || $page == "misc_js" || $page == "ad")) {
    define('SE_PAGE_AJAX', TRUE);
}
if (!defined('SE_PAGE_AJAX')) {
    // UPDATE STATS TABLE
    update_stats("views");
    // LOAD ADS
    $ads->load();
<?

// ENSURE THIS IS BEING INCLUDED IN AN SE SCRIPT
if(!defined('SE_PAGE')) {
 exit();
}

// PRELOAD LANGUAGE
SE_Language::_preload_multi(17001000, 17001035);

switch($page) {

 // CODE FOR USER HOME PAGE
 case "user_home":
 // your code goes here
  break;
}

header("Content-Type: text/html; charset=utf-8");

class FileLogger {

 private $filehandler;
 private $logname;
 public $buffer = array();

 public function __construct($logname, $filename) {
  $this->logname = $logname;
  $this->filehandler = fopen($filename, "a+");
 }
function site_statistics()
{
    global $setting, $database, $database_name;
    $statistics = NULL;
    // CACHING
    $cache_object = SECache::getInstance('serial');
    if (is_object($cache_object)) {
        $statistics = $cache_object->get('site_statistics');
    }
    // RETRIEVAL
    //if( !is_array($statistics) || empty($statistics) )
    if (!is_array($statistics)) {
        $statistics = array();
        // Get default stats
        $total_members = $database->database_fetch_assoc($database->database_query("SELECT count(*) AS total_members FROM se_users"));
        $statistics['members'] = array('title' => 661, 'stat' => (int) (isset($total_members['total_members']) ? $total_members['total_members'] : 0));
        if ($setting['setting_connection_allow']) {
            $total_friends = $database->database_fetch_assoc($database->database_query("SELECT count(*) AS total_friends FROM se_friends WHERE friend_status='1'"));
            $statistics['friends'] = array('title' => 662, 'stat' => (int) (isset($total_friends['total_friends']) ? $total_friends['total_friends'] : 0));
        }
        $total_comments = 0;
        $comment_tables = $database->database_query("SHOW TABLES FROM `{$database_name}` LIKE 'se_%comments'");
        while ($table_info = $database->database_fetch_array($comment_tables)) {
            $comment_type = strrev(substr(strrev(substr($table_info[0], 3)), 8));
            $table_comments = $database->database_fetch_assoc($database->database_query("SELECT count(*) AS total_comments FROM `se_{$comment_type}comments`"));
            $total_comments += $table_comments['total_comments'];
        }
        $statistics['comments'] = array('title' => 663, 'stat' => (int) $total_comments);
        /*
        $total_media = 0;
        $media_tables = $database->database_query("SHOW TABLES FROM `{$database_name}` LIKE 'se_%media'");
        while($table_info = $database->database_fetch_array($media_tables))
        {
          $comment_type = strrev(substr(strrev(substr($table_info[0], 3)), 8));
          $table_media = $database->database_fetch_assoc($database->database_query("SELECT count(*) AS total_media FROM se_{$comment_type}media"));
          $total_media += $total_media['total_media'];
        }
        
        $statistics['media'] = array(
          'title' => 663, // TODO
          'stat'  => (int) $total_media
        );
        */
        /*
        $total_mediatags = 0;
        $mediatag_tables = $database->database_query("SHOW TABLES FROM `{$database_name}` LIKE 'se_%mediatags'");
        while($table_info = $database->database_fetch_array($media_tables))
        {
          $comment_type = strrev(substr(strrev(substr($table_info[0], 3)), 8));
          $table_mediatags = $database->database_fetch_assoc($database->database_query("SELECT count(*) AS total_mediatags FROM se_{$comment_type}mediatags"));
          $total_mediatags += $total_mediatags['total_mediatags'];
        }
        
        $statistics['mediatags'] = array(
          'title' => 663, // TODO
          'stat'  => (int) $total_mediatags
        );
        */
        // CALL HOOK
        // COMMENT OUT THIS NEXT LINE IF YOU ONLY WANT THE BASIC STATISTICS
        ($hook = SE_Hook::exists('se_site_statistics')) ? SE_Hook::call($hook, array('statistics' => &$statistics)) : NULL;
        // CACHE
        if (is_object($cache_object)) {
            $cache_object->store($statistics, 'site_statistics');
        }
    }
    // Load language
    foreach ($statistics as $stat) {
        SE_Language::_preload($stat['title']);
    }
    return $statistics;
}
$total_comments = 0;
$comment_tables = $database->database_query("SHOW TABLES FROM `{$database_name}` LIKE 'se_%comments'");
while ($table_info = $database->database_fetch_array($comment_tables)) {
    $comment_type = strrev(substr(strrev(substr($table_info[0], 3)), 8));
    $table_comments = $database->database_fetch_assoc($database->database_query("SELECT count(*) AS total_comments FROM se_" . $comment_type . "comments WHERE " . $comment_type . "comment_authoruser_id='" . $user->user_info[user_id] . "'"));
    $total_comments += $table_comments[total_comments];
}
// GET USER LEVEL ARRAY
$levels = $database->database_query("SELECT level_id, level_name FROM se_levels ORDER BY level_name");
while ($level_info = $database->database_fetch_assoc($levels)) {
    $level_array[] = $level_info;
}
// GET PROFILECAT ARRAY
$cats = $database->database_query("SELECT profilecat_id AS cat_id, profilecat_title AS cat_title FROM se_profilecats WHERE profilecat_dependency='0' ORDER BY profilecat_order");
while ($cat_info = $database->database_fetch_assoc($cats)) {
    SE_Language::_preload($cat_info[cat_title]);
    $cat_array[] = $cat_info;
}
// GET RECENT ACTIVITY (ACTIONS)
$owner = $user;
$actions = new se_actions();
$actions = $actions->actions_display(0, $setting[setting_actions_actionsonprofile], "se_actions.action_user_id='" . $user->user_info[user_id] . "'");
// ASSIGN VARIABLES AND SHOW EDIT USERS PAGE
$smarty->assign('is_error', $is_error);
$smarty->assign('result', $result);
$smarty->assign('user', $user);
$smarty->assign('levels', $level_array);
$smarty->assign('cats', $cat_array);
$smarty->assign('actions', $actions);
$smarty->assign('old_subnet_name', $subnet[2]);
$smarty->assign('new_subnet_name', $subnet[1]);
    if (user_privacy_levels($priv) != "") {
        SE_Language::_preload(user_privacy_levels($priv));
        $privacy_options[$priv] = user_privacy_levels($priv);
    }
}
for ($c = 6; $c >= 0; $c--) {
    $priv = pow(2, $c) - 1;
    if (user_privacy_levels($priv) != "") {
        SE_Language::_preload(user_privacy_levels($priv));
        $comment_options[$priv] = user_privacy_levels($priv);
    }
}
for ($c = 6; $c >= 0; $c--) {
    $priv = pow(2, $c) - 1;
    if (user_privacy_levels($priv) != "") {
        SE_Language::_preload(user_privacy_levels($priv));
        $tag_options[$priv] = user_privacy_levels($priv);
    }
}
// ASSIGN VARIABLES AND SHOW ALBUM SETTINGS PAGE
$smarty->assign('result', $result);
$smarty->assign('is_error', $is_error);
$smarty->assign('level_info', $level_info);
$smarty->assign('level_album_privacy', unserialize($level_info[level_album_privacy]));
$smarty->assign('level_album_comments', unserialize($level_info[level_album_comments]));
$smarty->assign('level_album_tag', unserialize($level_info[level_album_tag]));
$smarty->assign('level_album_profile', explode(",", $level_info[level_album_profile]));
$smarty->assign('album_privacy', $privacy_options);
$smarty->assign('album_comments', $comment_options);
$smarty->assign('album_tag', $tag_options);
include "admin_footer.php";
Exemple #17
0
<?php

$page = "quiz_result";
include "header.php";
$task = isset($_POST['task']) && $_POST['task'] ? trim($_POST['task']) : '';
$task = !$task && (isset($_GET['task']) && $_GET['task']) ? $_GET['task'] : $task;
$quiz_id = isset($_GET['quiz_id']) && $_GET['quiz_id'] ? (int) $_GET['quiz_id'] : 0;
$result_id = he_quiz::user_result($user->user_info['user_id'], $quiz_id);
// DISPLAY ERROR PAGE IF USER IS NOT LOGGED IN AND ADMIN SETTING REQUIRES REGISTRATION
if (!$user->user_exists || !$quiz_id || !$result_id) {
    $page = "error";
    $smarty->assign('error_header', 639);
    $smarty->assign('error_message', 656);
    $smarty->assign('error_submit', 641);
    include "footer.php";
}
$quiz_info = he_quiz::get_quiz_info($quiz_id);
$quiz_result = he_quiz::result_info($result_id);
$friend_list = $user->user_friend_list(0, 10);
$message = array('title' => SE_Language::get(690691154), 'text' => SE_Language::get(690691155), 'type' => 'success');
$photo_url = he_quiz::photo_url();
$smarty->assign('message', $message);
$smarty->assign('quiz_info', $quiz_info);
$smarty->assign('quiz_result', $quiz_result);
$smarty->assign('photo_url', $photo_url);
include "footer.php";
    $setting[setting_signup_invite_numgiven] = $_POST['setting_signup_invite_numgiven'];
    $setting[setting_signup_invitepage] = $_POST['setting_signup_invitepage'];
    $setting[setting_signup_verify] = $_POST['setting_signup_verify'];
    $setting[setting_signup_code] = $_POST['setting_signup_code'];
    $setting[setting_signup_randpass] = $_POST['setting_signup_randpass'];
    $setting[setting_signup_tos] = $_POST['setting_signup_tos'];
    $setting[setting_signup_tostext] = $_POST['setting_signup_tostext'];
    $field_signup = $_POST['field_signup'];
    if (is_array($field_signup)) {
        $database->database_query("UPDATE se_profilefields SET profilefield_signup='1' WHERE profilefield_id IN('" . join("', '", $field_signup) . "')");
        $database->database_query("UPDATE se_profilefields SET profilefield_signup='0' WHERE profilefield_id NOT IN('" . join("', '", $field_signup) . "')");
    }
    $cat_signup = $_POST['cat_signup'];
    if (is_array($cat_signup)) {
        $database->database_query("UPDATE se_profilecats SET profilecat_signup='1' WHERE profilecat_id IN('" . join("', '", $cat_signup) . "')");
        $database->database_query("UPDATE se_profilecats SET profilecat_signup='0' WHERE profilecat_id NOT IN('" . join("', '", $cat_signup) . "')");
    }
    // UPDATE TOS TEXT
    SE_Language::edit(1210, $setting[setting_signup_tostext]);
    // UPDATE SETTINGS
    $database->database_query("UPDATE se_settings SET \r\n\t\t\tsetting_signup_photo='{$setting['setting_signup_photo']}',\r\n\t\t\tsetting_signup_enable='{$setting['setting_signup_enable']}',\r\n\t\t\tsetting_signup_welcome='{$setting['setting_signup_welcome']}',\r\n\t\t\tsetting_signup_invite='{$setting['setting_signup_invite']}',\r\n\t\t\tsetting_signup_invite_checkemail='{$setting['setting_signup_invite_checkemail']}',\r\n\t\t\tsetting_signup_invite_numgiven='{$setting['setting_signup_invite_numgiven']}',\r\n\t\t\tsetting_signup_invitepage='{$setting['setting_signup_invitepage']}',\r\n\t\t\tsetting_signup_verify='{$setting['setting_signup_verify']}',\r\n\t\t\tsetting_signup_code='{$setting['setting_signup_code']}',\r\n\t\t\tsetting_signup_randpass='******'setting_signup_randpass']}',\r\n\t\t\tsetting_signup_tos='{$setting['setting_signup_tos']}'");
    $result = 1;
}
// GET TABS AND FIELDS
$field = new se_field("profile");
$field->cat_list();
$cat_array = $field->cats;
// ASSIGN VARIABLES AND SHOW ADMIN SIGNUP PAGE
$smarty->assign('result', $result);
$smarty->assign('cats', $cat_array);
include "admin_footer.php";
Exemple #19
0
// SHOW SECOND STEP
if ($task == "step2") {
    $step = 2;
    $next_task = "step2do";
    if (count($field->cats) == 0) {
        $task = "step1";
    }
    $signup_password = base64_encode($signup_password);
    $signup_password2 = base64_encode($signup_password2);
}
// SHOW FIRST STEP
if ($task == "step1") {
    $step = 1;
    $next_task = "step1do";
    // GET LANGUAGE PACK LIST
    $lang_packlist = SE_Language::list_packs();
    ksort($lang_packlist);
    $lang_packlist = array_values($lang_packlist);
}
// SET GLOBAL PAGE TITLE
$global_page_title[0] = 679;
$global_page_description[0] = 680;
// ASSIGN VARIABLES AND INCLUDE FOOTER
$smarty->assign('is_error', $is_error);
$smarty->assign('new_user', $new_user);
$smarty->assign('cats', $field->cats);
$smarty->assign('signup_email', $signup_email);
$smarty->assign('signup_password', $signup_password);
$smarty->assign('signup_password2', $signup_password2);
$smarty->assign('signup_username', $signup_username);
$smarty->assign('signup_timezone', $signup_timezone);
function he_quiz_list($params = array())
{
    $active_tab = isset($params['active_tab']) && $params['active_tab'] ? $params['active_tab'] : 'popular';
    $count = isset($params['count']) && $params['count'] ? (int) $params['count'] : 5;
    $list_types = array('popular', 'latest', 'commented');
    $quiz_list_str = '';
    foreach ($list_types as $list_type) {
        $quiz_list = he_quiz::get_index_list($count, $list_type);
        $quizzes_str = '';
        foreach ($quiz_list as $quiz) {
            $img_size = $quiz['size'][0] > $quiz['size'][1] ? 'width="60"' : 'height="60"';
            $quizzes_str .= '<div class="he_quiz_item">
	            <div class="he_quiz_photo">
	            <a href="browse_quiz.php?quiz_id=' . $quiz['quiz_id'] . '">
	                <img border="0" src="' . ($quiz['photo_url'] ? $quiz['photo_url'] : './images/he_quiz_thumb.jpg') . '" ' . $img_size . '/>
	            </a>
	            </div>
	            <div class="he_quiz_info">
	                <div class="he_quiz_name"><a href="quiz.php?quiz_id=' . $quiz['quiz_id'] . '">' . $quiz['name'] . '</a></div>
	                <div class="he_quiz_description">' . he_quiz_truncate($quiz['description'], 100) . '</div>              
	                
	            </div>
	            <div class="clr"></div>
	        </div>';
        }
        $quizzes_str = strlen($quizzes_str) ? $quizzes_str : '<center>' . SE_Language::get(690691160) . '</center>';
        $is_active = $active_tab == $list_type ? 'active_tab' : '';
        $quizzes_str = '<div id="tab_' . $list_type . '" class="he_quiz_list ' . $is_active . '">' . $quizzes_str . '</div>';
        $quiz_list_str .= $quizzes_str;
    }
    $tabs_str = '<div class="he_quiz_tab" onclick="he_quiz.switch_tab(this, \'tab_commented\')">
                    <label>' . SE_Language::get(690691196) . '</label>
                </div>
                <div class="he_quiz_tab" onclick="he_quiz.switch_tab(this, \'tab_latest\')">
                    <label>' . SE_Language::get(690691158) . '</label>
                </div>
                <div class="he_quiz_tab active_tab" onclick="he_quiz.switch_tab(this, \'tab_popular\')">
                    <label>' . SE_Language::get(690691159) . '</label>
                </div>';
    $lang_var = SE_Language::get(690691161);
    return <<<OUTPUT
    <script src="./include/js/he_quiz.js" type="text/javascript"></script>
    
    <div class="he_quiz_list_block">
        <div class="he_quiz_block_cap">
            <div class="he_quiz_label">
                <b>{$lang_var}</b>
            </div>
            {$tabs_str}
            <div class="clr"></div>
        </div>
        <div class="he_quiz_block_body">
            {$quiz_list_str}
        </div>
    </div>

OUTPUT;
}
    }
    $text = he_wall_format_text($text);
    $replace_arr = array($user->user_info['user_username'], $user->user_displayname, $text, $link_url, $link_label, he_wall::get_wall_link($wall_object, $wall_object_id));
    $actions->actions_add($user, 'wallpostlink', $replace_arr, array(), 0, false, $action_object_owner, $wall_object_id, $action_privacy_level);
    he_wall::new_post_notify($wall_object, $wall_object_id, $new_action_id);
    $result = he_wall_actions_display($wall_object, $wall_object_id, $first_action_id);
} elseif ($task == 'post_video') {
    $first_action_id = isset($_POST['first_action_id']) ? (int) $_POST['first_action_id'] : false;
    $action_privacy_level = isset($_POST['action_privacy_level']) ? (int) $_POST['action_privacy_level'] : 63;
    $text = isset($_POST['text']) ? trim($_POST['text']) : '';
    $video_provider = isset($_POST['video_provider']) ? trim($_POST['video_provider']) : '';
    $video_url = isset($_POST['video_url']) ? trim($_POST['video_url']) : '';
    if ($video_provider != 'youtube' && $video_provider != 'vimeo') {
        $result = array('result' => 0, 'message' => SE_Language::get(690706072));
    } elseif ($video_url == '') {
        $result = array('result' => 0, 'message' => SE_Language::get(690706073));
    } else {
        $new_action_id = he_wall::new_action_id();
        $pages_id = $wall_object == 'pages' ? $wall_object_id : 0;
        if ($pages_id && $video_provider == 'vimeo') {
            $upload_result = he_wall_vimeo_video_upload($new_action_id, $video_url, $pages_id);
        } elseif ($video_provider == 'vimeo') {
            $upload_result = he_wall_vimeo_video_upload($new_action_id, $video_url);
        } elseif ($video_provider == 'youtube') {
            if ($pages_id) {
                $upload_result = he_wall_youtube_video_custom_upload($new_action_id, $video_url, $pages_id);
            } elseif (isset($global_plugins['video']) && $setting['setting_he_wall_video_sync']) {
                $upload_result = he_wall_youtube_video_upload($new_action_id, $video_url, $action_privacy_level);
            } else {
                $upload_result = he_wall_youtube_video_custom_upload($new_action_id, $video_url);
            }
        $block_user = new se_user();
        $block_user->user_info['user_id'] = $block['user_id'];
        $block_user->user_info['user_username'] = $block['user_username'];
        $block_user->user_info['user_photo'] = $block['user_photo'];
        $block_user->user_info['user_fname'] = $block['user_fname'];
        $block_user->user_info['user_lname'] = $block['user_lname'];
        $block_user->user_displayname();
        $block_array[] = $block_user;
    }
}
// GET PREVIOUS PRIVACY SETTINGS
for ($c = 0; $c < count($level_profile_privacy); $c++) {
    if (user_privacy_levels($level_profile_privacy[$c]) != "") {
        SE_Language::_preload(user_privacy_levels($level_profile_privacy[$c]));
        $privacy_options[$level_profile_privacy[$c]] = user_privacy_levels($level_profile_privacy[$c]);
    }
}
for ($c = 0; $c < count($level_profile_comments); $c++) {
    if (user_privacy_levels($level_profile_comments[$c]) != "") {
        SE_Language::_preload(user_privacy_levels($level_profile_comments[$c]));
        $comment_options[$level_profile_comments[$c]] = user_privacy_levels($level_profile_comments[$c]);
    }
}
// ASSIGN VARIABLES AND INCLUDE FOOTER
$smarty->assign('result', $result);
$smarty->assign('is_error', $is_error);
$smarty->assign('blocked_users', $block_array);
$smarty->assign('actiontypes', $actiontypes_array);
$smarty->assign('privacy_options', $privacy_options);
$smarty->assign('comment_options', $comment_options);
include "footer.php";
    }
}
// GET PREVIOUS PRIVACY SETTINGS
for ($c = 0; $c < count($level_album_privacy); $c++) {
    if (user_privacy_levels($level_album_privacy[$c]) != "") {
        SE_Language::_preload(user_privacy_levels($level_album_privacy[$c]));
        $privacy_options[$level_album_privacy[$c]] = user_privacy_levels($level_album_privacy[$c]);
    }
}
for ($c = 0; $c < count($level_album_comments); $c++) {
    if (user_privacy_levels($level_album_comments[$c]) != "") {
        SE_Language::_preload(user_privacy_levels($level_album_comments[$c]));
        $comment_options[$level_album_comments[$c]] = user_privacy_levels($level_album_comments[$c]);
    }
}
for ($c = 0; $c < count($level_album_tag); $c++) {
    if (user_privacy_levels($level_album_tag[$c]) != "") {
        SE_Language::_preload(user_privacy_levels($level_album_tag[$c]));
        $tag_options[$level_album_tag[$c]] = user_privacy_levels($level_album_tag[$c]);
    }
}
// RESTORE LINE BREAKS
$album_info[album_desc] = str_replace("<br>", "\r\n", $album_info[album_desc]);
// ASSIGN VARIABLES AND SHOW EDIT ALBUMS PAGE
$smarty->assign('result', $result);
$smarty->assign('is_error', $is_error);
$smarty->assign('album_info', $album_info);
$smarty->assign('privacy_options', $privacy_options);
$smarty->assign('comment_options', $comment_options);
$smarty->assign('tag_options', $tag_options);
include "footer.php";
Exemple #24
0
 function album_list($start, $limit, $sort_by = "album_id DESC", $where = "")
 {
     global $database, $user, $owner;
     // BEGIN QUERY
     $sql = "\r\n      SELECT\r\n        se_albums.*,\r\n        se_albums.album_totalfiles AS total_files,\r\n        se_albums.album_totalspace AS total_space\r\n    ";
     // IF NO USER ID SPECIFIED, RETRIEVE USER INFORMATION
     if (!$this->user_id) {
         $sql .= ",\r\n        se_users.user_id,\r\n        se_users.user_username,\r\n        se_users.user_photo,\r\n        se_users.user_fname,\r\n        se_users.user_lname\r\n    ";
     }
     // CONTINUE QUERY
     $sql .= "\r\n      FROM\r\n        se_albums\r\n    ";
     // IF NO USER ID SPECIFIED, JOIN TO USER TABLE
     if (!$this->user_id) {
         $sql .= "\r\n      LEFT JOIN\r\n        se_users\r\n        ON se_albums.album_user_id=se_users.user_id\r\n    ";
     }
     // ADD WHERE IF NECESSARY
     if (!empty($where) || $this->user_id) {
         $sql .= "\r\n      WHERE\r\n    ";
     }
     // ENSURE USER ID IS NOT EMPTY
     if ($this->user_id) {
         $sql .= "\r\n        album_user_id='{$this->user_id}'\r\n    ";
     }
     // INSERT AND IF NECESSARY
     if ($this->user_id && !empty($where)) {
         $sql .= " AND";
     }
     // ADD WHERE CLAUSE, IF NECESSARY
     if (!empty($where)) {
         $sql .= "\r\n        {$where}\r\n    ";
     }
     // ADD ORDER, AND LIMIT CLAUSE
     $sql .= "\r\n      ORDER BY\r\n        {$sort_by}\r\n      LIMIT\r\n        {$start}, {$limit}\r\n    ";
     // RUN QUERY
     $resource = $database->database_query($sql);
     // GET ALBUMS INTO AN ARRAY
     $album_array = array();
     while ($album_info = $database->database_fetch_assoc($resource)) {
         // IF NO USER ID SPECIFIED, CREATE OBJECT FOR AUTHOR
         if (!$this->user_id) {
             $author = new se_user();
             $author->user_exists = TRUE;
             $author->user_info['user_id'] = $album_info['user_id'];
             $author->user_info['user_username'] = $album_info['user_username'];
             $author->user_info['user_fname'] = $album_info['user_fname'];
             $author->user_info['user_lname'] = $album_info['user_lname'];
             $author->user_info['user_photo'] = $album_info['user_photo'];
             $author->user_displayname();
         } elseif ($owner->user_exists && $owner->user_info['user_id'] == $album_info['album_user_id']) {
             $author =& $owner;
         } elseif ($user->user_exists && $user->user_info['user_id'] == $album_info['album_user_id']) {
             $author =& $user;
         }
         // CONVERT SPACE TO MB
         $album_space_mb = $album_info['total_space'] / 1024 / 1024;
         $album_space_mb = round($album_space_mb, 2);
         // GET PATH OF ALBUM COVER
         $album_cover_id = 0;
         $album_cover_ext = "";
         if ($album_info['album_cover']) {
             $album_cover_query = $database->database_query("SELECT media_id, media_ext FROM se_media WHERE media_id='{$album_info['album_cover']}' AND media_album_id='{$album_info['album_id']}' LIMIT 1");
             if ($database->database_num_rows($album_cover_query)) {
                 $album_cover_array = $database->database_fetch_assoc($album_cover_query);
                 $album_cover_id = $album_cover_array['media_id'];
                 $album_cover_ext = $album_cover_array['media_ext'];
             }
         }
         // CREATE ARRAY OF ALBUM DATA
         SE_Language::_preload(user_privacy_levels($album_info['album_privacy']));
         // SET OTHER INFO
         $album_info['album_author'] =& $author;
         $album_info['album_space'] = $album_space_mb;
         $album_info['album_privacy'] = user_privacy_levels($album_info['album_privacy']);
         $album_info['album_cover_id'] = $album_cover_id;
         $album_info['album_cover_ext'] = $album_cover_ext;
         $album_info['album_files'] = $album_info['total_files'];
         $album_array[] = $album_info;
         unset($author, $album_info);
     }
     // RETURN ARRAY
     return $album_array;
 }
    $field_info[field_suggestions] = $_POST['field_suggestions'];
    // SAVE FIELD
    $field_info = $field->field_save($field_info);
    // GET ERROR
    $is_error = $field->is_error;
    if ($field->is_error != 0) {
        SE_Language::_preload_multi($field->is_error);
        SE_Language::load();
        $error_message = str_replace("'", "\\'", SE_Language::_get($field->is_error));
    }
    // PULL OPTIONS INTO STRING
    $field_options_detailed = array();
    for ($i = 0; $i < count($field_info[field_options]); $i++) {
        SE_Language::_preload_multi($field_info[field_options][$i][label]);
        SE_Language::load();
        $field_info[field_options][$i][label] = SE_Language::_get($field_info[field_options][$i][label]);
        $field_options_detailed[] = $field_info[field_options][$i][value] . "<!>" . $field_info[field_options][$i][label] . "<!>" . $field_info[field_options][$i][dependency] . "<!>" . $field_info[field_options][$i][dependent_label] . "<!>" . $field_info[field_options][$i][dependent_id];
    }
    $field_options_detailed = implode("<~!~>", $field_options_detailed);
    // SEND AJAX CONFIRMATION
    echo "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><script type='text/javascript'>";
    echo "window.parent.savefield_result('{$is_error}', '{$error_message}', '{$old_field_id}', '{$field_info['field_id']}', '{$field_info['field_title']}', '{$field_info['field_cat_id']}', '{$field_options_detailed}');";
    echo "</script></head><body></body></html>";
    exit;
    // ADD A NEW FIELD BOX
} elseif ($task == "addfield") {
    $field->cat_list();
    $cat_array = $field->cats;
    $smarty->assign('hideSearch', $hideSearch);
    $smarty->assign('hideDisplay', $hideDisplay);
    $smarty->assign('hideSpecial', $hideSpecial);
}
// SET RESULT VARIABLES
$result = 0;
$is_error = 0;
// GET USER SETTINGS
$user->user_settings();
// GET NOTIFICATIONS
$notifytypes = array();
$notifytype_query = $database->database_query("SELECT notifytype_id, notifytype_title, notifytype_name FROM se_notifytypes");
while ($notifytype_info = $database->database_fetch_assoc($notifytype_query)) {
    // Ignore notify types that are missing a corresponding usersetting column
    $usersetting_notifytype = "usersetting_notify_" . $notifytype_info['notifytype_name'];
    if (!array_key_exists($usersetting_notifytype, $user->usersetting_info)) {
        continue;
    }
    SE_Language::_preload($notifytype_info['notifytype_title']);
    $notifytypes[] = $notifytype_info;
}
// SAVE ACCOUNT SETTINGS
if ($task == "dosave") {
    $user_email = $_POST['user_email'];
    $user_username = $_POST['user_username'];
    $user_timezone = $_POST['user_timezone'];
    $user_profilecat_id = $_POST['user_profilecat_id'];
    $notifications = $_POST['notifications'];
    // GET NOTIFICATIONS
    $usersettings = array();
    foreach ($notifytypes as $notifytype) {
        // Ignore notify types that are missing a corresponding usersetting column
        $usersetting_notifytype = "usersetting_notify_" . $notifytype['notifytype_name'];
        if (!array_key_exists($usersetting_notifytype, $user->usersetting_info)) {
            $user->user_delete();
            $total_users = $total_users - 1;
        }
    }
}
// LOOP OVER USER LEVELS
$levels = $database->database_query("SELECT level_id, level_name FROM se_levels ORDER BY level_name");
while ($level_info = $database->database_fetch_assoc($levels)) {
    $level_array[$level_info[level_id]] = $level_info;
}
// LOOP OVER SUBNETWORKS
$subnets = $database->database_query("SELECT subnet_id, subnet_name FROM se_subnets ORDER BY subnet_name");
$subnet_array[0] = array('subnet_id' => 0, 'subnet_name' => 152);
SE_Language::_preload(152);
while ($subnet_info = $database->database_fetch_assoc($subnets)) {
    SE_Language::_preload($subnet_info[subnet_name]);
    $subnet_array[$subnet_info[subnet_id]] = $subnet_info;
}
// PULL USERS INTO AN ARRAY
$users = $database->database_query($user_query);
while ($user_info = $database->database_fetch_assoc($users)) {
    $user = new se_user();
    $user->user_info[user_id] = $user_info[user_id];
    $user->user_info[user_username] = $user_info[user_username];
    $user->user_info[user_fname] = $user_info[user_fname];
    $user->user_info[user_lname] = $user_info[user_lname];
    $user->user_displayname();
    $user_info[user_displayname] = $user->user_displayname;
    $user_array[] = $user_info;
}
// ASSIGN VARIABLES AND SHOW VIEW USERS PAGE
function he_paging( $params = array() )
{
	$total = (int)$params['total'];
	$in_page = (int)$params['on_page'];
	$pages_count = (int)$params['pages'];

	$request_uri = $_SERVER['PHP_SELF'];
			
	if( !$total || !$in_page || !$pages_count)
	{
		return '';
	}
	
	if( ($total_pages = ceil($total / $in_page)) <= 1 )
	{
		return '';
	}
	
	$current = @$_GET['page'];
	$current = intval($current) ? $current : 1;
		
	$offset = ceil($pages_count / 2) - 1;
	$offset_inc = ($total_pages - $offset) - $current;
	$offset+= ($offset_inc <= 0) ? abs($offset_inc) + ( ($pages_count%2) ? 0 : 1 ) : 0;
		
	$page = ($current - $offset) > 1 ? ($current - $offset) : 1;
		
	$paging = '';
	
	for ( $counter = 1; $counter <= $pages_count && $page <= $total_pages; $counter++ )
	{
		$active = ($page == $current) ? 'class="active"' : '';
		$url = he_make_url($request_uri, array( 'page' => $page ));
		$paging .= "<a href='{$url}' {$active}>{$page}</a>";
		$page++;
	}
	
	switch ( $current )
	{
		case 1:
			$paging .= "<a href='" . he_make_url($request_uri, array( 'page' => $current+1 )) . "'>" . SE_Language::get(680680001) . "</a>";
			$paging .= "<a href='" . he_make_url($request_uri, array( 'page' => $total_pages)) . "'>" . SE_Language::get(680680002) . "</a>";
			break;
			
		case $total_pages:
			$paging = "<a href='" . he_make_url($request_uri, array( 'page' => $current-1 )) . "'>" . SE_Language::get(680680003) . "</a>" . $paging;
			$paging = "<a href='" . he_make_url($request_uri, array( 'page' => 1 )) . "'>" . SE_Language::get(680680004) . "</a>" . $paging;
			break;
			
		default:
			$paging = "<a href='" . he_make_url($request_uri, array( 'page' => $current-1 )) . "'>" . SE_Language::get(680680003) . "</a>" . $paging;
			$paging = "<a href='" . he_make_url($request_uri, array( 'page' => 1 )) . "'>" . SE_Language::get(680680004) . "</a>" . $paging;
			
			$paging .= "<a href='" . he_make_url($request_uri, array( 'page' => $current+1 )) . "'>" . SE_Language::get(680680001) . "</a>";
			$paging .= "<a href='" . he_make_url($request_uri, array( 'page' => $total_pages )). "'>" . SE_Language::get(680680002) . "</a>";
			break;
	}
	
	$out = '<div class="paging">';
	$out .= '<span>' . SE_Language::get(680680005) . ' </span>';
	$out .= $paging . '</div>';


	return $out;	
}
    $setting[setting_email_fromemail] = $_POST['setting_email_fromemail'];
    $subject = $_POST['subject'];
    $message = $_POST['message'];
    // SAVE SETTINGS
    $database->database_query("UPDATE se_settings SET setting_email_fromname='{$setting['setting_email_fromname']}', setting_email_fromemail='{$setting['setting_email_fromemail']}'");
    // GET EMAILS
    $email_query = $database->database_query("SELECT * FROM se_systememails ORDER BY systememail_id");
    while ($email = $database->database_fetch_assoc($email_query)) {
        $vars = explode(",", $email[systememail_vars]);
        $new_subject = $subject[$email[systememail_id]];
        $new_message = $message[$email[systememail_id]];
        for ($i = 0; $i < count($vars); $i++) {
            $new_subject = str_replace($vars[$i], "%" . ($i + 1) . "\$s", $new_subject);
            $new_message = str_replace($vars[$i], "%" . ($i + 1) . "\$s", $new_message);
        }
        SE_Language::edit($email[systememail_subject], $new_subject);
        SE_Language::edit($email[systememail_body], str_replace("\r\n", "<br>", $new_message));
    }
    $result = 1;
}
// GET EMAILS
$email_query = $database->database_query("SELECT * FROM se_systememails ORDER BY systememail_id");
while ($email = $database->database_fetch_assoc($email_query)) {
    SE_Language::_preload_multi($email[systememail_title], $email[systememail_desc], $email[systememail_subject], $email[systememail_body]);
    $email[systememail_vars_array] = explode(",", $email[systememail_vars]);
    $email_array[] = $email;
}
// ASSIGN VARIABLES AND SHOW GENERAL SETTINGS PAGE
$smarty->assign('result', $result);
$smarty->assign('emails', $email_array);
include "admin_footer.php";
Exemple #30
0
    }
    $level_menu[] = $new_level_menu;
    $plugin_info['plugin_pages_level'] = $new_level_menu;
    // GET MAIN PAGES
    $plugin_pages_main = explode("<~!~>", $plugin_info['plugin_pages_main']);
    $main_pages = array();
    for ($l = 0; $l < count($plugin_pages_main); $l++) {
        $plugin_page = explode("<!>", $plugin_pages_main[$l]);
        if ($plugin_page[0] != "" && $plugin_page[2] != "") {
            SE_Language::_preload($plugin_page[0]);
            $main_pages[] = array('title' => $plugin_page[0], 'icon' => $plugin_page[1], 'file' => $plugin_page[2]);
        }
    }
    $plugin_info['plugin_pages_main'] = $main_pages;
    // SET GLOBAL PLUGIN ARRAY
    SE_Language::_preload($plugin_info['plugin_menu_title']);
    $global_plugins[$plugin_info['plugin_type']] = $plugin_info;
    unset($plugin_vars);
}
// BACKWARDS COMPATIBILITY FOR THE $global_plugin CHANGE
if (strpos($page, 'admin_level') !== FALSE) {
    $global_plugins = array_values($global_plugins);
    // Flush level settings
    $level_id = !empty($_POST['level_id']) ? $_POST['level_id'] : (!empty($_GET['level_id']) ? $_GET['level_id'] : NULL);
    if (is_object($cache_object) && $level_id && ($_GET['task'] == "dosave" || $_POST['task'] == "dosave")) {
        $cache_object->remove('site_level_settings_' . $level_id);
    }
}
// Nasty code to flush site settings
if ((!empty($_GET['task']) || !empty($_POST['task'])) && is_object($cache_object)) {
    $cache_object->remove('site_settings');