$title = empty($_POST['title']) ? addslashes($node) : "{$title4save} {$filecount}"; if (is_readable($file_path) && in_array(strtolower($ext), $array_allowed_exts)) { $lid = $xoopsDB->genId($table_photos . "_lid_seq"); if (in_array(strtolower($ext), $myalbum_normal_exts)) { list($w, $h) = getimagesize($file_path); } else { list($w, $h) = array(0, 0); } $sql = "INSERT INTO {$table_photos} SET lid='{$lid}', cid='{$cid}', title='{$title}', ext='{$ext}', res_x='{$w}', res_y='{$h}', submitter='{$submitter}', status=1, date='{$date}'"; $xoopsDB->query($sql) or die("DB error: INSERT photos table."); if ($lid == 0) { $lid = $xoopsDB->getInsertId(); } print " <a href='../photo.php?lid={$lid}' target='_blank'>{$file_path}</a>\n"; copy($file_path, "{$photos_dir}/{$lid}.{$ext}"); myalbum_create_thumb("{$photos_dir}/{$lid}.{$ext}", $lid, $ext); $xoopsDB->query("INSERT INTO {$table_text} SET lid='{$lid}', description='{$desc4save}'"); echo _AM_MB_FINISHED . "<br />\n"; $filecount++; } } closedir($dir_h); if ($filecount <= 1) { echo "<p>{$dir4edit} : " . _ALBM_MES_BATCHNONE . "</p>"; } else { printf("<p>" . _ALBM_MES_BATCHDONE . "</p>", $filecount - 1); } $result_str = ob_get_contents(); ob_end_clean(); } // Make form objects
if ($RowsNum > 0) { $sql = "INSERT INTO {$table_photos} (lid, cid, title, ext, submitter, status, date, hits, rating, votes, comments) VALUES ({$newid}, {$cid}, '" . addslashes($title) . "', '{$ext}', {$submitter}, {$status}, {$date}, '{$id_foto_principale}', '{$prezzo}', 0, 0)"; } else { $sql = "INSERT INTO {$table_photos} (lid, cid, title, ext, submitter, status, date, hits, rating, votes, comments) VALUES ({$newid}, {$cid}, '" . addslashes($title) . "', '{$ext}', {$submitter}, {$status}, {$date}, 0, '{$prezzo}', 0, 0)"; $id_foto_principale = $newid; } $xoopsDB->query($sql) or die("DB error: INSERT photo table"); if ($newid == 0) { $newid = $xoopsDB->getInsertId(); } myalbum_modify_photo("{$photos_dir}/{$tmp_name}", "{$photos_dir}/{$newid}.{$ext}"); $dim = GetImageSize("{$photos_dir}/{$newid}.{$ext}"); if ($dim) { $xoopsDB->query("UPDATE {$table_photos} SET res_x='{$dim[0]}', res_y='{$dim[1]}' WHERE lid='{$newid}'"); } if (!myalbum_create_thumb("{$photos_dir}/{$newid}.{$ext}", $newid, $ext)) { $xoopsDB->query("DELETE FROM {$table_photos} WHERE lid={$newid}"); redirect_header('submit.php', 2, _ALBM_FILEREADERROR); exit; } $xoopsDB->query("INSERT INTO {$table_text} (lid, description) VALUES ({$newid}, '" . addslashes($desc_text) . "')") or die("DB error: INSERT text table"); // Update User's Posts (Should be modified when need admission.) $user_handler =& xoops_gethandler('user'); $submitter_obj =& $user_handler->get($submitter); for ($i = 0; $i < $myalbum_addposts; $i++) { $submitter_obj->incrementPost(); } // Trigger Notification if ($status) { $notification_handler =& xoops_gethandler('notification'); // Global Notification
$sql = "INSERT INTO {$table_text} SET lid='{$lid}',description=''"; $xoopsDB->query($sql); $dst_file = "{$photos_dir}/{$lid}.{$ext}"; if ($imgcat_storetype == 'db') { $fp = fopen($dst_file, "wb"); if ($fp == false) { continue; } $brs = $xoopsDB->query("SELECT image_body FROM " . $xoopsDB->prefix("imagebody") . " WHERE image_id='{$image_id}'"); list($body) = $xoopsDB->fetchRow($brs); fwrite($fp, $body); fclose($fp); myalbum_create_thumb($dst_file, $lid, $ext); } else { @copy($src_file, $dst_file); myalbum_create_thumb($src_file, $lid, $ext); } list($width, $height, $type) = getimagesize($dst_file); $xoopsDB->query("UPDATE {$table_photos} SET res_x='{$width}',res_y='{$height}' WHERE lid='{$lid}'"); $import_count++; } redirect_header('import.php', 2, sprintf(_AM_FMT_IMPORTSUCCESS, $import_count)); exit; } } // // Form Part // xoops_cp_header(); include './mymenu.php'; echo "<h3 style='text-align:left;'>" . sprintf(_AM_H3_FMT_IMPORTTO, $xoopsModule->name()) . "</h3>\n";