function DisplayAPIinfo(&$context, &$modSettings, $db_prefix, &$txt) { if (!$this->modSettings["tea_enable"]) { return; } return; loadLanguage('TEA'); $ID_MEMBER = $context['user']['id']; // Did we get the user by name... if (isset($_REQUEST['user'])) { $memberResult = loadMemberData($_REQUEST['user'], true, 'profile'); } elseif (!empty($_REQUEST['u'])) { $memberResult = loadMemberData((int) $_REQUEST['u'], false, 'profile'); } else { $memberResult = loadMemberData($ID_MEMBER, false, 'profile'); } if (!is_numeric($memberResult[0])) { die("Invalid User id"); } if ($ID_MEMBER == $memberResult[0]) { $allow = AllowedTo(array('tea_view_own', 'tea_view_any')); } else { $allow = AllowedTo('tea_view_any'); } if ($allow) { $api = $this->smcFunc['db_query']('', "SELECT userid, api, charid, status, status_change FROM {db_prefix}tea_api WHERE ID_MEMBER = " . $memberResult[0]); $api = $this->select($api); if (!empty($api)) { $api = $api[0]; } echo ' </tr><tr> <td><b>' . $this->txt['tea_userid_short'] . ': </b></td> <td>' . $api[0] . '</td> </tr><tr> <td><b>' . $this->txt['tea_api_short'] . ': </b></td> <td>' . $api[1] . '</td>'; } }
function DeletePicture2() { global $lang, $mybb, $db, $gallerySettings, $plugins; $id = intval($_REQUEST['id']); if (empty($id)) { fatal_error2($lang->gallery_error_no_pic_selected); } // Verify incoming POST request verify_post_check($mybb->get_input('my_post_key')); // Check if the user owns the picture or is admin $dbresult = $db->query("\n SELECT \n \tp.ID_PICTURE, p.filename, p.thumbfilename, p.ID_MEMBER \n FROM " . TABLE_PREFIX . "gallery_pic as p \n WHERE ID_PICTURE = {$id} LIMIT 1"); $row = $db->fetch_array($dbresult); $memID = $row['ID_MEMBER']; if (AllowedTo('manage') || AllowedTo('delete') && $mybb->user['uid'] == $memID) { //Delete Large image @unlink($gallerySettings['gallery_path'] . $row['filename']); //Delete Thumbnail @unlink($gallerySettings['gallery_path'] . $row['thumbfilename']); // Delete all the picture related db entries $db->query("DELETE FROM " . TABLE_PREFIX . "gallery_comment WHERE ID_PICTURE = {$id} LIMIT 1"); $db->query("DELETE FROM " . TABLE_PREFIX . "gallery_report WHERE ID_PICTURE = {$id} LIMIT 1"); // Delete the picture $db->query("DELETE FROM " . TABLE_PREFIX . "gallery_pic WHERE ID_PICTURE = {$id} LIMIT 1"); $plugins->run_hooks("gallery_delete_picture_completed"); // Redirect to the users image page. redirect('ezgallery.php?action=myimages&u=' . $mybb->user['uid']); } else { fatal_error2($lang->gallery_error_nodelete_permission); } }