Пример #1
0
function _xVideosExport()
{
    $DB = GetDB();
    $result = $DB->Query('SELECT * FROM `tbx_video`');
    header("Content-type: text/plain");
    header("Content-Disposition: attachment; filename=export.txt");
    while ($video = $DB->NextRow($result)) {
        $clip = $DB->Row('SELECT * FROM `tbx_video_clip` WHERE `video_id`=? LIMIT 1', array($video['video_id']));
        $category = $DB->Row('SELECT * FROM `tbx_category` WHERE `category_id`=?', array($video['category_id']));
        if ($clip['clip'][0] == '/') {
            $clip['clip'] = Config::Get('base_url') . $clip['clip'];
        }
        $thumbs = array();
        $th_result = $DB->Query('SELECT * FROM `tbx_video_thumbnail` WHERE `video_id`=?', array($video['video_id']));
        while ($thumb = $DB->NextRow($th_result)) {
            $thumbs[] = $thumb['thumbnail'];
        }
        $DB->Free($th_result);
        $output = array(strip_newlines($video['title']), strip_newlines($video['description']), $video['duration'], $category['name'], $clip['clip'], 'http://' . $_SERVER['HTTP_HOST'], join(',', $thumbs));
        echo join('|', $output) . "\n";
    }
    $DB->Free($result);
}
Пример #2
0
 /**
  * Create a new user record and return a rcube_user instance
  *
  * @param string IMAP user name
  * @param string IMAP host
  * @return object rcube_user New user instance
  */
 static function create($user, $host)
 {
     $user_name = '';
     $user_email = '';
     $rcmail = rcmail::get_instance();
     // try to resolve user in virtuser table and file
     if ($email_list = self::user2email($user, false, true)) {
         $user_email = is_array($email_list[0]) ? $email_list[0][0] : $email_list[0];
     }
     $data = $rcmail->plugins->exec_hook('create_user', array('user' => $user, 'user_name' => $user_name, 'user_email' => $user_email));
     // plugin aborted this operation
     if ($data['abort']) {
         return false;
     }
     $user_name = $data['user_name'];
     $user_email = $data['user_email'];
     $dbh = $rcmail->get_dbh();
     $dbh->query("INSERT INTO " . get_table_name('users') . "\n        (created, last_login, username, mail_host, alias, language)\n       VALUES (" . $dbh->now() . ", " . $dbh->now() . ", ?, ?, ?, ?)", strip_newlines($user), strip_newlines($host), strip_newlines($data['alias'] ? $data['alias'] : $user_email), $_SESSION['language']);
     if ($user_id = $dbh->insert_id('users')) {
         // create rcube_user instance to make plugin hooks work
         $user_instance = new rcube_user($user_id);
         $rcmail->user = $user_instance;
         $mail_domain = $rcmail->config->mail_domain($host);
         if ($user_email == '') {
             $user_email = strpos($user, '@') ? $user : sprintf('%s@%s', $user, $mail_domain);
         }
         if ($user_name == '') {
             $user_name = $user != $user_email ? $user : '';
         }
         if (empty($email_list)) {
             $email_list[] = strip_newlines($user_email);
         } else {
             if (count($email_list) > 1 && $rcmail->config->get('identities_level', 0) > 1) {
                 $email_list = array($email_list[0]);
             }
         }
         // create new identities records
         $standard = 1;
         foreach ($email_list as $row) {
             if (is_array($row)) {
                 $email = $row[0];
                 $name = $row[1] ? $row[1] : $user_name;
             } else {
                 $email = $row;
                 $name = $user_name;
             }
             $plugin = $rcmail->plugins->exec_hook('create_identity', array('login' => true, 'record' => array('user_id' => $user_id, 'name' => strip_newlines($name), 'email' => $email, 'standard' => $standard, 'signature' => '')));
             if (!$plugin['abort'] && $plugin['record']['email']) {
                 $dbh->query("INSERT INTO " . get_table_name('identities') . "\n                (user_id, del, standard, name, email, signature)\n               VALUES (?, 0, ?, ?, ?, ?)", $user_id, $plugin['record']['standard'], $plugin['record']['name'] != NULL ? $plugin['record']['name'] : '', $plugin['record']['email'], $plugin['record']['signature']);
             }
             $standard = 0;
         }
     } else {
         raise_error(array('code' => 500, 'type' => 'php', 'line' => __LINE__, 'file' => __FILE__, 'message' => "Failed to create new user"), true, false);
     }
     return $user_id ? $user_instance : false;
 }
Пример #3
0
function forwardPage($id)
{
    global $tables;
    $ok = true;
    $subtitle = '';
    $info = '';
    $html = '';
    $form = '';
    $personalNote = '';
    ## Check requirements
    # message
    $mid = 0;
    if (isset($_REQUEST['mid'])) {
        $mid = sprintf('%d', $_REQUEST['mid']);
        $messagedata = loadMessageData($mid);
        $mid = $messagedata['id'];
        if ($mid) {
            $subtitle = $GLOBALS['strForwardSubtitle'] . ' ' . stripslashes($messagedata['subject']);
        }
    }
    #mid set
    # user
    if (!isset($_REQUEST['uid']) || !$_REQUEST['uid']) {
        FileNotFound();
    }
    ## get userdata
    $req = Sql_Query(sprintf('select * from %s where uniqid = "%s"', $tables['user'], sql_escape($_REQUEST['uid'])));
    $userdata = Sql_Fetch_Array($req);
    ## verify that this subscriber actually received this message to forward, otherwise they're not allowed
    $allowed = Sql_Fetch_Row_Query(sprintf('select userid from %s where userid = %d and messageid = %d', $GLOBALS['tables']['usermessage'], $userdata['id'], $mid));
    if (empty($userdata['id']) || $allowed[0] != $userdata['id']) {
        ## when sending a test email as an admin, the entry isn't there yet
        if (empty($_SESSION['adminloggedin']) || $_SESSION['adminloggedin'] != $_SERVER['REMOTE_ADDR']) {
            FileNotFound('<br/><i>' . $GLOBALS['I18N']->get('When testing the phpList forward functionality, you need to be logged in as an administrator.') . '</i><br/>');
        }
    }
    $firstpage = 1;
    ## is this the initial page or a followup
    # forward addresses
    $forwardemail = '';
    if (isset($_REQUEST['email']) && !empty($_REQUEST['email'])) {
        $firstpage = 0;
        $forwardPeriodCount = Sql_Fetch_Array_Query(sprintf('select count(user) from %s where date_add(time,interval %s) >= now() and user = %d and status ="sent" ', $tables['user_message_forward'], FORWARD_EMAIL_PERIOD, $userdata['id']));
        $forwardemail = stripslashes($_REQUEST['email']);
        $emails = explode("\n", $forwardemail);
        $emails = trimArray($emails);
        $forwardemail = implode("\n", $emails);
        #0011860: forward to friend, multiple emails
        $emailCount = $forwardPeriodCount[0];
        foreach ($emails as $index => $email) {
            $emails[$index] = trim($email);
            if (is_email($email)) {
                ++$emailCount;
            } else {
                $info .= sprintf('<br />' . $GLOBALS['strForwardInvalidEmail'], $email);
                $ok = false;
            }
        }
        if ($emailCount > FORWARD_EMAIL_COUNT) {
            $info .= '<br />' . $GLOBALS['strForwardCountReached'];
            $ok = false;
        }
    } else {
        $ok = false;
    }
    #0011996: forward to friend - personal message
    # text cannot be longer than max, to prevent very long text with only linefeeds total cannot be longer than twice max
    if (FORWARD_PERSONAL_NOTE_SIZE && isset($_REQUEST['personalNote'])) {
        if (strlen(strip_newlines($_REQUEST['personalNote'])) > FORWARD_PERSONAL_NOTE_SIZE || strlen($_REQUEST['personalNote']) > FORWARD_PERSONAL_NOTE_SIZE * 2) {
            $info .= '<BR />' . $GLOBALS['strForwardNoteLimitReached'];
            $ok = false;
        }
        $personalNote = strip_tags(htmlspecialchars_decode(stripslashes($_REQUEST['personalNote'])));
        $userdata['personalNote'] = $personalNote;
    }
    if ($userdata['id'] && $mid) {
        if ($ok && count($emails)) {
            ## All is well, send it
            require_once 'admin/sendemaillib.php';
            #0013845 Lead Ref Scheme
            if (FORWARD_FRIEND_COUNT_ATTRIBUTE) {
                $iCountFriends = FORWARD_FRIEND_COUNT_ATTRIBUTE;
            } else {
                $iCountFriends = 0;
            }
            if ($iCountFriends) {
                $nFriends = intval(UserAttributeValue($userdata['id'], $iCountFriends));
            }
            ## remember the lists for this message in order to notify only those admins
            ## that own them
            $messagelists = array();
            $messagelistsreq = Sql_Query(sprintf('select listid from %s where messageid = %d', $GLOBALS['tables']['listmessage'], $mid));
            while ($row = Sql_Fetch_Row($messagelistsreq)) {
                array_push($messagelists, $row[0]);
            }
            foreach ($emails as $index => $email) {
                #0011860: forward to friend, multiple emails
                $done = Sql_Fetch_Array_Query(sprintf('select user,status,time from %s where forward = "%s" and message = %d', $tables['user_message_forward'], $email, $mid));
                $info .= '<br />' . $email . ': ';
                if ($done['status'] === 'sent') {
                    $info .= $GLOBALS['strForwardAlreadyDone'];
                } elseif (isBlackListed($email)) {
                    $info .= $GLOBALS['strForwardBlacklistedEmail'];
                } else {
                    if (!TEST) {
                        # forward the message
                        # sendEmail will take care of blacklisting
                        ### CHECK $email vs $forwardemail
                        if (sendEmail($mid, $email, 'forwarded', $userdata['htmlemail'], array(), $userdata)) {
                            $info .= $GLOBALS['strForwardSuccessInfo'];
                            sendAdminCopy(s('Message Forwarded'), s('%s has forwarded message %d to %s', $userdata['email'], $mid, $email), $messagelists);
                            Sql_Query(sprintf('insert into %s (user,message,forward,status,time)
                 values(%d,%d,"%s","sent",now())', $tables['user_message_forward'], $userdata['id'], $mid, $email));
                            if ($iCountFriends) {
                                ++$nFriends;
                            }
                        } else {
                            $info .= $GLOBALS['strForwardFailInfo'];
                            sendAdminCopy(s('Message Forwarded'), s('%s tried forwarding message %d to %s but failed', $userdata['email'], $mid, $email), $messagelists);
                            Sql_Query(sprintf('insert into %s (user,message,forward,status,time)
                values(%d,%d,"%s","failed",now())', $tables['user_message_forward'], $userdata['id'], $mid, $email));
                            $ok = false;
                        }
                    }
                }
            }
            # foreach friend
            if ($iCountFriends) {
                saveUserAttribute($userdata['id'], $iCountFriends, array('name' => FORWARD_FRIEND_COUNT_ATTRIBUTE, 'value' => $nFriends));
            }
        }
        #ok & emails
    } else {
        # no valid sender
        logEvent(s('Forward request from invalid user ID: %s', substr($_REQUEST['uid'], 0, 150)));
        $info .= '<BR />' . $GLOBALS['strForwardFailInfo'];
        $ok = false;
    }
    /*
      $data = PageData($id);
      if (isset($data['language_file']) && is_file(dirname(__FILE__).'/texts/'.basename($data['language_file']))) {
        @include dirname(__FILE__).'/texts/'.basename($data['language_file']);
      }
    */
    ## BAS Multiple Forward
    ## build response page
    $form = '<form method="post" action="">';
    $form .= sprintf('<input type=hidden name="mid" value="%d">', $mid);
    $form .= sprintf('<input type=hidden name="id" value="%d">', $id);
    $form .= sprintf('<input type=hidden name="uid" value="%s">', $userdata['uniqid']);
    $form .= sprintf('<input type=hidden name="p" value="forward">');
    if (!$ok) {
        #0011860: forward to friend, multiple emails
        if (FORWARD_EMAIL_COUNT == 1) {
            $form .= '<br /><h2>' . $GLOBALS['strForwardEnterEmail'] . '</h2>';
            $form .= sprintf('<input type=text name="email" value="%s" size=50 class="attributeinput">', $forwardemail);
        } else {
            $form .= '<br /><h2>' . sprintf($GLOBALS['strForwardEnterEmails'], FORWARD_EMAIL_COUNT) . '</h2>';
            $form .= sprintf('<textarea name="email" rows="10" cols="50" class="attributeinput">%s</textarea>', $forwardemail);
        }
        #0011996: forward to friend - personal message
        if (FORWARD_PERSONAL_NOTE_SIZE) {
            $form .= sprintf('<h2>' . $GLOBALS['strForwardPersonalNote'] . '</h2>', FORWARD_PERSONAL_NOTE_SIZE);
            $cols = 50;
            $rows = min(10, ceil(FORWARD_PERSONAL_NOTE_SIZE / 40));
            $form .= sprintf('<br/><textarea type="text" name="personalNote" rows="%d" cols="%d" class="attributeinput">%s</textarea>', $rows, $cols, $personalNote);
        }
        $form .= sprintf('<br /><input type="submit" value="%s"></form>', $GLOBALS['strContinue']);
    }
    ### END BAS
    ### Michiel, remote response page
    $remote_content = '';
    if (preg_match("/\\[URL:([^\\s]+)\\]/i", $messagedata['message'], $regs)) {
        if (isset($regs[1]) && strlen($regs[1])) {
            $url = $regs[1];
            if (!preg_match('/^http/i', $url)) {
                $url = 'http://' . $url;
            }
            $remote_content = fetchUrl($url);
        }
    }
    if (!empty($remote_content) && preg_match('/\\[FORWARDFORM\\]/', $remote_content, $regs)) {
        if ($firstpage) {
            ## this is the initial page, not a follow up one.
            $remote_content = str_replace($regs[0], $info . $form, $remote_content);
        } else {
            $remote_content = str_replace($regs[0], $info, $remote_content);
        }
        $res = $remote_content;
    } else {
        $res = '<title>' . $GLOBALS['strForwardTitle'] . '</title>';
        $res .= $GLOBALS['pagedata']['header'];
        $res .= '<h3>' . $subtitle . '</h3>';
        if ($ok) {
            $res .= '<h4>' . $info . '</h4>';
        } elseif (!empty($info)) {
            $res .= '<div class="error missing">' . $info . '</div>';
        }
        $res .= $form;
        $res .= '<p>' . $GLOBALS['PoweredBy'] . '</p>';
        $res .= $GLOBALS['pagedata']['footer'];
    }
    ### END MICHIEL
    return $res;
}
Пример #4
0
}
if (stristr($realname, "Bcc:") or stristr($realname, "cc:")) {
    echo "Invalid content";
    exit;
}
if (stristr($email, "Bcc:") or stristr($email, "cc:")) {
    echo "Invalid content";
    exit;
}
$extraHeaders = "";
if ($email != '') {
    $extraHeaders .= "From: \"" . addslashes($realname) . "\" <" . strip_newlines($email) . ">\r\n";
}
if ($realname != '') {
    $extraHeaders .= "Reply-To:" . strip_newlines($email) . "\r\n";
}
if ($htmlFormat == 'h') {
    $extraHeaders .= "Content-type: text/html\r\n";
}
if ($recipient_cc != '') {
    $extraHeaders .= "Cc: " . strip_newlines($recipient_cc) . "\r\n";
}
if ($recipient_bcc != '') {
    $extraHeaders .= "Bcc: " . strip_newlines($recipient_bcc) . "\r\n";
}
$success = 1;
$success = mail($recipient, $subject, $msg, $extraHeaders);
//print "mail($recipient,$subject,$msg,$extraHeaders)";
//print "$msg";
//header("Location: $redirect");
echo "<script language=\"JavaScript\" type=\"text/javascript\">alert('Thanks for the message! Please hit back on your browswer to return.');self.close();</script>";
Пример #5
0
 /**
  * Create a new user record and return a rcube_user instance
  *
  * @param string $user IMAP user name
  * @param string $host IMAP host
  * @return rcube_user New user instance
  */
 static function create($user, $host)
 {
     $user_name = '';
     $user_email = '';
     $rcube = rcube::get_instance();
     $dbh = $rcube->get_dbh();
     // try to resolve user in virtuser table and file
     if ($email_list = self::user2email($user, false, true)) {
         $user_email = is_array($email_list[0]) ? $email_list[0]['email'] : $email_list[0];
     }
     $data = $rcube->plugins->exec_hook('user_create', array('host' => $host, 'user' => $user, 'user_name' => $user_name, 'user_email' => $user_email, 'email_list' => $email_list, 'language' => $_SESSION['language']));
     // plugin aborted this operation
     if ($data['abort']) {
         return false;
     }
     $dbh->query("INSERT INTO " . $dbh->table_name('users') . " (created, last_login, username, mail_host, language)" . " VALUES (" . $dbh->now() . ", " . $dbh->now() . ", ?, ?, ?)", strip_newlines($data['user']), strip_newlines($data['host']), strip_newlines($data['language']));
     if ($user_id = $dbh->insert_id('users')) {
         // create rcube_user instance to make plugin hooks work
         $user_instance = new rcube_user($user_id, array('user_id' => $user_id, 'username' => $data['user'], 'mail_host' => $data['host'], 'language' => $data['language']));
         $rcube->user = $user_instance;
         $mail_domain = $rcube->config->mail_domain($data['host']);
         $user_name = $data['user_name'];
         $user_email = $data['user_email'];
         $email_list = $data['email_list'];
         if (empty($email_list)) {
             if (empty($user_email)) {
                 $user_email = strpos($data['user'], '@') ? $user : sprintf('%s@%s', $data['user'], $mail_domain);
             }
             $email_list[] = strip_newlines($user_email);
         } else {
             if (count($email_list) > 1 && $rcube->config->get('identities_level', 0) > 1) {
                 $email_list = array($email_list[0]);
             }
         }
         if (empty($user_name)) {
             $user_name = $data['user'];
         }
         // create new identities records
         $standard = 1;
         foreach ($email_list as $row) {
             $record = array();
             if (is_array($row)) {
                 if (empty($row['email'])) {
                     continue;
                 }
                 $record = $row;
             } else {
                 $record['email'] = $row;
             }
             if (empty($record['name'])) {
                 $record['name'] = $user_name != $record['email'] ? $user_name : '';
             }
             $record['name'] = strip_newlines($record['name']);
             $record['user_id'] = $user_id;
             $record['standard'] = $standard;
             $plugin = $rcube->plugins->exec_hook('identity_create', array('login' => true, 'record' => $record));
             if (!$plugin['abort'] && $plugin['record']['email']) {
                 $rcube->user->insert_identity($plugin['record']);
             }
             $standard = 0;
         }
     } else {
         rcube::raise_error(array('code' => 500, 'type' => 'php', 'line' => __LINE__, 'file' => __FILE__, 'message' => "Failed to create new user"), true, false);
     }
     return $user_id ? $user_instance : false;
 }
Пример #6
0
function forwardPage($id)
{
    global $data, $tables, $envelope;
    $ok = true;
    $subtitle = '';
    $info = '';
    $html = '';
    $form = '';
    ## Check requirements
    # user
    if (!isset($_REQUEST["uid"]) || !$_REQUEST['uid']) {
        FileNotFound();
    }
    $firstpage = 1;
    ## is this the initial page or a followup
    # forward addresses
    $forwardemail = '';
    if (isset($_REQUEST['email']) && !empty($_REQUEST['email'])) {
        $firstpage = 0;
        $forwardPeriodCount = Sql_Fetch_Array_Query(sprintf('select count(user) from %s where date_add(time,interval %s) >= now() and user = %d and status ="sent" ', $tables['user_message_forward'], FORWARD_EMAIL_PERIOD, $userdata['id']));
        $forwardemail = stripslashes($_REQUEST['email']);
        $emails = explode("\n", $forwardemail);
        $emails = trimArray($emails);
        $forwardemail = implode("\n", $emails);
        #0011860: forward to friend, multiple emails
        $emailCount = $forwardPeriodCount[0];
        foreach ($emails as $index => $email) {
            $emails[$index] = trim($email);
            if (is_email($email)) {
                $emailCount++;
            } else {
                $info .= sprintf('<BR />' . $GLOBALS['strForwardInvalidEmail'], $email);
                $ok = false;
            }
        }
        if ($emailCount > FORWARD_EMAIL_COUNT) {
            $info .= '<BR />' . $GLOBALS["strForwardCountReached"];
            $ok = false;
        }
    } else {
        $ok = false;
    }
    # message
    $mid = 0;
    if (isset($_REQUEST['mid'])) {
        $mid = sprintf('%d', $_REQUEST['mid']);
        $req = Sql_Query(sprintf('select * from %s where id = %d', $tables["message"], $mid));
        $messagedata = Sql_Fetch_Array($req);
        $mid = $messagedata['id'];
        if ($mid) {
            $subtitle = $GLOBALS['strForwardSubtitle'] . ' ' . stripslashes($messagedata['subject']);
        }
    }
    #mid set
    ## get userdata
    $req = Sql_Query("select * from {$tables["user"]} where uniqid = \"" . $_REQUEST["uid"] . "\"");
    $userdata = Sql_Fetch_Array($req);
    $req = Sql_Query(sprintf('select * from %s where email = "%s"', $tables["user"], $forwardemail));
    $forwarduserdata = Sql_Fetch_Array($req);
    #0011996: forward to friend - personal message
    # text cannot be longer than max, to prevent very long text with only linefeeds total cannot be longer than twice max
    if (FORWARD_PERSONAL_NOTE_SIZE && isset($_REQUEST['personalNote'])) {
        if (strlen(strip_newlines($_REQUEST['personalNote'])) > FORWARD_PERSONAL_NOTE_SIZE || strlen($_REQUEST['personalNote']) > FORWARD_PERSONAL_NOTE_SIZE * 2) {
            $info .= '<BR />' . $GLOBALS['strForwardNoteLimitReached'];
            $ok = false;
        }
        $personalNote = strip_tags(htmlspecialchars_decode(stripslashes($_REQUEST['personalNote'])));
        $userdata['personalNote'] = $personalNote;
    }
    if ($userdata["id"] && $mid) {
        if ($ok && count($emails)) {
            ## All is well, send it
            require 'admin/sendemaillib.php';
            #0013845 Lead Ref Scheme
            if (FORWARD_FRIEND_COUNT_ATTRIBUTE) {
                $iCountFriends = getAttributeIDbyName(FORWARD_FRIEND_COUNT_ATTRIBUTE);
            } else {
                $iCountFriends = 0;
            }
            if ($iCountFriends) {
                $nFriends = intval(UserAttributeValue($userdata['id'], $iCountFriends));
            }
            #0011860: forward to friend, multiple emails
            foreach ($emails as $index => $email) {
                #0011860: forward to friend, multiple emails
                $done = Sql_Fetch_Array_Query(sprintf('select user,status,time from %s where forward = "%s" and message = %d', $tables['user_message_forward'], $email, $mid));
                $info .= '<BR />' . $email . ': ';
                if ($done['status'] === 'sent') {
                    $info .= $GLOBALS['strForwardAlreadyDone'];
                } elseif (isBlackListed($email)) {
                    $info .= $GLOBALS['strForwardBlacklistedEmail'];
                } else {
                    if (!TEST) {
                        # forward the message
                        # sendEmail will take care of blacklisting
                        if (sendEmail($mid, $email, 'forwarded', $userdata['htmlemail'], array(), $userdata)) {
                            $info .= $GLOBALS["strForwardSuccessInfo"];
                            sendAdminCopy("Message Forwarded", $userdata["email"] . " has forwarded a message {$mid} to {$email}");
                            Sql_Query(sprintf('insert into %s (user,message,forward,status,time)
                 values(%d,%d,"%s","sent",now())', $tables['user_message_forward'], $userdata['id'], $mid, $email));
                            if ($iCountFriends) {
                                $nFriends++;
                            }
                        } else {
                            $info .= $GLOBALS["strForwardFailInfo"];
                            sendAdminCopy("Message Forwarded", $userdata["email"] . " tried forwarding a message {$mid} to {$email} but failed");
                            Sql_Query(sprintf('insert into %s (user,message,forward,status,time)
                values(%d,%d,"%s","failed",now())', $tables['user_message_forward'], $userdata['id'], $mid, $email));
                            $ok = false;
                        }
                    }
                }
            }
            # foreach friend
            if ($iCountFriends) {
                saveUserAttribute($userdata['id'], $iCountFriends, array('name' => FORWARD_FRIEND_COUNT_ATTRIBUTE, 'value' => $nFriends));
            }
        }
        #ok & emails
    } else {
        # no valid sender
        logEvent("Forward request from invalid user ID: " . substr($_REQUEST["uid"], 0, 150));
        $info .= '<BR />' . $GLOBALS["strForwardFailInfo"];
        $ok = false;
    }
    $data = PageData($id);
    if (isset($data['language_file']) && is_file(dirname(__FILE__) . '/texts/' . basename($data['language_file']))) {
        @(include dirname(__FILE__) . '/texts/' . basename($data['language_file']));
    }
    ## BAS Multiple Forward
    ## build response page
    $form = '<form method="post" action="">';
    $form .= sprintf('<input type=hidden name="mid" value="%d">', $mid);
    $form .= sprintf('<input type=hidden name="id" value="%d">', $id);
    $form .= sprintf('<input type=hidden name="uid" value="%s">', $userdata['uniqid']);
    $form .= sprintf('<input type=hidden name="p" value="forward">');
    if (!$ok) {
        #0011860: forward to friend, multiple emails
        if (FORWARD_EMAIL_COUNT == 1) {
            $form .= '<BR /><H2>' . $GLOBALS['strForwardEnterEmail'] . '</H2>';
            $form .= sprintf('<input type=text name="email" value="%s" size=50 class="attributeinput">', $forwardemail);
        } else {
            $form .= '<BR /><H2>' . sprintf($GLOBALS['strForwardEnterEmails'], FORWARD_EMAIL_COUNT) . '</H2>';
            $form .= sprintf('<textarea name="email" rows=10 cols=50 class="attributeinput">%s</textarea>', $forwardemail);
        }
        #0011996: forward to friend - personal message
        if (FORWARD_PERSONAL_NOTE_SIZE) {
            $form .= sprintf('<h2>' . $GLOBALS['strForwardPersonalNote'] . '</H2>', FORWARD_PERSONAL_NOTE_SIZE);
            $cols = 50;
            $rows = min(10, ceil(FORWARD_PERSONAL_NOTE_SIZE / 40));
            $form .= sprintf('<BR/><textarea type=text name="personalNote" rows=%d cols=%d class="attributeinput">%s</textarea>', $rows, $cols, $personalNote);
        }
        $form .= sprintf('<br /><input type=submit value="%s"></form>', $GLOBALS['strContinue']);
    }
    ### END BAS
    ### Michiel, remote response page
    $remote_content = '';
    if (preg_match("/\\[URL:([^\\s]+)\\]/i", $messagedata['message'], $regs)) {
        if (isset($regs[1]) && strlen($regs[1])) {
            $url = $regs[1];
            if (!preg_match('/^http/i', $url)) {
                $url = 'http://' . $url;
            }
            $remote_content = fetchUrl($url);
        }
    }
    if (!empty($remote_content) && preg_match('/\\[FORWARDFORM\\]/', $remote_content, $regs)) {
        if ($firstpage) {
            ## this is the initial page, not a follow up one.
            $remote_content = str_replace($regs[0], $info . $form, $remote_content);
        } else {
            $remote_content = str_replace($regs[0], $info, $remote_content);
        }
        $res = $remote_content;
    } else {
        $res = '<title>' . $GLOBALS["strForwardTitle"] . '</title>';
        $res .= $data["header"];
        $res .= '<h1>' . $subtitle . '</h1>';
        if ($ok) {
            $res .= '<h2>' . $info . '</h2>';
        } else {
            $res .= '<div class="missing">' . $info . '</div>';
        }
        $res .= $form;
        $res .= "<P>" . $GLOBALS["PoweredBy"] . '</p>';
        $res .= $data["footer"];
    }
    ### END MICHIEL
    return $res;
}