}
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] $gdzie = stripinput($_POST['gdzie']);
$kiedy = stripinput($_POST['kiedy']);[/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] '$kiedy', '$gdzie'[/color])");
$result = dbquery("DELETE FROM ".$db_prefix."submissions WHERE submit_id='$submit_id'");
opentable($locale['580']);
echo "