Пример #1
0
        $result = $xoopsDB->query("SELECT l.lid, l.cid,l.cid1,l.cid2,l.cid3,l.cid4, l.title,l.caption,l.caption1,l.caption2, l.poster_name,l.icd,l.url,l.tel,l.fax,l.zip,l.address,l.rss,l.lat,l.lng,l.zoom,l.mtype, l.ext,l.ext1,l.ext2, l.res_x, l.res_y,l.res_x1, l.res_y1,l.res_x2, l.res_y2, l.status, l.date, l.hits, l.rating, l.votes, l.comments, l.submitter, 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 = gnavi_get_array_for_photo_assign($photo);
        if ($photo['ext']) {
            $preview_name = $lid . "." . $photo['ext'];
        }
        if ($photo['ext1']) {
            $preview_name1 = $lid . "_1." . $photo['ext1'];
        }
        if ($photo['ext2']) {
            $preview_name2 = $lid . "_2." . $photo['ext2'];
        }
    }
    //photo assign
    $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 {
Пример #2
0
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);
}