function setting_manager($post = false)
 {
     $this->sanitizer =& TextSanitizer::getInstance();
     if ($post) {
         $this->readPost();
     } else {
         $this->dbType = 'pgsql';
         $this->dbHost = 'localhost';
         $this->dbPort = '5432';
         $this->dcl_root = str_replace("\\", "/", getcwd());
         // "
         $this->dcl_root = str_replace("/setup", "/", $this->dcl_root);
         $filepath = !empty($_SERVER['REQUEST_URI']) ? dirname($_SERVER['REQUEST_URI']) : dirname($_SERVER['SCRIPT_NAME']);
         $filepath = str_replace("\\", "/", $filepath);
         // "
         $filepath = str_replace("/setup", "", $filepath);
         if (substr($filepath, 0, 1) == "/") {
             $filepath = substr($filepath, 1);
         }
         if (substr($filepath, -1) == "/") {
             $filepath = substr($filepath, 0, -1);
         }
         $this->dcl_www_root = "/" . $filepath . "/";
         $this->redirMethod = 'php';
         $this->cookieMethod = 'php';
     }
 }
 function setting_manager($post = false)
 {
     $this->sanitizer =& TextSanitizer::getInstance();
     if ($post) {
         $this->readPost();
     } else {
         $this->database = 'mysql';
         $this->dbhost = 'localhost';
         $this->prefix = 'xoops';
         $this->db_pconnect = 0;
         $this->root_path = str_replace("\\", "/", getcwd());
         // "
         $this->root_path = str_replace("/install", "", $this->root_path);
         $filepath = !empty($_SERVER['REQUEST_URI']) ? dirname($_SERVER['REQUEST_URI']) : dirname($_SERVER['SCRIPT_NAME']);
         $filepath = str_replace("\\", "/", $filepath);
         // "
         $filepath = str_replace("/install", "", $filepath);
         if (substr($filepath, 0, 1) == "/") {
             $filepath = substr($filepath, 1);
         }
         if (substr($filepath, -1) == "/") {
             $filepath = substr($filepath, 0, -1);
         }
         $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://';
         $this->xoops_url = !empty($filepath) ? $protocol . $_SERVER['HTTP_HOST'] . "/" . $filepath : $protocol . $_SERVER['HTTP_HOST'];
     }
 }
Esempio n. 3
0
 function setting_manager($post = false)
 {
     $this->sanitizer =& TextSanitizer::getInstance();
     if ($post) {
         $this->readPost();
     } else {
         $this->database = 'mysql';
         $this->dbhost = 'localhost';
         //
         // Generate prefix
         //
         srand(microtime() * 10000);
         do {
             $this->prefix = substr(md5(rand()), 0, 6);
         } while (!preg_match("/^[a-z]/", $this->prefix));
         $this->salt = substr(md5(rand()), 5, 8);
         $this->db_pconnect = 0;
         $this->root_path = str_replace('\\', '/', getcwd());
         // "
         $this->root_path = str_replace('/install', '', $this->root_path);
         $filepath = !empty($_SERVER['REQUEST_URI']) ? dirname($_SERVER['REQUEST_URI']) : dirname($_SERVER['SCRIPT_NAME']);
         $filepath = str_replace('\\', '/', $filepath);
         // "
         $filepath = str_replace('/install', '', $filepath);
         if (substr($filepath, 0, 1) == '/') {
             $filepath = substr($filepath, 1);
         }
         if (substr($filepath, -1) == '/') {
             $filepath = substr($filepath, 0, -1);
         }
         $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://';
         $this->xoops_url = !empty($filepath) ? $protocol . $_SERVER['HTTP_HOST'] . '/' . $filepath : $protocol . $_SERVER['HTTP_HOST'];
         // find xoops_trust_path
         $path = $this->root_path;
         while (strlen($path) > 4) {
             if (is_dir($path . '/xoops_trust_path')) {
                 $this->trust_path = $path . '/xoops_trust_path';
                 break;
             }
             $path = dirname($path);
         }
     }
 }
Esempio n. 4
0
        exit;
    } else {
        if (INSTALL_USER != '' && $_SERVER['PHP_AUTH_USER'] != INSTALL_USER) {
            header('HTTP/1.0 401 Unauthorized');
            echo 'You can not access this XOOPS installer.';
            exit;
        }
        if (INSTALL_PASSWD != $_SERVER['PHP_AUTH_PW']) {
            header('HTTP/1.0 401 Unauthorized');
            echo 'You can not access this XOOPS installer.';
            exit;
        }
    }
}
include_once './class/textsanitizer.php';
$myts =& TextSanitizer::getInstance();
if (isset($_POST)) {
    foreach ($_POST as $k => $v) {
        ${$k} = $myts->stripSlashesGPC($v);
    }
}
$language = 'english';
if (!empty($_POST['lang'])) {
    $language = $_POST['lang'];
} else {
    if (isset($_COOKIE['install_lang'])) {
        $language = $_COOKIE['install_lang'];
    } else {
        $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'ja,en-us;q=0.7,zh-TW;q=0.6';
        if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
            $accept_langs = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
 /**
  *	sendNewModeratedMsgNotice - contains the logic to send out email notifications to the forum admins when a new moderated message is posted
  *
  *	@return boolean success.
  */
 function sendNewModeratedMsgNotice()
 {
     $ids =& $this->Forum->getForumAdminIDs();
     //
     //	See if there is anyone to send messages to
     //
     if (!count($ids) > 0 && !$this->Forum->getSendAllPostsTo()) {
         return true;
     }
     $f =& $this->getForum();
     $g =& $f->getGroup();
     $body = "\nRead to this message and approve/reject it at: " . "\n" . util_make_url('/forum/admin/pending.php?action=view_pending&group_id=' . $g->getID() . "&forum_id=" . $f->getID()) . "\nBy: " . $this->getPosterRealName() . "\n\n";
     $text = $this->getBody();
     $sanitizer = new TextSanitizer();
     $text = $sanitizer->convertNeededTagsForEmail($text);
     $text = strip_tags($this->removebbcode(util_line_wrap($text)));
     $text = $sanitizer->convertExtendedCharsForEmail($text);
     $body .= $text . "\n\n______________________________________________________________________" . "\nYou are receiving this email because the forum you administrate has a new moderated message awaiting your approval.";
     //$extra_headers = 'Reply-to: '.$this->Forum->getUnixName().'@'.$GLOBALS['sys_default_domain'];
     $extra_headers = "Return-Path: <noreply@" . $GLOBALS['sys_default_domain'] . ">\n";
     $extra_headers .= "Errors-To: <noreply@" . $GLOBALS['sys_default_domain'] . ">\n";
     $extra_headers .= "Sender: <noreply@" . $GLOBALS['sys_default_domain'] . ">\n";
     $extra_headers .= "Reply-To: " . $this->Forum->getReturnEmailAddress() . "\n";
     $extra_headers .= "Precedence: Bulk\n" . "List-Id: " . $this->Forum->getName() . " <forum" . $this->Forum->getId() . "@" . $GLOBALS['sys_default_domain'] . ">\n" . "List-Help: " . util_make_url('/forum/forum.php?id=' . $this->Forum->getId()) . "\n" . "Message-Id: <forumpost" . $this->getId() . "@" . $GLOBALS['sys_default_domain'] . ">";
     $parentid = $this->getParentId();
     if (!empty($parentid)) {
         $extra_headers .= "\nIn-Reply-To: " . $this->Forum->getReturnEmailAddress() . "\n" . "References: <forumpost" . $this->getParentId() . "@" . $GLOBALS['sys_default_domain'] . ">";
     }
     $subject = "[" . $this->Forum->getUnixName() . "][" . $this->getID() . "] " . util_unconvert_htmlspecialchars($this->getSubject());
     if (count($ids) != 0) {
         $sql = "SELECT email FROM users WHERE status='A' AND user_id IN ('" . implode($ids, '\',\'') . "')";
         $bccres = db_query($sql);
     }
     ($BCC =& implode(util_result_column_to_array($bccres), ',')) . ',' . $this->Forum->getSendAllPostsTo();
     $User = user_get_object($this->getPosterID());
     //util_send_message('',$subject,$body,$User->getEmail(),$BCC,$this->getPosterRealName(),$extra_headers);
     util_send_message('', $subject, $body, "noreply@" . $GLOBALS['sys_default_domain'], $BCC, 'Forum', $extra_headers);
     //		util_handle_message(array_unique($ids),$subject,$body,$this->Forum->getSendAllPostsTo(),'','forumgateway@'.$GLOBALS[sys_default_domain]);
     return true;
 }
Esempio n. 6
0
 $doc_group = getIntFromRequest('doc_group');
 $title = getStringFromRequest('title');
 $description = getStringFromRequest('description');
 $language_id = getIntFromRequest('language_id');
 $data = getStringFromRequest('data');
 $file_url = getStringFromRequest('file_url');
 //$ftp_filename = getStringFromRequest('ftp_filename');
 $uploaded_data = getUploadedFile('uploaded_data');
 $stateid = getIntFromRequest('stateid');
 $filetype = getStringFromRequest('filetype');
 $editor = getStringFromRequest('editor');
 $d = new Document($g, $docid);
 if ($d->isError()) {
     exit_error(_('Error'), $d->getErrorMessage());
 }
 $sanitizer = new TextSanitizer();
 $data = $sanitizer->SanitizeHtml($data);
 if ($editor && $d->getFileData() != $data && !$uploaded_data['name']) {
     $filename = $d->getFileName();
     if (!$filetype) {
         $filetype = $d->getFileType();
     }
 } elseif ($uploaded_data['name']) {
     if (!is_uploaded_file($uploaded_data['tmp_name'])) {
         exit_error(_('Error'), sprintf(_('Invalid file attack attempt %1$s'), $uploaded_data['name']));
     }
     $data = addslashes(fread(fopen($uploaded_data['tmp_name'], 'r'), $uploaded_data['size']));
     $filename = $uploaded_data['name'];
     $filetype = $uploaded_data['type'];
 } elseif ($file_url) {
     $data = '';
Esempio n. 7
0
 //actually finish editing the message and save the contents
 $f = new Forum($fa->GetGroupObject(), $forum_id);
 if (!$f || !is_object($f)) {
     exit_error('Error', 'Error Getting Forum');
 } elseif ($f->isError()) {
     exit_error('Error', $f->getErrorMessage());
 }
 $fm = new ForumMessage($f, $msg_id, false, false);
 if (!$fm || !is_object($fm)) {
     exit_error(_('Error'), _('Error getting new forum message'));
 } elseif ($fm->isError()) {
     exit_error(_('Error'), $fm->getErrorMessage());
 }
 $subject = getStringFromRequest('subject');
 $body = getStringFromRequest('body');
 $sanitizer = new TextSanitizer();
 $body = $sanitizer->SanitizeHtml($body);
 $is_followup_to = getStringFromRequest('is_followup_to');
 $form_key = getStringFromRequest('form_key');
 $posted_by = getStringFromRequest('posted_by');
 $post_date = getStringFromRequest('post_date');
 $is_followup_to = getStringFromRequest('is_followup_to');
 $has_followups = getStringFromRequest('has_followups');
 $most_recent_date = getStringFromRequest('most_recent_date');
 if ($fm->updatemsg($forum_id, $posted_by, $subject, $body, $post_date, $is_followup_to, $thread_id, $has_followups, $most_recent_date)) {
     $feedback .= _('Message Edited Successfully');
 } else {
     $feedback .= $fm->getErrorMessage();
 }
 forum_header(array('title' => _('Edit a Message')));
 echo '<p>' . util_make_link('/forum/forum.php?forum_id=' . $forum_id, _("Return to the forum"));
Esempio n. 8
0
    }
    news_footer(array());
} else {
    if (user_ismember($sys_news_group, 'A')) {
        /*
        	News uber-user admin pages
        	Show all waiting news items except those already rejected.
        	Admin members of $sys_news_group (news project) can edit/change/approve news items
        */
        if ($post_changes) {
            if ($approve) {
                if ($status == 1) {
                    /*
                    	Update the db so the item shows on the home page
                    */
                    $sanitizer = new TextSanitizer();
                    $details = $sanitizer->SanitizeHtml($details);
                    $sql = "UPDATE news_bytes SET is_approved='1', post_date='" . time() . "', " . "summary='" . htmlspecialchars($summary) . "', details='" . $details . "' WHERE id='{$id}'";
                    $result = db_query($sql);
                    if (!$result || db_affected_rows($result) < 1) {
                        $feedback .= _('Error On Update:');
                    } else {
                        $feedback .= _('NewsByte Updated.');
                    }
                } else {
                    if ($status == 2) {
                        /*
                        	Move msg to deleted status
                        */
                        $sql = "UPDATE news_bytes SET is_approved='2' WHERE id='{$id}'";
                        $result = db_query($sql);