public function add_core_hooks()
 {
     \CODOF\Hook::add('on_cron_notify', array(new \CODOF\Forum\Notification\Notifier(), 'dequeueNotify'));
     \CODOF\Hook::add('on_cron_daily_digest', array(new \CODOF\Forum\Notification\Digest\Digest(), 'sendDailyDigest'));
     \CODOF\Hook::add('on_cron_weekly_digest', array(new \CODOF\Forum\Notification\Digest\Digest(), 'sendWeeklyDigest'));
     \CODOF\Hook::add('on_cron_mail_notify_send', array(new \CODOF\Forum\Notification\MailQueue(), 'dequeue'));
 }
        }
        echo '
    <script>
    var codopm={};
    codopm.path="' . codopm::$path . '";
    codopm.req_path="' . codopm::$req_path . '";
    codopm.from="' . $user->id . '";
    codopm.xhash="' . codopm::$xhash . '";
    codopm.profile_id="' . codopm::$profile_id . '";    
    codopm.profile_name="' . codopm::$profile_name . '";
    </script>';
        require "start.php";
    }
}
$user = $adapter->get_user();
if ($myadapter == 'Codoforum') {
    \CODOF\Hook::add('before_profile_view', function ($user) {
        codopm::$profile_id = $user->id;
        codopm::$profile_name = $user->username;
        codopm::$profile_path = RURI . 'user/profile';
    });
    \CODOF\Hook::add('block_profile_view_tabs_after', 'codopm_load');
    \CODOF\Hook::add('tpl_before_user_profile_view', 'codopm_add_assets');
    require 'server/codopm.php';
} else {
    codopm::$profile_id = $user->id;
    codopm::$profile_path = '';
    codopm::$profile_name = '';
    codopm_load();
    codopm_add_assets();
}
        if ($type == 'new_topic') {
            $subject = \CODOF\Util::get_opt('topic_notify_subject');
            $message = \CODOF\Util::get_opt('topic_notify_message');
        } else {
            $subject = \CODOF\Util::get_opt('post_notify_subject');
            $message = \CODOF\Util::get_opt('post_notify_message');
        }
        $mail = new \CODOF\Forum\Notification\Mail();
        $me = CODOF\User\User::get();
        $mails = array();
        $offset = 0;
        while ($data = $this->getData($cid, $tid, $pid, $offset)) {
            foreach ($data as $info) {
                //do not send email to the user making the post
                if ($me->id == $info['id'] || $info['mail'] == null) {
                    continue;
                }
                $user = array("id" => $me->id, "username" => $me->username);
                $post = array("omessage" => $info['omessage'], "imessage" => $info['imessage'], "url" => \CODOF\Forum\Forum::getPostURL($tid, $info['title'], $pid), "id" => $info['id'], "username" => $info['username'], "title" => $info['title'], "category" => $info['cat_name']);
                $mail->user = $user;
                $mail->post = $post;
                $mails[] = array("to_address" => $info['mail'], "mail_subject" => html_entity_decode($mail->replace_tokens($subject), ENT_NOQUOTES, "UTF-8"), "body" => html_entity_decode($mail->replace_tokens($message), ENT_QUOTES, "UTF-8"));
            }
            \DB::table(PREFIX . 'codo_mail_queue')->insert($mails);
            $offset += 400;
        }
    }
}
$pn = new Notify();
\CODOF\Hook::add('after_notify_insert', array($pn, 'queue_mails'));