Модификация для mJournal v2.0pb7 Добавление загрузки файлов ZIP, MP3, DOC и TXT 1. Выполнить запрос: ALTER TABLE `ibf_jattach` ADD `attach_type` VARCHAR( 128 ) NOT NULL AFTER `attach_key` ; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 2. В файле image_lib.php ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ----------------------------- Найти: ----------------------------- var $resize_height = 0; ----------------------------- Добавить ниже: ----------------------------- var $is_image = 0; var $all_type = 0; ----------------------------- Найти: ----------------------------- var $mime_allowed = array ( 'image/x-png' => '.png', 'image/png' => '.png', 'image/gif' => '.gif', 'image/jpeg' => '.jpg', 'image/pjpeg' => '.jpg'); ----------------------------- Заменить на: ----------------------------- var $mime_allowed = array ( 'image/x-png' => array('.png',1), 'image/png' => array('.png',1), 'image/gif' => array('.gif',1), 'image/jpeg' => array('.jpg',1), 'image/jpg' => array('.jpg',1), 'image/pjpeg' => array('.jpg',1), 'application/x-zip-compressed' => array('.jaf',0), 'application/zip' => array('.jaf',0), 'audio/mpeg' => array('.jaf',0), 'audio/x-mpeg' => array('.jaf',0), 'audio/mp3' => array('.jaf',0), 'application/msword' => array('.jaf',0), 'text/plain' => array('.jaf',0), ); ----------------------------- Найти: ----------------------------- // Make local name ----------------------------- Добавить выше: ----------------------------- // Set attach type $this->is_image = $this->mime_allowed[$this->type][1]; // Allowed only image if (!$this->all_type and !$this->is_image) { $this->error = $ibforums->lang['j_err_dl_type']; return FALSE; } ----------------------------- Найти: ----------------------------- $this->name .= $this->mime_allowed[$this->type]; ----------------------------- Заменить на: ----------------------------- $this->name .= $this->mime_allowed[$this->type][0]; ----------------------------- Найти: ----------------------------- // Get image size ----------------------------- Добавить выше: ----------------------------- // Resize image if need if ($this->is_image) { ----------------------------- Найти: ----------------------------- $this->file_size = @filesize($this->path.'/'.$this->name); ----------------------------- Добавить ниже: ----------------------------- } ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 3. В файле post_function.php ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ----------------------------- Найти: ----------------------------- $image_lib->name = "j".$journal->users['id']."_".time(); ----------------------------- Добавить ниже: ----------------------------- $image_lib->all_type = 1; ----------------------------- Найти: ----------------------------- $image_lib->thumb_width = $ibforums->vars['j_th_width']; $image_lib->thumb_height = $ibforums->vars['j_th_height']; $image_lib->make_thumbnail(); ----------------------------- Заменить на: ----------------------------- if ($image_lib->is_image) { $image_lib->thumb_width = $ibforums->vars['j_th_width']; $image_lib->thumb_height = $ibforums->vars['j_th_height']; $image_lib->make_thumbnail(); } ----------------------------- Найти: ----------------------------- 'attach_cid' => 0, ----------------------------- Добавить ниже: ----------------------------- 'attach_type' => $image_lib->type, ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 4. В файле post_render.php ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ----------------------------- Найти: ----------------------------- if (!$journal->users['j_show_img']) ----------------------------- Заменить на: ----------------------------- if (!$journal->users['j_show_img'] and $row['attach_width'] > 0 and $row['attach_height'] > 0) ----------------------------- Найти: ----------------------------- return $journal->skin->html['posts']->attachments_img( $row['attach_file'] ); ----------------------------- Добавить выше: ----------------------------- if ($row['attach_width'] == 0 and $row['attach_height'] == 0) { return $journal->skin->html['posts']->attachments_file($row['attach_id'],htmlspecialchars($row['attach_name'],ENT_QUOTES)); } ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 5. В файле skin_posts.php (Если используются шаблоны из базы, то в каждый скин добавить функцию attachments_file) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ----------------------------- Найти: ----------------------------- //=========================================================================== // attachments_img_thumb //=========================================================================== function attachments_img_thumb($thumb_name="",$file_name="") { ----------------------------- Добавить выше: ----------------------------- //=========================================================================== // attachments_file //=========================================================================== function attachments_file($file_id="",$file_name="") { global $ibforums, $journal; $IPBHTML = ""; //--starthtml--// $IPBHTML .= <<{$file_name} EOF; //--endhtml--// return $IPBHTML; } ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 6. В файле journal.php ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ----------------------------- Найти: ----------------------------- 'doset' => array(1,'dosetup','',array()), ----------------------------- Добавить выше: ----------------------------- 'attach' => array(1,'attach','',array()), ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 7. В файле lang_journal.php найти j_upload_text и добавить разрешенные расширения файлов (.zip .mp3 .doc .txt) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 8. Скопировать в папку journal файл attach.php ( файл тут http://www.urisoft.ru/journal/upload/attach.rar ) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------