本文整理汇总了PHP中WCF类的典型用法代码示例。如果您正苦于以下问题:PHP WCF类的具体用法?PHP WCF怎么用?PHP WCF使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WCF类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testContestPage
public function testContestPage()
{
$user = $this->user;
$contest = $this->contest;
// save two jurytalk entries
require_once WCF_DIR . 'lib/data/contest/jurytalk/ContestJurytalkEditor.class.php';
$this->deleteArray[] = $jurytalk = ContestJurytalkEditor::create($contestID = $contest->contestID, $jurytalk = __METHOD__ . ' jurytalk #1', $userID = $user->userID, $username = $user->username);
$this->deleteArray[] = $jurytalk = ContestJurytalkEditor::create($contestID = $contest->contestID, $jurytalk = __METHOD__ . ' jurytalk #2', $userID = $user->userID, $username = $user->username);
$raised = false;
try {
$this->runHTTP('page=ContestJurytalk&contestID=' . $contest->contestID);
} catch (Exception $e) {
$raised = true;
}
$this->assertTrue($raised, "user should not be allowed to access a private contest");
// now try with owner
$this->setCurrentUser($user);
$this->runHTTP('page=ContestJurytalk&contestID=' . $contest->contestID);
$this->assertEquals(count(WCF::getTPL()->get('jurytalks')), 2);
// now try with jury member who was invited
$this->deleteArray[] = $juryuser = $this->createUser();
require_once WCF_DIR . 'lib/data/contest/jury/ContestJuryEditor.class.php';
$this->deleteArray[] = $jury = ContestJuryEditor::create($contestID = $contest->contestID, $userID = $juryuser->userID, $groupID = 0, $state = 'invited');
$this->setCurrentUser($juryuser);
$this->runHTTP('page=ContestJurytalk&contestID=' . $contest->contestID);
// invited members should only see first entry
$this->assertEquals(count(WCF::getTPL()->get('jurytalks')), 1);
// accepted members should have 2 entries
$jury->update($contestID, $userID, $groupID, 'accepted');
$this->runHTTP('page=ContestJurytalk&contestID=' . $contest->contestID);
$this->assertEquals(count(WCF::getTPL()->get('jurytalks')), 2);
}
示例2: execute
/**
* @see EventListener::execute()
*/
public function execute($eventObj, $className, $eventName)
{
if (MODULE_USER_INFRACTION == 1) {
if ($eventName == 'init') {
if (WCF::getUser()->getPermission('admin.user.infraction.canWarnUser') || USER_CAN_SEE_HIS_WARNINGS && WCF::getUser()->userID == $eventObj->userID) {
$eventObj->sqlSelects .= "(SELECT COUNT(*) FROM wcf" . WCF_N . "_user_infraction_warning_to_user WHERE userID = " . $eventObj->userID . ") AS warnings,";
}
} else {
if ($eventName == 'assignVariables') {
if (!$eventObj->getUser()->warnings) {
// remove warning overview tab
foreach (UserProfileMenu::getInstance()->menuItems as $parentMenuItem => $items) {
foreach ($items as $key => $item) {
if ($item['menuItem'] == 'wcf.user.profile.menu.link.infraction') {
unset(UserProfileMenu::getInstance()->menuItems[$parentMenuItem][$key]);
}
}
}
}
// add warn button
if (WCF::getUser()->getPermission('admin.user.infraction.canWarnUser')) {
WCF::getTPL()->append('additionalAdminOptions', '<li><a href="index.php?form=UserWarn&userID=' . $eventObj->userID . SID_ARG_2ND . '">' . WCF::getLanguage()->get('wcf.user.infraction.button.warn') . '</a></li>');
}
}
}
}
}
示例3: getData
/**
* @see OptionType::getData()
*/
public function getData($optionData, $newValue)
{
$newValue = str_replace(' ', '', $newValue);
$newValue = str_replace(WCF::getLanguage()->get('wcf.global.thousandsSeparator'), '', $newValue);
$newValue = str_replace(WCF::getLanguage()->get('wcf.global.decimalPoint'), '.', $newValue);
return floatval($newValue);
}
示例4: getData
/**
* @see CacheBuilder::getData()
*/
public function getData($cacheResource)
{
list($cache, $packageID, $languageIDs) = explode('-', $cacheResource['cache']);
$data = array();
// get all taggable types
$sql = "SELECT\t\ttaggable.taggableID, taggable.name\n\t\t\tFROM\t\twcf" . WCF_N . "_package_dependency package_dependency,\n\t\t\t\t\twcf" . WCF_N . "_tag_taggable taggable\n\t\t\tWHERE \t\ttaggable.packageID = package_dependency.dependency\n\t\t\t\t\tAND package_dependency.packageID = " . $packageID . "\n\t\t\tORDER BY\tpackage_dependency.priority";
$result = WCF::getDB()->sendQuery($sql);
$itemIDs = array();
while ($row = WCF::getDB()->fetchArray($result)) {
$itemIDs[$row['name']] = $row['taggableID'];
}
if (count($itemIDs) > 0) {
// get tag ids
$tagIDs = array();
$sql = "SELECT\t\tCOUNT(*) AS counter, object.tagID\n\t\t\t\tFROM \t\twcf" . WCF_N . "_tag_to_object object\n\t\t\t\tWHERE \t\tobject.taggableID IN (" . implode(',', $itemIDs) . ")\n\t\t\t\t\t\tAND object.languageID IN (" . $languageIDs . ")\n\t\t\t\tGROUP BY \tobject.tagID\n\t\t\t\tORDER BY \tcounter DESC";
$result = WCF::getDB()->sendQuery($sql, 500);
while ($row = WCF::getDB()->fetchArray($result)) {
$tagIDs[$row['tagID']] = $row['counter'];
}
// get tags
if (count($tagIDs)) {
$sql = "SELECT\t\tname, tagID\n\t\t\t\t\tFROM\t\twcf" . WCF_N . "_tag\n\t\t\t\t\tWHERE\t\ttagID IN (" . implode(',', array_keys($tagIDs)) . ")";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$row['counter'] = $tagIDs[$row['tagID']];
$this->tags[StringUtil::toLowerCase($row['name'])] = new Tag(null, $row);
}
// sort by counter
uasort($this->tags, array('self', 'compareTags'));
$data = $this->tags;
}
}
return $data;
}
示例5: readFormParameters
/**
* @see Form::readFormParameters()
*/
public function readFormParameters()
{
parent::readFormParameters();
// default settings
$this->closeThread = $this->thread->isClosed;
$this->subscription = $this->thread->subscribed;
if (WCF::getUser()->userID) {
// options
$this->parseURL = WCF::getUser()->{$this->permissionType . 'ParseURL'};
$this->enableSmilies = WCF::getUser()->{$this->permissionType . 'EnableSmilies'};
$this->enableHtml = WCF::getUser()->{$this->permissionType . 'EnableHtml'};
$this->enableBBCodes = WCF::getUser()->{$this->permissionType . 'EnableBBCodes'};
if ($this->showSignatureSetting) {
$this->showSignature = WCF::getUser()->{$this->permissionType . 'ShowSignature'};
}
if (!$this->subscription && WCF::getUser()->enableSubscription) {
$this->subscription = 1;
}
} else {
// options
$this->parseURL = MESSAGE_FORM_DEFAULT_PARSE_URL;
$this->enableSmilies = MESSAGE_FORM_DEFAULT_ENABLE_SMILIES;
$this->enableHtml = MESSAGE_FORM_DEFAULT_ENABLE_HTML;
$this->enableBBCodes = MESSAGE_FORM_DEFAULT_ENABLE_BBCODES;
}
$this->enableSmilies = intval($this->enableSmilies && WCF::getUser()->getPermission('user.' . $this->permissionType . '.canUseSmilies'));
$this->enableHtml = intval($this->enableHtml && WCF::getUser()->getPermission('user.' . $this->permissionType . '.canUseHtml'));
$this->enableBBCodes = intval($this->enableBBCodes && WCF::getUser()->getPermission('user.' . $this->permissionType . '.canUseBBCodes'));
}
示例6: execute
/**
* @see Cronjob::execute()
*/
public function execute($data)
{
$sql = "SELECT\t*\n\t\t\tFROM\twcf" . WCF_N . "_group\n\t\t\tWHERE\tneededAge <> 0\n\t\t\t\tOR neededPoints <> 0";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$userIDArray = array();
if ($row['neededAge'] > 0) {
$sql = "SELECT\tuserID\n\t\t\t\t\tFROM\twcf" . WCF_N . "_user\n\t\t\t\t\tWHERE\tregistrationDate <= " . (TIME_NOW - 86400 * $row['neededAge']) . "\n\t\t\t\t\t\tAND userID NOT IN (\n\t\t\t\t\t\t\tSELECT\tuserID\n\t\t\t\t\t\t\tFROM\twcf" . WCF_N . "_user_to_groups\n\t\t\t\t\t\t\tWHERE\tgroupID = " . $row['groupID'] . "\n\t\t\t\t\t\t)";
$result2 = WCF::getDB()->sendQuery($sql);
while ($row2 = WCF::getDB()->fetchArray($result2)) {
$userIDArray[] = $row2['userID'];
}
}
if ($row['neededPoints'] > 0) {
$sql = "SELECT\tuserID\n\t\t\t\t\tFROM\twcf" . WCF_N . "_user\n\t\t\t\t\tWHERE\tactivityPoints >= " . $row['neededPoints'] . "\n\t\t\t\t\t\tAND userID NOT IN (\n\t\t\t\t\t\t\tSELECT\tuserID\n\t\t\t\t\t\t\tFROM\twcf" . WCF_N . "_user_to_groups\n\t\t\t\t\t\t\tWHERE\tgroupID = " . $row['groupID'] . "\n\t\t\t\t\t\t)";
$result2 = WCF::getDB()->sendQuery($sql);
while ($row2 = WCF::getDB()->fetchArray($result2)) {
$userIDArray[] = $row2['userID'];
}
}
if (count($userIDArray)) {
$userIDArray = array_unique($userIDArray);
// assign to group
$sql = "INSERT INTO\twcf" . WCF_N . "_user_to_groups\n\t\t\t\t\t\t\t(userID, groupID)\n\t\t\t\t\tSELECT\t\tuserID, " . $row['groupID'] . "\n\t\t\t\t\tFROM\t\twcf" . WCF_N . "_user\n\t\t\t\t\tWHERE\t\tuserID IN (" . implode(',', $userIDArray) . ")";
WCF::getDB()->sendQuery($sql);
// reset sesions
Session::resetSessions($userIDArray);
}
}
}
示例7: __construct
public function __construct($data, $boxname = "")
{
$this->BoxData['templatename'] = "wbb3addonsBox01";
$this->getBoxStatus($data);
$this->BoxData['boxID'] = $data['boxID'];
if (!defined('WBB3ADDONSBOX01_TITLE')) {
define('WBB3ADDONSBOX01_TITLE', '');
}
if (!defined('WBB3ADDONSBOX01_BOXOPENED')) {
define('WBB3ADDONSBOX01_BOXOPENED', false);
}
if (!defined('WBB3ADDONSBOX01_VALUE')) {
define('WBB3ADDONSBOX01_VALUE', '');
}
if (!defined('WBB3ADDONSBOX01_PHP')) {
define('WBB3ADDONSBOX01_PHP', false);
}
if (WBB3ADDONSBOX01_BOXOPENED == true) {
$this->BoxData['Status'] = 1;
}
// php?! *******************************************
if (WBB3ADDONSBOX01_PHP) {
ob_start();
eval(WBB3ADDONSBOX01_VALUE);
$val = ob_get_clean();
} else {
$val = WBB3ADDONSBOX01_VALUE;
}
WCF::getTPL()->assign(array('wbb3addonsBox01Title' => WBB3ADDONSBOX01_TITLE, 'wbb3addonsBox01Value' => $val, 'wbb3addonsBox01Opened' => WBB3ADDONSBOX01_BOXOPENED));
}
示例8: execute
/**
* @see Cronjob::execute()
*/
public function execute($data)
{
$sql = "DELETE FROM wcf" . WCF_N . "_user_guestbook" . "\n WHERE userID NOT IN (SELECT userID FROM wcf" . WCF_N . "_user)";
WCF::getDB()->sendQuery($sql);
$sql = "DELETE FROM wcf" . WCF_N . "_user_guestbook_header" . "\n WHERE userID NOT IN (SELECT userID FROM wcf" . WCF_N . "_user)";
WCF::getDB()->sendQuery($sql);
}
示例9: readPostIDs
/**
* @see PostList::readPostIDs()
*/
protected function readPostIDs()
{
$sql = "SELECT\t\tpostID, attachments, pollID\n\t\t\tFROM\t\twbb" . WBB_N . "_post post\n\t\t\t" . (!empty($this->sqlConditions) ? "WHERE " . $this->sqlConditions : "") . "\n\t\t\tORDER BY\t" . $this->sqlOrderBy;
$result = WCF::getDB()->sendQuery($sql, $this->limit, $this->offset);
while ($row = WCF::getDB()->fetchArray($result)) {
// post id
if (!empty($this->postIDs)) {
$this->postIDs .= ',';
}
$this->postIDs .= $row['postID'];
// attachments
if ($row['attachments'] != 0) {
$this->attachmentPostIDArray[] = $row['postID'];
}
// polls
if ($row['pollID'] != 0) {
if ($this->pollIDs != '') {
$this->pollIDs .= ',';
}
$this->pollIDs .= $row['pollID'];
}
}
$this->readAttachments();
$this->readPolls();
}
示例10: getTopOptionCategories
protected function getTopOptionCategories($packageID)
{
// get all option categories and filter categories with low priority
$sql = "SELECT\t\tcategoryName, categoryID \n\t\t\tFROM\t\twcf" . WCF_N . "_option_category option_category,\n\t\t\t\t\twcf" . WCF_N . "_package_dependency package_dependency\n\t\t\tWHERE \t\toption_category.packageID = package_dependency.dependency\n\t\t\t\t\tAND package_dependency.packageID = " . $packageID . "\n\t\t\tORDER BY\tpackage_dependency.priority";
$result = WCF::getDB()->sendQuery($sql);
$optionCategories = array();
while ($row = WCF::getDB()->fetchArray($result)) {
$optionCategories[$row['categoryName']] = $row['categoryID'];
}
$sql = "SELECT \t\tcategoryID, parentCategoryName, categoryName,\n\t\t\t\t\t(\n\t\t\t\t\t\tSELECT COUNT(*) FROM wcf" . WCF_N . "_option WHERE categoryName = category.categoryName AND packageID IN (\n\t\t\t\t\t\t\tSELECT dependency FROM wcf" . WCF_N . "_package_dependency WHERE packageID = " . $packageID . "\n\t\t\t\t\t\t)\n\t\t\t\t\t) AS count\n\t\t\tFROM\t\twcf" . WCF_N . "_option_category category\n\t\t\tWHERE\t\tcategoryID IN (" . implode(',', $optionCategories) . ")";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
if (!isset($this->optionCategoryStructure[$row['parentCategoryName']])) {
$this->optionCategoryStructure[$row['parentCategoryName']] = array();
}
$this->optionCategoryStructure[$row['parentCategoryName']][] = $row;
}
$topOptionCategories = array();
foreach ($this->optionCategoryStructure[''] as $optionCategory) {
$count = $optionCategory['count'] + $this->countOptions($optionCategory['categoryName']);
if ($count > 0) {
$topOptionCategories[] = $optionCategory['categoryID'];
}
}
return $topOptionCategories;
}
示例11: update
/**
* Updates the data in our database table
*/
public function update()
{
$updateSQL = '';
if (!empty($this->serverID)) {
if (!empty($updateSQL)) {
$updateSQL .= ',';
}
$updateSQL .= '`serverID` = ' . $this->serverID;
}
if (!empty($updateSQL)) {
$updateSQL .= ',';
}
$updateSQL .= '`authorID` = ' . $this->authorID;
if (!empty($this->authorName)) {
if (!empty($updateSQL)) {
$updateSQL .= ',';
}
$updateSQL .= '`authorName` = \'' . escapeString($this->authorName) . '\'';
}
$updateSQL .= ',`message` = \'' . escapeString($this->message) . '\'';
$updateSQL .= ",`timestamp` = " . $this->timestamp;
$updateSQL .= ',`enableSmilies` = ' . ($this->enableSmilies ? '1' : '0');
$updateSQL .= ',`enableHtml` = ' . ($this->enableHtml ? '1' : '0');
$updateSQL .= ',`enableBBCodes` = ' . ($this->enableBBCodes ? '1' : '0');
$updateSQL .= ",`isDisabled` = " . $this->isDisabled;
$sql = "UPDATE bash" . BASH_N . "_server_comment\r\n\t\t\t\tSET\r\n\t\t\t\t\t" . $updateSQL . "\r\n\t\t\t\tWHERE\r\n\t\t\t\t\tcommentID = " . $this->commentID;
WCF::getDB()->sendQuery($sql);
}
示例12: renderBoards
/**
* Renders the list of boards.
*/
public function renderBoards()
{
// get unread threads
$this->readUnreadThreads();
// get boards
$this->readBoards();
// assign data
WCF::getTPL()->assign('boards', $this->boards);
WCF::getTPL()->assign('unreadThreadsCount', $this->unreadThreadsCount);
// show newest posts
if (BOARD_LIST_ENABLE_LAST_POST) {
$lastPosts = WCF::getCache()->get('boardData', 'lastPosts');
if (is_array($lastPosts)) {
$visibleLanguages = false;
if (count(WCF::getSession()->getVisibleLanguageIDArray())) {
$visibleLanguages = WCF::getSession()->getVisibleLanguageIDArray();
}
foreach ($lastPosts as $boardID => $languages) {
foreach ($languages as $languageID => $row) {
if (!$languageID || !$visibleLanguages || in_array($languageID, $visibleLanguages)) {
$this->lastPosts[$row['boardID']] = new DatabaseObject($row);
continue 2;
}
}
}
}
WCF::getTPL()->assign('lastPosts', $this->lastPosts);
}
// stats
if (BOARD_LIST_ENABLE_STATS) {
WCF::getTPL()->assign('boardStats', WCF::getCache()->get('boardData', 'counts'));
}
}
示例13: show
/**
* @see Page::show()
*/
public function show()
{
// check permission
WCF::getUser()->checkPermission('user.guestbook.canViewList');
HeaderMenu::setActiveMenuItem('wcf.header.menu.userGuestbook');
parent::show();
}
示例14: execute
/**
* @see EventListener::execute()
*/
public function execute($eventObj, $className, $eventName)
{
WCF::getTPL()->append('additionalCSS', '
<link rel="stylesheet" type="text/css" href="' . RELATIVE_WCF_DIR . 'style/containers.css" />
<link rel="stylesheet" type="text/css" href="' . RELATIVE_WCF_DIR . 'style/forms.css" />
');
}
示例15: execute
/**
* @see Action::execute()
*/
public function execute()
{
parent::execute();
// count board
$sql = "SELECT\tCOUNT(*) AS count\n\t\t\tFROM\twbb" . WBB_N . "_board";
$row = WCF::getDB()->getFirstRow($sql);
$count = $row['count'];
// get board ids
$boardIDs = '';
$sql = "SELECT\t\tboardID\n\t\t\tFROM\t\twbb" . WBB_N . "_board\n\t\t\tORDER BY\tboardID";
$result = WCF::getDB()->sendQuery($sql, $this->limit, $this->limit * $this->loop);
while ($row = WCF::getDB()->fetchArray($result)) {
$boardIDs .= ',' . $row['boardID'];
// update last post
$board = new BoardEditor($row['boardID']);
$board->setLastPosts();
}
if (empty($boardIDs)) {
// clear board cache
WCF::getCache()->clear(WBB_DIR . 'cache', 'cache.boardData.php');
$this->calcProgress();
$this->finish();
}
// update boards
$sql = "UPDATE\twbb" . WBB_N . "_board board\n\t\t\tSET\tthreads = (\n\t\t\t\t\tSELECT\tCOUNT(*)\n\t\t\t\t\tFROM\twbb" . WBB_N . "_thread\n\t\t\t\t\tWHERE\tboardID = board.boardID\n\t\t\t\t\t\tAND isDeleted = 0\n\t\t\t\t\t\tAND isDisabled = 0\n\t\t\t\t),\n\t\t\t\tposts = (\n\t\t\t\t\tSELECT\tIFNULL(SUM(replies), 0) + COUNT(*)\n\t\t\t\t\tFROM\twbb" . WBB_N . "_thread thread\n\t\t\t\t\tWHERE\tboardID = board.boardID\n\t\t\t\t\t\tAND isDeleted = 0\n\t\t\t\t\t\tAND isDisabled = 0\n\t\t\t\t)\n\t\t\tWHERE\tboard.boardID IN (0" . $boardIDs . ")";
WCF::getDB()->sendQuery($sql);
$this->executed();
$this->calcProgress($this->limit * $this->loop, $count);
$this->nextLoop();
}