コード例 #1
0
ファイル: invokeconfig.php プロジェクト: adi00/wumaproject
function getSubjectByTid($tid, $param)
{
    global $db;
    $tid = (int) $tid;
    if (!$tid) {
        return false;
    }
    $thread = $db->get_one("SELECT tid,fid,author,authorid,subject,type,postdate,hits,replies FROM pw_threads WHERE tid=" . pwEscape($tid));
    $thread['url'] = 'read.php?tid=' . $thread['tid'];
    $thread['title'] = $thread['subject'];
    $thread['titlealt'] = $thread['subject'];
    $thread['image'] = '';
    $thread['forumname'] = getForumName($thread['fid']);
    $thread['forumurl'] = getForumUrl($thread['fid']);
    $temp = array();
    foreach ($param as $key => $value) {
        $temp_2 = '';
        if ($key == 'descrip') {
            $temp_2 = getDescripByTid($tid);
        } elseif ($key == 'image') {
            $temp[$key] = getImagesByTid($tid);
            continue;
        } elseif (array_key_exists($key, $thread)) {
            $temp_2 = $thread[$key];
        } else {
            $temp_2 = '';
        }
        $temp[$key] = PW_tplGetData::_analyseResultByParameter($temp_2, $value);
    }
    return $temp;
}
コード例 #2
0
ファイル: rewardsource.class.php プロジェクト: jechiy/PHPWind
 function _cookData($data)
 {
     foreach ($data as $k => $v) {
         $v['url'] = 'read.php?tid=' . $v['tid'];
         $v['title'] = $v['subject'];
         $v['value'] = $v['postdate'];
         $v['image'] = '';
         $v['forumname'] = getForumName($v['fid']);
         $v['forumurl'] = getForumUrl($v['fid']);
         $v['authorurl'] = 'u.php?uid=' . $v['authorid'];
         list($v['topictypename'], $v['topictypeurl']) = getTopicType($v['type'], $v['fid']);
         $v['addition'] = $v;
         $data[$k] = $v;
     }
     return $data;
 }
コード例 #3
0
 /**
  * 
  * 数据处理
  * @param array $data
  * @return array
  */
 function _cookData($data)
 {
     foreach ($data as $key => $value) {
         $v = array();
         $v['url'] = 'read.php?tid=' . $value['tid'];
         $v['authorurl'] = 'u.php?uid=' . $value['authorid'];
         $v['title'] = $value['subject'];
         $v['forumname'] = getForumName($value['fid']);
         $v['forumurl'] = getForumUrl($value['fid']);
         $v['author'] = $value['anonymous'] ? '匿名' : $value['author'];
         $v['authorid'] = $value['authorid'];
         $v['postdate'] = $value['postdate'];
         $v['topictypename'] = $value['modelname'];
         $v['topictypeurl'] = 'thread.php?fid=' . $value['fid'] . '&modelid=' . $value['modelid'];
         $data[$key] = $v;
     }
     return $data;
 }
コード例 #4
0
 function getRelateDataByKey($key)
 {
     global $db;
     L::loadClass('tplgetdata', 'area', false);
     $tid = (int) $key;
     if (!$tid) {
         return array();
     }
     $thread = $db->get_one("SELECT tid,fid,author,authorid,subject,type,postdate,hits,replies FROM pw_threads WHERE tid=" . S::sqlEscape($tid));
     if (!$thread) {
         return array();
     }
     $thread['url'] = $this->_getSubjectUrl($thread['tid']);
     $thread['title'] = $thread['subject'];
     $thread['titlealt'] = $thread['subject'];
     $thread['authorurl'] = 'u.php?uid=' . $thread['authorid'];
     $thread['image'] = $this->_getImagesByTid($tid);
     $thread['forumname'] = getForumName($thread['fid']);
     $thread['forumurl'] = getForumUrl($thread['fid']);
     $thread['descrip'] = getDescripByTid($tid);
     return $thread;
 }
コード例 #5
0
ファイル: tucoolsource.class.php プロジェクト: jechiy/PHPWind
 /**
  * 
  * 数据处理
  * @param int $fid
  * @return 
  */
 function _cookData($data)
 {
     $attachsService = L::loadClass('attachs', 'forum');
     foreach ($data as $k => $v) {
         $v['url'] = 'read.php?tid=' . $v['tid'];
         $v['title'] = $v['subject'];
         if (!$v['title']) {
             unset($data[$k]);
             continue;
         }
         $v['value'] = $v['postdate'];
         $v['hits'] = $v['hits'] ? $v['hits'] : 0;
         $v['totalnum'] = $v['totalnum'] ? $v['totalnum'] : 0;
         $v['collectnum'] = $v['collectnum'] ? $v['collectnum'] : 0;
         $temp = geturl($v['cover'], 'show');
         $v['image'] = $temp[0] ? $temp[0] : $GLOBALS['imgpath'] . '/imgdel_h200.jpg';
         $v['forumname'] = getForumName($v['fid']);
         $v['forumurl'] = getForumUrl($v['fid']);
         $v['authorurl'] = 'u.php?uid=' . $v['authorid'];
         $v['addition'] = $v;
         $data[$k] = $v;
     }
     return $data;
 }
コード例 #6
0
ファイル: gettidcontent.php プロジェクト: adi00/wumaproject
!defined('P_W') && exit('Forbidden');
define('AJAX', 1);
InitGP(array('tid', 'block_id'));
$tid = (int) $tid;
if (!$tid) {
    exit;
}
$thread = $db->get_one("SELECT tid,fid,author,authorid,subject,type,postdate,hits,replies FROM pw_threads WHERE tid=" . pwEscape($tid));
$temp = array();
if ($thread) {
    $temp = array();
    $temp['url'] = 'read.php?tid=' . $thread['tid'];
    $temp['title'] = $thread['subject'];
    $temp['image'] = '';
    $temp['forumname'] = getForumName($thread['fid']);
    $temp['forumurl'] = getForumUrl($thread['fid']);
    $temp['descrip'] = getDescripByTid($tid);
    //	$block	= $stopic_service->getBlockById($block_id);
    //	foreach ($block['config'] as $value) {
    //		if ($value == 'descrip') {
    //			$temp[$value] = getDescripByTid($tid);
    //		} elseif (array_key_exists($value,$thread)) {
    //			$temp[$value] = $thread[$value];
    //		} else {
    //			$temp[$value] = '';
    //		}
    //	}
    $temp = pwJsonEncode($temp);
    echo "success\t" . $temp;
} else {
コード例 #7
0
ファイル: element.class.php プロジェクト: adi00/wumaproject
 /**
  * 热门点击排行
  *
  * @param string $type
  * @param string $fid
  * @param int $num
  * @param int $special
  * @return array
  */
 function hitSortInterface($type = 'hitsort', $fid = 0, $num = 0, $special = 0)
 {
     !$type && ($type = 'hitsort');
     !in_array($type, array('hitsort', 'hitsortday', 'hitsortweek')) && Showmsg('undefined_action');
     $num = intval($num) ? intval($num) : $this->defaultnum;
     !$fid && ($fid = getCommonFid());
     if ($type == 'hitsort' && $this->ifpwcache & 16 || $type == 'hitsortday' && $this->ifpwcache & 32 || $type == 'hitsortweek' && $this->ifpwcache & 64) {
         $sqladd = '';
         $sort = array();
         $fid && ($sqladd .= " AND e.mark IN ({$fid}) ");
         $query = $this->db->query("SELECT t.tid,t.fid,t.author,t.authorid,t.subject,t.type,t.postdate,t.hits,t.replies FROM pw_elements e LEFT JOIN pw_threads t ON e.id=t.tid WHERE e.type=" . pwEscape($type) . " {$sqladd} ORDER BY e.value DESC " . pwLimit($num));
         while ($rt = $this->db->fetch_array($query)) {
             $post = array();
             $post['url'] = 'read.php?tid=' . $rt['tid'];
             $post['title'] = $rt['subject'];
             $post['value'] = $rt['hits'];
             $post['image'] = '';
             $post['forumname'] = getForumName($rt['fid']);
             $post['forumurl'] = getForumUrl($rt['fid']);
             $post['addition'] = $rt;
             $sort[] = $post;
         }
     } else {
         $info = $this->singLeton(true, $num);
         switch ($type) {
             case 'hitsort':
                 $time = 0;
                 break;
             case 'hitsortday':
                 $time = 24;
                 break;
             case 'hitsortweek':
                 $time = 7 * 24;
                 break;
             default:
                 $time = 0;
         }
         $sort = $info->getPostList('hitsort', $fid, $info->cachenum, $time);
     }
     return $sort;
 }
コード例 #8
0
 /**
  * 
  * 数据处理
  * @param array $data
  * @return array
  */
 function _cookData($data)
 {
     foreach ($data as $key => $value) {
         $v = array();
         $v['url'] = 'read.php?tid=' . $value['tid'];
         $v['title'] = $value['subject'];
         $v['forumname'] = getForumName($value['fid']);
         $v['forumurl'] = getForumUrl($value['fid']);
         $v['author'] = $value['anonymous'] ? '匿名' : $value['author'];
         $v['authorid'] = $value['authorid'];
         $v['authorurl'] = 'u.php?uid=' . $v['authorid'];
         for ($i = 1; $i < 6; $i++) {
             if ($value['picture' . $i]) {
                 $temp = geturl($value['picture' . $i]);
                 break;
             }
         }
         $v['image'] = $temp[0] ? $temp[0] : '';
         $v['postdate'] = $value['postdate'];
         $v['topictypename'] = $value['modelname'];
         $v['topictypeurl'] = 'thread.php?fid=' . $value['fid'] . '&actmid=' . $value['actmid'];
         $v['starttime'] = get_date($value['starttime'], 'Y-m-d');
         $v['endtime'] = get_date($value['endtime'], 'Y-m-d');
         $data[$key] = $v;
     }
     return $data;
 }
コード例 #9
0
ファイル: element.class.php プロジェクト: jechiy/PHPWind
 function _cookSubjectData($data)
 {
     $post = array();
     $post['url'] = 'read.php?tid=' . $data['tid'];
     $post['authorurl'] = 'u.php?uid=' . $data['authorid'];
     $post['title'] = $data['subject'];
     $post['value'] = $data['postdate'];
     $post['image'] = '';
     $post['forumname'] = getForumName($data['fid']);
     $post['forumurl'] = getForumUrl($data['fid']);
     list($post['topictypename'], $post['topictypeurl']) = getTopicType($data['type'], $data['fid']);
     $post['addition'] = $data;
     return $post;
 }
コード例 #10
0
 /**
  * get new attachs
  * $type must in array('img','txt','zip')
  * @param int $type
  * @param int $fid
  * @param int $num
  * @param int $hour
  * @return array
  */
 function newAttach($type, $fid = 0, $num = 0, $hour = 0)
 {
     require_once R_P . 'require/bbscode.php';
     global $timestamp, $db_ftpweb, $attachpath;
     $attachtype = array('img', 'txt', 'zip');
     if (!in_array($type, $attachtype)) {
         return false;
     }
     $num = (int) $num;
     $hour = (int) $hour;
     !$fid && ($fid = getCommonFid());
     !$num && ($num = $this->cachenum);
     $time = $hour ? strlen($hour) == 10 ? $hour : $timestamp - intval($hour) * 3600 : 0;
     $sqladd = '';
     $sqladd .= $time ? ' AND a.uploadtime>' . S::sqlEscape($time) : '';
     $fid && ($sqladd .= " AND a.fid IN ({$fid}) ");
     if ($this->reality == false) {
         $sql = "SELECT a.tid as id,a.aid AS value,a.attachurl AS addition,a.ifthumb as special FROM pw_attachs a LEFT JOIN pw_threads t ON a.tid=t.tid WHERE a.type=" . S::sqlEscape($type, 1) . " AND a.pid=0 AND a.needrvrc=0 AND t.ifcheck='1' {$sqladd} GROUP BY a.tid ORDER BY a.aid DESC " . S::sqlLimit($num);
     } else {
         $sql = "SELECT a.tid,a.attachurl,t.author,t.authorid,t.subject,a.ifthumb FROM pw_attachs a LEFT JOIN pw_threads t ON a.tid=t.tid WHERE a.type=" . S::sqlEscape($type, 1) . " AND a.pid=0 AND a.needrvrc=0 AND t.ifcheck='1' {$sqladd} ORDER BY a.aid DESC " . S::sqlLimit($num);
     }
     $attachs = array();
     $query = $this->db->query($sql);
     while ($attach = $this->db->fetch_array($query)) {
         $tid = $attach['tid'] ? $attach['tid'] : $attach['id'];
         $pw_tmsgs = GetTtable($tid);
         $content = $this->db->get_value("SELECT content FROM {$pw_tmsgs} WHERE tid=" . S::sqlEscape($tid));
         $atc_content = substrs(stripWindCode($content), 30);
         if ($this->reality == true) {
             $tem = array();
             $tem['url'] = 'read.php?tid=' . $attach['tid'];
             $tem['title'] = $attach['subject'];
             $tem['value'] = $atc_content;
             $tem['image'] = $this->_getImageUrl($attach['attachurl'], $attach['ifthumb']);
             $tem['forumname'] = getForumName($attach['fid']);
             $tem['forumurl'] = getForumUrl($attach['fid']);
             $tem['addition'] = $attach;
             $attachs[] = $tem;
         } else {
             if ($attachs[$attach['id']]) {
                 continue;
             }
             $additions = array('0' => $attach['addition'], '1' => $atc_content);
             $addition = addslashes(serialize($additions));
             $attach['addition'] = $addition;
             $attachs[$attach['id']] = $attach;
         }
     }
     return $attachs;
 }
コード例 #11
0
ファイル: integration.php プロジェクト: kubixservice/kubix
     $sth->execute();
     $getMail = $sth->fetchAll();
     foreach ($getMail as $e) {
         return $e->email;
     }
 }
 if (isset($_POST['forum'])) {
     if ($item->forum_status == 1) {
         exit('already confirmed');
     }
     $forumName = trim($_POST['name']);
     $forumMail = trim($_POST['email']);
     if ($item->email != $forumMail) {
         exit('Game email needs to be equal input email.');
     }
     if (getForumName($server, $forumMail) == "" || getForumName($server, $forumMail) != $forumName) {
         exit('Input name and forum name must be equal or username not found.');
     }
     if (getForumMail($server, $forumName) == "" || getForumMail($server, $forumName) != $forumMail || getForumMail($server, $forumName) != $item->email) {
         exit('Ragnarok account email not equal forum account email.');
     }
     $rand = rand(1000000, 99999999);
     $postMessage = "\n\t\tActivate integration with forum.\n\t\tConfirm your email: " . $siteURL . "?module=account&action=forumactivate&code=" . $rand . "&user="******"\n\t";
     $headers = "From: " . Flux::message('InviteServerName') . " <" . Flux::message('InviteServerEmail') . ">\r\n";
     $headers .= "Bcc: " . Flux::message('InviteServerEmail') . "\r\n";
     $sql = "update `login` set `forum_name` = '" . $forumName . "', `forum_code` = '" . $rand . "' WHERE `userid` = '" . $item->userid . "'";
     $sth = $server->connection->getStatement($sql);
     $sth->execute();
     $getMail = $sth->fetchAll();
     if (mail($forumMail, "Activate integration", $postMessage, $headers)) {
         echo 'email sended';
コード例 #12
0
function createForumCategory($itemId)
{
    global $h, $db, $config;
    if (!$itemId && !$h->session->isAdmin) {
        return false;
    }
    //invalid request
    if ($itemId) {
        $item = getForumItem($itemId);
        $parent = getForumItem($item['parentId']);
        if ($itemId && !$item || $item['locked']) {
            die;
        }
        //block attempt to create item with nonexisting parent
    }
    $quoteId = 0;
    if (!empty($_GET['q']) && is_numeric($_GET['q'])) {
        $quoteId = $_GET['q'];
    }
    $writeSubject = '';
    $writeBody = '';
    if ($quoteId) {
        /* Quote another message */
        $quoteItem = getForumItem($quoteId);
        $quoteName = $quoteItem['authorName'];
        if ($quoteName && trim($quoteItem['itemBody'])) {
            $writeBody = '[quote name=' . $quoteName . ']' . $quoteItem['itemBody'] . "[/quote]\n\n";
        }
    }
    if (!empty($_POST['subject'])) {
        $writeSubject = $_POST['subject'];
    }
    if (!empty($_POST['body'])) {
        $writeBody = $_POST['body'];
    }
    $createdId = 0;
    $forum_error = '';
    if (!empty($_POST['subject']) || !empty($_POST['body'])) {
        if (strlen($writeBody) <= $config['forum']['maxsize_body']) {
            if ($h->session->isAdmin && ($itemId == 0 || $item['parentId'] == 0)) {
                //Create category or a forum
                if ($writeSubject) {
                    $createdId = addForumFolder($itemId, $writeSubject, $writeBody);
                    goLoc('forum.php?id=' . $createdId);
                    die;
                } else {
                    $forum_error = 'You must write a topic!';
                }
            } else {
                //Create a thread or a post
                if ($parent['parentId'] == 0 && !$writeSubject) {
                    $forum_error = 'You must write a topic!';
                } else {
                    $sticky = 0;
                    if ($h->session->isAdmin && !empty($_POST['sticky'])) {
                        $sticky = $_POST['sticky'];
                    }
                    $createdId = addForumMessage($itemId, $writeSubject, $writeBody, $sticky);
                    if ($createdId) {
                        //attach all FILETYPE_FORUM ownerId =0 to this id
                        $q = 'UPDATE tblFiles SET ownerId=' . $createdId . ' WHERE fileType=' . FILETYPE_FORUM . ' AND ownerId=0 AND uploaderId=' . $h->session->id;
                        $db->update($q);
                    }
                    goLoc('forum.php?id=' . $itemId . '#post' . $createdId);
                    die;
                }
            }
        } else {
            $forum_error = 'The post is too long, the max allowed length are ' . $config['forum']['maxsize_body'] . ' characters, please try to shorten down your text a bit.';
        }
        if (!$forum_error) {
            if (!empty($_POST['subscribehere'])) {
                //Start a subscription of the created topic
                //fixme: make sure we are creating a topic so users cant subscribe to whole forums
                addSubscription(SUBSCRIPTION_FORUM, $itemId);
            }
            if ($itemId == 0 || $item['parentId'] == 0) {
                header('Location: forum.php?id=' . $itemId);
            } else {
                $item = getForumItem($itemId);
                header('Location: forum.php?id=' . $item['parentId'] . '#post' . $itemId);
            }
            die;
        }
    }
    $hide_subject = false;
    if (!empty($forum_error)) {
        echo '<div class="critical">' . $forum_error . '</div>';
    }
    echo '<form method="post" name="newpost" enctype="multipart/form-data" action="' . $_SERVER['PHP_SELF'] . '?id=' . $itemId . '">';
    if ($itemId == 0) {
        //Create root level category (admins only)
        echo 'Forum - Add new root level category<br/><br/>';
        echo t('Name') . ': ' . xhtmlInput('subject', $writeSubject, 60, 50) . '<br/>';
    } else {
        if (!$item['parentId']) {
            //Create a category inside a "root level category" (admins only)
            echo 'Forum - Add new subcategory (under <b>' . getForumName($itemId) . '</b>)<br/><br/>';
            echo t('Subject') . ': <input type="text" size="60" maxlength="50" name="subject" value="' . $writeSubject . '"/><br/>';
            echo t('Description') . ':<br/>';
            echo '<input type="text" name="body" size="60" value="' . $writeBody . '"/><br/><br/>';
        } else {
            if ($parent['parentId'] == 0) {
                //Create a discussion thread (everyone)
                echo 'Add new discussion thread under ' . getForumDepthHTML(FORUM_FOLDER, $itemId) . '<br/><br/>';
                echo t('Subject') . ': <input type="text" size="60" maxlength="50" name="subject" value="' . $writeSubject . '"/><br/>';
                echo '<textarea name="body" cols="60" rows="14">' . $writeBody . '</textarea><br/><br/>';
                if ($h->session->isAdmin) {
                    //Allow admins to create stickies & announcements
                    echo '<input name="sticky" type="radio" class="radio" value="0" id="r0" checked="checked"/><label for="r0">Create a normal thread</label><br/>';
                    echo '<input name="sticky" type="radio" class="radio" value="1" id="r1"/><label for="r1">Admin only: Make the thread a sticky</label><br/>';
                    echo '<input name="sticky" type="radio" class="radio" value="2" id="r2"/><label for="r2">Admin only: Make the thread an announcement</label><br/>';
                }
            } else {
                //Create a post (everyone)
                echo getForumDepthHTML(FORUM_FOLDER, $itemId) . ' - Add a response to this post<br/><br/>';
                echo showForumPost($item, '', false);
                //handle file upload
                if (!empty($_FILES['file1'])) {
                    $h->files->handleUpload($_FILES['file1'], FILETYPE_FORUM, 0);
                }
                $h->files->showAttachments(FILETYPE_FORUM, 0);
                echo '<div id="forum_new_attachment">';
                echo t('Attach a file') . ': ';
                echo '<input type="file" name="file1"/>';
                echo xhtmlSubmit('Upload');
                echo '</div>';
                echo '<textarea name="body" cols="60" rows="14">' . $writeBody . '</textarea><br/><br/>';
            }
        }
    }
    $item = getForumItem($itemId);
    echo '<br/>';
    echo xhtmlSubmit('Save');
    /*
    if (!isSubscribed($itemId, SUBSCRIBE_MAIL)) {
        $content .= '<input name="subscribehere" type="checkbox" class="checkbox">Subscribe to topic';
    } else {
        $content .= '<div class="critical">You are already subscribed to this topic</div>';
    }
    */
    echo '</form><br/>';
    echo '<script type="text/javascript">';
    echo 'if (document.newpost.subject) document.newpost.subject.focus();';
    echo 'else if (document.newpost.body) document.newpost.body.focus();';
    echo '</script>';
}