Example #1
0
 function displayContactForm()
 {
     $this->displayHeader();
     $email = isset($_POST['email']) ? cleanOutput($_POST['email']) : '';
     $name = isset($_POST['name']) ? cleanOutput($_POST['name']) : '';
     $subject = isset($_POST['subject']) ? cleanOutput($_POST['subject']) : '';
     $msg = isset($_POST['msg']) ? cleanOutput($_POST['msg'], 'html') : '';
     if (isset($_SESSION['ok'])) {
         $okMessage = '<p>' . T_('The following message has been sent to the Administrator:') . '</p>' . $_SESSION['ok'];
         displayOkMessage($okMessage);
         unset($_SESSION['ok']);
     }
     echo '
         <fieldset>
             <form method="post" class="contactform" action="contact.php">
                 <div class="field-row">
                     <div class="field-label"><label for="email"><b>' . T_('Your Email') . '</b></label></div>
                     <div class="field-widget"><input type="text" id="email" name="email" size="30" value="' . $email . '"/></div>
                 </div>
                 <div class="field-row">
                     <div class="field-label"><label for="name"><b>' . T_('Your Name') . '</b></label></div>
                     <div class="field-widget"><input type="text" id="name" name="name" size="30" value="' . $name . '"/></div>
                 </div>
                 <div class="field-row">
                     <div class="field-label"><label for="subject"><b>' . T_('Subject') . '</b></label></div>
                     <div class="field-widget"><input type="text" id="subject" name="subject" size="30" value="' . $subject . '"/></div>
                 </div>
                 <div class="field-row">
                     <div class="field-label"><label for="msg"><b>' . T_('Message') . '</b></label></div>
                     <div class="field-widget"><textarea name="msg" rows="10" cols="40">' . $msg . '</textarea></div>
                 </div>
                 <p><input type="submit" name="submit" value="' . T_('Submit') . '"/></p>
             </form>
         </fieldset>';
     $this->displayFooter();
 }
Example #2
0
 /**
  * displayEditNewsSubmit 
  * 
  * @return void
  */
 function displayEditNewsSubmit()
 {
     $this->displayHeader();
     $id = $_POST['id'];
     $user = $_POST['user'];
     $sql = "UPDATE `fcms_news` \n                SET `title` = ?, \n                    `news`  = ? \n                WHERE `id`  = ?";
     $params = array($_POST['title'], $_POST['post'], $_POST['id']);
     if (!$this->fcmsDatabase->update($sql, $params)) {
         $this->fcmsError->displayError();
         $this->fcmsFamilyNews->displayFamilyNews($user, $id);
         $this->displayFooter();
         return;
     }
     displayOkMessage();
     $this->fcmsFamilyNews->displayFamilyNews($user, $id);
     $this->displayFooter();
 }
Example #3
0
 /**
  * displayEditProfileAddressForm 
  * 
  * @return void
  */
 function displayEditProfileAddressForm()
 {
     $this->displayHeader();
     if (isset($_SESSION['success'])) {
         displayOkMessage();
         unset($_SESSION['success']);
     }
     $this->fcmsProfile->displayEditAddress();
     $this->displayFooter();
 }
Example #4
0
 /**
  * displayDeleteSubmit 
  * 
  * @return void
  */
 function displayDeleteSubmit()
 {
     $aid = $_GET['delete'];
     $cat = $_GET['cat'];
     $validator = new FormValidator();
     if ($this->fcmsUser->access >= 2) {
         $this->displayHeader();
         echo '
         <p class="error-alert">' . T_('You do not have permission to perform this task.') . '</p>';
         $this->fcmsBook->displayAddressList($cat);
         $this->displayFooter();
         return;
     }
     $errors = $validator->validate($_GET, $this->fcmsBook->getProfile('delete'));
     if ($errors !== true) {
         $this->displayHeader();
         displayErrors($errors);
         $this->fcmsBook->displayAddressList($cat);
         $this->displayFooter();
         return;
     }
     $sql = "SELECT a.`user`, u.`phpass`\n                FROM `fcms_address` AS a, `fcms_users` AS u\n                WHERE a.`id` = ?\n                AND a.`user` = u.`id`";
     $r = $this->fcmsDatabase->getRow($sql, $aid);
     if ($r === false) {
         $this->displayHeader();
         $this->fcmsError->displayError();
         $this->displayFooter();
         return;
     }
     $user = $r['user'];
     $pass = $r['phpass'];
     if ($r['phpass'] !== 'NONMEMBER' && $r['phpass'] !== 'PRIVATE') {
         $this->displayHeader();
         echo '
         <p class="error-alert">' . T_('You cannot delete the address of a member.') . '</p>';
         $this->fcmsBook->displayAddressList($cat);
         $this->displayFooter();
         return;
     }
     $sql = "DELETE FROM `fcms_users` \n                WHERE `id` = ?";
     if (!$this->fcmsDatabase->delete($sql, $user)) {
         $this->displayHeader();
         $this->fcmsDatabase->displayError();
         $this->displayFooter();
         return;
     }
     $sql = "DELETE FROM fcms_address \n                WHERE id = ?";
     if (!$this->fcmsDatabase->delete($sql, $aid)) {
         $this->displayHeader();
         $this->fcmsError->displayError();
         $this->displayFooter();
         return;
     }
     $this->displayAddressList();
     displayOkMessage(T_('Address Deleted Successfully.'));
     $this->displayFooter();
 }
Example #5
0
File: index.php Project: lmcro/fcms
 /**
  * displayCategory 
  * 
  * @return void
  */
 function displayCategory()
 {
     $this->displayHeader();
     if (isset($_SESSION['message'])) {
         unset($_SESSION['message']);
         displayOkMessage();
     }
     $page = getPage();
     $this->fcmsPhotoGallery->displayGalleryMenu($_GET['uid'], $_GET['cid']);
     $this->fcmsPhotoGallery->showCategories($page, $_GET['uid'], $_GET['cid']);
     $this->displayFooter();
 }
Example #6
0
 /**
  * displayEditCategoryForm 
  * 
  * @return void
  */
 function displayEditCategoryForm()
 {
     $this->displayHeader();
     if ($this->fcmsUser->access > 2) {
         echo '
     <p class="error-alert">' . T_('You do not have permission to perform this task.') . '</p>';
         $this->displayFooter();
         return;
     }
     if (isset($_SESSION['ok'])) {
         unset($_SESSION['ok']);
         displayOkMessage();
     }
     $this->fcmsRecipe->displayEditCategoryForm();
     $this->displayFooter();
 }
Example #7
0
 /**
  * displayThread 
  * 
  * Displays the posts for a specific thread.
  * 
  * @return void
  */
 function displayThread()
 {
     $this->displayHeader(array('jsOnload' => '
 $(\'.delpost input[type="submit"]\').click(function(e) {
     return confirmDeleteLink(this, "' . T_('Are you sure you want to DELETE this?') . '", e);
 });'));
     $threadId = (int) $_GET['thread'];
     $page = getPage();
     if (isset($_SESSION['success'])) {
         displayOkMessage();
         unset($_SESSION['success']);
     }
     $this->fcmsMessageBoard->showPosts($threadId, $page);
     $this->displayFooter();
 }
Example #8
0
 /**
  * displayDocuments 
  * 
  * @return void
  */
 function displayDocuments()
 {
     $this->displayHeader();
     if ($this->fcmsUser->access <= 5) {
         echo '
         <div id="actions_menu">
             <ul><li><a href="?adddoc=yes">' . T_('Add Document') . '</a></li></ul>
         </div>';
     }
     if (isset($_SESSION['ok'])) {
         unset($_SESSION['ok']);
         displayOkMessage();
     }
     $page = getPage();
     $this->fcmsDocument->showDocuments($page);
     $this->displayFooter();
 }
Example #9
0
 /**
  * displayImportBlogPosts 
  * 
  * @return void
  */
 function displayImportBlogPosts()
 {
     $this->displayHeader();
     // setup familynew obj
     $newsObj = new FamilyNews($this->fcmsError, $this->fcmsDatabase, $this->fcmsUser);
     // get external ids
     $external_ids = $newsObj->getExternalPostIds();
     // Get import blog settings
     $sql = "SELECT `user`, `blogger`, `tumblr`, `wordpress`, `posterous`\n                FROM `fcms_user_settings`\n                WHERE `user` = ?";
     $r = $this->fcmsDatabase->getRow($sql, $this->fcmsUser->id);
     if ($r === false) {
         $this->fcmsError->displayError();
         $this->displayFooter();
         return;
     }
     if (empty($r)) {
         echo '<div class="error-alert">' . T_('Nothing to import.') . '</div>';
         $this->fcmsSettings->displayFamilyNews();
         $this->displayFooter();
         return;
     }
     $count = 0;
     switch ($_GET['import']) {
         case 'blogger':
             $count = $newsObj->importBloggerPosts($r['blogger'], $this->fcmsUser->id, '', $external_ids);
             if ($count === false) {
                 $this->fcmsSettings->displayFamilyNews();
                 $this->displayFooter();
                 return;
             }
             break;
         case 'tumblr':
             $count = $newsObj->importTumblrPosts($r['tumblr'], $this->fcmsUser->id, '', $external_ids);
             if ($count === false) {
                 $this->fcmsSettings->displayFamilyNews();
                 $this->displayFooter();
                 return;
             }
             break;
         case 'wordpress':
             $count = $newsObj->importWordpressPosts($r['wordpress'], $this->fcmsUser->id, '', $external_ids);
             if ($count === false) {
                 $this->fcmsSettings->displayFamilyNews();
                 $this->displayFooter();
                 return;
             }
             break;
         case 'posterous':
             $count = $newsObj->importPosterousPosts($r['posterous'], $this->fcmsUser->id, '', $external_ids);
             if ($count === false) {
                 $this->fcmsSettings->displayFamilyNews();
                 $this->displayFooter();
                 return;
             }
             break;
     }
     displayOkMessage(sprintf(T_ngettext('%d post has been imported.', '%d posts have been imported.', $count), $count));
     $this->fcmsSettings->displayFamilyNews();
     $this->displayFooter();
     return;
 }
Example #10
0
 /**
  * displayInbox 
  * 
  * @return void
  */
 function displayInbox()
 {
     $this->displayHeader(array('jsOnload' => '
 $(\'.pm_footer input[type="submit"]\').click(function(e) {
     return confirmDeleteLink(this, "' . T_('Are you sure you want to DELETE this?') . '", e);
 });'));
     if (isset($_SESSION['success'])) {
         displayOkMessage();
         unset($_SESSION['success']);
     }
     $header = T_('Inbox');
     if (isset($_SESSION['private_messages']) && $_SESSION['private_messages'] > 0) {
         $header = sprintf(T_('Inbox (%d)'), $_SESSION['private_messages']);
     }
     echo '
         <form method="post" action="privatemsg.php">
             <table id="pm" cellpadding="0" cellspacing="0">
                 <tr>
                     <th colspan="3" class="pm_header">' . $header . '</th>
                 </tr>';
     $sql = "SELECT p.`id`, `to`, `from`, `title`, `date`, `read`, u.`avatar`, u.`gravatar`\n                FROM `fcms_privatemsg` AS p\n                LEFT JOIN `fcms_users` AS u ON p.`from` = u.`id`\n                WHERE `to` = ?\n                ORDER BY `date` DESC";
     $rows = $this->fcmsDatabase->getRows($sql, $this->fcmsUser->id);
     if ($rows === false) {
         $this->fcmsError->displayError();
         $this->displayFooter();
         return;
     }
     foreach ($rows as $r) {
         $date = fixDate(T_('M. j, Y, g:i a'), $this->fcmsUser->tzOffset, $r['date']);
         $avatarPath = getAvatarPath($r['avatar'], $r['gravatar']);
         $from = getUserDisplayName($r['from']);
         $rowClass = '';
         $linkClass = 'read';
         if ($r['read'] < 1) {
             $rowClass = 'new';
             $linkClass = '';
         }
         echo '
                 <tr class="' . $rowClass . '">
                     <td class="img"></td>
                     <td>
                         <div class="user">
                             <img src="' . $avatarPath . '" alt="' . $from . '" title="' . $from . '"/>
                         </div>
                         <a class="' . $linkClass . '" href="?pm=' . (int) $r['id'] . '">' . cleanOutput($r['title']) . '</a>
                         <span>' . $date . '</span>
                     </td>
                     <td class="check"><input type="checkbox" name="del[]" value="' . (int) $r['id'] . '"/></td>
                 </tr>';
     }
     echo '
                 <tr>
                     <th colspan="3" class="pm_footer">
                         <input class="sub1" type="submit" name="delete" value="' . T_('Delete Selected') . '"/>
                     </th>
                 </tr>
             </table>
         </form>';
     $this->displayFooter();
 }
Example #11
0
 /**
  * displayFamilyTree 
  * 
  * @return void
  */
 function displayFamilyTree()
 {
     $this->displayHeader(array('jsOnload' => 'initAddRelative();'));
     if (isset($_SESSION['ok'])) {
         unset($_SESSION['ok']);
         displayOkMessage();
     }
     $this->fcmsFamilyTree->displayMembersTreeList();
     $oldestId = $this->fcmsFamilyTree->getOldestRelativeId($this->fcmsFamilyTree->currentTreeUserId);
     if ($oldestId === false) {
         $this->fcmsDatabase->displayError();
         $thid->displayFooter();
         return;
     }
     // Get oldest relative user info
     $sql = "SELECT `id`, `fname`, `mname`, `lname`, `maiden`, `dob_year`, `dob_month`, `dob_day`, `dod_year`, `dod_month`, `dod_day`, \n                    `avatar`, `gravatar`, `sex`, `phpass`\n                FROM `fcms_users`\n                WHERE `id` = ?";
     $user = $this->fcmsDatabase->getRow($sql, $oldestId);
     if ($user === false) {
         $this->fcmsError->displayError();
         $this->displayFooter();
         return;
     }
     if (empty($user)) {
         echo '<div class="error-alert">' . T_('Missing or invalid id.') . '</div>';
         $this->displayFooter();
         return;
     }
     $descendants = $this->fcmsFamilyTree->getDescendantsAndSpouses(array($oldestId));
     echo '
     <div class="tree">
         <ul>
             <li>';
     $this->fcmsFamilyTree->displayPerson($user);
     $this->fcmsFamilyTree->displaySpousesAndKids($user, $descendants);
     echo '
             </li>
         </ul>
     </div>';
     // We may have run out of memory before we could print everyone
     // Let's notify the user of that
     if (!$this->fcmsFamilyTree->hasEnoughMemory) {
         echo '
     <script type="text/javascript">
         $("#familytree-page").prepend("<div class=\\"info-alert\\">"
             + "<h2>' . T_('Out of Memory') . '</h2>"
             + "<p>' . T_('Your current PHP configuration does not allow displaying of a Family Tree this large, so not all relationships are shown.') . '</p>"
             + "<p>' . T_('Please consider allocating more memory to PHP.') . '</p>"
         + "</div>");
     </script>';
     }
     $this->displayFooter();
 }
Example #12
0
    /**
     * displayInvitationSubmit 
     * 
     * @return void
     */
    function displayInvitationSubmit()
    {
        $this->displayHeader();
        $calendarId = (int) $_POST['calendar'];
        // make sure the user submitted atleast one email address
        if (!isset($_POST['all-members']) && !isset($_POST['email']) && !isset($_POST['non-member-emails'])) {
            $error = T_('You must invite at least one guest.');
            displayInvitationForm($calendarId, $error);
            return;
        }
        // Get any invitations already sent for this event
        $invitations = $this->getInvitations($calendarId, true);
        if ($invitations === false) {
            $this->fcmsError->displayError();
            $this->displayFooter();
            return;
        }
        if (!isset($invitations['_current_user'])) {
            // add the current user (host) to the invite as attending
            $sql = "INSERT INTO `fcms_invitation` \n                        (`event_id`, `user`, `created`, `updated`, `attending`)\n                    VALUES \n                        (?, ?, NOW(), NOW(), 1)";
            $params = array($calendarId, $this->fcmsUser->id);
            if (!$this->fcmsDatabase->insert($sql, $params)) {
                $this->fcmsError->displayError();
                $this->displayFooter();
                return;
            }
        }
        // Get the calendar event title
        $sql = "SELECT `title` \n                FROM `fcms_calendar` \n                WHERE `id` = ?";
        $r = $this->fcmsDatabase->getRow($sql, $calendarId);
        if ($r === false) {
            $this->fcmsError->displayError();
            $this->displayFooter();
            return;
        }
        $title = $r['title'];
        $invitees = array();
        $nonMembers = array();
        $members = array();
        // get emails from textarea
        if (isset($_POST['non-member-emails'])) {
            $nonMembers = explode("\n", $_POST['non-member-emails']);
        }
        // get any members that have been invited
        if (isset($_POST['all-members'])) {
            $sql = "SELECT `id`, `email` \n                    FROM `fcms_users` \n                    WHERE `activated` > 0\n                    AND `phpass` != 'NONMEMBER'\n                    AND `id` != ?";
            $rows = $this->fcmsDatabase->getRows($sql, $this->fcmsUser->id);
            if ($rows === false) {
                $this->fcmsError->displayError();
                $this->displayFooter();
                return;
            }
            foreach ($rows as $r) {
                array_push($members, array('id' => $r['id'], 'email' => $r['email']));
            }
        } elseif (isset($_POST['member'])) {
            foreach ($_POST['member'] as $id) {
                array_push($members, array('id' => $id, 'email' => $_POST["id{$id}"]));
            }
        }
        // merge all emails into one big list
        $invitees = array_merge($nonMembers, $members);
        // Create the invite and send the emails to each invitee
        foreach ($invitees as $invitee) {
            if (empty($invitee)) {
                continue;
            }
            // create a code for this user
            $code = uniqid('');
            $user = 0;
            $email = '';
            $toEmail = '';
            $toName = '';
            $fromName = getUserDisplayName($this->fcmsUser->id);
            $url = getDomainAndDir();
            // member
            if (is_array($invitee)) {
                $user = (int) $invitee['id'];
                $toEmail = rtrim($invitee['email']);
                $toName = getUserDisplayName($user);
                $email = null;
                $url .= 'calendar.php?event=' . $calendarId;
            } else {
                $user = 0;
                $toEmail = rtrim($invitee);
                $toName = $toEmail;
                $email = $toEmail;
                $url .= 'invitation.php?event=' . $calendarId . '&code=' . $code;
            }
            // Skip email address that have already been invited
            if (isset($invitations[$toEmail])) {
                continue;
            }
            // add an invitation to db
            $sql = "INSERT INTO `fcms_invitation` \n                        (`event_id`, `user`, `email`, `created`, `updated`, `code`)\n                    VALUES \n                        (?, ?, ?, NOW(), NOW(), ?)";
            $params = array($calendarId, $user, $email, $code);
            if (!$this->fcmsDatabase->insert($sql, $params)) {
                $this->fcmsError->displayError();
                $this->displayFooter();
                return;
            }
            // Send email invitation
            $subject = sprintf(T_pgettext('%s is the title of an event', 'Invitation: %s'), $title);
            $msg = sprintf(T_pgettext('%s is the name of a person, like Dear Bob,', 'Dear %s,'), $toName) . '

' . sprintf(T_pgettext('The first %s is the name of a person, the second is the title of an event', '%s has invited you to %s.'), $fromName, $title) . '

' . T_('Please visit the link below to view the rest of this invitation.') . '

' . $url . '

----
' . T_('This is an automated response, please do not reply.') . '

';
            $email_headers = getEmailHeaders();
            mail($toEmail, $subject, $msg, $email_headers);
        }
        displayOkMessage();
        $this->fcmsCalendar->displayEvent($calendarId);
        $this->displayFooter();
    }
Example #13
0
    /**
     * 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>&nbsp;</p>

        <h2>' . T_('Set up Cron') . '</h2>
        <p>' . T_('Set up a new crontab for each of the following commands.') . '</p>
        ' . $setupCron;
        $this->displayFooter();
    }
Example #14
0
File: video.php Project: lmcro/fcms
 /**
  * displayMessage 
  * 
  * @param string  $message 
  * 
  * @return void
  */
 function displayMessage($message)
 {
     unset($_SESSION['message']);
     switch ($message) {
         case 'remove_video':
             displayOkMessage(T_('Video removed successfully.'));
             break;
         case 'delete_video':
             displayOkMessage(T_('Video deleted successfully.'));
             break;
         case 'delete_video_youtube':
             displayOkMessage(T_('Video removed and deleted from YouTube successfully.'), '5000');
     }
 }
Example #15
0
 /**
  * displayPrayers 
  * 
  * @return void
  */
 function displayPrayers()
 {
     $this->displayHeader(array('jsOnload' => '
 $(\'.delform input[type="submit"]\').click(function(e) {
     return confirmDeleteLink(this, "' . T_('Are you sure you want to DELETE this?') . '", e);
 });'));
     if (isset($_SESSION['success'])) {
         displayOkMessage();
         unset($_SESSION['success']);
     }
     if (isset($_SESSION['delete_success'])) {
         displayOkMessage(T_('Prayer Concern Deleted Successfully'));
         unset($_SESSION['delete_success']);
     }
     if ($this->fcmsUser->access <= 5) {
         echo '
         <div id="actions_menu">
             <ul><li><a class="action" href="?addconcern=yes">' . T_('Add a Prayer Concern') . '</a></li></ul>
         </div>';
     }
     $page = getPage();
     $from = $page * 5 - 5;
     $sql = "SELECT p.`id`, `for`, `desc`, `user`, `date` \n                FROM `fcms_prayers` AS p, `fcms_users` AS u \n                WHERE u.`id` = p.`user` \n                ORDER BY `date` DESC \n                LIMIT {$from}, 5";
     $rows = $this->fcmsDatabase->getRows($sql);
     if ($rows === false) {
         $this->fcmsError->displayError();
         $this->displayFooter();
         return;
     }
     if (count($rows) <= 0) {
         echo '
         <div class="blank-state">
             <h2>' . T_('Nothing to see here') . '</h2>
             <h3>' . T_('Currently no one has added any Prayer Concerns.') . '</h3>
             <h3><a href="?addconcern=yes">' . T_('Why don\'t you add a new Prayer Concern now?') . '</a></h3>
         </div>';
         $this->displayFooter();
         return;
     }
     foreach ($rows as $r) {
         $date = fixDate(T_('F j, Y, g:i a'), $this->fcmsUser->tzOffset, $r['date']);
         $displayname = getUserDisplayName($r['user']);
         echo '
         <hr/>
         <h4>' . $date . '</h4>
         <div class="edit_delete">';
         // Edit
         if ($this->fcmsUser->id == $r['user'] || $this->fcmsUser->access < 2) {
             echo '
         <form method="post" action="prayers.php">
             <input type="hidden" name="id" value="' . (int) $r['id'] . '"/>
             <input type="hidden" name="for" value="' . cleanOutput($r['for']) . '"/>
             <input type="hidden" name="desc" value="' . cleanOutput($r['desc']) . '"/>
             <input type="submit" name="editprayer" value="' . T_('Edit') . '" class="editbtn" title="' . T_('Edit this Prayer Concern') . '"/>
         </form>';
         }
         // Delete
         if ($this->fcmsUser->access < 2) {
             echo '
         <form class="delform" method="post" action="prayers.php">
             <input type="hidden" name="id" value="' . (int) $r['id'] . '"/>
             <input type="submit" name="delprayer" value="' . T_('Delete') . '" class="delbtn" title="' . T_('Delete this Prayer Concern') . '"/>
         </form>';
         }
         echo '
         </div>
         <div class="for">
             <b>' . sprintf(T_('%s asks that you please pray for...'), '<a href="profile.php?member=' . (int) $r['user'] . '">' . $displayname . '</a>') . '</b>
             <div>' . cleanOutput($r['for']) . '</div>
         </div>
         <div class="because">
             <b>' . T_('Because...') . '</b>
             <div>' . parse($r['desc']) . '</div>
         </div>
         <div class="top"><a href="#top">' . T_('Back to Top') . '</a></div>';
     }
     // Display Pagination
     $sql = "SELECT count(`id`) AS c \n                FROM `fcms_prayers`";
     $r = $this->fcmsDatabase->getRow($sql);
     if ($r === false) {
         $this->fcmsError->displayError();
         $this->displayFooter();
         return;
     }
     $prayercount = (int) $r['c'];
     $total_pages = ceil($prayercount / 5);
     displayPagination('prayers.php', $page, $total_pages);
     $this->displayFooter();
 }