$perform = 'suspended'; } $sql = "UPDATE photos SET status = '" . $status . "' WHERE PID = " . $PID . " LIMIT 1"; $conn->execute($sql); if ($conn->Affected_Rows() == 1) { $messages[] = 'Successfully ' . $perform . ' photo!'; } else { $errors[] = 'Failed to ' . $action . ' photo! Are you sure this photo exists?!'; } $remove = '&a=' . $action . '&PID=' . $PID; break; default: $errors[] = 'Invalid action. Allowed actions: delete, activate, suspend and unflag!'; } } $query = constructQuery(); $sql = $query['count']; $rs = $conn->execute($sql); $total_photos = $rs->fields['total_photos']; $pagination = new Pagination($query['page_items']); $limit = $pagination->getLimit($total_photos); $paging = $pagination->getAdminPagination($remove); $sql = $query['select'] . " LIMIT " . $limit; $rs = $conn->execute($sql); $photos = $rs->getrows(); function constructQuery() { global $smarty; $query = array(); $query_select = "SELECT p.*, s.username, f.*\n FROM photos AS p, signup AS s, photo_flags AS f\n WHERE p.PID = f.PID AND f.UID = s.UID"; $query_count = "SELECT COUNT(f.PID) AS total_photos\n FROM photos AS p, signup AS s, photo_flags AS f\n WHERE p.PID = f.PID AND f.UID = s.UID";
$messages[] = 'Successfully deleted user!'; break; case 'activate': case 'suspend': $act = $action == 'activate' ? 'Active' : 'Inactive'; $act_name = $action == 'activate' ? 'activated' : 'suspended'; $sql = "UPDATE signup SET account_status = '" . $act . "' WHERE UID = '" . mysql_real_escape_string($UID) . "' LIMIT 1"; $conn->execute($sql); $messages[] = 'User account ' . $act_name . ' successfuly!'; $remove = '&a=' . $action . '&UID=' . $UID; break; default: $errors[] = 'Invalid action. Allowed actions: delete, activated and suspend!'; } } $query = constructQuery($module_keep); $sql = $query['count']; $rs = $conn->execute($sql); $total_users = $rs->fields['total_users']; $pagination = new Pagination($query['page_items']); $limit = $pagination->getLimit($total_users); $paging = $pagination->getAdminPagination($remove); $sql = $query['select'] . " LIMIT " . $limit; $rs = $conn->execute($sql); $users = $rs->getrows(); function constructQuery() { global $smarty; $query = array(); $query_count = "SELECT COUNT(f.UID) AS total_users FROM signup AS u, users_flags AS f WHERE f.UID = u.UID"; $query_select = "SELECT u.*, f.RID, f.reason, f.message, f.addtime, f.flag_id\n FROM signup AS u, users_flags AS f\n WHERE f.UID = u.UID";