Esempio n. 1
0
 public static function build_pagehead()
 {
     $user_scalable = local_channel() ? get_pconfig(local_channel(), 'system', 'user_scalable') : 1;
     if ($user_scalable === false) {
         $user_scalable = 1;
     }
     $preload_images = local_channel() ? get_pconfig(local_channel(), 'system', 'preload_images') : 0;
     if ($preload_images === false) {
         $preload_images = 0;
     }
     $interval = local_channel() ? get_pconfig(local_channel(), 'system', 'update_interval') : 80000;
     if ($interval < 10000) {
         $interval = 80000;
     }
     if (!x(self::$page, 'title')) {
         self::$page['title'] = self::$config['system']['sitename'];
     }
     if (!self::$meta->get_field('og:title')) {
         self::$meta->set('og:title', self::$page['title']);
     }
     self::$meta->set('generator', Zotlabs\Lib\System::get_platform_name());
     /* put the head template at the beginning of page['htmlhead']
      * since the code added by the modules frequently depends on it
      * being first
      */
     $tpl = get_markup_template('head.tpl');
     self::$page['htmlhead'] = replace_macros($tpl, array('$preload_images' => $preload_images, '$user_scalable' => $user_scalable, '$query' => urlencode(self::$query_string), '$baseurl' => self::get_baseurl(), '$local_channel' => local_channel(), '$metas' => self::$meta->get(), '$update_interval' => $interval, 'osearch' => sprintf(t('Search %1$s (%2$s)', 'opensearch'), Zotlabs\Lib\System::get_site_name(), t('$Projectname', 'opensearch')), '$icon' => head_get_icon(), '$head_css' => head_get_css(), '$head_js' => head_get_js(), '$js_strings' => js_strings(), '$zid' => get_my_address(), '$channel_id' => self::$profile['uid'])) . self::$page['htmlhead'];
     // always put main.js at the end
     self::$page['htmlhead'] .= head_get_main_js();
 }
Esempio n. 2
0
function z_mail($params)
{
    /**
     * @brief Send a text email message
     *
     * @param array $params an assoziative array with:
     *  * \e string \b fromName        name of the sender
     *  * \e string \b fromEmail       email of the sender
     *  * \e string \b replyTo         replyTo address to direct responses
     *  * \e string \b toEmail         destination email address
     *  * \e string \b messageSubject  subject of the message
     *  * \e string \b htmlVersion     html version of the message
     *  * \e string \b textVersion     text only version of the message
     *  * \e string \b additionalMailHeader  additions to the smtp mail header
     */
    if (!$params['fromEmail']) {
        $params['fromEmail'] = get_config('system', 'from_email');
        if (!$params['fromEmail']) {
            $params['fromEmail'] = 'Administrator' . '@' . App::get_hostname();
        }
    }
    if (!$params['fromName']) {
        $params['fromName'] = get_config('system', 'from_email_name');
        if (!$params['fromName']) {
            $params['fromName'] = Zotlabs\Lib\System::get_site_name();
        }
    }
    if (!$params['replyTo']) {
        $params['replyTo'] = get_config('system', 'reply_address');
        if (!$params['replyTo']) {
            $params['replyTo'] = 'noreply' . '@' . App::get_hostname();
        }
    }
    $params['sent'] = false;
    $params['result'] = false;
    call_hooks('email_send', $params);
    if ($params['sent']) {
        logger('notification: z_mail returns ' . $params['result'], LOGGER_DEBUG);
        return $params['result'];
    }
    $fromName = email_header_encode(html_entity_decode($params['fromName'], ENT_QUOTES, 'UTF-8'), 'UTF-8');
    $messageSubject = email_header_encode(html_entity_decode($params['messageSubject'], ENT_QUOTES, 'UTF-8'), 'UTF-8');
    $messageHeader = $params['additionalMailHeader'] . "From: {$fromName} <{$params['fromEmail']}>\n" . "Reply-To: {$fromName} <{$params['replyTo']}>";
    // send the message
    $res = mail($params['toEmail'], $messageSubject, $params['textVersion'], $messageHeader);
    logger('notification: z_mail returns ' . $res, LOGGER_DEBUG);
    return $res;
}