|
From: FlorinCB <ory...@us...> - 2009-07-12 03:59:36
|
Update of /cvsroot/mxbb/mx_smartor/album_mod/modules In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv26215 Modified Files: album_otf.php Log Message: fix Index: album_otf.php =================================================================== RCS file: /cvsroot/mxbb/mx_smartor/album_mod/modules/album_otf.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** album_otf.php 29 Aug 2008 05:58:24 -0000 1.4 --- album_otf.php 12 Jul 2009 03:59:31 -0000 1.5 *************** *** 224,231 **** $page_title = $lang['Album']; ! if ( !$is_block ) ! { include($mx_root_path . 'includes/page_header.'.$phpEx); ! } $template->set_filenames(array('body' => 'album_otf_body.tpl')); --- 224,232 ---- $page_title = $lang['Album']; ! ! if ( !$is_block ) ! { include($mx_root_path . 'includes/page_header.'.$phpEx); ! } $template->set_filenames(array('body' => 'album_otf_body.tpl')); *************** *** 248,288 **** $otf_pic_time = $otf_pic_time + 1; $pic_img_url = mx_append_sid(ALBUM_OTF_PATH . $pic_images[$pic_cat][$i][$j]); - - // $pic_thumbnail = $pic_cat_names[$pic_cat][$i][$j] . '_' . $pic_file_names[$pic_cat][$i][$j]; $pic_thumbnail = $pic_images[$pic_cat][$i][$j]; $pic_thumbnail_fullpath = ALBUM_CACHE_PATH . $pic_thumbnail; ! /* ! if ( file_exists($pic_thumbnail_fullpath) ) { ! $pic_img_thumb = $pic_thumbnail_fullpath; } else { $pic_img_thumb = mx_append_sid(this_smartor_mxurl("smartor_mode=album_otf_thumbnail" . '&pic_cat=' . $pic_cat_names[$pic_cat][$i][$j] . '&pic_id=' . $pic_file_names[$pic_cat][$i][$j])); } ! */ $pic_img_thumb = mx_append_sid(this_smartor_mxurl("smartor_mode=album_otf_thumbnail" . '&pic_cat=' . $pic_cat_names[$pic_cat][$i][$j] . '&pic_id=' . $pic_file_names[$pic_cat][$i][$j])); ! if ( ($upload_pics == true) && ($cat_to_upload > 0) ) { if ($upload_counter < 9) { ! $otf_pic_title = $pic_cat . ' - ' . $pic_names[$pic_cat][$i][$j] . ' - 00' . ($upload_counter + 1); } ! elseif ( ($upload_counter > 8) && ($upload_counter < 99) ) { ! $otf_pic_title = $pic_cat . ' - ' . $pic_names[$pic_cat][$i][$j] . ' - 0' . ($upload_counter + 1); } else { ! $otf_pic_title = $pic_cat . ' - ' . $pic_names[$pic_cat][$i][$j] . ' - ' . ($upload_counter + 1); ! } $otf_pic_path = ALBUM_OTF_PATH . $pic_images[$pic_cat][$i][$j]; ! if (pic_upload_to_cat($otf_pic_path, $pic_file_names[$pic_cat][$i][$j], ucfirst($otf_pic_title), $pic_names[$pic_cat][$i][$j], $cat_to_upload, $otf_pic_time)) { $upload_counter++; } } $template->assign_block_vars('pic_row.pic_column', array( --- 249,310 ---- $otf_pic_time = $otf_pic_time + 1; $pic_img_url = mx_append_sid(ALBUM_OTF_PATH . $pic_images[$pic_cat][$i][$j]); $pic_thumbnail = $pic_images[$pic_cat][$i][$j]; $pic_thumbnail_fullpath = ALBUM_CACHE_PATH . $pic_thumbnail; ! ! $pic_thumbnail_ext = $pic_cat_names[$pic_cat][$i][$j] . '_' . $pic_file_names[$pic_cat][$i][$j]; ! $pic_thumbnail_ext_fullpath = ALBUM_CACHE_PATH . $pic_thumbnail_ext; ! /* ! elseif (@file_exists($pic_thumbnail_ext_fullpath) ) { ! $pic_img_thumb = $pic_thumbnail_ext_fullpath; } + */ + + /* + if (@file_exists($pic_thumbnail_fullpath) ) + { + $pic_img_thumb = $pic_thumbnail_fullpath; + } else { $pic_img_thumb = mx_append_sid(this_smartor_mxurl("smartor_mode=album_otf_thumbnail" . '&pic_cat=' . $pic_cat_names[$pic_cat][$i][$j] . '&pic_id=' . $pic_file_names[$pic_cat][$i][$j])); } ! */ $pic_img_thumb = mx_append_sid(this_smartor_mxurl("smartor_mode=album_otf_thumbnail" . '&pic_cat=' . $pic_cat_names[$pic_cat][$i][$j] . '&pic_id=' . $pic_file_names[$pic_cat][$i][$j])); ! if ($cat_to_upload > 0) { if ($upload_counter < 9) { ! $otf_pic_title = '000' . ($upload_counter + 1) . $pic_cat . '_' . $pic_names[$pic_cat][$i][$j]; } ! elseif ( ($upload_counter > 9) && ($upload_counter < 99) ) { ! $otf_pic_title = '00' . ($upload_counter + 1) . $pic_cat . '_' . $pic_names[$pic_cat][$i][$j]; } + elseif ( ($upload_counter > 99) && ($upload_counter < 999) ) + { + $otf_pic_title = '0' . ($upload_counter + 1) . $pic_cat . '_' . $pic_names[$pic_cat][$i][$j]; + } else { ! $otf_pic_title = $pic_cat . '_' . ($upload_counter + 1) . $pic_names[$pic_cat][$i][$j]; ! } ! ! $otf_pic_path = ALBUM_OTF_PATH . $pic_images[$pic_cat][$i][$j]; ! ! $pic_upload_result = pic_upload_to_cat($otf_pic_path, $pic_file_names[$pic_cat][$i][$j], ucfirst($otf_pic_title), $pic_names[$pic_cat][$i][$j], $cat_to_upload, $otf_pic_time); ! ! if ($pic_upload_result) { $upload_counter++; } + else + { + pic_upload_to_cat($otf_pic_path, $pic_file_names[$pic_cat][$i][$j], ucfirst($otf_pic_title), $pic_names[$pic_cat][$i][$j], $cat_to_upload, $otf_pic_time); + } } $template->assign_block_vars('pic_row.pic_column', array( *************** *** 301,305 **** if ( ($upload_pics == true) && ($cat_to_upload > 0) ) { ! //$template->assign_block_vars('upload_confirm', array()); if ($upload_counter > 0) { --- 323,327 ---- if ( ($upload_pics == true) && ($cat_to_upload > 0) ) { ! $template->assign_block_vars('upload_confirm', array()); if ($upload_counter > 0) { *************** *** 352,359 **** $template->pparse('body'); ! if ( !$is_block ) ! { include($mx_root_path . 'includes/page_tail.'.$phpEx); ! } --- 374,381 ---- $template->pparse('body'); ! if (!$is_block ) ! { include($mx_root_path . 'includes/page_tail.'.$phpEx); ! } *************** *** 361,368 **** function pic_upload_to_cat($otf_pic_path, $otf_pic_filename, $otf_pic_title, $otf_pic_des, $otf_pic_cat, $otf_pic_time) { ! global $db, $userdata, $pic_thumbnail; if (file_exists(ALBUM_UPLOAD_PATH . $otf_pic_filename)) { ! $otf_pic_filename = $otf_pic_filename . '_' . time() . '_' . mt_rand(100000, 999999); } if (file_exists(ALBUM_UPLOAD_PATH . $otf_pic_filename)) --- 383,391 ---- function pic_upload_to_cat($otf_pic_path, $otf_pic_filename, $otf_pic_title, $otf_pic_des, $otf_pic_cat, $otf_pic_time) { ! global $db, $mx_user, $userdata, $pic_thumbnail; ! if (file_exists(ALBUM_UPLOAD_PATH . $otf_pic_filename)) { ! $otf_pic_filename = time() . '_' . mt_rand(100000, 999999) . '_' . $otf_pic_filename; } if (file_exists(ALBUM_UPLOAD_PATH . $otf_pic_filename)) *************** *** 371,388 **** } ! if ($pic_thumbnail == '') { $pic_thumbnail = $otf_pic_filename; } ! if ($otf_pic_time == '') { $otf_pic_time = time(); } $otf_pic_username = $userdata['username']; ! $otf_pic_user_id = $userdata['user_id']; ! $otf_pic_user_ip = $userdata['session_ip']; $move_file = 'rename'; - //$move_file = 'copy'; //$move_file = 'move_uploaded_file'; $upload_success = $move_file($otf_pic_path, ALBUM_UPLOAD_PATH . $otf_pic_filename); --- 394,426 ---- } ! if (!$pic_thumbnail) { $pic_thumbnail = $otf_pic_filename; } ! if (!$otf_pic_time) { $otf_pic_time = time(); } + $otf_pic_username = $userdata['username']; ! ! switch (PORTAL_BACKEND) ! { ! case 'internal': ! ! case 'phpbb2': ! ! $otf_pic_user_id = $userdata['user_id']; ! $otf_pic_user_ip = $userdata['session_ip']; ! break; ! ! case 'phpbb3': ! ! $otf_pic_user_id = $mx_user->data['user_id']; ! $otf_pic_user_ip = album_encode_ip($mx_user->data['session_ip']); ! break; ! } $move_file = 'rename'; //$move_file = 'move_uploaded_file'; $upload_success = $move_file($otf_pic_path, ALBUM_UPLOAD_PATH . $otf_pic_filename); *************** *** 393,402 **** $sql = "INSERT INTO " . ALBUM_TABLE . " (pic_filename, pic_thumbnail, pic_title, pic_desc, pic_user_id, pic_user_ip, pic_username, pic_time, pic_cat_id, pic_approval) VALUES ('$otf_pic_filename', '$pic_thumbnail', '$otf_pic_title', '$otf_pic_des', '$otf_pic_user_id', '$otf_pic_user_ip', '$otf_pic_username', '$otf_pic_time', '$otf_pic_cat', '1')"; ! if( !$result = $db->sql_query($sql) ) { return false; } } ! return true; } --- 431,452 ---- $sql = "INSERT INTO " . ALBUM_TABLE . " (pic_filename, pic_thumbnail, pic_title, pic_desc, pic_user_id, pic_user_ip, pic_username, pic_time, pic_cat_id, pic_approval) VALUES ('$otf_pic_filename', '$pic_thumbnail', '$otf_pic_title', '$otf_pic_des', '$otf_pic_user_id', '$otf_pic_user_ip', '$otf_pic_username', '$otf_pic_time', '$otf_pic_cat', '1')"; ! if(!$result = @$db->sql_query($sql)) { return false; } } ! else ! { ! @chmod(ALBUM_UPLOAD_PATH . $otf_pic_filename, 0777); ! $sql = "INSERT INTO " . ALBUM_TABLE . " (pic_filename, pic_thumbnail, pic_title, pic_desc, pic_user_id, pic_user_ip, pic_username, pic_time, pic_cat_id, pic_approval) ! VALUES ('$otf_pic_filename', '$pic_thumbnail', '$otf_pic_title', '$otf_pic_des', '$otf_pic_user_id', '$otf_pic_user_ip', '$otf_pic_username', '$otf_pic_time', '$otf_pic_cat', '1')"; ! if(!$result = @$db->sql_query($sql)) ! { ! mx_message_die(GENERAL_ERROR, 'Upload Failed, plus could not insert new entryes in album table', '', __LINE__, __FILE__, $sql); ! } ! ! print_r('Upload Failed, please upload missing files manualy via ftp. and change upload method.'); ! } ! return true; } |