$xoopsTpl->assign('description', $description); $get_append = "cid={$cid}"; } else { if ($uid != 0) { if ($uid < 0) { // This means 'my photo' $where = "submitter={$my_uid}"; $get_append = "uid=-1"; $xoopsTpl->assign('uid', -1); $pagetitle = _MD_GNAV_CAT_MYPOST; } else { // uid Specified $where = "submitter={$uid}"; $get_append = "uid={$uid}"; $xoopsTpl->assign('uid', $uid); $pagetitle = sprintf(_MD_GNAV_CAT_MOREPHOTOS, gnavi_get_name_from_uid($uid)); } //count $prs = $xoopsDB->query("SELECT COUNT(lid) FROM {$table_photos} WHERE {$where} AND status>0"); list($photo_num_total) = $xoopsDB->fetchRow($prs); $xoopsTpl->assign('photo_num_total', $photo_num_total . ' ' . _MD_GNAV_C_DATA); $photo_small_sum = $photo_num_total; //breadcrumbs $xoops_breadcrumbs[] = array('url' => XOOPS_URL . '/modules/' . $mydirname . '/index.php', 'name' => $xoopsModule->getVar('name')); if ($gnavi_indexpage == 'map') { $xoops_breadcrumbs[] = array('url' => XOOPS_URL . '/modules/' . $mydirname . '/index.php?page=category', 'name' => _MD_GNAV_CAT_ITEMLIST); } $xoops_breadcrumbs[] = array('name' => $pagetitle); } else { if ($month) { $gettime = intval(strtotime(substr($month, 0, 4) . "-" . substr($month, 4, 2) . "-01"));
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); }
$photo = gnavi_photo_assign($photo); $photo['mycat'] = gnavi_get_mycat($photo['cid'], $photo['cid1'], $photo['cid2'], $photo['cid3'], $photo['cid4']); $tpl = new XoopsTpl(); $tpl->assign($gnavi_assign_globals); $tpl->assign('photo', $photo); $tpl->display("db:{$mydirname}_itemheader.html"); $imgsrc_photo = $photo['imgsrc_photo']; $imgsrc_photo1 = $photo['imgsrc_photo1']; $imgsrc_photo2 = $photo['imgsrc_photo2']; } //make forms data if (!empty($_POST['preview'])) { $photo = array('lid' => $lid, 'title' => $title, 'cid' => $cid, 'cid1' => $cid1, 'cid2' => $cid2, 'cid3' => $cid3, 'cid4' => $cid4, 'icd' => $icd, 'ext' => $photo['ext'], 'ext1' => $photo['ext1'], 'ext2' => $photo['ext2'], 'caption' => $caption, 'caption1' => $caption1, 'caption2' => $caption2, 'url' => $url, 'tel' => $tel, 'fax' => $fax, 'zip' => $zip, 'address' => $address, 'rss' => $rss, 'lat' => $lat, 'lng' => $lng, 'zoom' => $zoom, 'mtype' => $mtype, 'submitter' => $submitter, 'poster_name' => $poster_name, 'description' => $desc_text, 'arrowhtml' => !($global_perms & GNAV_GPERM_WYSIWYG) ? 0 : $body_html, 'addinfo' => $addinfo, 'status' => $p_status, 'valid' => $p_valid, 'imgsrc_photo' => $imgsrc_photo, 'imgsrc_photo1' => $imgsrc_photo1, 'imgsrc_photo2' => $imgsrc_photo2); } else { if ($mode == G_INSERT) { $photo = array('lid' => 0, 'title' => '', 'cid' => $p_cid, 'cid1' => 0, 'cid2' => 0, 'cid3' => 0, 'cid4' => 0, 'icd' => 0, 'ext' => '', 'ext1' => '', 'ext2' => '', 'caption' => '', 'caption1' => '', 'caption2' => '', 'url' => '', 'tel' => '', 'fax' => '', 'zip' => '', 'address' => '', 'rss' => '', 'lat' => 0, 'lng' => 0, 'zoom' => 0, 'mtype' => '', 'submitter' => $submitter, 'poster_name' => $my_uid > 0 ? gnavi_get_name_from_uid($my_uid) : '', 'description' => '', 'addinfo' => '', 'status' => 0, 'valid' => 0); } else { $result = $xoopsDB->query("SELECT l.lid,l.title,l.cid,l.cid1,l.cid2,l.cid3,l.cid4,l.ext,l.ext1,l.ext2,l.caption,l.caption1,l.caption2,l.url,l.tel,l.fax,l.zip,l.address,l.rss,l.lat,l.lng,l.zoom,l.mtype,l.icd,l.submitter,l.poster_name,l.status,t.description,t.arrowhtml,t.addinfo FROM {$table_photos} l LEFT JOIN {$table_text} t ON l.lid=t.lid WHERE l.lid={$lid}"); $photo = $xoopsDB->fetchArray($result); $photo['imgsrc_photo'] = $imgsrc_photo; $photo['imgsrc_photo1'] = $imgsrc_photo1; $photo['imgsrc_photo2'] = $imgsrc_photo2; $photo['valid'] = $photo['status']; //map hidden if ($photo['lat'] == 0 && $photo['lng'] == 0) { $p_set_latlng = 0; } $p_cid = $photo['cid']; } //set map default if ($photo['lat'] == 0 && $photo['lng'] == 0) {
while (list($lid, $cid, $cid1, $cid2, $cid3, $cid4, $title, $poster_name, $submitter, $hits, $rating, $votes) = $xoopsDB->fetchRow($prs)) { $mycid = $cid; if (in_array($cid4, $children)) { $mycid = $cid4; } if (in_array($cid3, $children)) { $mycid = $cid3; } if (in_array($cid2, $children)) { $mycid = $cid2; } if (in_array($cid1, $children)) { $mycid = $cid1; } if (in_array($cid, $children)) { $mycid = $cid; } $catpath = $cattree->getPathFromId($mycid, "title"); $catpath = substr($catpath, 1); $catpath = str_replace("/", " <span class='fg2'>»»</span> ", $catpath); $title = $myts->makeTboxData4Show($title); if ($submitter > 0) { $poster_name = gnavi_get_name_from_uid($submitter); } $rankings[$i]['photo'][] = array('lid' => $lid, 'cid' => $cid, 'rank' => $rank, 'title' => $title, 'submitter' => $submitter, 'submitter_name' => $poster_name, 'category' => $catpath, 'hits' => $hits, 'rating' => number_format($rating, 2), 'votes' => $votes); $rank++; } $i++; } $xoopsTpl->assign_by_ref('rankings', $rankings); include XOOPS_ROOT_PATH . "/footer.php";