include_once "../../include/xoopscodes.php"; echo "<h2>" . ($mode == G_INSERT ? _MD_GNAV_SMT_UPLOAD : _MD_GNAV_SMT_EDIT) . "</h2><hr />"; // Preview if (!empty($_POST['preview']) || $mode == G_UPDATE) { if (!empty($_POST['preview'])) { if ($mode == G_INSERT) { $date = time(); $hits = 0; $status = 1; } else { $result = $xoopsDB->query("SELECT status,date,hits FROM {$table_photos} WHERE l.lid={$lid}"); list($status, $date, $hits) = $xoopsDB->fetchRow($result); $date = empty($_POST['store_timestamp']) ? $date : time(); } // Display Preview $photo = array('cid' => $cid, 'cid1' => $cid1, 'cid2' => $cid2, 'cid3' => $cid3, 'cid4' => $cid4, 'icd' => $icd, 'submitter' => $submitter, 'title' => $myts->makeTboxData4Show($title), 'caption' => $myts->makeTboxData4Show($caption), 'caption1' => $myts->makeTboxData4Show($caption1), 'caption2' => $myts->makeTboxData4Show($caption2), 'description' => $myts->displayTarea($desc_text, $arrow_html, 1, 1, 1, $arrow_br, 1), 'addinfo' => gnavi_addinfo_array($addinfo, $myts), 'submitter_name' => $myts->makeTboxData4Show($poster_name), 'poster_name' => $myts->makeTboxData4Show($poster_name), 'url' => $myts->makeTboxData4Show($url), 'tel' => $myts->makeTboxData4Show($tel), 'fax' => $myts->makeTboxData4Show($fax), 'zip' => $myts->makeTboxData4Show($zip), 'address' => $myts->makeTboxData4Show($address), 'rss' => $myts->makeTboxData4Show($rss), 'lat' => $lat, 'lng' => $lng, 'zoom' => $zoom, 'mtype' => $mtype, 'datetime' => formatTimestamp($date, 'm'), 'hits' => $hits, 'status' => $status, 'is_newphoto' => $date > time() - 86400 * $gnavi_newdays && $status == 1, 'is_updatedphoto' => $date > time() - 86400 * $gnavi_newdays && $status == 2, 'is_popularphoto' => $hits >= $gnavi_popular); $orgfile_name = $orgfile_name1 = $orgfile_name2 = ""; if ($mode != G_INSERT) { $prs = $xoopsDB->query("SELECT ext,ext1,ext2 FROM {$table_photos} WHERE lid={$lid}"); list($p_ext, $p_ext1, $p_ext2) = $xoopsDB->fetchRow($prs); if ($p_ext) { $orgfile_name = $lid . "." . $p_ext; } if ($p_ext1) { $orgfile_name1 = $lid . "_1." . $p_ext1; } if ($p_ext2) { $orgfile_name2 = $lid . "_2." . $p_ext2; } } $preview_name = gnavi_submit_uploader_pre(@$_POST['xoops_upload_file'][0], $preview_name, $del_photo, $orgfile_name);
function gnavi_get_array_for_photo_assign($fetched_result_array, $summary = false) { global $my_uid, $isadmin, $global_perms; global $photos_url, $thumbs_url, $thumbs_dir, $mod_url, $mod_path; global $gnavi_makethumb, $gnavi_thumbsize, $gnavi_popular, $gnavi_newdays, $gnavi_normal_exts, $gnavi_gmap_exts; include_once dirname(dirname(__FILE__)) . '/class/gnavi.textsanitizer.php'; $myts =& GNaviTextSanitizer::getInstance(); extract($fetched_result_array); list($imgsrc_photo, $ahref_photo, $imgsrc_thumb, $ahref_thumb, $is_normal_image) = gnavi_get_img_urls("{$lid}.{$ext}"); list($imgsrc_photo1, $ahref_photo1, $imgsrc_thumb1, $ahref_thumb1, $is_normal_image1) = gnavi_get_img_urls($lid . "_1." . $ext1); list($imgsrc_photo2, $ahref_photo2, $imgsrc_thumb2, $ahref_thumb2, $is_normal_image2) = gnavi_get_img_urls($lid . "_2." . $ext2); $arrow_html = $arrowhtml ? 1 : 0; $arrow_br = $arrowhtml ? 0 : 1; $addinfo_array = gnavi_addinfo_array($addinfo, $myts); // Voting stats if ($rating > 0) { if ($votes == 1) { $votestring = _MD_GNAV_RAT_ONEVOTE; } else { $votestring = sprintf(_MD_GNAV_RAT_NUMVOTES, $votes); } $info_votes = number_format($rating, 2) . " ({$votestring})"; } else { $info_votes = '0.00 (' . sprintf(_MD_GNAV_RAT_NUMVOTES, 0) . ')'; } // Submitter's name if ($submitter > 0) { $submitter_name = gnavi_get_name_from_uid($submitter); } else { $submitter_name = $poster_name; } // Category's title $cat_title = empty($cat_title) ? '' : $cat_title; // Summarize description if ($summary) { $description = $myts->extractSummary($description); } //kml lists $mykmls = ''; if (in_array($ext, $gnavi_gmap_exts)) { if ($mykmls) { $mykmls .= ','; } $mykmls .= "'" . $photos_url . "/" . $lid . "." . $ext . "'"; } if (in_array($ext1, $gnavi_gmap_exts)) { if ($mykmls) { $mykmls .= ','; } $mykmls .= "'" . $photos_url . "/" . $lid . "_1." . $ext1 . "'"; } if (in_array($ext2, $gnavi_gmap_exts)) { if ($mykmls) { $mykmls .= ','; } $mykmls .= "'" . $photos_url . "/" . $lid . "_2." . $ext2 . "'"; } return array('lid' => $lid, 'mycat' => gnavi_get_mycat($cid, $cid1, $cid2, $cid3, $cid4), 'cid' => $cid, 'cid1' => $cid1, 'cid2' => $cid2, 'cid3' => $cid3, 'cid4' => $cid4, 'icd' => $icd, 'ext' => $ext, 'ext1' => $ext1, 'ext2' => $ext2, 'mykmls' => $mykmls, 'res_x' => $res_x, 'res_y' => $res_y, 'window_x' => $res_x + 16, 'window_y' => $res_y + 16, 'res_x1' => $res_x1, 'res_y1' => $res_y1, 'window_x1' => $res_x1 + 16, 'window_y1' => $res_y1 + 16, 'res_x2' => $res_x2, 'res_y2' => $res_y2, 'window_x2' => $res_x2 + 16, 'window_y2' => $res_y2 + 16, 'title' => $myts->makeTboxData4Show($title), 'caption' => $myts->makeTboxData4Show($caption), 'caption1' => $myts->makeTboxData4Show($caption1), 'caption2' => $myts->makeTboxData4Show($caption2), 'datetime' => formatTimestamp($date, 'm'), 'description' => $myts->displayTarea($description, $arrow_html, 1, 1, 1, $arrow_br, 1), 'sdescription' => xoops_substr(strip_tags($myts->displayTarea($description, $arrow_html, 1, 1, 1, 1, 1)), 0, 512), 'addinfo' => $addinfo_array, 'ahref_thumb' => $ahref_thumb, 'ahref_thumb1' => $ahref_thumb1, 'ahref_thumb2' => $ahref_thumb2, 'imgsrc_thumb' => $imgsrc_thumb, 'imgsrc_thumb1' => $imgsrc_thumb1, 'imgsrc_thumb2' => $imgsrc_thumb2, 'imgsrc_photo' => $imgsrc_photo, 'imgsrc_photo1' => $imgsrc_photo1, 'imgsrc_photo2' => $imgsrc_photo2, 'ahref_photo' => $ahref_photo, 'ahref_photo1' => $ahref_photo1, 'ahref_photo2' => $ahref_photo2, 'can_edit' => $global_perms & GNAV_GPERM_EDITABLE && ($my_uid == $submitter || $isadmin), 'submitter' => $submitter, 'submitter_name' => $myts->makeTboxData4Show($submitter_name), 'poster_name' => $myts->makeTboxData4Show($poster_name), 'hits' => $hits, 'status' => $status, 'rating' => $rating, 'rank' => floor($rating - 0.001), 'votes' => $votes, 'info_votes' => $info_votes, 'comments' => $comments, 'lat' => $lat, 'lng' => $lng, 'zoom' => $zoom, 'mtype' => $myts->makeTboxData4Show($mtype), 'url' => $myts->makeTboxData4Show($url), 'rss' => $myts->makeTboxData4Show($rss), 'tel' => $myts->makeTboxData4Show($tel), 'fax' => $myts->makeTboxData4Show($fax), 'zip' => $myts->makeTboxData4Show($zip), 'address' => $myts->makeTboxData4Show($address), 'is_normal_image' => $is_normal_image, 'is_newphoto' => $date > time() - 86400 * $gnavi_newdays && $status == 1, 'is_updatedphoto' => $date > time() - 86400 * $gnavi_newdays && $status == 2, 'is_popularphoto' => $hits >= $gnavi_popular); }