function album_voting_vote_button($aid, $type = 1, $cat = false) { global $lang_plugin_album_voting; $superCage = Inspekt::makeSuperCage(); if (album_voting_user_voted($aid, $type)) { $text = $lang_plugin_album_voting['vote_remove']; $action = "0"; } else { $text = $lang_plugin_album_voting['vote_add']; $action = "1"; } $cat = $cat !== false ? '&cat=' . $cat : ''; $vote_button = "<a href=\"index.php?file=album_voting/vote&aid={$aid}&type={$type}&action={$action}{$cat}\" class=\"admin_menu\">{$text}</a>"; return $vote_button; }
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...'); } $aid = $superCage->get->getInt('aid'); $type = $superCage->get->getInt('type'); $cat = $superCage->get->keyExists('cat') ? $superCage->get->getInt('cat') : false; if (USER_ID) { $aid = $superCage->get->getInt('aid'); $type = $superCage->get->getInt('type'); $cat = $superCage->get->keyExists('cat') ? $superCage->get->getInt('cat') : false; if ($superCage->get->getInt('action') == 1) { if (!album_voting_user_voted($aid, $type)) { cpg_db_query("INSERT IGNORE INTO {$CONFIG['TABLE_PREFIX']}album_votes VALUES('{$aid}', '" . USER_ID . "', '{$type}', '" . time() . "')"); } } else { cpg_db_query("DELETE FROM {$CONFIG['TABLE_PREFIX']}album_votes WHERE aid = {$aid} AND type = {$type} AND user_id = " . USER_ID); } } if ($cat !== false) { header("Location: index.php?cat={$cat}"); } else { header("Location: thumbnails.php?album={$aid}"); }