'photos_swfu_upload', 'access callback' => TRUE, 'type' => MENU_CALLBACK, ); return $items; } function photos_swfu_form_alter(&$form, $form_state, $form_id) { global $user; if ($form_id == "photos_upload_form") { drupal_add_css(drupal_get_path('module', 'photos_swfu') .'/v102demo/swfupload.v102.theme.css'); drupal_add_js(drupal_get_path('module', 'photos_swfu') .'/v102demo/swfupload.js'); drupal_add_js(drupal_get_path('module', 'photos_swfu') .'/v102demo/swfupload.v102.js'); drupal_add_js(drupal_get_path('module', 'photos_swfu') .'/v102demo/swfupload.v102.callbacks.js', 'module'); if(arg(0) == 'node' && is_numeric(arg(1))){ $n = node_load(arg(1)); if($n->type == 'photos'){ $pid = $n->nid; }else{ $nid = $n->nid; } } $form['new']['swfu'] = array('#value' => '

'.t('Queue is empty').'

Cancel queue
','#weight' => -10); $url = url('photos_swfu/upload',array('query' => array('pid' => ($pid ? $pid: $_GET['pid']), 'nid' => $nid, 'uid' => session_id()))); $swf = base_path() . drupal_get_path('module', 'photos_swfu') .'/v102demo/swfupload_f8.swf'; if(arg(1)=='quote'){ $href = url($_GET['q'],array('query' => array('type' => 'upload'))); }else{ $href = url($_GET['q']); } drupal_add_js(<< $uid)); $limits = _upload_file_limits($user); $path = _photos_check_path(); $files = new stdClass(); $ext = end(explode('.',$_FILES['Filedata']['name'])); $files->filesize = $_FILES['Filedata']['size']; if(variable_get('photos_rname', 0)){ $name = round(rand(15770,967049700)).time().'.'.$ext; }else{ $name = $_FILES['Filedata']['name']; } $files->filepath = file_destination(file_create_path($path .'/'.trim(basename($name))),FILE_EXISTS_RENAME); $files->filename = end(explode('/',$files->filepath)); if(is_numeric($_GET['pid']) && $t = db_result(db_query("SELECT title FROM {node} WHERE type = '%s' AND nid = %d AND uid = %d", 'photos', $_GET['pid'], $user->uid))){ $files->pid = $_GET['pid']; $files->title = $t; }else{ $t = db_fetch_object(db_query_range("SELECT nid, title FROM {node} WHERE uid = %d AND type = '%s'", $user->uid, 'photos', 0, 1)); $files->pid = $t->nid; $files->title = $t->title; } if(is_numeric($_GET['nid']) && $t = db_fetch_object(db_query('SELECT nid, title FROM {node} WHERE nid = %d AND uid = %d', $_GET['nid'], $user->uid))){ $files->nid = $t->nid; $files->title = $t->title; } if($ext == 'zip' || $ext == 'ZIP'){ if(!variable_get('photos_upzip',0)){ return header("HTTP/1.0 500 Internal Server Error"); } if (file_move($_FILES['Filedata']['tmp_name'], $files->filepath)) { if(!_photos_unzip($files->filepath, $path, $files)){ return header("HTTP/1.0 500 Internal Server Error"); }else { return; } }else{ return header("HTTP/1.0 500 Internal Server Error"); } }else{ $validators = array( 'file_validate_is_image' => array(), 'file_validate_image_resolution' => array($limits['resolution']), 'file_validate_size' => array($limits['file_size'], $limits['user_size']) ); $_FILES['files']['name']['album'] = $name; $_FILES['files']['tmp_name']['album'] = $_FILES['Filedata']['tmp_name']; $_FILES['files']['size']['album'] = $_FILES['Filedata']['size']; if ($file = file_save_upload('album', $validators, $path)) { $title = urlencode($_FILES['Filedata']['name']); $file->title = ($title ? urldecode($title):$files->title); $file->pid = $files->pid; $file->nid = $files->nid; if(!_photos_image_date($file, $path)){ return header("HTTP/1.0 500 Internal Server Error"); } }else { return header("HTTP/1.0 500 Internal Server Error"); } } }else{ return header("HTTP/1.0 500 Internal Server Error"); } }else{ return header("HTTP/1.0 500 Internal Server Error"); } }