if ($stage == "2" && $t == "p") {
if (isset($_POST['publish'])) {
define("SAFEMODE", @ini_get("safe_mode") ? true : false);
define("PHOTODIR", PHOTOS.(!SAFEMODE ? "album_".$album_id."/" : ""));
require_once INCLUDES."photo_functions_include.php";
$photo_file = ""; $photo_thumb1 = ""; $photo_thumb2 = "";
$data = dbarray(dbquery(
"SELECT ts.*, user_id,user_name FROM ".$db_prefix."submissions ts
LEFT JOIN ".$db_prefix."users tu ON ts.submit_user=tu.user_id
WHERE submit_id='$submit_id'"
));
$submit_criteria = unserialize($data['submit_criteria']);
$photo_title = stripinput($_POST['photo_title']);
$photo_description = stripinput($_POST['photo_description']);
$album_id = isNum($_POST['album_id']) ? $_POST['album_id'] : "0";
$photo_name = strtolower(substr($submit_criteria['photo_file'], 0, strrpos($submit_criteria['photo_file'], ".")));
$photo_ext = strtolower(strrchr($submit_criteria['photo_file'],"."));
$photo_dest = PHOTODIR;
$photo_file = image_exists($photo_dest, $photo_name.$photo_ext);
[color=red][b] $miejsce = stripinput($_POST['miejsce']);
$wykonany = array(
"mday" => isNum($_POST['data']['mday']) ? $_POST['data']['mday'] : "--",
"mon" => isNum($_POST['data']['mon']) ? $_POST['data']['mon'] : "--",
"year" => isNum($_POST['data']['year']) ? $_POST['data']['year'] : "----",
"hours" => isNum($_POST['data']['hours']) ? $_POST['data']['hours'] : "0",
"minutes" => isNum($_POST['data']['minutes']) ? $_POST['data']['minutes'] : "0",
);
if ($_POST['data']['mday']!="--" && $_POST['data']['mon']!="--" && $_POST['data']['year']!="----") {
$wykonany = mktime($_POST['data']['hours'],$_POST['data']['minutes'],0,$_POST['data']['mon'],$_POST['data']['mday'],$_POST['data']['year']);
}
[/b] [/color]
copy(PHOTOS."submissions/".$submit_criteria['photo_file'], $photo_dest.$photo_file);
chmod($photo_dest.$photo_file, 0644);
unlink(PHOTOS."submissions/".$submit_criteria['photo_file']);
$imagefile = @getimagesize($photo_dest.$photo_file);
$photo_thumb1 = image_exists($photo_dest, $photo_name."_t1".$photo_ext);
createthumbnail($imagefile[2], $photo_dest.$photo_file, $photo_dest.$photo_thumb1, $settings['thumb_w'], $settings['thumb_h']);
if ($imagefile[0] > $settings['photo_w'] || $imagefile[1] > $settings['photo_h']) {
$photo_thumb2 = image_exists($photo_dest, $photo_name."_t2".$photo_ext);
createthumbnail($imagefile[2], $photo_dest.$photo_file, $photo_dest.$photo_thumb2, $settings['photo_w'], $settings['photo_h']);
}
$photo_order = dbresult(dbquery("SELECT MAX(photo_order) FROM ".$db_prefix."photos WHERE album_id='$album_id'"), 0) + 1;
$result = dbquery("INSERT INTO ".$db_prefix."photos (album_id, photo_title, photo_description, photo_filename, photo_thumb1, photo_thumb2, photo_datestamp, photo_user, photo_views, photo_order, photo_allow_comments, photo_allow_ratings
[color=red], datawykonania, miejscezrobienia[/color])
VALUES ('$album_id', '$photo_title',
'$photo_description', '$photo_file',
'$photo_thumb1', '$photo_thumb2',
'".time()."', '".$data['submit_user']."', '
0', '$photo_order', '1', '1'[color=red],
'$wykonany', '$miejsce'[/color])");
$result = dbquery("DELETE FROM ".$db_prefix."submissions WHERE submit_id='$submit_id'");
opentable($locale['580']);
echo "