<?php // ------------------------------------------------------------------------- // // myAlbum-P - XOOPS photo album // // <http://www.peak.ne.jp/> // // ------------------------------------------------------------------------- // include "admin_header.php"; include_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; require_once dirname(dirname(__FILE__)) . '/class/gnavi.textsanitizer.php'; // initialization of Xoops vars $cattree = new XoopsTree($table_cat, "cid", "pid"); $myts =& GNaviTextSanitizer::getInstance(); // GET vars $pos = empty($_GET['pos']) ? 0 : intval($_GET['pos']); $num = empty($_GET['num']) ? 20 : intval($_GET['num']); $txt = empty($_GET['txt']) ? '' : $myts->stripSlashesGPC(trim($_GET['txt'])); if (!empty($_POST['action']) && $_POST['action'] == 'admit' && isset($_POST['ids']) && is_array($_POST['ids'])) { // Do admission $whr = ""; foreach ($_POST['ids'] as $id) { $id = intval($id); $whr .= "lid={$id} OR "; } $xoopsDB->query("UPDATE {$table_photos} SET status=1 WHERE {$whr} 0"); // Trigger Notification $notification_handler =& xoops_gethandler('notification'); $rs = $xoopsDB->query("SELECT l.lid,l.cid,l.submitter,l.title,c.title FROM {$table_photos} l LEFT JOIN {$table_cat} c ON l.cid=c.cid WHERE {$whr} 0"); while (list($lid, $cid, $submitter, $title, $cat_title) = $xoopsDB->fetchRow($rs)) { $tags = array(); $tags['PHOTO_TITLE'] = $title;
function gnavi_update_desc($mode, $lid, $cid, $title, $submitter, $valid, $ext, $ext1, $ext2, $resx, $resy, $resx1, $resy1, $resx2, $resy2, $caption, $caption1, $caption2, $desc, $arrowhtml, $addinfo) { global $xoopsDB, $gnavi_addposts; global $table_photos, $table_text, $table_cat, $mod_url, $isadmin; $myts =& GNaviTextSanitizer::getInstance(); $caption = $ext == '' ? '' : $caption; $caption1 = $ext1 == '' ? '' : $caption1; $caption2 = $ext2 == '' ? '' : $caption2; $sql = "UPDATE {$table_photos} SET caption='" . addSlashes($caption) . "',caption1='" . addSlashes($caption1) . "',caption2='" . addSlashes($caption2) . "',ext='{$ext}',ext1='{$ext1}',ext2='{$ext2}',res_x={$resx},res_y={$resy},res_x1={$resx1},res_y1={$resy1},res_x2={$resx2},res_y2={$resy2} WHERE lid='{$lid}'"; $xoopsDB->query($sql) or die("DB error: UPDATE text table"); if ($mode == G_INSERT) { $sql = "INSERT INTO {$table_text} (lid, description,arrowhtml,addinfo) VALUES ({$lid},'" . addSlashes($desc) . "',{$arrowhtml},'" . addSlashes($addinfo) . "')"; $xoopsDB->query($sql) or die("DB error: INSERT desc table"); // Update User's Posts (Should be modified when need admission.) $user_handler =& xoops_gethandler('user'); $submitter_obj =& $user_handler->get($submitter); if (is_object($submitter_obj)) { for ($i = 0; $i < $gnavi_addposts; $i++) { $submitter_obj->incrementPost(); } } } else { // not admin can only touch photos status>0 $whr_status = $isadmin ? '' : 'AND status>0'; $sql = "UPDATE {$table_text} SET description='" . addSlashes($desc) . "',arrowhtml={$arrowhtml},addinfo='" . addSlashes($addinfo) . "' WHERE lid='{$lid}'"; $xoopsDB->query($sql) or die("DB error: UPDATE text table"); } // Trigger Notification if Change Or submit if ($valid == 1) { $notification_handler =& xoops_gethandler('notification'); $tags = array(); $tags['PHOTO_TITLE'] = $title; $tags['PHOTO_URI'] = $mod_url . "/index.php?lid=" . $lid; // Global Notification gnavi_trigger_event('global', 0, 'new_item', $tags); // Category Notification $rs = $xoopsDB->query("SELECT title FROM {$table_cat} WHERE cid={$cid}"); list($cat_title) = $xoopsDB->fetchRow($rs); $tags['CATEGORY_TITLE'] = $cat_title; $tags['PHOTO_URI'] = $mod_url . "/index.php?lid=" . $lid . "&cid=" . $cid; gnavi_trigger_event('category', $cid, 'new_item', $tags); } }
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); }