示例#1
0
 /**
  * submit join
  *	@param $p	join fields
  */
 function joinSubmit($p)
 {
     $js = '';
     // check input values
     for (reset($this->f_join); list($name, $a) = each($this->f_join);) {
         if ($a['regexp']) {
             if (!preg_match($a['regexp'], $p[$name])) {
                 $js .= $this->_getJsErr($name, $a['err']);
             }
         }
         switch ($name) {
             case 'username':
                 if (!$this->_checkUniqUser($p[$name])) {
                     $js .= $this->_getJsErr($name, '[L[Username must be uniq]]');
                 }
                 break;
             case 'email':
                 if (!$this->_checkUniqEmail($p[$name])) {
                     $js .= $this->_getJsErr($name, '[L[Email must be uniq]]');
                 }
                 break;
         }
     }
     // add user
     if (!$js) {
         $db = new DbLogin();
         $p['pwd'] = $this->_genPwd();
         prepare_to_db($p['username'], 0);
         prepare_to_db($p['email'], 0);
         if (!$db->insertUser($p)) {
             $js .= $this->_getJsErr('email', '[L[Database error]]');
         }
         // send activation mail
         $mail = new BxMail();
         if (!$mail->sendActivationMail($p)) {
             $js .= $this->_getJsErr('email', '[L[Send mail failed]]');
         }
     }
     return '<js>' . $js . '</js>';
 }
示例#2
0
 /**
  * save forum information
  *	@param $cat_id		category id
  *	@param $forum_id	forum id
  *	@param $title		forum title
  *	@param $desc		forum description
  *	@param $type		forum type (public|private)
  *	@param return		xml (<ret>0</ret>|<ret>1</ret>)
  */
 function editFormSubmit($cat_id, $forum_id, $title, $desc, $type, $order)
 {
     if (!$this->_admin || 0 != strcasecmp($_SERVER['REQUEST_METHOD'], 'POST')) {
         return '<ret>0</ret>';
     }
     $title = unicode_urldecode($title);
     $desc = unicode_urldecode($desc);
     prepare_to_db($title, 0);
     prepare_to_db($desc, 0);
     prepare_to_db($type, 0);
     $db = new DbAdmin();
     if ($forum_id > 0) {
         return $db->editForum((int) $forum_id, $title, $desc, $type, (int) $order) ? '<ret>1</ret>' : '<ret>0</ret>';
     } else {
         global $f;
         $forum_uri = $f->uriGenerate($title, TF_FORUM, 'forum_uri');
         return $db->insertForum((int) $cat_id, $title, $desc, $type, $forum_uri, (int) $order) ? '<ret>1</ret>' : '<ret>0</ret>';
     }
 }
 /**
  * save forum information
  *	@param $cat_id		category id
  *	@param $forum_id	forum id
  *	@param $title		forum title
  *	@param $desc		forum description
  *	@param $type		forum type (public|private)
  *	@param return		xml (<ret>0</ret>|<ret>1</ret>)
  */
 function editFormSubmit($cat_id, $forum_id, $title, $desc, $type)
 {
     if (!$this->_admin) {
         return '<ret>0</ret>';
     }
     $title = unicode_urldecode($title);
     $desc = unicode_urldecode($desc);
     prepare_to_db($title, 0);
     prepare_to_db($desc, 0);
     $db = new DbAdmin();
     if ($forum_id > 0) {
         return $db->editForum((int) $forum_id, $title, $desc, $type) ? '<ret>1</ret>' : '<ret>0</ret>';
     } else {
         global $f;
         $forum_uri = $f->uriGenerate($title, TF_FORUM, 'forum_uri');
         return $db->insertForum((int) $cat_id, $title, $desc, $type, $forum_uri) ? '<ret>1</ret>' : '<ret>0</ret>';
     }
 }
    /**
     * post new topic
     * @param $p	_post array
     */
    function postNewTopicXML($p)
    {
        $fdb = new DbForum();
        $f = $fdb->getForum((int) $p['forum_id']);
        if (!$this->_checkUserPerm('', $f['forum_type'], 'post')) {
            return <<<EOF
<html>
<body>
<script language="javascript" type="text/javascript">

\tif (window.parent.document.getElementById('tinyEditor'))
\t\twindow.parent.tinyMCE.execCommand('mceRemoveControl', false, 'tinyEditor');

\twindow.parent.document.f.accessDenied();

</script>
</body>
</html>
EOF;
        }
        if ($p['topic_sticky'] == 'on' && !$this->_checkUserPerm('', '', 'sticky')) {
            return <<<EOF
<html>
<body>
<script language="javascript" type="text/javascript">

\tif (window.parent.document.getElementById('tinyEditor'))
\t\twindow.parent.tinyMCE.execCommand('mceRemoveControl', false, 'tinyEditor');

\twindow.parent.document.f.accessDenied();

</script>
</body>
</html>
EOF;
        }
        // post mesage here
        $user = $this->_getLoginUserName();
        prepare_to_db($p['topic_subject'], 0);
        prepare_to_db($p['topic_text'], 1);
        $fdb->newTopic((int) $p['forum_id'], $p['topic_subject'], $p['topic_text'], $p['topic_sticky'] == 'on', $user);
        return <<<EOF
<html>
<body>
<script language="javascript" type="text/javascript">

\tif (window.parent.document.getElementById('tinyEditor'))
\t\twindow.parent.tinyMCE.execCommand('mceRemoveControl', false, 'tinyEditor');

\twindow.parent.document.f.postSuccess({$p['forum_id']});

</script>
</body>
</html>
EOF;
    }
示例#5
0
 function download($hash)
 {
     global $gConf;
     prepare_to_db($hash, 0);
     $a = $this->fdb->getAttachment($hash);
     if (!$a) {
         header("HTTP/1.1 404 Not Found");
         echo '404 Not Found';
         exit;
     }
     if (!$this->_checkUserPerm('', '', 'download', (int) $a['forum_id'])) {
         transCheck($this->_no_access(1), $gConf['dir']['xsl'] . 'search_form_main.xsl', $_GET['debug'] ? 0 : 1);
         exit;
     }
     $this->fdb->updateAttachmentDownloads($hash);
     header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
     header("Content-type: {$a['att_type']}");
     header("Content-Length: " . $a['att_size']);
     if (0 != strncmp('image/', $a['att_type'], 6)) {
         header("Content-Disposition: attachment; filename=\"{$a['att_name']}\"");
     }
     readfile($gConf['dir']['attachments'] . orca_build_path($hash) . $hash);
     exit;
 }