function profile_items_get_by_page($psid, $page = 1) { if (!($db = db::get())) { return false; } if (!is_numeric($psid)) { return false; } if (!is_numeric($page) || $page < 1) { $page = 1; } $offset = calculate_page_offset($page, 10); if (!($table_prefix = get_table_prefix())) { return false; } $profile_items_array = array(); $sql = "SELECT SQL_CALC_FOUND_ROWS PIID, NAME, TYPE, OPTIONS, POSITION "; $sql .= "FROM `{$table_prefix}PROFILE_ITEM` WHERE PSID = '{$psid}' "; $sql .= "ORDER BY POSITION, PIID LIMIT {$offset}, 10"; if (!($result = $db->query($sql))) { return false; } $sql = "SELECT FOUND_ROWS() AS ROW_COUNT"; if (!($result_count = $db->query($sql))) { return false; } list($profile_items_count) = $result_count->fetch_row(); if ($result->num_rows == 0 && $profile_items_count > 0 && $page > 1) { return profile_items_get_by_page($psid, $page - 1); } while ($profile_item = $result->fetch_assoc()) { $profile_items_array[] = $profile_item; } return array('profile_items_array' => $profile_items_array, 'profile_items_count' => $profile_items_count); }
echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\"> </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"center\">", form_submit("edititemsubmit", gettext("Save")), " ", form_submit("delete", gettext("Delete")), " ", form_submit("cancel", gettext("Cancel")), "</td>\n"; echo " </tr>\n"; echo " </table>\n"; html_display_warning_msg(gettext("To create Radio Buttons or a Drop Down List you need to enter each individual value on a separate line in the Options field."), '700', 'center'); html_display_warning_msg(gettext("To create clickable links enter the URL in the Options field and use <i>[ProfileEntry]</i> where the entry from the user's profile should appear. Examples: <p>MySpace: <i>http://www.myspace.com/[ProfileEntry]</i><br />Xbox LIVE: <i>http://profile.mygamercard.net/[ProfileEntry]</i></p>"), '700', 'center'); echo "</form>\n"; echo "</div>\n"; html_draw_bottom(); } else { html_draw_top(array('title' => sprintf(gettext('Admin - Manage Profile Sections - %s - View Items'), profile_section_get_name($psid)), 'class' => 'window_title', 'main_css' => 'admin.css')); $profile_items = profile_items_get_by_page($psid, $page); echo "<h1>", gettext("Admin"), html_style_image('separator'), gettext("Manage Profile Sections"), html_style_image('separator'), profile_section_get_name($psid), html_style_image('separator'), gettext("View items"), "</h1>\n"; if (isset($error_msg_array) && sizeof($error_msg_array) > 0) { html_display_error_array($error_msg_array, '86%', 'center'); } else { if (isset($_GET['added'])) { html_display_success_msg(gettext("Successfully added new profile item"), '86%', 'center'); } else { if (isset($_GET['edited'])) { html_display_success_msg(gettext("Successfully edited profile item"), '86%', 'center'); } else { if (isset($_GET['deleted'])) { html_display_success_msg(gettext("Successfully removed selected profile items"), '86%', 'center'); } else { if (sizeof($profile_items['profile_items_array']) < 1) { html_display_warning_msg(gettext("There are no existing profile items in this section. To add an item click the 'Add New' button below."), '86%', 'center');