コード例 #1
0
     $messages = array_reverse($messages);
 } else {
     $messages = $msg->getNewMessages($current_user->id);
 }
 if (!empty($messages)) {
     $msg_array = array();
     foreach ($messages as $message_data) {
         $last_message_id = $last_message_id < $message_data['id'] ? $message_data['id'] : $last_message_id;
         $msg_parts = explode('/', $message_data['body']);
         if ($message_data['type'] == '4001') {
             // Abuse
             if ($message_data['target_user_id'] == $session->_s_user_id) {
                 $abuse_msg_parts = explode('/', $message_data['body'], 5);
                 if ($room->_db_getList('name', 'id = ' . $abuse_msg_parts[1], 1)) {
                     $room_name = $room->_db_list[0]['name'];
                     $room->_db_freeList();
                 } else {
                     $room_name = '-';
                 }
                 switch ($abuse_msg_parts[2]) {
                     case '1':
                         $abuse_category = $l->g('spam');
                         break;
                     case '2':
                         $abuse_category = $l->g('insult');
                         break;
                     case '3':
                         $abuse_category = $l->g('adult_content');
                         break;
                     case '4':
                         $abuse_category = $l->g('illegal_content');
コード例 #2
0
 /**
  * "Kill" timed out sessions, set "Away" online status for sessions with ping older than (updater_interval+N) seconds
  */
 function _s_cleanUp()
 {
     // Store current state
     $this_vars = $this->_db_getFromObject();
     // Get sessions
     $sessions = array();
     $query = $this->_db_makeQuery(2100, date('Y-m-d H:i:s', time() - 1800), date('Y-m-d H:i:s', time() - $this->_conf_all['session_timeout']), date('Y-m-d H:i:s', time() - 5));
     $result = $this->_db_query($query);
     while ($data = $this->_db_fetch($result, MYSQL_ASSOC)) {
         $sessions[] = $data;
     }
     $this->_db_freeResult($result);
     $this->_db_freeList();
     if (!empty($sessions)) {
         _pcpin_loadClass('session');
         $session = new PCPIN_Session($this, '', true);
         foreach ($sessions as $sessiondata) {
             $session->_db_setObject($sessiondata);
             $session->_s_logOut();
         }
     }
     // Delete old messages
     if (!empty($this->_conf_all['message_lifetime'])) {
         _pcpin_loadClass('message');
         $message = new PCPIN_Message($this);
         $message->deleteMessages(null, time() - $this->_conf_all['message_lifetime']);
     }
     // Unmute users
     _pcpin_loadClass('user');
     $user = new PCPIN_User($this);
     if ($user->_db_getList('id', 'global_muted_until > 0000-00-00 00:00:00', 'global_muted_until < ' . date('Y-m-d H:i:s'))) {
         $user_ids = $user->_db_list;
         $user->_db_freeList();
         foreach ($user_ids as $data) {
             // Unmute user
             $user->globalMuteUnmute($data['id'], 0);
         }
         // Add system messages
         _pcpin_loadClass('message');
         $message = new PCPIN_Message($this);
         foreach ($user_ids as $data) {
             if ($this->_db_getList('_s_room_id', '_s_user_id = ' . $data['id'], 1)) {
                 $message->addMessage(10111, 'n', 0, '', 0, 0, $data['id'] . '/0', date('Y-m-d H:i:s'), 0, '');
             }
         }
     }
     // Clean unbanned users
     if ($result = $this->_db_query($this->_db_makeQuery(2080, date('Y-m-d H:i:s')))) {
         $this->_db_freeResult($result);
     }
     // Clean not activated email addresses
     if (!empty($this->_conf_all['activate_new_emails'])) {
         _pcpin_loadClass('user');
         $user = new PCPIN_User($this);
         if ($user->_db_getList('id', 'email_new != ', 'email_new_date < ' . date('Y-m-d H:i:s', time() - 3600 * $this->_conf_all['new_email_activation_timeout']))) {
             $user_ids = $user->_db_list;
             $user->_db_freeList();
             foreach ($user_ids as $data) {
                 $user->_db_updateRow($data['id'], 'id', array('email_new' => '', 'email_new_date' => '', 'email_new_activation_code' => ''));
             }
         }
     }
     // Delete idle and/or not activated user accounts
     if (!PCPIN_SLAVE_MODE && $this->_conf_all['activate_new_accounts'] == 1 || !empty($this->_conf_all['account_pruning'])) {
         _pcpin_loadClass('user');
         $user = new PCPIN_User($this);
         $query = $this->_db_makeQuery(2060, $this->_conf_all['activate_new_accounts'] == 1 ? date('Y-m-d H:i:s', time() - 3600 * $this->_conf_all['new_account_activation_timeout']) : '', !empty($this->_conf_all['account_pruning']) ? date('Y-m-d H:i:s', time() - $this->_conf_all['account_pruning'] * 86400) : '');
         $user_ids = array();
         if ($result = $this->_db_query($query)) {
             while ($data = $this->_db_fetch($result, MYSQL_ASSOC)) {
                 $user_ids[] = $data['id'];
             }
             $this->_db_freeResult($result);
         }
         if (!empty($user_ids)) {
             foreach ($user_ids as $id) {
                 $user->deleteUser($id);
             }
         }
     }
     // Delete empty and timed out user rooms
     _pcpin_loadClass('room');
     $room = new PCPIN_Room($this);
     if ($room->_db_getList('id', 'type = u', 'users_count <= 0', 'last_ping < ' . date('Y-m-d H:i:s', time() - $this->_conf_all['empty_userroom_lifetime']))) {
         $rooms = $room->_db_list;
         $room->_db_freeList();
         foreach ($rooms as $data) {
             $room->deleteRoom($data['id']);
         }
         // Add system message
         _pcpin_loadClass('message');
         $message = new PCPIN_Message($this);
         $message->addMessage(1100, 'n', 0, '', 0, 0, '-', date('Y-m-d H:i:s'), 0, '');
     }
     // Delete old logs
     if (!empty($this->_conf_all['logging_period'])) {
         _pcpin_loadClass('message_log');
         $message_log = new PCPIN_Message_Log($this);
         $message_log->cleanUp();
     }
     // Restore current state
     $this->_db_setObject($this_vars);
 }
コード例 #3
0
 /**
  * Delete category and all contained rooms
  * @param   int   $id   Category ID
  * @return  boolean TRUE on success or FALSE on error
  */
 function deleteCategory($id = 0)
 {
     $result = false;
     if (!empty($id) && $this->_db_getList('id = ' . $id, 1)) {
         // Are there rooms in this category?
         _pcpin_loadClass('room');
         $room = new PCPIN_Room($this);
         if ($room->_db_getList('id', 'category_id = ' . $id)) {
             // Delete category rooms
             $rooms = $room->_db_list;
             $room->_db_freeList();
             foreach ($rooms as $room_data) {
                 $room->deleteRoom($room_data['id']);
             }
         }
         // Update "moderated_categories" field by category moderators
         $moderators = $this->getModerators($id);
         if (!empty($moderators)) {
             _pcpin_loadClass('user');
             $user = new PCPIN_User($this);
             foreach ($moderators as $data) {
                 $user->_db_updateRow($data['id'], 'id', array('moderated_categories' => trim(str_replace(',' . $id . ',', ',', ',' . $data['moderated_categories'] . ','), ',')));
             }
         }
         // Delete category
         $this->_db_deleteRow($id);
     }
     return $result;
 }
コード例 #4
0
    }
    if (empty($_pcpin_data['is_guest'])) {
        $_pcpin_registered_users_count++;
        $_pcpin_registered_users[] = htmlspecialchars($_pcpin_data['nickname_plain']);
        $_pcpin_registered_users_colored[] = $_pcpin_nickname->coloredToHTML($_pcpin_data['nickname']);
    }
}
unset($_pcpin_memberlist);
unset($_pcpin_user);
unset($_pcpin_nickname);
// Get rooms
$_pcpin_rooms_count = $_pcpin_room->_db_getList('name', 'name ASC');
foreach ($_pcpin_room->_db_list as $_pcpin_data) {
    $_pcpin_rooms[] = htmlspecialchars($_pcpin_data['name']);
}
$_pcpin_room->_db_freeList();
unset($_pcpin_room);
// Close database connection
$_pcpin_init_session->_db_close();
// Delete session handler
unset($_pcpin_init_session);
// Restore original error reporting settings
error_reporting($_pcpin_old_error_reporting);
unset($_pcpin_old_error_reporting);
@ini_set('display_errors', $_pcpin_old_display_errors);
unset($_pcpin_old_display_errors);
// Restore original error handler
restore_error_handler();
// Restore old working directory
chdir($pcpin_old_cwd);
unset($pcpin_old_cwd);