function annotate_meta_album($meta) { global $CONFIG, $CURRENT_CAT_NAME, $RESTRICTEDWHERE, $lang_plugin_annotate; require_once './plugins/annotate/init.inc.php'; $annotate_init_array = annotate_initialize(); $lang_plugin_annotate = $annotate_init_array['language']; $annotate_icon_array = $annotate_init_array['icon']; switch ($meta['album']) { case 'lastnotes': $album_name = $annotate_icon_array['annotate'] . ' ' . $lang_plugin_annotate['lastnotes']; if ($CURRENT_CAT_NAME) { $album_name .= " - {$CURRENT_CAT_NAME}"; } $query = "SELECT DISTINCT n.pid \n FROM {$CONFIG['TABLE_PREFIX']}plugin_annotate AS n \n INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON n.pid = p.pid \n INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS r ON r.aid = p.aid \n {$RESTRICTEDWHERE}"; $result = cpg_db_query($query); $count = mysql_num_rows($result); mysql_free_result($result); $query = "SELECT MAX(nid) AS nid\n FROM {$CONFIG['TABLE_PREFIX']}plugin_annotate AS n \n INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON n.pid = p.pid \n INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS r ON r.aid = p.aid \n {$RESTRICTEDWHERE}\n GROUP BY n.pid \n ORDER BY n.nid DESC {$meta['limit']}"; $result = cpg_db_query($query); $latest_nids_array = array(); while ($row = mysql_fetch_assoc($result)) { $latest_nids_array[] = $row['nid']; } mysql_free_result($result); $query = "SELECT *, user_time AS msg_date\n FROM {$CONFIG['TABLE_PICTURES']} AS p\n INNER JOIN {$CONFIG['TABLE_PREFIX']}plugin_annotate AS n ON p.pid = n.pid \n INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS r ON r.aid = p.aid \n {$RESTRICTEDWHERE} \n AND approved = 'YES'\n AND n.nid IN (" . implode(', ', $latest_nids_array) . ")\n ORDER BY n.nid DESC"; $result = cpg_db_query($query); $rowset = cpg_db_fetch_rowset($result); mysql_free_result($result); build_caption($rowset, array('msg_date')); break; case 'shownotes': if (annotate_get_level('permissions') < 1) { global $lang_errors; cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__); } $superCage = Inspekt::makeSuperCage(); $note = $superCage->get->keyExists('note') ? $superCage->get->getRaw('note') : $superCage->cookie->getRaw($CONFIG['cookie_name'] . 'note'); setcookie($CONFIG['cookie_name'] . 'note', $note); $album_name = cpg_fetch_icon('search', 2) . ' ' . $lang_plugin_annotate['shownotes'] . " '{$note}'"; if ($CURRENT_CAT_NAME) { $album_name .= " - {$CURRENT_CAT_NAME}"; } $note = addslashes(addslashes($note)); $query = "SELECT p.pid FROM {$CONFIG['TABLE_PICTURES']} AS p INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS r ON p.aid = r.aid INNER JOIN {$CONFIG['TABLE_PREFIX']}plugin_annotate n ON p.pid = n.pid {$RESTRICTEDWHERE} AND approved = 'YES' AND n.note = '{$note}' GROUP BY p.pid"; $result = cpg_db_query($query); $count = mysql_num_rows($result); mysql_free_result($result); $query = "SELECT p.*, r.title FROM {$CONFIG['TABLE_PICTURES']} AS p INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS r ON p.aid = r.aid INNER JOIN {$CONFIG['TABLE_PREFIX']}plugin_annotate n ON p.pid = n.pid {$RESTRICTEDWHERE} AND approved = 'YES' AND n.note = '{$note}' GROUP BY p.pid ORDER BY p.pid DESC {$meta['limit']}"; $result = cpg_db_query($query); $rowset = cpg_db_fetch_rowset($result); mysql_free_result($result); build_caption($rowset); break; default: return $meta; } $meta['album_name'] = $album_name; $meta['count'] = $count; $meta['rowset'] = $rowset; return $meta; }
Copyright (c) 2003-2009 Coppermine Dev Team ************************************************* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. ******************************************** $HeadURL$ $Revision$ $LastChangedBy$ $Date$ **************************************************/ if (!defined('IN_COPPERMINE')) { die('Not in Coppermine...'); } if (annotate_get_level('permissions') < 2) { die('Access denied'); // Nobody will see that, as it's only for debugging purposes, so we can leave that string untranslated } $superCage = Inspekt::makeSuperCage(); if ($superCage->post->keyExists('add')) { $pid = $superCage->post->getInt('add'); $nid = $superCage->post->getInt('nid'); $posx = $superCage->post->getInt('posx'); $posy = $superCage->post->getInt('posy'); $width = $superCage->post->getInt('width'); $height = $superCage->post->getInt('height'); $note = addslashes(addslashes(urldecode(trim(str_replace('"', '\'', $superCage->post->getRaw('note')))))); $time = time(); if ($nid) { $sql = "UPDATE {$CONFIG['TABLE_PREFIX']}plugin_annotate SET posx = {$posx}, posy = {$posy}, width = {$width}, height = {$height}, note = '{$note}' WHERE nid = {$nid}";