/** * display * * @return void */ public function display() { $this->setAvatarTypes(); if (!$this->getAvatarData()) { $this->fcmsError->displayError(); return; } $avatarOptions = buildHtmlSelectOptions($this->avatarTypes, $this->data['currentAvatarType']); echo ' <form id="frm" name="frm" enctype="multipart/form-data" action="profile.php?view=picture" method="post"> <fieldset> <legend><span>' . T_('Profile Picture') . '</span></legend> <div class="field-row"> <div class="field-label"> <label for="avatar"><b>' . T_('Change Avatar') . '</b></label> </div> <div class="field-widget"> <select name="avatar_type" id="avatar_type"> ' . $avatarOptions . ' </select><br/> </div> </div> <div id="fcms" class="field-row">'; $this->displayUploadArea(); echo ' </div> <div id="gravatar" class="field-row"> <div class="field-label"> </div> <div class="field-widget"> <b>' . T_('Gravatar Email') . '</b><br/> <input type="text" name="gravatar_email" size="30" value="' . cleanOutput($this->data['gravatar']) . '"/><br/> </div> </div> <div id="default" class="field-row"> <div class="field-label"> </div> <div class="field-widget"> <b>' . T_('Default') . '</b><br/> <img id="current-avatar" src="' . getAvatarPath('no_avatar.jpg', '') . '" alt="' . T_('Default avatar.') . '"/> </div> </div> <div class="field-row"> <div class="field-label"> <label for="avatar"><b>' . T_('Current Avatar') . '</b></label> </div> <div class="field-widget"> <img id="current-avatar" src="' . getCurrentAvatar($this->fcmsUser->id) . '" alt="' . T_('This is your current avatar.') . '"/> </div> </div> <p><input class="sub1" type="submit" name="submit" id="submit-avatar" value="' . T_('Submit') . '"/></p> </fieldset> </form>'; }
/** * displayEditPhotoForm * * Displays a form for editing a photo. * * @param int $photo the photo id of the photo you want to edit * @param string $url optional -- the url to go back to after form is submitted * @return void */ function displayEditPhotoForm($photo, $url = '') { $photo = (int) $photo; $sql = "SELECT p.`id`, p.`user`, p.`filename`, p.`caption`, c.`name`, c.`id` AS category_id, p.`external_id`, e.`thumbnail`\n FROM `fcms_gallery_photos` AS p\n LEFT JOIN `fcms_category` AS c ON p.`category` = c.`id`\n LEFT JOIN `fcms_gallery_external_photo` AS e ON p.`external_id` = e.`id`\n WHERE p.`id` = ?"; $row = $this->fcmsDatabase->getRow($sql, $photo); if ($row === false) { $this->fcmsError->displayError(); return; } if (!empty($row)) { $_SESSION['photo-path-data'][$row['id']] = array('id' => $row['id'], 'user' => $row['user'], 'filename' => $row['filename'], 'external_id' => $row['external_id'], 'thumbnail' => $row['thumbnail']); $photo_user = (int) $row['user']; $filename = basename($row['filename']); $caption = cleanOutput($row['caption']); $cat_name = cleanOutput($row['name']); $cat_id = cleanOutput($row['category_id']); $photoSrc = $this->getPhotoSource($row); $categories = $this->getUserCategories($photo_user); $cat_options = buildHtmlSelectOptions($categories, $cat_id); $prev_tagged = array(); $members = array(); $autocomplete_selected = ''; // Setup the list of users already tagged $sql = "SELECT `id`, `user` \n FROM `fcms_gallery_photos_tags` \n WHERE `photo` = ?"; $rows = $this->fcmsDatabase->getRows($sql, $photo); if ($rows === false) { $this->fcmsError->displayError(); return; } foreach ($rows as $r) { $prev_tagged[$r['user']] = 1; } // Setup the list of active members for possible tags $sql = "SELECT `id` \n FROM `fcms_users` \n WHERE `activated` > 0\n ORDER BY `fname`, `lname`"; $rows = $this->fcmsDatabase->getRows($sql, $photo); if ($rows === false) { $this->fcmsError->displayError(); return; } $autocompleteList = ''; foreach ($rows as $r) { $name = cleanOutput(getUserDisplayName($r['id'], 2)); $autocompleteList .= '{ data: "' . $r['id'] . '", value: "' . $name . '" }, '; $members[$r['id']] = $name; } $autocompleteList = substr($autocompleteList, 0, -2); // remove the extra comma space at the end // handle previously tagged members if (count($prev_tagged) > 0) { foreach ($prev_tagged as $id => $name) { $prev_tagged_options .= '<input type="hidden" name="prev_tagged_users[]" value="' . $id . '"/>'; $prev_tagged_options .= '<input type="hidden" name="tagged[]" class="tagged" value="' . $id . '"/>'; $autocomplete_selected .= '<li>' . $members[$id] . '<a href="#" alt="' . $id . '" onclick="removeTagged(this)">x</a></li>'; } } // Display the form echo ' <fieldset> <legend><span>' . T_('Edit Photo') . '</span></legend> <img class="thumbnail" src="' . $photoSrc . '"/> <form id="autocomplete_form" enctype="multipart/form-data" action="index.php?' . $url . '" method="post"> <div class="field-row"> <div class="field-label"><label><b>' . T_('Change Category') . '</b></label></div> <div class="field-widget"> <select class="frm_sel" name="category" tabindex="1"> ' . $cat_options . ' </select> </div> </div> <div class="field-row"> <div class="field-label"><label><b>' . T_('Caption') . '</b></label></div> <div class="field-widget"> <input class="frm_text" type="text" name="photo_caption" size="50" tabindex="2" value="' . $caption . '"/> </div> </div> <div class="field-row"> <div class="field-label"><label><b>' . T_('Who is in this Photo?') . '</b></label></div> <div class="field-widget"> <input type="text" id="autocomplete_input" class="frm_text autocomplete_input" autocomplete="off" size="50" tabindex="3"/> <div id="autocomplete_instructions" class="autocomplete_instructions"> ' . T_('Type name of person...') . ' </div> <ul id="autocomplete_selected" class="autocomplete_selected"> ' . $autocomplete_selected . ' </ul> <div id="autocomplete_search" class="autocomplete_search" style="display:none"></div> <script type="text/javascript"> $(document).ready(function() { var users = [ ' . $autocompleteList . ' ]; $("#autocomplete_input").autocomplete({ lookup: users, showNoSuggestionNotice: true, noSuggestionNotice: "' . T_('No users found') . '", tabDisabled: true, onSelect: function (suggestion) { $("#autocomplete_instructions").hide(); $("#autocomplete_form").append( "<input type=\\"hidden\\" name=\\"tagged[]\\" class=\\"tagged\\" value=\\"" + suggestion.data + "\\">" ); $("#autocomplete_input").val("").focus(); $("#autocomplete_selected").append( "<li>" + suggestion.value + "<a href=\\"#\\" alt=\\"" + suggestion.data + "\\" " + "onclick=\\"removeTagged(this);\\">x</a></li>" ); } }); }); </script> </div> </div> <p> ' . $prev_tagged_options . ' <input type="hidden" name="photo_id" id="photo_id" value="' . $photo . '"/> <input class="sub1" type="submit" name="add_editphoto" value="' . T_('Edit') . '"/> ' . T_('or') . ' <a href="index.php?' . $url . '">' . T_('Cancel') . '</a> </p> </form> </fieldset>'; } else { echo ' <p class="error-alert">' . T_('Could not edit Photo. Photo ID does not exist.') . '</p>'; } }
/** * displayEditForm * * Displays the form to edit an existing calendar event. * * @param int $id * @return void */ function displayEditForm($id) { $id = (int) $id; $sql = "SELECT `id`, `date`, `time_start`, `time_end`, `date_added`, \n `title`, `desc`, `created_by`, `category`, `repeat`, `private`, `invite`\n FROM `fcms_calendar` \n WHERE `id` = ?\n LIMIT 1"; $row = $this->fcmsDatabase->getRow($sql, $id); if ($row === false) { $this->fcmsError->displayError(); return; } // Make sure then can edit this event if ($this->fcmsUser->access > 1 and $row['created_by'] != $this->fcmsUser->id) { echo ' <div class="error-alert">' . T_('You do not have permission to perform this task.') . '</div>'; return; } list($year, $month, $day) = explode('-', $row['date']); for ($i = 1; $i <= 31; $i++) { $days[$i] = $i; } for ($i = 1; $i <= 12; $i++) { $months[$i] = getMonthAbbr($i); } for ($i = 1900; $i <= date('Y') + 5; $i++) { $years[$i] = $i; } $times = $this->getTimesList(); $title = cleanOutput($row['title']); $desc = cleanOutput($row['desc']); $allDayChk = empty($row['time_start']) ? 'checked="checked"' : ''; // Setup category field $sql = "SELECT *\n FROM `fcms_category` \n WHERE `type` = 'calendar'"; $rows = $this->fcmsDatabase->getRows($sql); if ($rows === false) { $this->fcmsError->displayError(); return; } $choose = ''; foreach ($rows as $r) { if ($r['name'] == '') { $choose = '<option value="' . $r['id'] . '"></option>'; } else { $categories[$r['id']] = $r['name']; } } $repeatChk = $row['repeat'] == 'yearly' ? 'checked="checked"' : ''; $privateChk = $row['private'] == 1 ? 'checked="checked"' : ''; $inviteChk = $row['invite'] == 1 ? 'checked="checked"' : ''; // Display the form echo ' <form id="frm" method="post" action="calendar.php"> <fieldset> <legend><span>' . T_('Edit Event') . '</span></legend> <div class="field-row"> <div class="field-label"><label for="title"><b>' . T_('Event') . '</b></label></div> <div class="field-widget"> <input type="text" id="title" name="title" size="40" value="' . $title . '"/> <script type="text/javascript"> var ftitle = new LiveValidation(\'title\', { onlyOnSubmit: true}); ftitle.add(Validate.Presence, {failureMessage: ""}); </script> </div> </div> <div class="field-row"> <div class="field-label"><label for="desc"><b>' . T_('Description') . '</b></label></div> <div class="field-widget"> <input type="text" id="desc" name="desc" size="50" value="' . $desc . '"/> </div> </div> <div class="field-row"> <div class="field-label"><label for="sday"><b>' . T_('Date') . '</b></label></div> <div class="field-widget"> <select id="sday" name="sday"> ' . buildHtmlSelectOptions($days, $day) . ' </select> <select id="smonth" name="smonth"> ' . buildHtmlSelectOptions($months, $month) . ' </select> <select id="syear" name="syear"> ' . buildHtmlSelectOptions($years, $year) . ' </select> </div> </div> <div id="time" class="field-row"> <div class="field-label"><label for="sday"><b>' . T_('Time') . '</b></label></div> <div class="field-widget"> <select id="timestart" name="timestart"> <option></option> ' . buildHtmlSelectOptions($times, $row['time_start']) . ' </select> ' . T_('through') . ' <select id="timeend" name="timeend"> <option></option> ' . buildHtmlSelectOptions($times, $row['time_end']) . ' </select> <input id="all-day" named="all-day" type="checkbox" onclick="toggleDisable($(\'#timestart\'), $(\'#timeend\'))" ' . $allDayChk . '/> <label for="all-day">' . T_('All Day') . '</label> </div> </div> <div class="field-row"> <div class="field-label"><label for="category"><b>' . T_('Category') . '</b></label></div> <div class="field-widget"> <select id="category" name="category"> ' . $choose . ' ' . buildHtmlSelectOptions($categories, $row['category']) . ' </select> </div> </div> <div class="field-row"> <div class="field-label"><label for="repeat-yearly"><b>' . T_('Repeat (Yearly)') . '</b></label></div> <div class="field-widget"> <input type="checkbox" name="repeat-yearly" id="repeat-yearly" ' . $repeatChk . '/> </div> </div> <div class="field-row"> <div class="field-label"><label for="private"><b>' . T_('Private?') . '</b></label></div> <div class="field-widget"> <input type="checkbox" name="private" id="private" ' . $privateChk . '/> </div> </div> <div class="field-row"> <div class="field-label"><label for="invite"><b>' . T_('Invite Guests?') . '</b></label></div> <div class="field-widget"> <input type="checkbox" name="invite" id="invite" ' . $inviteChk . '/> </div> </div> <p> <input type="hidden" name="id" value="' . $id . '"/> <input class="sub1" type="submit" name="edit" value="' . T_('Edit') . '"/> <input class="sub2" type="submit" id="delcal" name="delete" value="' . T_('Delete') . '"/> ' . T_('or') . ' <a href="calendar.php?year=' . $year . '&month=' . $month . '&day=' . $day . '">' . T_('Cancel') . '</a> </p> </form> </fieldset>'; }
/** * getCategoryInputs * * @return string */ protected function getCategoryInputs() { $categories = $this->getUserCategories(); // We have existing categories if (count($categories) > 0) { return ' <input class="frm_text" type="text" id="new-category" name="new-category" size="35"/> <select id="existing-categories" name="category"> <option value="0"> </option> ' . buildHtmlSelectOptions($categories, '') . ' </select>'; } else { return ' <input class="frm_text" type="text" id="new-category" name="new-category" size="50"/>'; } }
/** * displayComposeForm * * @return void */ function displayComposeForm() { $this->displayHeader(); $id = ''; $title = ''; if (isset($_GET['id'])) { $id = (int) $_GET['id']; } if (isset($_GET['title'])) { $title = strip_tags($_GET['title']); $title = 'RE: ' . cleanOutput($title); } $sql = "SELECT `id`\n FROM `fcms_users` \n WHERE `activated` > 0\n AND `phpass` != 'NONMEMBER'"; $rows = $this->fcmsDatabase->getRows($sql); if ($rows === false) { $this->fcmsError->displayError(); $this->displayFooter(); return; } // TODO - optimize sql query above to get display name info instead foreach ($rows as $r) { $displayNameList[$r['id']] = getUserDisplayName($r['id'], 2); } asort($displayNameList); $user_options = buildHtmlSelectOptions($displayNameList, $id); echo ' <script type="text/javascript" src="ui/js/livevalidation.js"></script> <form method="post" id="newpmform" action="privatemsg.php"> <fieldset> <legend><span>' . T_('New PM') . '</span></legend> <div> <label for="title">' . T_('Subject') . '</label>: <input type="text" id="title" name="title" size="50" value="' . $title . '"/> </div><br/> <script type="text/javascript"> var ftitle = new LiveValidation(\'title\', { onlyOnSubmit: true }); ftitle.add(Validate.Presence, { failureMessage: "" }); </script> <div> <label for="to">' . T_('To') . '</label>: <select name="to"> ' . $user_options . ' </select> </div><br/> <script type="text/javascript">var bb = new BBCode();</script>'; displayBBCodeToolbar(); echo ' <div><textarea name="post" id="post" rows="10" cols="63"></textarea></div> <script type="text/javascript">bb.init(\'post\');</script> <script type="text/javascript"> var fpost = new LiveValidation(\'post\', { onlyOnSubmit: true }); fpost.add(Validate.Presence, { failureMessage: "" }); </script> <p> <input class="sub1" type="submit" name="submit" value="' . T_('Send') . '"/> <a href="privatemsg.php">' . T_('Cancel') . '</a> </p> </fieldset> </form> <p> </p>'; $this->displayFooter(); }
/** * displayAddForm * * Displays the form for adding an address. * * @return void */ function displayAddForm() { $country_list = buildCountryList(); $selected = getDefaultCountry(); $country_options = buildHtmlSelectOptions($country_list, $selected); $validator = new FormValidator(); // TODO // Make this a removable alert message (part of Alerts table) echo ' <form id="addressbook_form" action="addressbook.php" method="post"> <p class="info-alert"> ' . T_('Please only add addresses for Non-members. Anyone who is a member of this website must add/update their own address.') . ' </p> <fieldset> <legend><span>' . T_('Add Address') . '</span></legend> <div class="field-row"> <div class="field-label"><label for="fname"><b>' . T_('First Name') . '</b></label></div> <div class="field-widget"><input class="frm_text" type="text" name="fname" id="fname" size="25"/></div> </div> <div class="field-row"> <div class="field-label"><label for="lname"><b>' . T_('Last Name') . '</b></label></div> <div class="field-widget"><input class="frm_text" type="text" name="lname" id="lname" size="25"/></div> </div> <div class="field-row"> <div class="field-label"><label for="email"><b>' . T_('Email') . '</b></label></div> <div class="field-widget"><input class="frm_text" type="text" name="email" id="email" size="50"/></div> </div> <div class="field-row"> <div class="field-label"><label for="country"><b>' . T_('Country') . '</b></label></div> <div class="field-widget"> <select name="country" id="country"> <option></option> <option value="US">' . T_('UNITED STATES') . '</option> <option>------</option> ' . $country_options . ' </select> </div> </div> <div class="field-row"> <div class="field-label"><label for="address"><b>' . T_('Street Address') . '</b></label></div> <div class="field-widget"><input class="frm_text" type="text" name="address" id="address" size="25"/></div> </div> <div class="field-row"> <div class="field-label"><label for="city"><b>' . T_('City') . '</b></label></div> <div class="field-widget"><input class="frm_text" type="text" name="city" id="city" size="50"/></div> </div> <div class="field-row"> <div class="field-label"><label for="state"><b>' . T_('State') . '</b></label></div> <div class="field-widget"><input class="frm_text" type="text" name="state" id="state" size="50"/></div> </div> <div class="field-row"> <div class="field-label"><label for="zip"><b>' . T_('Zip Code') . '</b></label></div> <div class="field-widget"><input class="frm_text" type="text" name="zip" id="zip" size="10"/></div> </div> <div class="field-row"> <div class="field-label"><label for="home"><b>' . T_('Home Phone') . '</b></label></div> <div class="field-widget"><input class="frm_text" type="text" name="home" id="home" size="20"/></div> </div> <div class="field-row"> <div class="field-label"><label for="work"><b>' . T_('Work Phone') . '</b></label></div> <div class="field-widget"><input class="frm_text" type="text" name="work" id="work" size="20"/></div> </div> <div class="field-row"> <div class="field-label"><label for="cell"><b>' . T_('Cell Phone') . '</b></label></div> <div class="field-widget"><input class="frm_text" type="text" name="cell" id="cell" size="20"/></div> </div> <div class="field-row"> <div class="field-label"><label for="private"><b>' . T_('Private') . '</b></label></div> <div class="field-widget"><input type="checkbox" name="private" id="private"/></div> </div> <p> <input class="sub1" type="submit" name="addsubmit" value="' . T_('Add') . '"/> ' . T_('or') . ' <a href="addressbook.php">' . T_('Cancel') . '</a> </p> </fieldset> ' . $validator->getJsValidation($this->getProfile('add')) . ' </form>'; }
/** * displayCreateUserForm * * Displays the form for creating a new user to be added to the family tree * * @param string $type * @param int $userId * * @return void */ function displayCreateUserForm($type, $userId) { $userId = (int) $userId; $displayname = getUserDisplayName($userId, 2); switch ($type) { case 'father': $sex = 'M'; $legend = sprintf(T_('Add New Father for %s'), $displayname); $options = $this->getAddFatherMotherAdditionalOptions($userId, $type); break; case 'mother': $sex = 'F'; $legend = sprintf(T_('Add New Mother for %s'), $displayname); $options = $this->getAddFatherMotherAdditionalOptions($userId, $type); break; case 'brother': $sex = 'M'; $legend = sprintf(T_('Add New Brother for %s'), $displayname); $options = $this->getAddBrotherSisterAdditionalOptions($userId); break; case 'sister': $sex = 'F'; $legend = sprintf(T_('Add New Sister for %s'), $displayname); $options = $this->getAddBrotherSisterAdditionalOptions($userId); break; case 'spouse': $sex = '?'; $legend = sprintf(T_('Add New Spouse for %s'), $displayname); $options = $this->getAddSpouseAdditionalOptions($userId); break; case 'child': $sex = '?'; $legend = sprintf(T_('Add New Child for %s'), $displayname); $options = $this->getAddChildAdditionalOptions($userId); break; default: echo ' <div class="error-alert">' . T_('Invalid Display Type') . '</div>'; return; } if ($options === false) { $this->fcmsError->displayError(); return; } $dayList = array(); $i = 1; while ($i <= 31) { $dayList[$i] = $i; $i++; } $monthList = array(); $i = 1; while ($i <= 12) { $monthList[$i] = getMonthAbbr($i); $i++; } $validator = new FormValidator(); echo ' <form action="familytree.php?create=submit" method="post"> <fieldset class="relationship-form"> <legend><span>' . $legend . '</span></legend> <div class="cols"> <div> <label for="fname"><b>' . T_('First Name') . '</b></label><br/> <input class="frm_text" type="text" name="fname" id="fname" size="25"/> </div> <div> <label for="mname"><b>' . T_('Middle Name') . '</b></label><br/> <input class="frm_text" type="text" name="mname" id="mname" size="25"/> </div> <div> <label for="lname"><b>' . T_('Last Name') . '</b></label><br/> <input class="frm_text" type="text" name="lname" id="lname" size="25"/> </div> </div>'; // don't show maiden name unless it's needed if ($sex == 'F' || $sex == '?') { echo ' <p class="maiden-name"> <label for="maiden"><b>' . T_('Maiden Name') . '</b></label><br/> <input class="frm_text" type="text" name="maiden" id="maiden" size="25"/> </p>'; } // We don't know the sex of the child or spouse, but we do for all other relationships if ($sex === '?') { echo ' <p> <label><b>' . T_('Sex') . '</b></label><br/> <select id="sex" name="sex"> ' . buildHtmlSelectOptions(array('M' => T_('Male'), 'F' => T_('Female')), '-1') . ' </select> </p>'; } else { echo '<div><input type="hidden" id="sex" name="sex" value="' . $sex . '"/></div>'; } echo ' <p id="living_deceased" style="display:none;"> <label for="living_option" class="radio_label"> <input type="radio" id="living_option" name="living_deceased_options" checked="checked" value="1"/> ' . T_('Living') . ' </label> <label for="deceased_option" class="radio_label"> <input type="radio" id="deceased_option" name="living_deceased_options" value="1"/> ' . T_('Deceased') . ' </label> </p> <div class="dob_dod"> <div class="half"> <label for="day"><b>' . T_('Birthday') . '</b></label><br/> <select id="bday" name="bday"> <option value="">' . T_('Day') . '</option> ' . buildHtmlSelectOptions($dayList, "") . ' </select> <select id="bmonth" name="bmonth"> <option value="">' . T_('Month') . '</option> ' . buildHtmlSelectOptions($monthList, "") . ' </select> <input class="frm_text" type="text" name="byear" id="byear" size="5" maxlength="4" placeholder="' . T_('Year') . '"/> </div> <div id="deceased" class="half"> <label for="day"><b>' . T_('Date Deceased') . '</b></label><br/> <select id="dday" name="dday"> <option value="">' . T_('Day') . '</option> ' . buildHtmlSelectOptions($dayList, "") . ' </select> <select id="dmonth" name="dmonth"> <option value="">' . T_('Month') . '</option> ' . buildHtmlSelectOptions($monthList, "") . ' </select> <input class="frm_text" type="text" name="dyear" id="dyear" size="5" maxlength="4" placeholder="' . T_('Year') . '"/> </div> </div> ' . $options . ' ' . $validator->getJsValidation($this->getProfile('create')) . ' <p> <input type="hidden" id="id" name="id" value="' . $userId . '"/> <input type="hidden" id="type" name="type" value="' . cleanOutput($type) . '"/> <input class="sub1" type="submit" id="submit" name="submit" value="' . T_('Add') . '"/> <a href="familytree.php?view=' . $this->currentTreeUserId . '">' . T_('Cancel') . '</a> </p> </fieldset> </form>'; }
/** * displayPhotoGalleryForm * * @return void */ function displayPhotoGalleryForm() { $this->displayHeader(); $sql = "SELECT `name`, `value`\n FROM `fcms_config`"; $rows = $this->fcmsDatabase->getRows($sql); if ($rows === false) { $this->fcmsError->displayError(); $this->displayFooter(); return; } $row = array(); foreach ($rows as $r) { $row[$r['name']] = $r['value']; } $full_size_list = array('0' => T_('Off (2 photos)'), '1' => T_('On (3 photos)')); $full_size_options = buildHtmlSelectOptions($full_size_list, $row['full_size_photos']); if (defined('UPLOADS')) { $protected = '<span class="label success">' . T_('Protected') . '</span>'; } else { $protected = '<span class="label warning">' . T_('Un-protected') . '</span><br/><br/>'; $protected .= '<p><b>' . T_('Your photos can be viewed from non-authorized users.') . '</b></p>'; $protected .= '<p>' . T_('In order to protect your photos so only logged in users can view them, please refer to the help document below.') . '</p>'; $protected .= '<p><a href="' . URL_PREFIX . 'help.php?topic=admin#adm-protect-photos">' . T_('Help Me Protect My Photos') . '</a></p>'; } $message = ''; if (isset($_SESSION['success'])) { $message = '<div class="alert-message success">'; $message .= '<a class="close" href="#" onclick="$(this).up(\'div\').hide(); return false;">×</a>'; $message .= T_('Changes Updated Successfully') . '</div>'; unset($_SESSION['success']); } echo ' <form action="config.php?view=gallery" method="post"> <fieldset> <legend>' . T_('Photo Gallery') . '</legend> ' . $message . ' <div class="clearfix"> <label for="full_size_photos">' . T_('Full Size Photos') . '</label> <div class="input"> <select name="full_size_photos"> ' . $full_size_options . ' </select><br/><br/> <span class="help-block"> ' . T_('By default, Full Sized Photos is turned off to save on storage space and bandwidth. Turning this feature on can eat up significant space and bandwith.') . ' </span> </div> </div> <div class="clearfix"> <label for="protected">' . T_('Protected Photos') . '</label> <div class="input"> ' . $protected . ' </div> </div> <div class="actions"><input type="submit" class="btn primary" id="submit-gallery" name="submit-gallery" value="' . T_('Save') . '"/></div> </div> </fieldset> </form>'; $this->displayFooter(); }
/** * displaySchedulerPage * * @return void */ function displaySchedulerPage() { $this->displayHeader(); if (isset($_SESSION['schedule_edit'])) { displayOkMessage(); unset($_SESSION['schedule_edit']); } $this->fcmsAlert->displayScheduler($this->fcmsUser->id); // Check job running status $sql = "SELECT `value` AS 'running_job'\n FROM `fcms_config`\n WHERE `name` = 'running_job'"; $status = $this->fcmsDatabase->getRow($sql); if ($status === false) { $this->fcmsError->displayError(); $this->displayFooter(); return; } if ($status['running_job'] > 0) { echo ' <div class="alert-message block-message warning"> <h2>' . T_('A scheduled job is currently running.') . '</h2> <p>' . T_('Most jobs take less than an hour to complete, if the last successfull run for a scheduled job below is over an hour ago, their may be a problem with the current job.') . '</p> <p>' . T_('To debug this job:') . '</p> <ol> <li>' . T_('Turn on debugging.') . '</li> <li>' . T_('Reset the running job flag.') . '</p> </ol> <p> <a class="btn small" href="?running_job=off">' . T_('Set running job flag to off.') . '</a> ' . T_('(only if you know what you are doing)') . ' </p> </div>'; } // Get schedules $sql = "SELECT `id`, `type`, `repeat`, `lastrun`, `status`\n FROM `fcms_schedule`"; $rows = $this->fcmsDatabase->getRows($sql); if ($rows === false) { $this->fcmsError->displayError(); $this->displayFooter(); return; } echo ' <form id="scheduler-frm" action="scheduler.php" method="post"> <table class="sortable"> <thead> <tr> <th>' . T_('ID') . '</th> <th>' . T_('Type') . '</th> <th>' . T_('Frequency') . '</th> <th>' . T_('Last Run') . '</th> <th>' . T_('Status') . '</th> <th class="nosort"></th> </tr> </thead> <tbody>'; // This shouldn't happen if (count($rows) <= 0) { echo ' <tr> <td colspan="6" style="text-align:center"> <p>' . T_('No schedules found.') . ' <a href="?restore=schedules">' . T_('Restore missing schedules.') . '</a></p> </td> </tr> </tbody> </table> </form>'; $this->displayFooter(); return; } $onOff = array('1' => T_('On'), '0' => T_('Off')); $frequency = array('hourly' => T_('Hourly'), 'daily' => T_('Daily')); $setupCron = ''; foreach ($rows as $row) { $id = cleanOutput($row['id']); $type = cleanOutput($row['type']); $lastrun = cleanOutput($row['lastrun']); $statusOptions = buildHtmlSelectOptions($onOff, $row['status']); $repeatOptions = buildHtmlSelectOptions($frequency, $row['repeat']); $status = '<span class="label important">' . T_('Off') . '</span>'; if ($row['status'] == 1) { $status = '<span class="label success">' . T_('On') . '</span>'; } if ($lastrun == '0000-00-00 00:00:00') { $lastrun = '<i>' . T_('never') . '</i>'; } else { $tzOffset = getTimezone($this->fcmsUser->id); $lastrun = fixDate('Y-m-d h:i:s', $tzOffset, $lastrun); } $cronFreq = $row['repeat'] == 'daily' ? '0 0 * * *' : '0 * * * *'; $setupCron .= '<pre class="cron-example">' . $cronFreq . ' php -q ' . ROOT . 'cron.php job_type=' . $type . '</pre>'; echo ' <tr> <td> ' . $id . ' <input type="hidden" name="id[]" id="id" value="' . $id . '"> </td> <td>' . $type . '</td> <td> <select name="repeat[]" id="schedule_status" class="span4"> ' . $repeatOptions . ' </select> </td> <td>' . $lastrun . '</td> <td> <select name="status[]" id="schedule_status" class="span2"> ' . $statusOptions . ' </select> </td> <td>' . $status . '</td> </tr>'; } echo ' </tbody> </table> <div class="actions"> <input class="btn primary" type="submit" name="save" id="save" value="' . T_('Save Changes') . '"/> </div> </form> <p> </p> <h2>' . T_('Set up Cron') . '</h2> <p>' . T_('Set up a new crontab for each of the following commands.') . '</p> ' . $setupCron; $this->displayFooter(); }
/** * displayEditBasicInfo * * @return void */ function displayEditBasicInfo() { $sql = "SELECT `fname`, `mname`, `lname`, `maiden`, `bio`, `sex`, \n `dob_year`, `dob_month`, `dob_day`\n FROM `fcms_users`\n WHERE `id` = '" . $this->fcmsUser->id . "'"; $row = $this->fcmsDatabase->getRow($sql, $this->fcmsUser->id); if ($row === false) { $this->fcmsError->displayError(); return; } // Gender $gender_options = buildHtmlSelectOptions(array('M' => T_('Male'), 'F' => T_('Female')), $row['sex']); // Birthday $day_list = array(); $i = 1; while ($i <= 31) { $day_list[$i] = $i; $i++; } $day_options = buildHtmlSelectOptions($day_list, $row['dob_day']); $month_list = array(); $i = 1; while ($i <= 12) { $month_list[$i] = getMonthAbbr($i); $i++; } $month_options = buildHtmlSelectOptions($month_list, $row['dob_month']); $year_list = array(); $i = 1900; $year_end = fixDate('Y', $this->fcmsUser->tzOffset); while ($i <= $year_end) { $year_list[$i] = $i; $i++; } $year_options = buildHtmlSelectOptions($year_list, $row['dob_year']); echo ' <div id="sections_menu"> <ul> <li><a href="profile.php">' . T_('View Stats') . '</a></li> <li><a href="?view=info">' . T_('Basic Information') . '</a></li> <li><a href="?view=picture">' . T_('Profile Picture') . '</a></li> <li><a href="?view=address">' . T_('Address / Contact') . '</a></li> </ul> </div> <div id="leftcolumn"> <ul class="menu"> <li><a href="#section-name">' . T_('Name') . '</a></li> <li><a href="#section-bio">' . T_('Bio') . '</a></li> <li><a href="#section-gender">' . T_('Gender') . '</a></li> <li><a href="#section-birthday">' . T_('Birthday') . '</a></li> </ul> </div> <div id="maincolumn"> <script type="text/javascript" src="ui/js/livevalidation.js"></script> <form id="frm" action="profile.php?view=info" method="post"> <fieldset id="section-name"> <legend><span>' . T_('Name') . '</span></legend> <div class="field-row"> <div class="field-label"><label for="fname"><b>' . T_('First') . '</b></label></div> <div class="field-widget"> <input type="text" name="fname" size="50" id="fname" value="' . cleanOutput($row['fname']) . '"/> </div> </div> <script type="text/javascript"> var ffname = new LiveValidation(\'fname\', { onlyOnSubmit: true }); ffname.add(Validate.Presence, {failureMessage: "' . T_('Sorry, but this information is required.') . '"}); </script> <div class="field-row"> <div class="field-label"><label class="optional" for="mname"><b>' . T_('Middle') . '</b></label></div> <div class="field-widget"> <input type="text" name="mname" size="50" id="mname" value="' . cleanOutput($row['mname']) . '"/> </div> </div> <div class="field-row"> <div class="field-label"><label for="lname"><b>' . T_('Last') . '</b></label></div> <div class="field-widget"> <input type="text" name="lname" size="50" id="lname" value="' . cleanOutput($row['lname']) . '"/> </div> </div> <script type="text/javascript"> var flname = new LiveValidation(\'lname\', { onlyOnSubmit: true }); flname.add(Validate.Presence, {failureMessage: "' . T_('Sorry, but this information is required.') . '"}); </script> <div class="field-row"> <div class="field-label"><label class="optional" for="maiden"><b>' . T_('Maiden') . '</b></label></b></div> <div class="field-widget"> <input type="text" name="maiden" size="50" id="maiden" value="' . cleanOutput($row['maiden']) . '"/> </div> </div> </fieldset> <fieldset id="section-bio"> <legend><span>' . T_('Bio') . '</span></legend> <div class="field-row"> <div class="field-label"><label class="optional" for="bio"><b>' . T_('Bio') . '</b></label></div> <div class="field-widget"> <textarea name="bio" id="bio" cols="40" rows="5">' . $row['bio'] . '</textarea> </div> </div> </fieldset> <fieldset id="section-gender"> <legend><span>' . T_('Gender') . '</span></legend> <div class="field-row"> <div class="field-label"><b><label for="sex">' . T_('Gender') . '</label></b></div> <div class="field-widget"> <select id="sex" name="sex"> ' . $gender_options . ' </select> </div> </div> <script type="text/javascript"> var fsex = new LiveValidation(\'sex\', { onlyOnSubmit: true }); fsex.add(Validate.Presence, {failureMessage: "' . T_('Sorry, but this information is required.') . '"}); </script> </fieldset> <fieldset id="section-birthday"> <legend><span>' . T_('Birthday') . '</span></legend> <div class="field-row"> <div class="field-label"><label for="sday"><b>' . T_('Birthday') . '</b></label></div> <div class="field-widget"> <select id="sday" name="sday"> <option value="">' . T_('Day') . '</option> ' . $day_options . ' </select> <select id="smonth" name="smonth"> <option value="">' . T_('Month') . '</option> ' . $month_options . ' </select> <select id="syear" name="syear"> <option value="">' . T_('Year') . '</option> ' . $year_options . ' </select> </div> </div> </fieldset> <p><input class="sub1" type="submit" name="submit" id="submit" value="' . T_('Submit') . '"/></p> </form> </div>'; }
/** * displayMessageBoard * * @return void */ function displayMessageBoard() { $sql = "SELECT `boardsort`\n FROM `fcms_user_settings`\n WHERE `user` = '" . $this->fcmsUser->id . "'"; $row = $this->fcmsDatabase->getRow($sql, $this->fcmsUser->id); if ($row === false) { $this->fcmsError->displayError(); return; } // Messageboard Sort $boardsort_list = array("ASC" => T_('New Messages at Bottom'), "DESC" => T_('New Messages at Top')); $boardsort_options = buildHtmlSelectOptions($boardsort_list, $row['boardsort']); echo ' <script type="text/javascript" src="ui/js/livevalidation.js"></script> <form id="frm" action="settings.php?view=messageboard" method="post"> <fieldset> <legend><span>' . T_('Message Board') . '</span></legend> <div class="field-row"> <div class="field-label"><label for="boardsort"><b>' . T_('Sort Messages') . '</b></label></div> <div class="field-widget"> <select name="boardsort" id="boardsort" title="' . T_('What order do you want new messages to display?') . '"> ' . $boardsort_options . ' </select> </div> </div> <p><input class="sub1" type="submit" name="submit" id="submit" value="' . T_('Submit') . '"/></p> </fieldset> </form>'; }
/** * displayMergeMemberForm * * @param int $id The id of current member * * @return void */ function displayMergeMemberForm($id) { $id = (int) $id; // Get current member info $sql = "SELECT u.`id`, u.`username`, u.`fname`, u.`mname`, u.`lname`, u.`maiden`, u.`email`, \n u.`dob_year`, u.`dob_month`, u.`dob_day`,\n a.`address`, a.`city`, a.`state`, a.`zip`, a.`home`, a.`work`, a.`cell`, u.`bio`\n FROM `fcms_users` AS u, `fcms_address` AS a\n WHERE u.`id` = ?\n AND u.`id` = a.`user`"; $r = $this->fcmsDatabase->getRow($sql, $id); if ($r === false) { $this->fcmsError->displayError(); return; } // Get member list $sql = "SELECT `id`, `username`, `phpass`,`fname`, `lname`\n FROM `fcms_users` \n WHERE `id` != ?"; $rows = $this->fcmsDatabase->getRows($sql, $id); if ($rows === false) { $this->fcmsError->displayError(); return; } $members = array(); foreach ($rows as $row) { if ($row['phpass'] == 'NONMEMBER') { $members[$row['id']] = $row['lname'] . ', ' . $row['fname'] . ' (' . T_('Non-member') . ')'; continue; } $members[$row['id']] = $row['lname'] . ', ' . $row['fname'] . ' (' . $row['username'] . ')'; } asort($members); // Display the form echo ' <form method="post" id="merge-form" action="members.php"> <fieldset> <legend><span>' . T_('Merge Member') . '</span></legend> <div class="row"> <div class="span8"> <div class="clearfix"> <label>' . T_('ID') . '</label> <div class="input">' . $r['id'] . '</div> </div> <div class="clearfix"> <label>' . T_('Username') . '</label> <div class="input">' . cleanOutput($r['username']) . '</div> </div> <div class="clearfix"> <label>' . T_('Name') . '</label> <div class="input">' . cleanOutput($r['fname']) . ' ' . cleanOutput($r['mname']) . ' ' . cleanOutput($r['lname']) . '</div> </div> <div class="clearfix"> <label>' . T_('Maiden Name') . '</label> <div class="input">' . cleanOutput($r['maiden']) . '</div> </div> <div class="clearfix"> <label>' . T_('Email') . '</label> <div class="input">' . cleanOutput($r['email']) . '</div> </div> <div class="clearfix"> <label>' . T_('Birthday') . '</label> <div class="input">' . formatBirthday($r['dob_year'], $r['dob_month'], $r['dob_day']) . '</div> </div> <div class="clearfix"> <label>' . T_('Address') . '</label> <div class="input">' . cleanOutput($r['address']) . '</div> </div> <div class="clearfix"> <label>' . T_('City') . '</label> <div class="input">' . cleanOutput($r['city']) . '</div> </div> <div class="clearfix"> <label>' . T_('State') . '</label> <div class="input">' . cleanOutput($r['state']) . '</div> </div> <div class="clearfix"> <label>' . T_('Zip') . '</label> <div class="input">' . cleanOutput($r['zip']) . '</div> </div> <div class="clearfix"> <label>' . T_('Home Phone') . '</label> <div class="input">' . cleanOutput($r['home']) . '</div> </div> <div class="clearfix"> <label>' . T_('Work Phone') . '</label> <div class="input">' . cleanOutput($r['work']) . '</div> </div> <div class="clearfix"> <label>' . T_('Cell Phone') . '</label> <div class="input">' . cleanOutput($r['cell']) . '</div> </div> <div class="clearfix"> <label>' . T_('Bio') . '</label> <div class="input">' . cleanOutput($r['bio']) . '</div> </div> </div><!-- span8 --> <div class="span8"> <p> <b>' . T_('Member to merge with') . '</b><br/> <select id="merge-with" name="merge-with"> <option value="0"></option> ' . buildHtmlSelectOptions($members, -1) . ' </select> </p> </div><!-- /span8 --> </div><!-- /row --> <div class="actions"> <input type="hidden" id="id" name="id" value="' . (int) $id . '"/> <input class="btn primary" type="submit" id="merge-review" name="merge-review" value="' . T_('Next') . '"/> <a class="btn" href="members.php">' . T_('Cancel') . '</a> </div> </fieldset> </form>'; }
/** * displayEditRecipeForm * * Displays the form for editing a recipe. * * @param int $id * @param string $name * @param string $thumbnail * @param string $category * @param string $ingredients * @param string $directions * * @return void */ function displayEditRecipeForm($id, $name, $thumbnail, $category, $ingredients, $directions) { $categories = $this->getCategoryList(); $path = 'uploads/upimages/'; if (defined('UPLOADS')) { $path = 'file.php?u='; } echo ' <script type="text/javascript" src="inc/livevalidation.js"></script> <form method="post" id="editform" name="editform" action="recipes.php"> <fieldset> <legend><span>' . T_('Edit Recipe') . '</span></legend> <div> <label for="name">' . T_('Name') . '</label> <input type="text" name="name" id="name" value="' . cleanOutput($name) . '" size="50"/> <script type="text/javascript"> var fname = new LiveValidation(\'name\', { onlyOnSubmit: true }); fname.add(Validate.Presence, {failureMessage: ""}); </script> </div> <div> <label for="thumbnail">' . T_('Thumbnail') . '</label> <img src="' . $path . $thumbnail . '"/> <a href="recipes.php?category=' . $category . '&thumbnail=' . $id . '">' . T_('Change') . '</a> </div> <div> <label for="category">' . T_('Category') . '</label> <select name="category"> ' . buildHtmlSelectOptions($categories, $category) . ' </select> </div> <div> <label for="ingredients">' . T_('Ingredients') . '</label> <textarea name="ingredients" id="ingredients">' . $ingredients . '</textarea> <script type="text/javascript"> var fingredients = new LiveValidation(\'ingredients\', { onlyOnSubmit: true }); fingredients.add(Validate.Presence, {failureMessage: ""}); </script> </div> <div> <label for="directions">' . T_('Directions') . '</label> <textarea name="directions" id="directions">' . $directions . '</textarea> <script type="text/javascript"> var fdirections = new LiveValidation(\'directions\', { onlyOnSubmit: true }); fdirections.add(Validate.Presence, {failureMessage: ""}); </script> </div> <p> <input type="hidden" name="id" value="' . (int) $id . '"/> <input class="sub1" type="submit" name="submitedit" value="' . T_('Edit') . '"/> <a href="recipes.php">' . T_('Cancel') . '</a> </p> </fieldset> </form>'; }