当前位置: 首页>>代码示例>>PHP>>正文


PHP phorum_db_get_message函数代码示例

本文整理汇总了PHP中phorum_db_get_message函数的典型用法代码示例。如果您正苦于以下问题:PHP phorum_db_get_message函数的具体用法?PHP phorum_db_get_message怎么用?PHP phorum_db_get_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了phorum_db_get_message函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: phorum_admin_set_vroot

                        phorum_admin_set_vroot($cur_folder_id,$parent_folder[$cur_folder['parent_id']]['vroot'],$cur_folder_id);
                        
                    } else { // just default root ... 
                        phorum_admin_set_vroot($cur_folder_id,0,$cur_folder_id);
                    }
                    
                    // need to clear announcements in this vroot
                    $PHORUM['forum_id']=$oldfolder['vroot'];
                    $GLOBALS['PHORUM']['forum_id']=$oldfolder['vroot'];
                    $msg_array=phorum_db_get_message(PHORUM_SORT_ANNOUNCEMENT,'sort');
                    while(count($msg_array)) {
                    	// set announcements to forum-id=0 and hidden ...
                    	$new_msg=array('forum_id'=>0,'status'=>PHORUM_STATUS_HIDDEN);
                    	
                    	phorum_db_update_message($msg_array['message_id'],$new_msg);
                    	$msg_array=phorum_db_get_message(PHORUM_SORT_ANNOUNCEMENT,'sort');
                    }
                    

                // we have now set this folder as vroot
                } elseif($setvroot && ($oldfolder['vroot']==0 || $oldfolder['vroot'] != $cur_folder_id)) {    
                    if(!phorum_admin_set_vroot($cur_folder_id)) {
                        $error="Database error while setting virtual-root info.";
                    }            
                    
                } // is there an else?
                
            } else {
                $error="Database error while adding/updating folder.";
            }
        }
开发者ID:nistormihai,项目名称:Newscoop,代码行数:31,代码来源:newfolder.php

示例2: foreach

 // the message attachments with the working copy list
 // of attachments.
 foreach ($message_copy["attachments"] as $info) {
     if ($info["keep"]) {
         phorum_db_file_link($info["file_id"], $message["message_id"], PHORUM_LINK_MESSAGE);
     } else {
         if (phorum_api_file_check_delete_access($info["file_id"])) {
             phorum_api_file_delete($info["file_id"]);
         }
     }
 }
 // Retrieve the message again to have it in the correct
 // format (otherwise it's a bit messed up in the
 // post-function). Do merge back data which is not
 // stored in the database, but which we might need later on.
 $message = phorum_db_get_message($message["message_id"], 'message_id', false, true);
 foreach ($message_copy as $key => $val) {
     if (!isset($message[$key])) {
         $message[$key] = $val;
     }
 }
 phorum_update_thread_info($message["thread"]);
 /*
  * [hook]
  *     after_message_save
  *
  * [description]
  *     This hook can be used for performing actions based on what the
  *     message contained or altering it before it is emailed to the
  *     subscribed users. It is also useful for adding or removing 
  *     subscriptions.
开发者ID:sleepy909,项目名称:cpassman,代码行数:31,代码来源:action_post.php

示例3: phorum_mod_event_logging_hide_thread

function phorum_mod_event_logging_hide_thread($message_id)
{
    if (!$GLOBALS["PHORUM"]["mod_event_logging"]["do_log_mod_hide"]) {
        return $message_id;
    }
    // Check for suspended logging.
    if (!empty($GLOBALS["PHORUM"]["MOD_EVENT_LOGGING"]["SUSPEND"])) {
        return $message_id;
    }
    $dbmsg = phorum_db_get_message($message_id, "message_id", TRUE);
    if ($dbmsg === NULL || !is_array($dbmsg)) {
        return $message_id;
    }
    list($source, $from_module) = event_logging_find_source(1);
    $what = $dbmsg["parent_id"] == 0 ? "thread" : "message";
    event_logging_writelog(array("message" => "Moderation: Disapproved and hid {$what} \"{$dbmsg["subject"]}\".", "loglevel" => EVENTLOG_LVL_INFO, "message_id" => $message_id, "thread_id" => $dbmsg["thread"], "forum_id" => $dbmsg["forum_id"], "source" => $source, "category" => $from_module ? EVENTLOG_CAT_MODULE : EVENTLOG_CAT_APPLICATION));
    return $message_id;
}
开发者ID:sleepy909,项目名称:cpassman,代码行数:18,代码来源:event_logging.php

示例4: phorum_redirect_by_url

    phorum_redirect_by_url($dest_url);
    exit();
}

if(isset($PHORUM["args"][1])){
    $thread=$PHORUM["args"][1];
} elseif(isset($_POST["thread"])){
    $thread=$_POST["thread"];
}

if(empty($thread)) {
    phorum_redirect_by_url(phorum_get_url(PHORUM_LIST_URL));
    exit();
}

$message=phorum_db_get_message($thread);

if(isset($PHORUM["args"]["remove"])){
    // we are removing a message from the follow list
    phorum_user_unsubscribe( $PHORUM['user']['user_id'], $thread );
    $PHORUM["DATA"]["MESSAGE"]=$PHORUM["DATA"]["LANG"]["RemoveFollowed"];
    $PHORUM["DATA"]["URL"]["REDIRECT"]=phorum_get_url(PHORUM_FOREIGN_READ_URL, $message["forum_id"], $thread);
    $PHORUM["DATA"]["BACKMSG"]=$PHORUM["DATA"]["LANG"]["BackToThread"];
    $template="message";
} elseif(isset($PHORUM["args"]["noemail"])){
    // we are stopping emails for this thread
    phorum_user_unsubscribe( $PHORUM['user']['user_id'], $thread );
    phorum_user_subscribe( $PHORUM['user']['user_id'], $message["forum_id"], $thread, PHORUM_SUBSCRIPTION_BOOKMARK );
    $PHORUM["DATA"]["MESSAGE"]=$PHORUM["DATA"]["LANG"]["NoMoreEmails"];
    $PHORUM["DATA"]["URL"]["REDIRECT"]=phorum_get_url(PHORUM_FOREIGN_READ_URL, $message["forum_id"], $thread);
    $PHORUM["DATA"]["BACKMSG"]=$PHORUM["DATA"]["LANG"]["BackToThread"];
开发者ID:nistormihai,项目名称:Newscoop,代码行数:31,代码来源:follow.php

示例5: phorum_build_common_urls

include_once "./include/format_functions.php";
include_once "./include/api/base.php";
include_once "./include/api/user.php";
// set all our URL's ... we need these earlier
phorum_build_common_urls();
// checking read-permissions
if (!phorum_check_read_common()) {
    return;
}
$report = false;
$template = "report";
$message = array();
// get the message
if (isset($PHORUM["args"][1]) && is_numeric($PHORUM["args"][1])) {
    $message_id = $PHORUM["args"][1];
    $message = phorum_db_get_message($message_id);
}
if (is_array($message) && count($message)) {
    // check for report requests
    if (!empty($_POST["report"])) {
        if ($PHORUM["DATA"]["LOGGEDIN"]) {
            if (empty($_POST["explanation"])) {
                $_POST["explanation"] = "<" . $PHORUM["DATA"]["LANG"]["None"] . ">";
            }
            $mail_users = phorum_api_user_list_moderators($PHORUM['forum_id'], $PHORUM['email_ignore_admin'], TRUE);
            if (count($mail_users)) {
                $mail_data = array("mailmessage" => $PHORUM["DATA"]["LANG"]['ReportPostEmailBody'], "mailsubject" => $PHORUM["DATA"]["LANG"]['ReportPostEmailSubject'], "forumname" => $PHORUM["DATA"]["NAME"], "reportedby" => $PHORUM["user"]["display_name"], "author" => $message["author"], "subject" => $message["subject"], "body" => wordwrap($message["body"], 72), "ip" => $message["ip"], "raw_date" => $message["datestamp"], "date" => phorum_date($PHORUM["short_date_time"], $message["datestamp"]), "explanation" => wordwrap($_POST["explanation"], 72), "url" => phorum_get_url(PHORUM_READ_URL, $message["thread"], $message_id), "delete_url" => phorum_get_url(PHORUM_MODERATION_URL, PHORUM_DELETE_MESSAGE, $message_id), "hide_url" => phorum_get_url(PHORUM_MODERATION_URL, PHORUM_HIDE_POST, $message_id), "edit_url" => phorum_get_url(PHORUM_POSTING_URL, 'moderation', $message_id), "reporter_url" => phorum_get_url(PHORUM_PROFILE_URL, $PHORUM["user"]["user_id"]), "message" => $message);
                if (isset($_POST[PHORUM_SESSION_LONG_TERM])) {
                    // strip any auth info from the created urls
                    $mail_data["url"] = preg_replace("!,{0,1}" . PHORUM_SESSION_LONG_TERM . "=" . urlencode($_POST[PHORUM_SESSION_LONG_TERM]) . "!", "", $mail_data["url"]);
                    $mail_data["delete_url"] = preg_replace("!,{0,1}" . PHORUM_SESSION_LONG_TERM . "=" . urlencode($_POST[PHORUM_SESSION_LONG_TERM]) . "!", "", $mail_data["delete_url"]);
开发者ID:sleepy909,项目名称:cpassman,代码行数:31,代码来源:report.php

示例6: htmlspecialchars

     $PHORUM['DATA']["FORM"]["thread_id"] = $message["thread"];
     $PHORUM['DATA']["FORM"]["message_id"] = $msgthd_id;
     $PHORUM['DATA']["FORM"]["message_subject"] = htmlspecialchars($message["subject"], ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]);
     $PHORUM['DATA']["FORM"]["mod_step"] = PHORUM_DO_THREAD_SPLIT;
     $template = "split_form";
     break;
 case PHORUM_DO_THREAD_SPLIT:
     // this is the last step of a thread split
     $PHORUM['DATA']['OKMSG'] = $PHORUM["DATA"]['LANG']['MsgSplitOk'];
     $PHORUM['DATA']["URL"]["REDIRECT"] = $PHORUM["DATA"]["URL"]["LIST"];
     settype($_POST['forum_id'], "int");
     settype($_POST['message'], "int");
     settype($_POST['thread'], "int");
     phorum_db_split_thread($_POST['message'], $_POST['forum_id']);
     if ($PHORUM['cache_messages']) {
         $message = phorum_db_get_message($_POST['thread']);
         foreach ($message['meta']['message_ids'] as $message_id) {
             phorum_cache_remove('message', $message_id);
         }
     }
     // update message count / stats
     phorum_update_thread_info($_POST['thread']);
     phorum_update_thread_info($_POST['message']);
     phorum_db_update_forum_stats(true);
     /*
      * [hook]
      *     after_split
      *
      * [description]
      *     This hook can be used for performing actions on
      *     splitting threads
开发者ID:mgs2,项目名称:kw-forum,代码行数:31,代码来源:moderation.php

示例7: array_keys

 $forum_ids = array_keys($forums);
 // get messages
 $messages = phorum_db_get_recent_messages(30, 0, $forum_ids, $thread, $replies ? LIST_RECENT_MESSAGES : LIST_RECENT_THREADS);
 // remove users from messages array
 $users = $messages["users"];
 unset($messages["users"]);
 // run read hooks to get everything formatted
 if (isset($PHORUM["hooks"]["read"])) {
     $messages = phorum_hook("read", $messages);
 }
 $messages = phorum_format_messages($messages);
 // set up the feed specifics based on the info we are getting
 if ($thread && $PHORUM["forum_id"]) {
     // could happen with long threads
     if (!isset($messages[$thread])) {
         $thread_start = phorum_db_get_message($thread);
     } else {
         $thread_start = $messages[$thread];
     }
     $feed_url = phorum_get_url(PHORUM_FOREIGN_READ_URL, $PHORUM["forum_id"], $thread, $thread);
     $feed_title = strip_tags($thread_start["subject"]);
     $feed_description = strip_tags($thread_start["body"]);
 } elseif ($PHORUM["forum_id"]) {
     $feed_url = phorum_get_url(PHORUM_LIST_URL);
     $feed_title = strip_tags($PHORUM["DATA"]["TITLE"] . " - " . $PHORUM["DATA"]["NAME"]);
     $feed_description = strip_tags($PHORUM["DATA"]["DESCRIPTION"]);
 } else {
     $feed_url = phorum_get_url(PHORUM_INDEX_URL);
     $feed_title = strip_tags($PHORUM["DATA"]["TITLE"]);
     $feed_description = !empty($PHORUM["description"]) ? $PHORUM["description"] : "";
 }
开发者ID:mgs2,项目名称:kw-forum,代码行数:31,代码来源:feed.php

示例8: array

// ----------------------------------------------------------------------
// Handle a posted form
// ----------------------------------------------------------------------
$messages = null;
// selected messages (based on a filter)
$filters = array();
// active filters
$filtermode = "and";
// active filter mode (and / or)
$read_url_template = phorum_get_url(PHORUM_FOREIGN_READ_URL, '%forum_id%', '%thread_id%', '%message_id%');
// If there are messages to delete in the post data, then delete them
// from the database.
$delete_count = 0;
if (isset($_POST["deletemessage"]) && is_array($_POST["deletemessage"])) {
    $msgids = array_keys($_POST["deletemessage"]);
    $msgs = phorum_db_get_message($msgids, "message_id", true);
    $deleted_messages = array();
    foreach ($msgs as $msg) {
        // if the message was already deleted, skip it
        if (isset($delete_messages[$msg["message_id"]])) {
            continue;
        }
        $PHORUM["forum_id"] = $msg["forum_id"];
        $delmode = $msg["parent_id"] == 0 ? PHORUM_DELETE_TREE : PHORUM_DELETE_MESSAGE;
        // A hook to allow modules to implement extra or different
        // delete functionality.
        list($handled, $delids, $msgid, $msg, $delmode) = phorum_hook("before_delete", array(false, 0, $msg["message_id"], $msg, $delmode));
        // If the "before_delete" hook did not handle the delete action,
        // then we have to handle it here ourselves.
        if (!$handled) {
            // Delete the message or thread.
开发者ID:mgs2,项目名称:kw-forum,代码行数:31,代码来源:message_prune.php

示例9: phorum_api_file_check_delete_access

/**
 * Check if the active user has permission to delete a file.
 *
 * @example file_delete.php Delete a file.
 *
 * @param integer $file_id
 *     The file_id of the file for which to check the delete access.
 *
 * @return boolean
 *     TRUE if the user has rights to delete the file, FALSE otherwise.
 */
function phorum_api_file_check_delete_access($file_id)
{
    global $PHORUM;
    settype($file_id, "int");
    // Administrator users always have rights to delete files.
    if ($PHORUM["user"]["admin"]) {
        return TRUE;
    }
    // Anonymous users never have rights to delete files.
    if (empty($PHORUM["user"]["user_id"])) {
        return FALSE;
    }
    // For other users, the file information has to be retrieved
    // to be able to check the delete access.
    $file = phorum_api_file_check_read_access($file_id, PHORUM_FLAG_IGNORE_PERMS);
    // To prevent permission errors after deleting the same file twice,
    // we'll return TRUE if we did not find a file (if the file is not found,
    // then there's no harm in deleting it; the file storage API will
    // silently ignore deleting non-existent files). If some other error
    // occurred, then we return FALSE (most likely, the user does not
    // even have read permission for the file, so delete access would
    // be out of the question too).
    if ($file === FALSE) {
        if (phorum_api_errno() == PHORUM_ERRNO_NOTFOUND) {
            return TRUE;
        } else {
            return FALSE;
        }
    }
    // We don't care about deleting temporary files and files that
    // are linked to the posting editor (during writing a post).
    // Those are both intermediate states for files, without them
    // being available on the forum. So for those, we always grant
    // delete access.
    if ($file["link"] == PHORUM_LINK_TEMPFILE || $file["link"] == PHORUM_LINK_EDITOR) {
        return TRUE;
    }
    // If the file is owned by the user, then the user has rights
    // to delete the file (this would be a personal user file).
    if (!empty($file["user_id"]) && $file["user_id"] == $PHORUM["user"]["user_id"]) {
        return TRUE;
    }
    // The file is not owned by the user. In that case, the user only has
    // rights to delete it if it is a file that is linked to a message which
    // the user posted himself of which was posted in a forum for which
    // the user is a moderator.
    if ($file["link"] == PHORUM_LINK_MESSAGE) {
        // Retrieve the message to which the file is linked.
        $message = phorum_db_get_message($file["message_id"]);
        // If the message cannot be found, we do not care if the linked
        // file is deleted. It's clearly an orphin file.
        if (!$message) {
            return TRUE;
        }
        // Check if the user posted the message himself.
        if (!empty($message["user_id"]) && $message["user_id"] == $PHORUM["user"]["user_id"]) {
            return TRUE;
        }
        // Check if the user is moderator for the forum_id of the message.
        if (phorum_api_user_check_access(PHORUM_USER_ALLOW_MODERATE_MESSAGES, $message["forum_id"])) {
            return TRUE;
        }
    }
    // The default policy for any unhandled case is to deny access.
    return FALSE;
}
开发者ID:sheldon,项目名称:dejavu,代码行数:77,代码来源:file_storage.php

示例10: phorum_hook

          *
          */
         phorum_hook('after_merge', $msgid_translation);
     } else {
         // Cancel Thread Merge
         $PHORUM['DATA']['OKMSG'] = $PHORUM["DATA"]['LANG']['MsgMergeCancel'];
         $PHORUM['DATA']["URL"]["REDIRECT"] = $PHORUM["DATA"]["URL"]["LIST"];
     }
     // unset temporary moderator_data
     phorum_moderator_data_remove('merge_t1');
     break;
 case PHORUM_SPLIT_THREAD:
     // this is the first step of a thread split
     $PHORUM['DATA']['URL']["ACTION"] = phorum_get_url(PHORUM_MODERATION_ACTION_URL);
     $PHORUM['DATA']["FORM"]["forum_id"] = $PHORUM["forum_id"];
     $message = phorum_db_get_message($msgthd_id);
     $PHORUM['DATA']["FORM"]["thread_id"] = $message["thread"];
     $PHORUM['DATA']["FORM"]["message_id"] = $msgthd_id;
     $PHORUM['DATA']["FORM"]["message_subject"] = htmlspecialchars($message["subject"], ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]);
     $PHORUM['DATA']["FORM"]["mod_step"] = PHORUM_DO_THREAD_SPLIT;
     $template = "split_form";
     break;
 case PHORUM_DO_THREAD_SPLIT:
     // this is the last step of a thread split
     $PHORUM['DATA']['OKMSG'] = $PHORUM["DATA"]['LANG']['MsgSplitOk'];
     $PHORUM['DATA']["URL"]["REDIRECT"] = $PHORUM["DATA"]["URL"]["LIST"];
     settype($_POST['forum_id'], "int");
     settype($_POST['message'], "int");
     settype($_POST['thread'], "int");
     phorum_db_split_thread($_POST['message'], $_POST['forum_id']);
     // update message count / stats
开发者ID:sleepy909,项目名称:cpassman,代码行数:31,代码来源:moderation.php

示例11: phorum_api_newflags_markread

/**
 * Mark forums, threads or messages as read for the active Phorum user.
 *
 * @param mixed $markread_ids
 *     This parameter provides the ids of the items that have to be marked
 *     read. It can be either a single item id (depending on the $mode
 *     parameter either message_id, thread_id or forum_id) or an array
 *     of item ids.
 *
 * @param integer $mode
 *     This determines whether messages, threads or forums are marked
 *     read. Possible values for this parameter are:
 *     {@link PHORUM_MARKREAD_MESSAGES},
 *     {@link PHORUM_MARKREAD_THREADS},
 *     {@link PHORUM_MARKREAD_FORUMS}
 */
function phorum_api_newflags_markread($markread_ids, $mode = PHORUM_MARKREAD_MESSAGES)
{
    global $PHORUM;
    // No newflags for anonymous users.
    if (!$PHORUM['user']['user_id']) {
        return $messages;
    }
    // Make sure that the $markread_ids parameter is an array of integers.
    if (!is_array($markread_ids)) {
        $markread_ids = array((int) $markread_ids);
    } else {
        foreach ($markread_ids as $key => $val) {
            $markread_ids[$key] = (int) $val;
        }
    }
    // An array to keep track of the forums for which we need to invalidate
    // the cache later on.
    $processed_forum_ids = array();
    // Handle marking forums read.
    if ($mode == PHORUM_MARKREAD_FORUMS) {
        foreach ($markread_ids as $forum_id) {
            phorum_db_newflag_allread($forum_id);
            $processed_forum_ids[$forum_id] = $forum_id;
        }
    } elseif ($mode == PHORUM_MARKREAD_THREADS) {
        // Retrieve the data for the threads to mark read.
        $threads = phorum_db_get_message($markread_ids, 'message_id', TRUE);
        // Process the threads.
        $markread = array();
        foreach ($threads as $thread) {
            // In case this was no thread or broken thread data.
            if ($thread['parent_id'] != 0 || empty($thread['meta']['message_ids'])) {
                continue;
            }
            // Fetch the user's newflags for the thread's forum, so we
            // can limit the messages to mark read to the actual unread
            // messages in the thread.
            $forum_id = $thread['forum_id'];
            if (!isset($PHORUM['user']['newflags'][$forum_id])) {
                $newflags = phorum_api_newflags_by_forum($forum_id);
            } else {
                $newflags = $PHORUM['user']['newflags'][$forum_id];
            }
            // Find out what message_ids are unread in the thread.
            // If we have no newflags for the forum (yet), then consider
            // all the messages in the thread as new.
            $markread = array();
            foreach ($thread['meta']['message_ids'] as $mid) {
                if (empty($newflags) || !isset($newflags[$mid]) && $mid > $newflags['min_id']) {
                    $markread[] = array('id' => $mid, 'forum' => $forum_id);
                }
            }
            $processed_forum_ids[$forum_id] = $forum_id;
        }
        // Mark the messages in the thread(s) as read.
        phorum_db_newflag_add_read($markread);
    } elseif ($mode == PHORUM_MARKREAD_MESSAGES) {
        // Retrieve the data for the messages to mark read.
        $messages = phorum_db_get_message($markread_ids);
        // Process the messages.
        $markread = array();
        foreach ($messages as $message) {
            $markread[] = array('id' => $message['message_id'], 'forum' => $message['forum_id']);
            $processed_forum_ids[$message['forum_id']] = $message['forum_id'];
        }
        // Mark the messages read in the database.
        phorum_db_newflag_add_read($markread);
    }
    // Invalidate cached forum newflags data.
    foreach ($processed_forum_ids as $forum_id) {
        unset($PHORUM['user']['newflags'][$forum_id]);
        if ($PHORUM['cache_newflags']) {
            $cachekey = $forum_id . '-' . $PHORUM['user']['user_id'];
            phorum_cache_remove('newflags', $cachekey);
            phorum_cache_remove('newflags_index', $cachekey);
        }
    }
}
开发者ID:sleepy909,项目名称:cpassman,代码行数:94,代码来源:newflags.php

示例12: create


//.........这里部分代码省略.........

		// Defaults
		$message['sort'] = PHORUM_SORT_DEFAULT;
		$message['closed'] = 0;

		// ??? Whats that suffix for?
//		$suffix = preg_replace("/[^a-z0-9]/i", "", $PHORUM["name"]);
//		$message['msgid'] = md5(uniqid(rand())) . ".$suffix";
		$message['msgid'] = md5(uniqid(rand()));
		$message['moderator_post'] = '0';
		$message['datestamp'] = time();

		// Fetch the forum object -
		// we need it for the config values.
		$forumObj = new Phorum_forum($p_forumId);
		if (!$forumObj->exists()) {
			return false;
		}

		// Set message workflow based on forum config.
		if ($forumObj->isModerated()) {
		    $message['status'] = PHORUM_STATUS_HOLD;
		} else {
		    $message['status'] = PHORUM_STATUS_APPROVED;
		}

		// Set user IP.
		$user_ip = $_SERVER["REMOTE_ADDR"];
		if ($settings["dns_lookup"]) {
		    $resolved = @gethostbyaddr($_SERVER["REMOTE_ADDR"]);
		    if (!empty($resolved)) {
		        $user_ip = $resolved;
		    }
		}
		$message["ip"] = $user_ip;

        $lockTables = array($PHORUM['message_table'],
                            $PHORUM['search_table'],
                            $PHORUM['subscribers_table']);
        $this->lockTables($lockTables);

		phorum_db_post_message($message);

		$this->mod_emailcomments($message);

		// Update the thread count.
		$sql = "SELECT COUNT(*) as thread_count FROM ".$PHORUM['message_table']
			   ." WHERE forum_id=".$p_forumId
			   ." AND thread=".$message['thread']
			   ." AND status > 0";
		$threadCount = $g_ado_db->GetOne($sql);

		$sql = "UPDATE ".$PHORUM['message_table']
				." SET thread_count=".$threadCount;
		$g_ado_db->Execute($sql);

	    // Retrieve the message again because the database sets
	    // some values.
	    $message = phorum_db_get_message($message["message_id"], "message_id", true);
		$this->m_data = $message;

		// Set the thread depth
		$this->__initThreadDepth();

		// Set the thread order.
		$this->__initThreadOrder();

		$this->__updateThreadInfo();

        if (isset($PHORUM['user']['user_id'])) {
		    // Mark own message read.
	        phorum_db_newflag_add_read(array(0=>array(
	            "id"    => $message["message_id"],
	            "forum" => $message["forum_id"],
	        )));

	        // Update the number of messages the user has posted.
        	phorum_db_user_addpost();
        }

        // Actions for messages which are approved.
	    if ($message["status"] > 0) {
	        // Update forum statistics,
	        // ??? Note: phorum_db_update_forum_stats requires global parameter-passing.
	        $PHORUM['forum_id'] = $p_forumId;
	        phorum_db_update_forum_stats(false, 1, $message["datestamp"]);

	        // Mail subscribed users.
	        //phorum_email_notice($message);
	    }

	    // Mail moderators.
	    if ($forumObj->emailModeratorsEnabled()) {
	        //phorum_email_moderators($message);
	    }
	    
	    $this->unlockTables();

	    return true;
	} // fn create
开发者ID:nistormihai,项目名称:Newscoop,代码行数:101,代码来源:Phorum_message.php

示例13: phorum_db_get_message

    }
}
// We never store the email address in the message in case it
// was posted by a registered user.
if ($message["user_id"]) {
    $message["email"] = "";
}
// Find the startmessage for the thread.
if ($mode == "reply" || $mode == "edit") {
    $top_parent = phorum_db_get_message($message["thread"]);
}
// Do permission checks for replying to messages.
if ($mode == "reply") {
    // Find the direct parent for this message.
    if ($message["thread"] != $message["parent_id"]) {
        $parent = phorum_db_get_message($message["parent_id"]);
    } else {
        $parent = $top_parent;
    }
    // If this thread is unapproved, then get out.
    $unapproved = empty($top_parent) || empty($parent) || $top_parent["status"] != PHORUM_STATUS_APPROVED || $parent["status"] != PHORUM_STATUS_APPROVED;
    if ($unapproved) {
        // In case we run the editor included in the read page,
        // we should not redirect to the listpage for moderators.
        // Else a moderator can never read an unapproved message.
        if (isset($PHORUM["postingargs"]["as_include"])) {
            if ($PHORUM["DATA"]["MODERATOR"]) {
                $PHORUM["DATA"]["OKMSG"] = $PHORUM["DATA"]["LANG"]["UnapprovedMessage"];
                return;
            }
        }
开发者ID:sleepy909,项目名称:cpassman,代码行数:31,代码来源:check_permissions.php

示例14: sphinx_search_action

function sphinx_search_action($arrSearch)
{
    global $PHORUM;
    // No pecl class, try php version
    if (!class_exists('SphinxClient')) {
        // loads from php include_path
        require_once 'sphinxapi.php';
    }
    // these are the index-names set in sphinx.conf - one for searching messages, the other for searching by authors only
    // both contain an additional index for the deltas - changes done after the last full reindex
    $index_name_msg = 'phorum5_msg_d phorum5_msg';
    $index_name_author = 'phorum5_author phorum5_author_d';
    // excerpts_index is just one index as that function only accepts one, it used for determining charsets / mapping tables, nothing more
    $excerpts_index = 'phorum5_msg';
    $index = $index_name_msg;
    if ($arrSearch['match_type'] == 'ALL') {
        $match_mode = SPH_MATCH_ALL;
    } elseif ($arrSearch['match_type'] == 'ANY') {
        $match_mode = SPH_MATCH_ANY;
    } elseif ($arrSearch['match_type'] == 'PHRASE') {
        $match_mode = SPH_MATCH_PHRASE;
    } elseif ($arrSearch['match_type'] == 'AUTHOR') {
        $match_mode = SPH_MATCH_PHRASE;
        $index = $index_name_author;
    } else {
        // Return search control to Phorum in case the search type isn't handled by the module.
        return $arrSearch;
    }
    if (empty($arrSearch['search']) && !empty($arrSearch['author'])) {
        $arrSearch['search'] = $arrSearch['author'];
        $index = $index_name_author;
    }
    $sphinx = new SphinxClient();
    $sphinx->SetServer($PHORUM['mod_sphinx_search']['hostname'], $PHORUM['mod_sphinx_search']['port']);
    $sphinx->SetMatchMode($match_mode);
    // set the limits for paging
    $sphinx->SetLimits($arrSearch['offset'], $arrSearch['length']);
    // set the timeframe to search
    if ($arrSearch['match_dates'] > 0) {
        $min_ts = time() - 86400 * $arrSearch['match_dates'];
        $max_ts = time();
        $sphinx->SetFilterRange('datestamp', $min_ts, $max_ts);
    }
    // Check what forums the active Phorum user can read.
    $allowed_forums = phorum_api_user_check_access(PHORUM_USER_ALLOW_READ, PHORUM_ACCESS_LIST);
    // If the user is not allowed to search any forum or the current
    // active forum, then return the emtpy search results array.
    if (empty($allowed_forums) || $PHORUM['forum_id'] > 0 && !in_array($PHORUM['forum_id'], $allowed_forums)) {
        $arrSearch['results'] = array();
        $arrSearch['totals'] = 0;
        $arrSearch['continue'] = 0;
        $arrSearch['raw_body'] = 1;
        return $arrSearch;
    }
    // Prepare forum_id restriction.
    $search_forums = array();
    foreach (explode(',', $arrSearch['match_forum']) as $forum_id) {
        if ($forum_id == 'ALL') {
            $search_forums = $allowed_forums;
            break;
        }
        if (isset($allowed_forums[$forum_id])) {
            $search_forums[] = $forum_id;
        }
    }
    $sphinx->SetFilter('forum_id', $search_forums);
    // set the sort-mode
    $sphinx->SetSortMode(SPH_SORT_ATTR_DESC, 'datestamp');
    // do the actual query
    $results = $sphinx->Query($arrSearch['search'], $index);
    $res = $sphinx->GetLastWarning();
    if ($res) {
        error_log("sphinx_search.php: WARNING: {$res}");
    }
    $res = $sphinx->GetLastError();
    if ($res) {
        error_log("sphinx_search.php: ERROR: {$res}");
    }
    // if no messages were found, then return empty handed.
    if (!isset($results['matches'])) {
        $arrSearch['results'] = array();
        $arrSearch['totals'] = 0;
        $arrSearch['continue'] = 0;
        $arrSearch['raw_body'] = 1;
        return $arrSearch;
    }
    $search_msg_ids = $results['matches'];
    // get the messages we found
    $found_messages = phorum_db_get_message(array_keys($search_msg_ids), 'message_id', true);
    // sort them in reverse order of the message_id to automagically sort them by date desc this way
    krsort($found_messages);
    reset($found_messages);
    // prepare the array for building highlighted excerpts
    $docs = array();
    foreach ($found_messages as $id => $data) {
        // remove hidden text in the output - only added by the hidden_msg module
        $data['body'] = preg_replace("/(\\[hide=([\\#a-z0-9]+?)\\](.+?)\\[\\/hide\\])/is", '', $data['body']);
        $docs[] = htmlspecialchars(phorum_strip_body($data['body']));
    }
    $words = '';
//.........这里部分代码省略.........
开发者ID:raul72,项目名称:phorum-sphinx_search,代码行数:101,代码来源:sphinx_search.php

示例15: phorum_api_user_save_settings

$PHORUM['DATA']['SELECTED'] = $moddays;
$PHORUM['DATA']['SELECTED_2'] = $showwaiting ? true : false;
// Store current selection for the user.
phorum_api_user_save_settings(array("cc_messages_moddays" => $moddays, "cc_messages_onlyunapproved" => $showwaiting));
// some needed vars
$numunapproved = 0;
$oldforum = $PHORUM['forum_id'];
$mod_forums = phorum_api_user_check_access(PHORUM_USER_ALLOW_MODERATE_MESSAGES, PHORUM_ACCESS_LIST);
$gotforums = count($mod_forums) > 0;
if ($gotforums && isset($_POST['deleteids']) && count($_POST['deleteids'])) {
    //print_var($_POST['deleteids']);
    $deleteids = $_POST['deleteids'];
    foreach ($deleteids as $did => $did_var) {
        $deleteids[$did] = (int) $did_var;
    }
    $delete_messages = phorum_db_get_message(array_keys($deleteids), 'message_id', true);
    //print_var($delete_messages);
    foreach ($deleteids as $msgthd_id => $doit) {
        // A hook to allow modules to implement extra or different
        // delete functionality.
        if ($doit && isset($mod_forums[$delete_messages[$msgthd_id]['forum_id']])) {
            $delete_handled = 0;
            if (isset($PHORUM["hooks"]["before_delete"])) {
                list($delete_handled, $msg_ids, $msgthd_id, $delete_messages[$msgthd_id], $delete_mode) = phorum_hook("before_delete", array(0, 0, $msgthd_id, $delete_messages[$msgthd_id], PHORUM_DELETE_MESSAGE));
            }
            // Handle the delete action, unless a module already handled it.
            if (!$delete_handled) {
                // Delete the message from the database.
                phorum_db_delete_message($msgthd_id, PHORUM_DELETE_MESSAGE);
                // Delete the message attachments from the database.
                $files = phorum_db_get_message_file_list($msgthd_id);
开发者ID:mgs2,项目名称:kw-forum,代码行数:31,代码来源:messages.php


注:本文中的phorum_db_get_message函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。