/** * Get list of gallery avatars * @return array */ function getGalleryAvatars() { $avatars = array(); _pcpin_loadClass('binaryfile'); $binaryfile = new PCPIN_BinaryFile($this); if ($this->_db_getList('id, primary, binaryfile_id', 'user_id = 0', 'id ASC')) { foreach ($this->_db_list as $data) { if ($binaryfile->_db_getList('width, height', 'id = ' . $data['binaryfile_id'])) { $data['width'] = $binaryfile->_db_list[0]['width']; $data['height'] = $binaryfile->_db_list[0]['height']; $avatars[] = $data; } } $this->_db_freeList(); } return $avatars; }
// Ignore further messages } else { // Add message to database $last_sent_message_time = time(); $msg->addMessage($type, $offline, $current_user->id, $current_nickname, $target_room_id, $target_user_id, $body, date('Y-m-d H:i:s'), $privacy, $css_properties); // Attachments? _pcpin_loadClass('attachment'); $attachment = new PCPIN_Attachment($session); _pcpin_loadClass('message_log_attachment'); $message_log_attachment = new PCPIN_Message_Log_Attachment($session); _pcpin_loadClass('binaryfile'); $binaryfile = new PCPIN_BinaryFile($session); if (!empty($tmpdata_list)) { foreach ($tmpdata_list as $tmpdata_data) { $attachment->addAttachment($msg->id, $tmpdata_data['binaryfile_id'], $tmpdata_data['filename']); if (!empty($session->_conf_all['logging_period']) && $binaryfile->_db_getList('body,size,mime_type', 'id = ' . $tmpdata_data['binaryfile_id'], 1)) { $message_log_attachment->addLogRecord($msg->id, $tmpdata_data['filename'], $binaryfile->_db_list[0]['body'], $binaryfile->_db_list[0]['size'], $binaryfile->_db_list[0]['mime_type']); $binaryfile->_db_freeList(); } } } } } } } } } // Get new messages if (!empty($get_last_msgs) && $get_last_msgs > 0) { $messages = $msg->getLastMessages($current_user->id, $get_last_msgs); $messages = array_reverse($messages);
*/ /** * Load and output a binary file * @param int $b_id ID of the binary file * @param int $b_x If file is an image: Desired image width. If empty, image will be not resized. * @param int $b_y If file is an image: Desired image height. If empty, image will be not resized. * @param int $bg_r If file is an image and will be resized: Desired red component of image background (0..255). Default value is taken from configuration. * @param int $bg_g If file is an image and will be resized: Desired green component of image background (0..255). Default value is taken from configuration. * @param int $bg_b If file is an image and will be resized: Desired blue component of image background (0..255). Default value is taken from configuration. */ // Use cache (for future purposes) $cache_expires = 31536000; // Cache: 365 days _pcpin_loadClass('binaryfile'); $binaryfile = new PCPIN_BinaryFile($session); if (!empty($b_id) && is_scalar($b_id) && $binaryfile->_db_getList('protected, mime_type, size, body', 'id = ' . $b_id, 1)) { if ($binaryfile->_db_list[0]['protected'] != '') { // Binaryfile is protected $protection_parts = explode('/', $binaryfile->_db_list[0]['protected']); foreach ($protection_parts as $part) { switch ($part) { case 'log': if (empty($current_user->id)) { die; } break; case 'reg': if ($current_user->is_guest == 'y') { die; } break;