• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP filter_all_post函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: handleSaveAnswer

 public function handleSaveAnswer($request_method, $request_data)
 {
     $msg = NULL;
     $error = FALSE;
     switch ($request_method) {
         case 'POST':
             filter_all_post($request_data);
             $request_data['answer'] = trim($request_data['answer']);
             if (empty($request_data['answer'])) {
                 $msg = __('Answer can not be left blank');
                 $error = true;
             } else {
                 $comment = new Comment();
                 // setting some variables
                 $usr = PA::$user;
                 $comment->comment = $comment->subject = $request_data['answer'];
                 $comment->parent_type = TYPE_ANSWER;
                 $id = $comment->parent_id = $comment->content_id = $request_data['id'];
                 $comment->user_id = $usr->user_id;
                 $comment->name = $usr->login_name;
                 $comment->email = $usr->email;
                 if ($comment->spam_check()) {
                     $msg = __('Sorry, your Answer cannot be posted as it looks like spam. Try removing any links to possibly suspect sites, and re-submitting.');
                     $error = true;
                     Logger::log('Comment rejected by spam filter', LOGGER_ACTION);
                 } else {
                     $msg = __('Your Answer has been posted successfully');
                     $comment->save_comment();
                     if ($comment->spam_state != SPAM_STATE_OK) {
                         $msg = __('Sorry, your answer cannot be posted as it was classified as spam by Akismet, or contained links to blacklisted sites. Please check the links in your post, and that your name and e-mail address are correct.');
                         $error = true;
                     } else {
                         unset($request_data);
                         //invalidate cache of content block as it is modified now
                         if (PA::$network_info) {
                             $nid = '_network_' . PA::$network_info->network_id;
                         } else {
                             $nid = '';
                         }
                         //unique name
                         $cache_id = 'content_' . $id . $nid;
                         CachedTemplate::invalidate_cache($cache_id);
                     }
                 }
             }
             break;
     }
     $msg_array = array();
     $msg_array['failure_msg'] = $msg;
     $msg_array['success_msg'] = NULL;
     $redirect_url = NULL;
     $query_str = NULL;
     set_web_variables($msg_array, $redirect_url, $query_str);
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:54,代码来源:AnswersModule.php


示例2: handleAJAX_updateUserAnnouncement

 private function handleAJAX_updateUserAnnouncement($request_data)
 {
     filter_all_post($request_data);
     $msg = 'success';
     $html = null;
     try {
         PA::$login_user->set_profile_field(GENERAL, "shoutout", $request_data['value']);
         $html = PA::$login_user->get_profile_field(GENERAL, "shoutout");
     } catch (Exception $e) {
         $msg = $html = $e->getMessage();
     }
     echo json_encode(array("msg" => $msg, "result" => $html));
     exit;
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:14,代码来源:PersonalAnnouncementModule.php


示例3: handleAJAX_addUserComment

 private function handleAJAX_addUserComment($request_data)
 {
     $msg = 'success';
     $html = 'null';
     filter_all_post($request_data);
     if (!empty($request_data['content'])) {
         $comment = new Comment();
         $usr = PA::$login_user;
         $comment->comment = $request_data['content'];
         $comment->subject = $request_data['content'];
         $comment->parent_type = TYPE_USER;
         $comment->parent_id = PA::$page_uid;
         $comment->content_id = PA::$page_uid;
         $comment->user_id = $usr->user_id;
         $comment->name = $usr->login_name;
         $comment->email = $usr->email;
         $id = PA::$page_uid;
         if ($comment->spam_check()) {
             Logger::log("Comment rejected by spam filter", LOGGER_ACTION);
             $msg = $html = __("Comment rejected by spam filter");
         } else {
             try {
                 $comment->save_comment();
                 if ($comment->spam_state != SPAM_STATE_OK) {
                     $msg = $html = __("Comment rejected by spam filter");
                 }
                 $html = $this->render();
             } catch (Exception $e) {
                 $msg = $html = $e->getMessage();
             }
         }
     } else {
         $msg = __("Comment can't be empty.");
     }
     echo json_encode(array("msg" => $msg, "result" => htmlspecialchars($html)));
     exit;
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:37,代码来源:ShowUserCommentModule.php


示例4: handleAJAX_delRole

 private function handleAJAX_delRole($request_data)
 {
     $roles = new Roles();
     filter_all_post($request_data);
     try {
         $role = $roles->get($request_data['role_id']);
         if (is_object($role)) {
             if (!$role->read_only) {
                 $roles->delete((int) $request_data['role_id']);
                 $msg = __('Role sucessfully deleted.');
             } else {
                 $msg = __('This Role can\'t be deleted.');
             }
         }
     } catch (CNException $e) {
         $msg = "{$e->message}";
     }
     print $msg;
     exit;
 }
开发者ID:Cyberspace-Networks,项目名称:CoreSystem,代码行数:20,代码来源:CNRoleManageModule.php


示例5: filter_all_post

<?php

/** !
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* [filename] is a part of PeopleAggregator.
* [description including history]
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* @author [creator, or "Original Author"]
* @license http://bit.ly/aVWqRV PayAsYouGo License
* @copyright Copyright (c) 2010 Broadband Mechanics
* @package PeopleAggregator
*/
$error = FALSE;
filter_all_post($_form);
if (isset($_form['comment']) && empty($_form['comment'])) {
    $error = TRUE;
    $failure_message = 9024;
}
if ($_form && empty($error)) {
    $comment = new Comment();
    $usr = get_login_user();
    $comment->comment = $_form['comment'];
    $comment->subject = $_form['comment'];
    $comment->parent_type = TYPE_USER;
    $comment->parent_id = $_form['id'];
    $comment->content_id = $_form['id'];
    $comment->user_id = $usr->user_id;
    $comment->name = $usr->login_name;
    $comment->email = $usr->email;
    $id = $_form['id'];
    if ($comment->spam_check()) {
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:31,代码来源:action.php


示例6: edit_forum_topic

function edit_forum_topic($_form)
{
    filter_all_post($_POST);
    $error = FALSE;
    $msg = '';
    $title = trim($_POST['forum_title']);
    $body = trim($_POST['forum_contents']);
    if (empty($title)) {
        $error = TRUE;
        $msg .= "Please specify a title for the forum topic";
    }
    if (empty($body)) {
        $error = TRUE;
        $msg .= "Please enter small description of the topic";
    }
    if (!$error) {
        $request_info = load_info();
        $cat_obj = new MessageBoard();
        $cat_obj->title = $title;
        $cat_obj->body = $body;
        $cat_obj->boardmessage_id = $_REQUEST['mid'];
        if ($_POST['chk_allow_anonymous'] != ALLOW_ANONYMOUS) {
            $cat_obj->allow_anonymous = 0;
        } else {
            $cat_obj->allow_anonymous = 1;
        }
        try {
            $mid = $cat_obj->save($login_uid, NULL);
        } catch (PAException $e) {
            $msg = "Error occured in saving data";
            $error = TRUE;
        }
    }
    $msg_array = array();
    $msg_array['failure_msg'] = $msg;
    $msg_array['success_msg'] = NULL;
    $return_array = array('msg' => $msg_array);
    return $return_array;
}
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:39,代码来源:action.php


示例7: handlePOST_GroupInvitationSubmit

 public function handlePOST_GroupInvitationSubmit($request_data)
 {
     if (isset($request_data['submit'])) {
         filter_all_post($request_data);
         $gid = $request_data['groups'];
         $self_invite = FALSE;
         $error = FALSE;
         // check if groups are there
         if (empty($gid)) {
             $error = TRUE;
             $msg[] = __("Please select a group");
         }
         if (empty($error) && !empty($request_data['email_user_name'])) {
             // if login name are supplied
             $friend_user_name = trim($request_data['email_user_name']);
             $friend_user_name_array = explode(',', $friend_user_name);
             $cnt_usr_name = count($friend_user_name_array);
             for ($counter = 0; $counter < $cnt_usr_name; $counter++) {
                 try {
                     $user_obj = new User();
                     $user_obj->load(trim($friend_user_name_array[$counter]));
                     if ($user_obj->email == PA::$login_user->email) {
                         $self_invite = TRUE;
                         //you can not invite your self
                     } else {
                         $valid_user_login_names[] = $user_obj->login_name;
                         $valid_usr_name_email[] = $user_obj->email;
                     }
                 } catch (PAException $e) {
                     if (!empty($friend_user_name_array[$counter])) {
                         $invalid_login_msg .= $friend_user_name_array[$counter] . ', ';
                     }
                 }
             }
             // end for
             if (!empty($invalid_login_msg)) {
                 $invalid_login_msg = substr($invalid_login_msg, 0, -2);
                 $msg[] = sprintf(__('Invitation could not be sent to following login names- %s'), $invalid_login_msg);
             }
         }
         // end if : if user names are supplied.
         $invalid = null;
         if (empty($error) && !empty($request_data['email_id'])) {
             // if email ids are supplied
             $friend_email = trim($request_data['email_id']);
             $friend_email_array = explode(',', $friend_email);
             $cnt_email = count($friend_email_array);
             // Check for valid-invalid email addresses start
             for ($counter = 0; $counter < $cnt_email; $counter++) {
                 $email_validation = Validation::validate_email(trim($friend_email_array[$counter]));
                 if ($email_validation == '0') {
                     $invalid[] = trim($friend_email_array[$counter]);
                 } else {
                     if ($friend_email_array[$counter] == PA::$login_user->email) {
                         $self_invite = TRUE;
                     } else {
                         $valid_user_first_emails[] = $friend_email_array[$counter];
                         $valid_email[] = trim($friend_email_array[$counter]);
                     }
                 }
             }
         }
         // Check for valid-invalid email addresses end
         // Action for valid-invalid email addresses start
         if (empty($friend_email) && empty($friend_user_name)) {
             // if email field is left empty
             $msg[] = MessagesHandler::get_message(6001);
             $error = TRUE;
         } else {
             if (!empty($friend_email) && !empty($friend_user_name)) {
                 $msg = array();
                 $msg[] = MessagesHandler::get_message(7026);
                 $error = TRUE;
             } else {
                 if (!empty($self_invite) || sizeof($invalid) > 0) {
                     // if self invitation is made
                     if (!empty($self_invite)) {
                         $msg[] = MessagesHandler::get_message(6002);
                     }
                     if (!empty($invalid)) {
                         // if invalid email addresses are supplied
                         $invalid_cnt = count($invalid);
                         $invalid_msg = '';
                         for ($counter = 0; $counter < $invalid_cnt; $counter++) {
                             if (!empty($invalid[$counter])) {
                                 $invalid_msg .= $invalid[$counter] . ', ';
                             }
                         }
                         if (!empty($invalid_msg)) {
                             $invalid_msg = substr($invalid_msg, 0, -2);
                             $msg[] = sprintf(__('Invitation could not be sent to following email addresses- %s'), $invalid_msg);
                         }
                     }
                 }
             }
         }
         if (empty($error)) {
             // At this point invitation could be made
             if (!empty($valid_email) && !empty($valid_usr_name_email)) {
                 $valid_email = array_merge($valid_email, $valid_usr_name_email);
//.........这里部分代码省略.........
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:101,代码来源:GroupInvitationModule.php


示例8: trim

<?
echo "This script has huge security problems, so has been disabled.  It's also not used in the Beta theme, so you should never get here.";
exit;

$login_required = TRUE;
include "includes/page.php";
require_once "../api/MessageBoard/MessageBoard.php";

$back = $_REQUEST['back_page'];
//print_r($_REQUEST);exit;
$mid = trim($_REQUEST['message_id']);
if ($_REQUEST['do'] == 'edit') {
  filter_all_post($_REQUEST);  
  $title = trim($_REQUEST['edit_title']);
  $body = trim($_REQUEST['edit_body']);
  
  $m = new MessageBoard();
  $m->title = $title;
  $m->body = $body;
  $m->boardmessage_id = $mid;
  $id = $m->save($uid=NULL,$is_insert=0);
}
if ($_REQUEST['do'] == 'delete') {
  
  MessageBoard::delete_all_in_parent($mid,PARENT_TYPE_MESSAGE);
}
if ($_REQUEST['groupurl']) {
  $url = $_REQUEST['groupurl'];
  header("Location:$url"); exit;
}
header("location:$back");exit;
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:31,代码来源:edit_comments.php


示例9: handlePOST_submitAbuse

 function handlePOST_submitAbuse($request_data)
 {
     global $error_msg;
     if ($request_data['action'] == 'submitAbuse' && !empty(PA::$login_uid)) {
         filter_all_post($request_data);
         $abuse = trim($request_data['abuse']);
         $type = isset($request_data['type']) && $request_data['type'] == 'comment' ? 'comment' : 'content';
         $mail_type = $type == 'comment' ? "report_abuse_on_comment" : "report_abuse_on_content";
         if (!empty($abuse)) {
             $extra = $this->shared_data['extra'];
             $network_info = $this->shared_data['network_info'];
             $error_msg = "";
             try {
                 // Saving the abuse report
                 $report_abuse_obj = new ReportAbuse();
                 $report_abuse_obj->parent_type = $type == 'comment' ? TYPE_COMMENT : TYPE_CONTENT;
                 $report_abuse_obj->parent_id = $request_data['cid'];
                 $report_abuse_obj->reporter_id = PA::$login_uid;
                 $report_abuse_obj->body = $request_data['abuse'];
                 $id = $report_abuse_obj->save();
             } catch (PAException $e) {
                 $error_msg = $e->message;
             }
             $ccid_string = "";
             PANotify::send($mail_type, PA::$network_info, PA::$login_user, $report_abuse_obj);
             $error_msg = 9002;
             /*
                     if(!empty($request_data['gid'])) {
                       $group = new Group();
                       $group->load((int)$request_data['gid']);
                       PANotify::send("report_abuse_grp_owner", $group, PA::$login_user, $report_abuse_obj);
                     }
             */
             try {
                 if (!empty($this->shared_data['content']) && !empty($this->shared_data['collection'])) {
                     $content = $this->shared_data['content'];
                     $collection = $this->shared_data['collection'];
                     if ($content && $content->parent_collection_id != -1) {
                         if ($this->shared_data['is_group_content']) {
                             $mail_type = $type == 'comment' ? "report_abuse_on_comment_grp_owner" : "report_abuse_grp_owner";
                             PANotify::send($mail_type, $this->shared_data['collection'], PA::$login_user, $report_abuse_obj);
                             $error_msg = 9002;
                         }
                     }
                 }
             } catch (PAException $e) {
                 $error_msg = $e->message;
             }
         } else {
             $error_msg = 9004;
         }
     }
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:53,代码来源:PermalinkModule.php


示例10: saveEmail

function saveEmail(&$err_msg, $save_to_file = false)
{
    global $email_type;
    $error = false;
    $res = false;
    filter_all_post($_POST);
    $mandatory_fields = array('subject' => 'Caption', "description" => "Description", 'email_message' => 'Message');
    foreach ($mandatory_fields as $key => $value) {
        if (empty($_POST[$key])) {
            $error = true;
            $err_msg[] = $value . ' can\'t be empty.';
        }
    }
    if (!$error) {
        $res = true;
        $err_msg = 13001;
        $email = new EmailMessages();
        $email->subject = $_POST['subject'];
        $email->category = $_POST['category'];
        $email->template = $_POST['template'];
        $email->message = $_POST['email_message'];
        $email->description = $_POST['description'];
        $email->type = $email_type;
        $email->update();
        if ($save_to_file) {
            try {
                $email->saveToFile();
            } catch (Exception $e) {
                $error = true;
                $err_msg = $e->getMessage();
                $res = false;
            }
        }
    }
    return $res;
}
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:36,代码来源:configure_email.php


示例11: handlePOST

 /** !!
  * This handles the data that is POSTed back to the page upon
  * submission of the form. There is a lot happening in here,
  * but it basically looks at the submitted data, figures out
  * what it is supposed to do with it (based on if the group is
  * being created or modified), then creates a new group or
  * updates the current data using the {@link handle_entity() } method.
  *
  * @param array $request_data  All of the data POSTed back to the form.
  */
 public function handlePOST($request_data)
 {
     require_once "web/includes/classes/CNFileUploader.php";
     require_once "api/CNActivities/CNActivities.php";
     require_once "api/cnapi_constants.php";
     if ($request_data['addgroup']) {
         filter_all_post($request_data);
         $groupname = trim($request_data['groupname']);
         $body = trim($request_data['groupdesc']);
         $tag_entry = trim($request_data['group_tags']);
         $group_category = $request_data['group_category'];
         $header_image = NULL;
         $header_image_action = @$request_data['header_image_action'];
         $display_header_image = @$request_data['display_header_image'];
         $collection_id = NULL;
         $this->extra = NULL;
         if ($request_data['ccid']) {
             $collection_id = (int) $request_data['ccid'];
             $group = new Group();
             $group->load($collection_id);
             // preserve group info we are not editing in this module
             // load group extra
             $extra = $group->extra;
             if (!empty($extra)) {
                 $this->extra = unserialize($extra);
             }
             $header_image = $group->header_image;
             $header_image_action = $group->header_image_action;
             $display_header_image = $group->display_header_image;
         }
         $access = 0;
         // default access is 0 means public
         $reg_type = $request_data['reg_type'];
         if ($reg_type == REG_INVITE) {
             // if reg. type = "Invite" access is PRIVATE
             $access = ACCESS_PRIVATE;
         }
         $is_moderated = 0;
         // is moderated is 0 means contents appear immediately
         $group_tags = $request_data['group_tags'];
         if (empty($request_data['groupname'])) {
             $error_msg = 90222;
         } else {
             if (empty($group_category) && empty($error_msg)) {
                 $error_msg = 90224;
             } else {
                 if (empty($error_msg)) {
                     try {
                         if (empty($_FILES['groupphoto']['name'])) {
                             $upfile = $request_data['file'];
                         } else {
                             $myUploadobj = new FileUploader();
                             //creating instance of file.
                             $image_type = 'image';
                             $file = $myUploadobj->upload_file(PA::$upload_path, 'groupphoto', true, true, $image_type);
                             if ($file == false) {
                                 throw new CNException(GROUP_PARAMETER_ERROR, __("File upload error: ") . $myUploadobj->error);
                             }
                             $upfile = $file;
                             $avatar_uploaded = TRUE;
                         }
                         $exception_message = NULL;
                         $result = Group::save_new_group($collection_id, $_SESSION['user']['id'], $groupname, $body, $upfile, $group_tags, $group_category, $access, $reg_type, $is_moderated, $header_image, $header_image_action, $display_header_image, $this->extra);
                         $ccid = $result;
                         $exception_message = 'Group creation failed: ' . $result;
                         if (!is_numeric($result)) {
                             throw new CNException(GROUP_CREATION_FAILED, $exception_message);
                         } else {
                             if (@$avatar_uploaded) {
                                 Storage::link($upfile, array("role" => "avatar", "group" => (int) $result));
                             }
                             if (@$header_uploaded) {
                                 Storage::link($header_image, array("role" => "header", "group" => (int) $result));
                             }
                             $this->gid = $this->id = $result;
                             if (empty($request_data['gid'])) {
                                 $mail_type = $activity = 'group_created';
                                 $act_text = ' created a new group';
                             } else {
                                 $mail_type = $activity = 'group_settings_updated';
                                 $act_text = ' changed group settings ';
                             }
                             $group = new Group();
                             $group->load((int) $this->gid);
                             PANotify::send($mail_type, PA::$network_info, PA::$login_user, $group);
                             // notify network onwer
                             $_group_url = PA::$url . PA_ROUTE_GROUP . '/gid=' . $result;
                             $group_owner = new User();
                             $group_owner->load((int) $_SESSION['user']['id']);
                             $activity_extra['info'] = $group_owner->first_name . $act_text;
//.........这里部分代码省略.........
开发者ID:Cyberspace-Networks,项目名称:CoreSystem,代码行数:101,代码来源:CNAddGroupModule.php


示例12: dirname

<?php

/* Function for Filtering the POST data Array 
This is included file in post_content.php
Purpose : save structured blogging post
Author: tekriti
Bug fixes:
*/
require_once dirname(__FILE__) . "/../ext/BlogPost/BlogPost.php";
global $base_url, $network_info;
$user = get_login_user();
filter_all_post($_REQUEST);
filter_all_post($_POST, FALSE, TRUE);
// don't strip html *everywhere*, just strip bad tags - or we'll mutilate any html content.
// TO DO: This array should be populated from the database.
$sb_types = array('event' => array(array('caption' => 'Generic', 'sb_mc_type' => 'event/generic'), array('caption' => 'Conference', 'sb_mc_type' => 'event/conference'), array('caption' => 'Concert', 'sb_mc_type' => 'event/concert')), 'review' => array(array('caption' => 'Local Service', 'sb_mc_type' => 'review/localservice'), array('caption' => 'Event', 'sb_mc_type' => 'review/event'), array('caption' => 'Bar/Club', 'sb_mc_type' => 'review/club'), array('caption' => 'Restaurant', 'sb_mc_type' => 'review/restaurant'), array('caption' => 'Caf&eacute;', 'sb_mc_type' => 'review/cafe'), array('caption' => 'Hotel/Resort', 'sb_mc_type' => 'review/hotel'), array('caption' => 'Book', 'sb_mc_type' => 'review/book'), array('caption' => 'Album', 'sb_mc_type' => 'review/album'), array('caption' => 'Article', 'sb_mc_type' => 'review/article'), array('caption' => 'Magazine', 'sb_mc_type' => 'review/magazine'), array('caption' => 'Movie', 'sb_mc_type' => 'review/movie'), array('caption' => 'Software', 'sb_mc_type' => 'review/software'), array('caption' => 'Song', 'sb_mc_type' => 'review/song'), array('caption' => 'Website', 'sb_mc_type' => 'review/website')));
if ($_POST) {
    $succ_msg = NULL;
    // check to see if there are any errors
    $SbHelper = new SbHelper();
    $SbHelper->set_mc_type($_REQUEST['sb_mc_type']);
    $error_array = $SbHelper->processForm();
    // check for album creation
    if (@$_POST['new_album']) {
        // try to create new album
        $save_alb = createalbum();
        if ($save_alb['error'] == TRUE) {
            array_push($error_array, $save_alb['msg']);
        } else {
            $created_album_id = $save_alb;
        }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:31,代码来源:sb_content.php


示例13: handlePOSTPageSubmit

 /** !!
  * Takes the data submitted in the form and gets all of the useful data
  * necessary to send a message.  It takes the name that is being sent to and 
  * gets the id, email, and other assorted data.  It then sends the message and
  * tells the user what the outcome of that process is. It also makes sure the
  *  message is within the correct length.
  *
  *  @param array $request_data  The data to be operated on.
  */
 public function handlePOSTPageSubmit($request_data)
 {
     $error = false;
     if (!empty($request_data)) {
         if (isset($request_data['send'])) {
             $message = NULL;
             filter_all_post($request_data, TRUE);
             // applying input filter to the post data, this function is define in function.php
             $subject = $request_data['subject'];
             $body = $request_data['body'];
             $in_reply_to = $request_data['in_reply_to'];
             if (empty($request_data['to'])) {
                 $message = 8003;
                 $error = true;
             }
             if (strlen($body) > MAX_MESSAGE_LENGTH) {
                 $message = 8002;
                 $error = true;
             }
             if (!$error) {
                 if (empty($subject)) {
                     $subject = '[none]';
                 }
                 $login_names = preg_split("/,\\s*/", $request_data['to']);
                 $valid_recipients = array();
                 //login name of all the valid login names.
                 $invalid_recipients = array();
                 // names of all the invalid recipients.
                 foreach ($login_names as $login_name) {
                     try {
                         $User = new User();
                         $User->load($login_name);
                         $valid_recipients['id'][] = $User->user_id;
                         $valid_recipients['name'][] = $User->login_name;
                         $valid_recipients['display_name'][] = $User->display_name;
                         $valid_recipients['fname'][] = $User->first_name;
                         $valid_recipients['email'][] = $User->email;
                         $valid_recipients['user'][] = $User;
                         $notif_settings = null;
                         $recipient_profile = User::load_user_profile($User->user_id, $User->user_id, 'notifications');
                         if (!empty($recipient_profile)) {
                             $notif_settings = unserialize($recipient_profile[0]['value']);
                         }
                         $valid_recipients['notifications'][] = $notif_settings;
                     } catch (PAException $e) {
                         $invalid_recipients[] = $login_name;
                     }
                 }
                 $message = null;
                 if (count($valid_recipients)) {
                     $is_draft = FALSE;
                     // actually 'send' the message
                     Message::add_message(PA::$login_uid, $valid_recipients['id'], $valid_recipients['name'], $subject, $body, $is_draft, $in_reply_to);
                     // handle 'also send to email' and 'message_waiting_blink'
                     $valid_recipients_count = count($valid_recipients['id']);
                     for ($counter = 0; $counter < $valid_recipients_count; $counter++) {
                         if (!empty($valid_recipients['notifications'][$counter])) {
                             $rec_notif_settings = $valid_recipients['notifications'][$counter];
                             $as_email = false;
                             if (!empty($rec_notif_settings['user_send_message']['value'])) {
                                 switch ($rec_notif_settings['user_send_message']['value']) {
                                     case NET_EMAIL:
                                     case NET_BOTH:
                                         $as_email = true;
                                         PAMail::send("user_send_message", $valid_recipients['user'][$counter], PA::$login_user, array('subject' => $subject, 'message' => $body));
                                         break;
                                     default:
                                         break;
                                 }
                             }
                             // if they are not getting it in email already
                             if (empty($as_email) && !empty($rec_notif_settings['msg_waiting_blink']) && $rec_notif_settings['msg_waiting_blink'] == NET_EMAIL) {
                                 PAMail::send("msg_waiting_blink", $valid_recipients['email'][$counter], PA::$login_user, array());
                             }
                         }
                     }
                     $message = sprintf(__("Message sent successfully to %s"), implode(", ", $valid_recipients['display_name']));
                 }
                 if (count($invalid_recipients)) {
                     //some of the recipients are invalid. So displaying the error message for them.
                     $message .= sprintf(__("Message sending failed for %s  as user(s) doesn't exist"), implode(", ", $invalid_recipients));
                     $error = true;
                 } else {
                     // message sent successfully to all the recipients. Redirecting user to inbox
                     header('Location: ' . PA::$url . PA_ROUTE_MYMESSAGE . "/msg={$message}");
                     exit;
                 }
             }
             if (!empty($message)) {
                 $msg_array = array();
                 $msg_array['failure_msg'] = $message;
//.........这里部分代码省略.........
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:101,代码来源:AddMessageModule.php


示例14: handlePOST_addChild

 private function handlePOST_addChild($request_data)
 {
     global $error_msg;
     $error = FALSE;
     $login_name = trim($_POST['login_name']);
     $first_name = stripslashes(trim($_POST['first_name']));
     $last_name = stripslashes(trim($_POST['last_name']));
     $email = trim($_POST['email']);
     $password = trim($_POST['password']);
     $use_parent_email = $_POST['use_parent_email'];
     //echo "<pre>".print_r($_POST, 1)."</pre>"; die();
     if (!isset($_POST['state'])) {
         if (isset($_POST['stateOther'])) {
             $_POST['state'] = $_POST['stateOther'];
         }
     }
     if (isset($_POST['stateOther'])) {
         unset($_POST['stateOther']);
     }
     $msg = NULL;
     if (!Validation::validate_email($email) && !empty($_POST['email'])) {
         $email_invalid = TRUE;
         $error = TRUE;
         $msg .= '<br> Email address is not valid';
     }
     if (User::user_exist($login_name)) {
         $msg = "Username {$login_name} is already taken";
         $error = TRUE;
     }
     if ($error == FALSE) {
         $newuser = new User();
         $newuser->login_name = $login_name;
         $newuser->password = $password;
         $newuser->first_name = $first_name;
         $newuser->last_name = $last_name;
         $newuser->email = $email;
         $newuser->is_active = ACTIVE;
         if (!empty($_FILES['userfile']['name'])) {
             $myUploadobj = new FileUploader();
             //creating instance of file.
             $image_type = 'image';
             $file = $myUploadobj->upload_file(PA::$upload_path, 'userfile', true, true, $image_type);
             if ($file == false) {
                 $msg = $myUploadobj->error;
                 $error = TRUE;
             } else {
                 $newuser->picture = $file;
             }
         }
         if ($error == FALSE) {
             try {
                 if ($use_parent_email) {
                     $newuser->save($check_unique_email = false);
                 } else {
                     $newuser->save($check_unique_email = true);
                 }
                 if (!empty($file)) {
                     Storage::link($file, array("role" => "avatar", "user" => $newuser->user_id));
                 }
                 // creating message basic folders
                 Message::create_basic_folders($newuser->user_id);
                 // adding default relation
                 if ($newuser->user_id != SUPER_USER_ID) {
                     User_Registration::add_default_relation($newuser->user_id, PA::$network_info);
                 }
                 // adding default media as well as album
                 User_Registration::add_default_media($newuser->user_id, '', PA::$network_info);
                 User_Registration::add_default_media($newuser->user_id, '_audio', PA::$network_info);
                 User_Registration::add_default_media($newuser->user_id, '_video', PA::$network_info);
                 User_Registration::add_default_blog($newuser->user_id);
                 //adding default link categories & links
                 User_Registration::add_default_links($newuser->user_id);
                 // code for adding default desktop image for user
                 $desk_img = uihelper_add_default_desktopimage($newuser->user_id);
                 if (empty($desk_img)) {
                     $desktop_images = array('bay.jpg', 'everglade.jpg', 'bay_boat.jpg', 'delhi.jpg');
                     $rand_key = array_rand($desktop_images);
                     $desk_img = $desktop_images[$rand_key];
                 }
                 $states = array_values(PA::getStatesList());
                 $countries = array_values(PA::getCountryList());
                 $profile_keys = array('dob_day', 'dob_month', 'dob_year', 'homeAddress1', 'homeAddress2', 'city', 'state', 'country', 'postal_code', 'phone', 'use_parent_email');
                 $profile_data = array();
                 filter_all_post($_POST);
                 //filters all data of html
                 foreach ($profile_keys as $k => $pkey) {
                     if (!empty($_POST[$pkey])) {
                         if ($pkey == 'state' && $_POST[$pkey] >= 0) {
                             $prof_rec = array('uid' => $newuser->user_id, 'name' => $pkey, 'value' => $states[$_POST[$pkey]], 'type' => GENERAL, 'perm' => 1);
                         } else {
                             if ($pkey == 'country' && $_POST[$pkey] >= 0) {
                                 $prof_rec = array('uid' => $newuser->user_id, 'name' => $pkey, 'value' => $countries[$_POST[$pkey]], 'type' => GENERAL, 'perm' => 1);
                             } else {
                                 $prof_rec = array('uid' => $newuser->user_id, 'name' => $pkey, 'value' => $_POST[$pkey], 'type' => GENERAL, 'perm' => 1);
                             }
                         }
                         $profile_data[] = $prof_rec;
                     }
                 }
                 $profile_data[] = array('uid' => $newuser->user_id, 'name' => 'user_caption_image', 'value' => $desk_img, 'type' => GENERAL, 'perm' => 1);
//.........这里部分代码省略.........
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:101,代码来源:FamilyModerationModule.php


示例15: header

     $is_active = ACTIVE;
     if ($extra['network_content_moderation'] == NET_YES) {
         $content = Content::load_all_content_for_moderation(NULL, $condition);
         if (!empty($content)) {
             $is_active = $content[0]['is_active'];
         }
     }
     $new_save->is_active = $is_active;
     $new_save->save();
     $tag_array = Tag::split_tags($_POST['tags']);
     Tag::add_tags_to_content($new_save->content_id, $tag_array);
     header("Location:group_media_gallery.php?gid=" . $_POST['group_id'] . '&type=' . $module);
 }
 if (isset($_POST['submit'])) {
     /* Function for Filtering the POST data Array */
     filter_all_post($_POST, TRUE);
     if ($_POST['media_type'] == 'image') {
         $module = 'Images';
         $new_save = new Image();
         if (isset($_POST['image_perm'])) {
             $new_save->file_perm = $_POST['image_perm'];
         }
     } else {
         if ($_POST['media_type'] == 'audio') {
             $module = 'Audios';
             $new_save = new Audio();
             if (isset($_POST['audio_perm'])) {
                 $new_save->file_perm = $_POST['audio_perm'];
             }
         } else {
             if ($_POST['media_type'] == 'video') {
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:31,代码来源:edit_media.php


示例16: handleSaveProfile

 /** !!
  * Upon post, this method calls a method defined later in this file,
  *  one with a name like {$section_name}ProfileSave, where $section_name
  *  is basic,general,professional,etc.
  * @param string $request_method Should be POST.
  * @param array $request_data Profile data to save. Will be passed to its respective method.
  */
 public function handleSaveProfile($request_method, $request_data)
 {
     global $error_msg;
     $error_msg = null;
     switch ($request_method) {
         case 'POST':
             filter_all_post(&$request_data);
             if (!empty($request_data['profile_type'])) {
                 $saveHandler = $request_data['profile_type'] . 'ProfileSave';
                 if (method_exists($this, $saveHandler)) {
                     $this->{$saveHandler}($request_data);
                 } else {
                     $error_msg = __("EditProfileModule::handleSaveProfile() - Unknown save handler!");
                 }
             }
             break;
     }
     //    $this->setWebPageMessage();
 }
开发者ID:CivicCommons,项目名称:people-aggregator,代码行数:26,代码来源:EditProfileModule.php


示例17: create_new_network

function create_new_network($_form)
{
    // function checks initial settings for network creation
    $can_network_be_created = Network::can_network_be_created();
    if ($can_network_be_created['error'] == TRUE) {
        $config_error = TRUE;
        $error = TRUE;
        $error_msg = $can_network_be_created['error_msg'];
    } else {
        if (!PA::$login_uid) {
            $config_error = TRUE;
        }
    }
    //form_data is array used for form fields
    // its initialized by $_form
    $temp_data['action'] = 'add';
    $vartoset = array('address', 'name', 'tagline', 'category', 'desc', 'header_image', 'header_image_option', 'action', 'type', 'network_group_title', 'network_content_moderation');
    for ($i = 0; $i < count($vartoset); $i += 1) {
        $var = $vartoset[$i];
        if (!empty($_form[$var])) {
            $temp_data[$var] = trim($_form[$var]);
        }
        if ($var == 'type') {
            if (isset($_form[$var])) {
                $temp_data[$var] = $_form[$var];
            }
        }
    }
    if (empty($config_error)) {
        filter_all_post($_form);
        //filters all data of html
        $error_post = check_error();
        //validation check
        if ($error_post['error'] == TRUE) { 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP filter_configure函数代码示例发布时间:2022-05-15
下一篇:
PHP filterText函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap