Пример #1
0
 public static function insert_default_data()
 {
     global $db, $db_type;
     $now = time();
     $db->start_transaction();
     $db->query('INSERT INTO ' . $db->prefix . 'ranks (rank, min_posts) VALUES(\'' . $db->escape(__('New member', 'luna')) . '\', 0)') or error('Unable to insert into table ' . $db->prefix . 'ranks. Please check your configuration and try again', __FILE__, __LINE__, $db->error());
     $db->query('INSERT INTO ' . $db->prefix . 'ranks (rank, min_posts) VALUES(\'' . $db->escape(__('Member', 'luna')) . '\', 10)') or error('Unable to insert into table ' . $db->prefix . 'ranks. Please check your configuration and try again', __FILE__, __LINE__, $db->error());
     require FORUM_ROOT . 'include/notifications.php';
     new_notification('2', 'backstage/about.php', 'Welcome to Luna, discover the possibilities!', 'fa-moon-o');
     $db->end_transaction();
 }
Пример #2
0
                $result = $db->query('SELECT commented FROM ' . $db->prefix . 'comments WHERE thread_id=' . $tid . ' ORDER BY id DESC LIMIT 1, 1') or error('Unable to fetch comment info', __FILE__, __LINE__, $db->error());
                $previous_comment_time = $db->result($result);
                // Get any subscribed users that should be notified (banned users are excluded)
                $result = $db->query('SELECT u.id, u.email, u.notify_with_comment, u.language FROM ' . $db->prefix . 'users AS u INNER JOIN ' . $db->prefix . 'thread_subscriptions AS s ON u.id=s.user_id LEFT JOIN ' . $db->prefix . 'forum_perms AS fp ON (fp.forum_id=' . $cur_commenting['fid'] . ' AND fp.group_id=u.group_id) LEFT JOIN ' . $db->prefix . 'online AS o ON u.id=o.user_id LEFT JOIN ' . $db->prefix . 'bans AS b ON u.username=b.username WHERE b.username IS NULL AND COALESCE(o.logged, u.last_visit)>' . $previous_comment_time . ' AND (fp.read_forum IS NULL OR fp.read_forum=1) AND s.thread_id=' . $tid . ' AND u.id!=' . $luna_user['id']) or error('Unable to fetch subscription info', __FILE__, __LINE__, $db->error());
                if ($db->num_rows($result)) {
                    require_once LUNA_ROOT . 'include/email.php';
                    $notification_emails = array();
                    if ($luna_config['o_censoring'] == '1') {
                        $cleaned_message = bbcode2email($censored_message, -1);
                    } else {
                        $cleaned_message = bbcode2email($message, -1);
                    }
                    // Loop through subscribed users and send emails
                    while ($cur_subscriber = $db->fetch_assoc($result)) {
                        // First of all, add a new notification
                        new_notification($cur_subscriber['id'], get_base_url() . '/thread.php?pid=' . $new_pid . '#p' . $new_pid, $username . ' replied to ' . $cur_commenting['subject'], 'fa-reply');
                        // Is the subscription email for $cur_subscriber['language'] cached or not?
                        if (!isset($notification_emails[$cur_subscriber['language']])) {
                            // Load the "new reply" template
                            $mail_tpl = trim(__('Subject: Reply to thread: "<thread_subject>"

<replier> has replied to the thread "<thread_subject>" to which you are subscribed. There may be more new replies, but this is the only notification you will receive until you visit the board again.

The comment is located at <comment_url>

You can unsubscribe by going to <unsubscribe_url>

--
<board_mailer> Mailer
(Do not reply to this message)', 'luna'));
                            // Load the "new reply full" template (with comment included)
Пример #3
0
                $result = $db->query('SELECT posted FROM ' . $db->prefix . 'posts WHERE topic_id=' . $tid . ' ORDER BY id DESC LIMIT 1, 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
                $previous_post_time = $db->result($result);
                // Get any subscribed users that should be notified (banned users are excluded)
                $result = $db->query('SELECT u.id, u.email, u.notify_with_post, u.language FROM ' . $db->prefix . 'users AS u INNER JOIN ' . $db->prefix . 'topic_subscriptions AS s ON u.id=s.user_id LEFT JOIN ' . $db->prefix . 'forum_perms AS fp ON (fp.forum_id=' . $cur_posting['fid'] . ' AND fp.group_id=u.group_id) LEFT JOIN ' . $db->prefix . 'online AS o ON u.id=o.user_id LEFT JOIN ' . $db->prefix . 'bans AS b ON u.username=b.username WHERE b.username IS NULL AND COALESCE(o.logged, u.last_visit)>' . $previous_post_time . ' AND (fp.read_forum IS NULL OR fp.read_forum=1) AND s.topic_id=' . $tid . ' AND u.id!=' . $luna_user['id']) or error('Unable to fetch subscription info', __FILE__, __LINE__, $db->error());
                if ($db->num_rows($result)) {
                    require_once FORUM_ROOT . 'include/email.php';
                    $notification_emails = array();
                    if ($luna_config['o_censoring'] == '1') {
                        $cleaned_message = bbcode2email($censored_message, -1);
                    } else {
                        $cleaned_message = bbcode2email($message, -1);
                    }
                    // Loop through subscribed users and send emails
                    while ($cur_subscriber = $db->fetch_assoc($result)) {
                        // First of all, add a new notification
                        new_notification($cur_subscriber['id'], get_base_url() . '/viewtopic.php?pid=' . $new_pid . '#p' . $new_pid, $username . ' replied to ' . $cur_posting['subject'], 'fa-reply');
                        // Is the subscription email for $cur_subscriber['language'] cached or not?
                        if (!isset($notification_emails[$cur_subscriber['language']])) {
                            // Load the "new reply" template
                            $mail_tpl = trim(__('Subject: Reply to thread: "<thread_subject>"

<replier> has replied to the thread "<thread_subject>" to which you are subscribed. There may be more new replies, but this is the only notification you will receive until you visit the board again.

The comment is located at <comment_url>

You can unsubscribe by going to <unsubscribe_url>

--
<board_mailer> Mailer
(Do not reply to this message)', 'luna'));
                            // Load the "new reply full" template (with post included)
Пример #4
0
         $end_at = $cur_item['id'];
     }
     // Check if there is more work to do
     if ($end_at > 0) {
         $result = $db->query('SELECT 1 FROM ' . $db->prefix . 'comments WHERE id > ' . $end_at . ' ORDER BY id ASC LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error());
         if ($db->num_rows($result) > 0) {
             $query_str = '?stage=rebuild_idx&start_at=' . $end_at;
         }
     }
     break;
     // Show results page
 // Show results page
 case 'finish':
     // Give a "Success" notifcation
     if ($luna_config['o_cur_version'] != Version::LUNA_VERSION) {
         new_notification('2', 'backstage/index.php', 'Luna has been updated to ' . Version::LUNA_VERSION, 'fa-cloud-upload');
     }
     // We update the version numbers
     $db->query('UPDATE ' . $db->prefix . 'config SET conf_value = \'' . Version::LUNA_VERSION . '\' WHERE conf_name = \'o_cur_version\'') or error('Unable to update version', __FILE__, __LINE__, $db->error());
     $db->query('UPDATE ' . $db->prefix . 'config SET conf_value = \'' . Version::LUNA_CORE_VERSION . '\' WHERE conf_name = \'o_core_version\'') or error('Unable to update core version', __FILE__, __LINE__, $db->error());
     $db->query('UPDATE ' . $db->prefix . 'config SET conf_value = \'' . Version::LUNA_CODE_NAME . '\' WHERE conf_name = \'o_code_name\'') or error('Unable to update code name', __FILE__, __LINE__, $db->error());
     // And the database revision number
     $db->query('UPDATE ' . $db->prefix . 'config SET conf_value = \'' . Version::LUNA_DB_VERSION . '\' WHERE conf_name = \'o_database_revision\'') or error('Unable to update database revision number', __FILE__, __LINE__, $db->error());
     // And the search index revision number
     $db->query('UPDATE ' . $db->prefix . 'config SET conf_value = \'' . Version::LUNA_SI_VERSION . '\' WHERE conf_name = \'o_searchindex_revision\'') or error('Unable to update search index revision number', __FILE__, __LINE__, $db->error());
     // And the parser revision number
     $db->query('UPDATE ' . $db->prefix . 'config SET conf_value = \'' . Version::LUNA_PARSER_VERSION . '\' WHERE conf_name = \'o_parser_revision\'') or error('Unable to update parser revision number', __FILE__, __LINE__, $db->error());
     // Check the default language still exists!
     if (!file_exists(LUNA_ROOT . 'lang/' . $luna_config['o_default_lang'] . '/common.php')) {
         $db->query('UPDATE ' . $db->prefix . 'config SET conf_value = \'English\' WHERE conf_name = \'o_default_lang\'') or error('Unable to update default language', __FILE__, __LINE__, $db->error());
     }