Esempio n. 1
0
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;
}
Esempio n. 2
0
    $p = $_GET['p'];
} else {
    $p = 1;
}
// SET VARS
$media_per_page = 20;
// CHECK PRIVACY
$privacy_max = $owner->user_privacy_max($user);
if (!($owner->user_info['user_privacy'] & $privacy_max)) {
    header("Location: " . $url->url_create('profile', $owner->user_info['user_username']));
    exit;
}
// START QUERY
$photo_query = "";
// CALL TAG HOOK
($hook = SE_Hook::exists('se_mediatag')) ? SE_Hook::call($hook, array()) : NULL;
// GET TOTAL PHOTOS
$total_files = $database->database_num_rows($database->database_query($photo_query));
// ADD TO PHOTO QUERY
$photo_query .= " ORDER BY mediatag_date DESC";
// MAKE MEDIA PAGES
$page_vars = make_page($total_files, $media_per_page, $p);
// RUN TAG QUERY
$media = $database->database_query($photo_query);
// GET MEDIA INTO AN ARRAY
$file_array = array();
while ($media_info = $database->database_fetch_assoc($media)) {
    // CREATE OBJECT FOR AUTHOR, IF EXISTS
    if ($media_info['user_id'] != '0') {
        $author = new se_user();
        $author->user_exists = 1;
Esempio n. 3
0
$total_results = 0;
$is_results = 0;
$object_count = 0;
$search_objects = array();
$is_next_page = 0;
if ($p < 1) {
    $p = 1;
}
// DO SEARCH
if ($task == "dosearch" && $search_text != "") {
    // START SEARCH TIMER
    $start_timer = getmicrotime();
    // SEARCH PROFILES
    search_profile();
    // CALL SEARCH HOOK
    ($hook = SE_Hook::exists('se_search_do')) ? SE_Hook::call($hook, array()) : NULL;
    // GET GRAND TOTAL RESULTS
    for ($r = 0; $r < count($search_objects); $r++) {
        if ($search_objects[$r][search_total] != 0) {
            if ($total_results == 0) {
                header("Location: search.php?task=dosearch&search_text=" . urlencode($search_text) . "&t=" . $search_objects[$r]['search_type']);
                exit;
            }
            $is_results = 1;
        }
    }
    // END TIMER
    $end_timer = getmicrotime();
    $search_time = round($end_timer - $start_timer, 3);
    // CHECK TO SEE IF THERE IS A "NEXT PAGE"
    if (count($results) > $results_per_page) {
Esempio n. 4
0
        }
        $login_secure = $_POST['login_secure'];
        if ($login_secure != $code) {
            $user->is_error = 708;
        }
    }
    if (!$user->is_error) {
        $user->user_login($email, $_POST['password'], $_POST['javascript_disabled'], $_POST['persistent']);
    }
    // IF USER IS LOGGED IN SUCCESSFULLY, FORWARD THEM TO SPECIFIED URL
    if (!$user->is_error) {
        $failed_login_count = $_SESSION['failed_login_count'] = 0;
        // INSERT ACTION
        $actions->actions_add($user, "login", array($user->user_info['user_username'], $user->user_displayname), array(), 0, false, "user", $user->user_info['user_id'], $user->user_info['user_privacy']);
        // CALL LOGIN HOOK
        ($hook = SE_Hook::exists('se_login_success')) ? SE_Hook::call($hook, array()) : NULL;
        cheader("{$return_url}");
        exit;
    } else {
        $failed_login_count = ++$_SESSION['failed_login_count'];
        $is_error = $user->is_error;
        $user = new se_user();
    }
}
// SET GLOBAL PAGE TITLE
$global_page_title[0] = 658;
$global_page_description[0] = 673;
// ASSIGN VARIABLES AND INCLUDE FOOTER
$smarty->assign('email', $email);
$smarty->assign('is_error', $is_error);
$smarty->assign('return_url', $return_url);
Esempio n. 5
0
 function album_delete($album_id)
 {
     global $database, $url;
     $media = $database->database_query("SELECT media_id, media_ext FROM se_media WHERE media_album_id='{$album_id}'");
     // LOOP OVER MEDIA
     while ($media_info = $database->database_fetch_assoc($media)) {
         $media_path = $url->url_userdir($this->user_id) . $media_info[media_id] . "." . $media_info[media_ext];
         if (file_exists($media_path)) {
             unlink($media_path);
         }
         $thumb_path = $url->url_userdir($this->user_id) . $media_info[media_id] . "_thumb." . $media_info[media_ext];
         if (file_exists($thumb_path)) {
             unlink($thumb_path);
         }
     }
     $database->database_query("DELETE FROM se_albums, se_media, se_mediacomments, se_mediatags USING se_albums LEFT JOIN se_media ON se_albums.album_id=se_media.media_album_id LEFT JOIN se_mediacomments ON se_media.media_id=se_mediacomments.mediacomment_media_id LEFT JOIN se_mediatags ON se_media.media_id=se_mediatags.mediatag_media_id WHERE se_albums.album_id='{$album_id}'");
     // CALL ALBUM CREATION HOOK
     ($hook = SE_Hook::exists('se_album_delete')) ? SE_Hook::call($hook, array()) : NULL;
 }
Esempio n. 6
0
    $admin_notifications[] = 1315;
}
$file_version_arr = explode('.', $version);
$file_version = array_shift($file_version_arr) . '.' . join('', $file_version_arr);
$database_version_arr = explode('.', $setting['setting_version']);
$database_version = array_shift($database_version_arr) . '.' . join('', $database_version_arr);
if ($file_version != $database_version) {
    $admin_notifications[] = sprintf(SELanguage::get(1320), $file_version, $database_version);
}
foreach ($sanity->tests as $sanity_test) {
    if ($sanity_test->result || $sanity_test->is_recommendation) {
        continue;
    }
    $admin_notifications[] = $sanity_test->getCategory() . ': ' . $sanity_test->getTitle() . ': ' . $sanity_test->getMessage();
}
($hook = SE_Hook::exists('se_admin_notifications')) ? SE_Hook::call($hook, array()) : NULL;
// ASSIGN VARIABLES AND SHOW ADMIN HOME PAGE
$smarty->assign('admin_notifications', $admin_notifications);
$smarty->assign('task', $task);
$smarty->assign('total_users_num', $total_users['total_users']);
$smarty->assign('total_messages_num', $total_messages['total_messages']);
$smarty->assign('total_comments_num', $total_comments);
$smarty->assign('total_user_levels', $total_user_levels['total_user_levels']);
$smarty->assign('total_subnetworks', $total_subnetworks['total_subnetworks']);
$smarty->assign('total_reports', $total_reports['total_reports']);
$smarty->assign('total_friendships', $total_friendships['total_friendships']);
$smarty->assign('total_announcements', $total_announcements['total_announcements']);
$smarty->assign('total_admins', $total_admins['total_admins']);
$smarty->assign('online_users', online_users());
$smarty->assign('signups_today', $signups_today);
$smarty->assign('logins_today', $logins_today);
Esempio n. 7
0
    $new_user->user_photo_upload("photo");
    $is_error = $new_user->is_error;
    $task = "step3";
}
// SEND INVITE EMAILS
if ($task == "step4do") {
    $invite_emails = $_POST['invite_emails'];
    $invite_message = $_POST['invite_message'];
    if ($invite_emails != "") {
        send_systememail('invite', $invite_emails, array($new_user->user_displayname, $new_user->user_info['user_email'], $invite_message, "<a href=\"" . $url->url_base . "signupon13.php\">" . $url->url_base . "signupon13.php</a>"), TRUE);
    }
    // SEND USER TO THANK YOU PAGE
    $task = "step5";
}
// SIGNUP TERMINAL VELOCITY POINT HOOK
($hook = SE_Hook::exists('se_signup_decide')) ? SE_Hook::call($hook, array()) : NULL;
// SHOW COMPLETION PAGE
if ($task == "step5") {
    // UNSET SIGNUP COOKIES
    setcookie("signup_id", "", 0, "/");
    setcookie("signup_email", "", 0, "/");
    setcookie("signup_password", "", 0, "/");
    // UPDATE SIGNUP STATS
    update_stats("signups");
    // DISPLAY THANK YOU
    $step = 5;
}
// SHOW FOURTH STEP
if ($task == "step4") {
    $step = 4;
    $next_task = "step4do";
Esempio n. 8
0
    $global_plugins[$plugin_info['plugin_type']] =& $plugin_vars;
    if (!empty($plugin_vars['menu_user'])) {
        $show_menu_user = TRUE;
    }
    unset($plugin_vars);
}
$global_plugins['plugin_controls'] = array('show_menu_user' => $show_menu_user);
SE_DEBUG ? $_benchmark->end('plugins') : NULL;
SE_DEBUG ? $_benchmark->start('page') : NULL;
// CHECK TO SEE IF SITE IS ONLINE OR NOT, ADMIN NOT LOGGED IN, DISPLAY OFFLINE PAGE
if (!$setting['setting_online'] && !$admin->admin_exists) {
    $page = "offline";
    include "footer.php";
}
// CALL HEADER HOOK
($hook = SE_Hook::exists('se_header')) ? SE_Hook::call($hook, array()) : NULL;
// CHECK IF LOGGED-IN USER IS ON OWNER'S BLOCKLIST
if ($user->user_exists && $owner->user_exists && $owner->user_blocked($user->user_info['user_id'])) {
    // ASSIGN VARIABLES AND DISPLAY ERROR PAGE
    $page = "error";
    $smarty->assign('error_header', 639);
    $smarty->assign('error_message', 640);
    $smarty->assign('error_submit', 641);
    include "footer.php";
}
// CHECK TO SEE IF USER HAS BEEN BLOCKED BY IP
if (check_ip_in_banned_list($_SERVER['REMOTE_ADDR'], $setting['setting_banned_ips'])) {
    // LOGOUT IF LOGGED IN
    if ($user->user_exists) {
        $user->user_logout();
    }
Esempio n. 9
0
 function user_delete()
 {
     global $database, $url, $global_plugins;
     // CALL USER DELETE HOOK
     ($hook = SE_Hook::exists('se_user_delete')) ? SE_Hook::call($hook, $this->user_info['user_id']) : NULL;
     // DELETE USER, USERSETTING, PROFILE, STYLES TABLE ROWS
     $database->database_query("DELETE FROM se_users WHERE user_id='{$this->user_info['user_id']}' LIMIT 1");
     $database->database_query("DELETE FROM se_usersettings WHERE usersetting_user_id='{$this->user_info['user_id']}' LIMIT 1");
     $database->database_query("DELETE FROM se_profilevalues WHERE profilevalue_user_id='{$this->user_info['user_id']}' LIMIT 1");
     $database->database_query("DELETE FROM se_profilestyles WHERE profilestyle_user_id='{$this->user_info['user_id']}' LIMIT 1");
     // DELETE USER-OWNED AND PROFILE COMMENTS
     $database->database_query("DELETE FROM se_profilecomments WHERE profilecomment_user_id='{$this->user_info['user_id']}'");
     // DELETE NOTIFICATIONS SENT TO OTHER USERS FOR A PM THEY SENT
     $database->database_query("DELETE se_notifys.* FROM se_pmconvoops LEFT JOIN se_notifys ON se_notifys.notify_object_id=se_pmconvoops.pmconvoop_pmconvo_id WHERE se_notifys.notify_notifytype_id=2 && se_pmconvoops.pmconvoop_user_id='{$this->user_info['user_id']}'");
     // DELETE PMCONVOS AND PMS WHERE THE DELETED USER AND THE OTHER USER ARE THE ONLY TWO INSIDE, OR WHERE THE DELETED USER WAS THE INITIAL SENDER
     $database->database_query("UPDATE se_pmconvos LEFT JOIN se_pmconvoops ON pmconvoop_pmconvo_id=pmconvo_id SET pmconvo_recipients=pmconvo_recipients-1 WHERE pmconvoop_user_id='{$this->user_info['user_id']}'");
     $database->database_query("UPDATE se_pmconvos LEFT JOIN se_pmconvoops ON pmconvoop_pmconvo_id=pmconvo_id SET pmconvo_recipients=0 WHERE pmconvoop_user_id='{$this->user_info['user_id']}' && pmconvoop_user_id=(SELECT pm_authoruser_id FROM se_pms WHERE pm_pmconvo_id=pmconvo_id ORDER BY pm_id ASC)");
     $database->database_query("DELETE FROM se_pmconvoops WHERE pmconvoop_user_id='{$this->user_info['user_id']}'");
     // THIS MAY ALSO DELETE OTHER CONVOS THAT WERE PARTIALLY REMOVED
     $database->database_query("DELETE se_pms.*, se_pmconvos.*, se_pmconvoops.* FROM se_pmconvos LEFT JOIN se_pms ON pm_pmconvo_id=pmconvo_id LEFT JOIN se_pmconvoops ON pmconvoop_pmconvo_id=pmconvo_id WHERE pmconvo_recipients<2");
     // DELETE CONNECTIONS TO AND FROM USER
     $database->database_query("DELETE FROM se_friends, se_friendexplains USING se_friends LEFT JOIN se_friendexplains ON se_friends.friend_id=se_friendexplains.friendexplain_friend_id WHERE se_friends.friend_user_id1='{$this->user_info['user_id']}' OR se_friends.friend_user_id2='{$this->user_info['user_id']}'");
     // DELETE ALL OF THIS USER'S REPORTS
     $database->database_query("DELETE FROM se_reports WHERE report_user_id='{$this->user_info['user_id']}'");
     // DELETE USER ACTIONS
     $database->database_query("DELETE FROM se_actions, se_actionmedia USING se_actions LEFT JOIN se_actionmedia ON se_actions.action_id=se_actionmedia.actionmedia_action_id WHERE action_user_id='{$this->user_info['user_id']}'");
     // DELETE USER NOTIFICATIONS
     $database->database_query("DELETE FROM se_notifys WHERE notify_user_id='{$this->user_info['user_id']}'");
     // DELETE NOTIFICATIONS BY USER
     $database->database_query("DELETE FROM se_notifys WHERE notify_notifytype_id=1 AND notify_object_id='{$this->user_info['user_id']}'");
     // DELETE USER'S FILES
     if (is_dir($url->url_userdir($this->user_info['user_id']))) {
         $dir = $url->url_userdir($this->user_info['user_id']);
     } else {
         $dir = "." . $url->url_userdir($this->user_info['user_id']);
     }
     if ($dh = @opendir($dir)) {
         while (($file = @readdir($dh)) !== false) {
             if ($file != "." && $file != "..") {
                 @unlink($dir . $file);
             }
         }
         @closedir($dh);
     }
     @rmdir($dir);
     $this->user_clear();
 }
Esempio n. 10
0
 function actions_display($visibility = 0, $actionsperuser, $where = "", $last_action_id = false, $first_action_id = false)
 {
     global $database, $user, $owner, $setting;
     $actions_array = array();
     // CACHING
     $cache_object = SECache::getInstance('serial');
     $user_id = $user->user_exists ? $user->user_info['user_id'] : 0;
     $user_subnet_id = $user->user_exists ? $user->user_info['user_subnet_id'] : 0;
     $where_md5 = $where ? '_' . md5($where) : '';
     $cache_id = 'he_actions_' . $visibility . '_' . (int) $last_action_id . '_' . (int) $first_action_id . '_' . $user_id . $where_md5;
     if (is_object($cache_object)) {
         $actions_array = $cache_object->get($cache_id);
     }
     // GET ACTIONS
     if (empty($actions_array)) {
         // GET CURRENT DATE
         $nowdate = time();
         // BEGIN BUILDING QUERY
         $actions_query = "SELECT se_actions.*, se_actiontypes.actiontype_icon, se_actiontypes.actiontype_text, \r\n                se_actiontypes.actiontype_media FROM se_actions \r\n                LEFT JOIN se_actiontypes ON se_actions.action_actiontype_id=se_actiontypes.actiontype_id";
         // GET USER PREFERENCES, IF USER LOGGED IN
         $user_pref_where = "";
         if ($setting['setting_actions_preference'] == 1 && $user->user_exists) {
             if (empty($user->usersetting_info)) {
                 $user->user_settings();
             }
             $usersetting_actions_display = join(',', array_filter(explode(',', $user->usersetting_info['usersetting_actions_display'])));
             $user_pref_where = " se_actiontypes.actiontype_id IN ({$usersetting_actions_display}) AND";
         }
         switch ($visibility) {
             // ALL ACTIONS, NO USER PREFS
             case 0:
                 $actions_query .= " WHERE";
                 break;
             case 10:
                 $actions_query .= " WHERE {$user_pref_where}";
                 break;
                 // ALL REGISTERED USERS, EXCLUDING LOGGED IN USER
             // ALL REGISTERED USERS, EXCLUDING LOGGED IN USER
             case 1:
                 $actions_query .= " WHERE se_actions.action_user_id<>'{$user_id}' AND";
                 $actions_query .= $user_pref_where;
                 break;
                 // ONLY MY FRIENDS AND EVERYONE IN MY SUBNET, EXCLUDING LOGGED IN USER
             // ONLY MY FRIENDS AND EVERYONE IN MY SUBNET, EXCLUDING LOGGED IN USER
             case 2:
                 $actions_query .= " LEFT JOIN se_friends ON se_friends.friend_user_id2=se_actions.action_user_id \r\n                        AND se_friends.friend_user_id1='{$user_id}' AND se_friends.friend_status='1'";
                 $actions_query .= " LEFT JOIN se_users ON se_users.user_id=se_actions.action_user_id";
                 $actions_query .= " WHERE se_actions.action_user_id<>'{$user_id}' AND";
                 $actions_query .= " (se_friends.friend_id <> 'NULL' OR se_users.user_subnet_id='{$user_subnet_id}') AND";
                 $actions_query .= $user_pref_where;
                 break;
                 // ONLY MY FRIENDS, EXCLUDING LOGGED IN USER
             // ONLY MY FRIENDS, EXCLUDING LOGGED IN USER
             case 4:
                 $actions_query .= " RIGHT JOIN se_friends ON se_friends.friend_user_id2=se_actions.action_user_id \r\n                        AND se_friends.friend_user_id1='{$user_id}' AND se_friends.friend_status='1'";
                 $actions_query .= " WHERE se_actions.action_user_id<>'{$user_id}' AND";
                 $actions_query .= $user_pref_where;
                 break;
         }
         // CHECK PRIVACY
         $actions_query .= "\r\n              CASE \r\n                WHEN se_actions.action_object_owner='user' THEN\r\n                  CASE\r\n                    WHEN se_actions.action_user_id='{$user_id}'\r\n                      THEN TRUE\r\n                    WHEN ((se_actions.action_object_privacy & @SE_PRIVACY_REGISTERED) AND '{$user->user_exists}'<>0)\r\n                      THEN TRUE\r\n                    WHEN ((se_actions.action_object_privacy & @SE_PRIVACY_ANONYMOUS) AND '{$user->user_exists}'=0)\r\n                      THEN TRUE\r\n                    WHEN ((se_actions.action_object_privacy & @SE_PRIVACY_SELF) AND se_actions.action_object_owner_id='{$user_id}')\r\n                      THEN TRUE\r\n                    WHEN ((se_actions.action_object_privacy & @SE_PRIVACY_FRIEND) AND (SELECT TRUE FROM se_friends \r\n                         WHERE friend_user_id1=se_actions.action_object_owner_id AND friend_user_id2='{$user_id}' AND friend_status='1' LIMIT 1))\r\n                      THEN TRUE\r\n                    WHEN ((se_actions.action_object_privacy & @SE_PRIVACY_SUBNET) AND '{$user->user_exists}'<>0 \r\n                         AND (SELECT TRUE FROM se_users WHERE user_id=se_actions.action_object_owner_id AND user_subnet_id='{$user_subnet_id}' LIMIT 1))\r\n                      THEN TRUE\r\n                    WHEN ((se_actions.action_object_privacy & @SE_PRIVACY_FRIEND2) AND \r\n                          (SELECT TRUE FROM se_friends AS friends_primary \r\n                             LEFT JOIN se_users ON friends_primary.friend_user_id1=se_users.user_id \r\n                             LEFT JOIN se_friends AS friends_secondary ON friends_primary.friend_user_id2=friends_secondary.friend_user_id1 \r\n                             WHERE friends_primary.friend_user_id1=se_actions.action_object_owner_id \r\n                             AND friends_secondary.friend_user_id2='{$user_id}' AND se_users.user_subnet_id='{$user_subnet_id}' LIMIT 1\r\n                          ))\r\n                      THEN TRUE\r\n                    ELSE FALSE\r\n                END\r\n            ";
         // CALL HOOK
         ($hook = SE_Hook::exists('se_action_privacy')) ? SE_Hook::call($hook, array('actions_query' => &$actions_query)) : NULL;
         // RESUME CASE STATEMENT
         $actions_query .= "\r\n                ELSE TRUE\r\n                END AND\r\n            ";
         // ADD WHERE CLAUSE IF NECESSARY
         if ($where != "") {
             $actions_query .= " ({$where}) AND";
         }
         // LIMIT RESULTS TO TIME PERIOD SPECIFIED BY ADMIN
         $actions_query .= " se_actions.action_date > " . ($nowdate - $setting['setting_actions_showlength']);
         $actions_query .= $last_action_id ? " AND se_actions.action_id < " . $last_action_id : '';
         $actions_query .= $first_action_id ? " AND se_actions.action_id > " . $first_action_id : '';
         // ORDER BY ACTION ID DESCENDING
         $actions_query .= " ORDER BY action_id DESC";
         $limit = $setting['setting_he_wall_actions_per_page'];
         // LIMIT RESULTS TO MAX NUMBER SPECIFIED BY ADMIN
         $actions_query .= " LIMIT {$limit}";
         // GET RECENT ACTIVITY FEED
         $actions = $database->database_query($actions_query);
         $actions_array = array();
         $actions_users_array = array();
         while ($action = $database->database_fetch_assoc($actions)) {
             // ONLY DISPLAY THIS ACTION IF MAX OCCURRANCES PER USER HAS NOT YET BEEN REACHED
             $actions_users_array[] = $action['action_user_id'];
             $occurrances = array_count_values($actions_users_array);
             if ($occurrances[$action['action_user_id']] <= $actionsperuser) {
                 // UNSERIALIZE VARIABLES
                 // NOTE: I don't like mb_unserialize: it ignores the strlen param. But it works...
                 if (($action_vars = unserialize($action['action_text'])) === FALSE) {
                     $action_vars = mb_unserialize($action['action_text']);
                 }
                 // REGISTER PRELOADED TEXT
                 SE_Language::_preload($action['actiontype_text']);
                 // RETRIEVE MEDIA IF NECESSARY
                 $action_media = false;
                 if ($action['actiontype_media']) {
                     $action_media = array();
                     $media = $database->database_query("SELECT * FROM se_actionmedia WHERE actionmedia_action_id='{$action['action_id']}'");
                     while ($media_info = $database->database_fetch_assoc($media)) {
                         $action_media[] = $media_info;
                     }
                 }
                 // ADD THIS ACTION TO OUTPUT ARRAY
                 $actions_array[] = array('action_id' => $action['action_id'], 'action_date' => $action['action_date'], 'action_text' => $action['actiontype_text'], 'action_vars' => $action_vars, 'action_user_id' => $action['action_user_id'], 'action_icon' => $action['actiontype_icon'], 'action_media' => $action_media);
             }
         }
         // CACHE
         if (is_object($cache_object)) {
             $cache_object->store($actions_array, $cache_id);
         }
     }
     // Process actions (load language)
     foreach ($actions_array as $action) {
         SE_Language::_preload($action['action_text']);
     }
     // RETURN LIST OF ACTIONS
     return $actions_array;
 }
     // GET MAX ORDER
     $max = $database->database_fetch_assoc($database->database_query("SELECT max(album_order) AS max FROM se_albums WHERE album_user_id='{$user->user_info['user_id']}'"));
     $album_order = $max[max] + 1;
     // INSERT NEW ALBUM INTO DATABASE
     $database->database_query("\r\n      INSERT INTO se_albums (\r\n\t\t\t\talbum_user_id,\r\n\t\t\t\talbum_datecreated,\r\n\t\t\t\talbum_dateupdated,\r\n\t\t\t\talbum_title, \r\n\t\t\t\talbum_desc, \r\n\t\t\t\talbum_search,\r\n\t\t\t\talbum_privacy,\r\n\t\t\t\talbum_comments,\r\n\t\t\t\talbum_tag,\r\n\t\t\t\talbum_order\r\n      ) VALUES (\r\n\t\t\t\t'{$user->user_info['user_id']}',\r\n\t\t\t\t'{$album_datecreated}',\r\n\t\t\t\t'{$album_datecreated}',\r\n\t\t\t\t'{$album_title}',\r\n\t\t\t\t'{$album_desc}',\r\n\t\t\t\t'{$album_search}',\r\n\t\t\t\t'{$album_privacy}',\r\n\t\t\t\t'{$album_comments}',\r\n\t\t\t\t'{$album_tag}',\r\n\t\t\t\t'{$album_order}'\r\n      )\r\n    ") or die($database->database_error());
     $album_id = $database->database_insert_id();
     // UPDATE LAST UPDATE DATE (SAY THAT 10 TIMES FAST)
     $user->user_lastupdate();
     // INSERT ACTION
     if (strlen($album_title) > 100) {
         $album_title = substr($album_title, 0, 97);
         $album_title .= "...";
     }
     $actions->actions_add($user, "newalbum", array($user->user_info[user_username], $user->user_displayname, $album_id, $album_title), array(), 0, FALSE, "user", $user->user_info[user_id], $album_privacy);
     // CALL ALBUM CREATION HOOK
     ($hook = SE_Hook::exists('se_album_create')) ? SE_Hook::call($hook, array()) : NULL;
 }
 // BE SURE ALBUM BELONGS TO THIS USER
 $resource = $database->database_query("SELECT * FROM se_albums WHERE album_id='{$album_id}' AND album_user_id='" . $user->user_info['user_id'] . "'");
 if (!$database->database_num_rows($resource)) {
     header("Location: user_album.php");
     exit;
 }
 $album_info = $database->database_fetch_assoc($resource);
 // GET TOTAL SPACE USED
 $space_used = $album->album_space();
 if ($user->level_info[level_album_storage]) {
     $space_left = $user->level_info[level_album_storage] - $space_used;
 } else {
     $space_left = $dfs = disk_free_space("/") ? $dfs : pow(2, 32);
 }