本文整理汇总了PHP中CFactory::getInputFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP CFactory::getInputFilter方法的具体用法?PHP CFactory::getInputFilter怎么用?PHP CFactory::getInputFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFactory
的用法示例。
在下文中一共展示了CFactory::getInputFilter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check
public function check()
{
// Santinise data
$safeHtmlFilter = CFactory::getInputFilter();
$this->caption = $safeHtmlFilter->clean($this->caption);
return true;
}
示例2: check
/**
* Pre-store sanitization & check
*
* @access public
* @return bool
*/
public function check()
{
// Santinize data
$safeHtmlFilter = CFactory::getInputFilter();
$this->title = $safeHtmlFilter->clean($this->title);
$this->points = (int) $safeHtmlFilter->clean($this->points);
return true;
}
示例3: check
public function check()
{
//CFactory::load( 'helpers', 'string');
// Santinise data
$safeHtmlFilter = CFactory::getInputFilter();
$this->caption = CStringHelper::nl2br($safeHtmlFilter->clean($this->caption));
return true;
}
示例4: check
function check()
{
$config = CFactory::getConfig();
$safeHtmlFilter = CFactory::getInputFilter($config->get('allowhtml'));
$this->title = $safeHtmlFilter->clean($this->title);
$this->message = $safeHtmlFilter->clean($this->message);
return true;
}
示例5: check
public function check()
{
// Santinise data
$safeHtmlFilter = CFactory::getInputFilter();
$this->name = $safeHtmlFilter->clean($this->name);
$this->description = $safeHtmlFilter->clean($this->description);
$this->email = $safeHtmlFilter->clean($this->email);
$this->website = $safeHtmlFilter->clean($this->website);
return true;
}
示例6: check
public function check()
{
// Filter the discussion
$config = CFactory::getConfig();
//$clean = ('none' != $config->get('htmleditor'));
$safeHtmlFilter = CFactory::getInputFilter();
$this->title = $safeHtmlFilter->clean($this->title);
$safeHtmlFilter = CFactory::getInputFilter($config->getBool('allowhtml'));
$this->message = $safeHtmlFilter->clean($this->message);
return true;
}
示例7: check
public function check()
{
// Santinise data
$safeHtmlFilter = CFactory::getInputFilter();
$this->name = $safeHtmlFilter->clean($this->name);
$this->email = $safeHtmlFilter->clean($this->email);
$this->website = $safeHtmlFilter->clean($this->website);
// Allow html tags
$config = CFactory::getConfig();
$safeHtmlFilter = CFactory::getInputFilter($config->get('allowhtml'));
$this->description = $safeHtmlFilter->clean($this->description);
return true;
}
示例8: saveWall
function saveWall($uniqueId, $message, $appType, &$creator, $isOwner, $processFunc = '', $templateFile = 'wall.content', $wallId = 0)
{
$my = CFactory::getUser();
// Add some required parameters, otherwise assert here
CError::assert($uniqueId, '', '!empty', __FILE__, __LINE__);
CError::assert($appType, '', '!empty', __FILE__, __LINE__);
CError::assert($message, '', '!empty', __FILE__, __LINE__);
CError::assert($my->id, '', '!empty', __FILE__, __LINE__);
// Load the models
CFactory::load('models', 'wall');
CFactory::load('helpers', 'url');
$wall =& JTable::getInstance('Wall', 'CTable');
$wall->load($wallId);
if ($wallId == 0) {
// Get current date
$now =& JFactory::getDate();
$now = $now->toMySQL();
// Set the wall properties
$wall->type = $appType;
$wall->contentid = $uniqueId;
$wall->post_by = $creator->id;
$wall->date = $now;
$wall->published = 1;
// @todo: set the ip address
$wall->ip = $_SERVER['REMOTE_ADDR'];
}
$wall->comment = $message;
$filter = CFactory::getInputFilter();
$wall->comment = $filter->clean($wall->comment);
// Store the wall message
$wall->store();
// Convert it to array so that the walls can be processed by plugins
$args = array();
$args[0] =& $wall;
//Process wall comments
CFactory::load('libraries', 'comment');
$comment = new CComment();
$wallComments = $wall->comment;
$wall->comment = $comment->stripCommentData($wall->comment);
// Trigger the wall comments
CWall::triggerWallComments($args);
$wallData = new stdClass();
$wallData->id = $wall->id;
$wallData->content = CWallLibrary::_getWallHTML($wall, $wallComments, $appType, $isOwner, $processFunc, $templateFile);
CFactory::load('helpers', 'string');
$wallData->content = CStringHelper::replaceThumbnails($wallData->content);
return $wallData;
}
示例9: deletegroupdiscussion
function deletegroupdiscussion($data)
{
require_once JPATH_SITE . '/components/com_community/libraries/core.php';
CFactory::load('libraries', 'apps');
$error_messages = array();
$response = NULL;
$validated = true;
if ("" == $data['groupid'] || 0 == $data['groupid']) {
$validated = false;
$error_messages[] = array("id" => 1, "fieldname" => "groupid", "message" => "Groupid cannot be blank");
}
$inputFilter = CFactory::getInputFilter(true);
$validated = true;
if (true == $validated) {
if ($data['discuss_id'] == "" || $data['discuss_id'] == "0") {
$error_messages[] = array("id" => 1, "fieldname" => "discussid", "message" => "Discuss id cannot be blank");
} else {
CFactory::load('helpers', 'owner');
CFactory::load('models', 'discussions');
$groupsModel =& CFactory::getModel('groups');
$wallModel =& CFactory::getModel('wall');
$discussion =& JTable::getInstance('Discussion', 'CTable');
$group =& JTable::getInstance('Group', 'CTable');
$group->load($groupid);
//$isGroupAdmin = $groupsModel->isAdmin( $my->id , $group->id );
$discussion->set('id', strip_tags($data['discuss_id']));
if ($discussion->delete()) {
// Remove the replies to this discussion as well since we no longer need them
$wallModel->deleteAllChildPosts($data['discuss_id'], 'discussions');
// Substract the count from the groups table
$groupsModel->substractDiscussCount($groupid);
//$success_message = "Group discussion id[" . $discussion->id . "] deleted successfully.";
}
}
}
if (true == isset($error_messages) && 0 < sizeof($error_messages)) {
$res = array();
foreach ($error_messages as $key => $error_message) {
$res[] = $error_message;
}
$response = array("id" => 0, 'errors' => $res);
} else {
$response = array('id' => $discussion->id);
}
return $response;
}
示例10: createnewgroupdiscussion
function createnewgroupdiscussion($data)
{
require_once JPATH_SITE . '/components/com_community/libraries/core.php';
CFactory::load('libraries', 'apps');
$error_messages = array();
$response = NULL;
$validated = true;
$db =& JFactory::getDBO();
$survey_filepath = JPATH_ROOT . DS . 'configuration' . DS . 'surveyfiles' . DS . $data['survey_filename'];
if ("" == $data['creator'] || 0 == $data['creator']) {
$validated = false;
$error_messages[] = array("id" => 1, "fieldname" => "creator", "message" => "Creator cannot be blank");
}
if ("" == $data['groupid'] || 0 == $data['groupid']) {
$validated = false;
$error_messages[] = array("id" => 1, "fieldname" => "groupid", "message" => "Groupid cannot be blank");
}
if ($data['title'] == "" || 0 == strlen($data['title'])) {
$validated = false;
$error_messages[] = array("id" => 1, "fieldname" => "title", "message" => "Title cannot be blank");
}
if ($data['message'] == "" || 0 == strlen($data['message'])) {
$validated = false;
$error_messages[] = array("id" => 1, "fieldname" => "message", "message" => "Message cannot be blank");
}
$inputFilter = CFactory::getInputFilter(true);
$validated = true;
if (true == $validated) {
// Bind the data with the table first
$discussion =& JTable::getInstance('Discussion', 'CTable');
$discussion->set('title', strip_tags($data['title']));
$discussion->set('message', $inputFilter->clean($data['message']));
$discussion->set('groupid', $data['groupid']);
$discussion->set('creator', $data['creator']);
$discussion->set('created', gmdate('Y-m-d H:i:s'));
$discussion->set('lastreplied', $discussion->created);
$isNew = is_null($discussion->id) || !$discussion->id ? true : false;
$query = "SELECT id FROM #__users WHERE id =" . $data['creator'];
$db->setQuery($query);
$creator = $db->LoadResult();
$query = "SELECT id FROM #__community_groups WHERE id =" . $data['groupid'];
$db->setQuery($query);
$isgroup = $db->LoadResult();
if (!$creator) {
$error_messages[] = array("id" => 1, "fieldname" => "creator", "message" => "Invalid discussion creator id. Check 'creator' field in request");
}
if (!$isgroup) {
$error_messages[] = array("id" => 1, "fieldname" => "groupid", "message" => "Invalid group id. Check 'groupid' field in request");
} else {
if (!file_exists($survey_filepath)) {
$validated = false;
$error_messages[] = array("id" => 1, "fieldname" => "survey_filename", "message" => "Invalid Survey File Name");
} else {
// Save the discussion.
$discussion->store();
$survey = new stdClass();
$survey->group_id = $data['groupid'];
$survey->discussion_id = $discussion->id;
$survey->status = 0;
$survey->timestamp = date('Y-m-d H:i:s');
$survey->filename = $data['survey_filename'];
$db->insertObject('#__myhsclosure_survey', $survey, 'discussion_id');
}
}
//add user points
CFactory::load('libraries', 'userpoints');
CUserPoints::assignPoint('group.discussion.create');
if (!$creator) {
}
if (!$isgroup) {
} else {
if ($data['isqm'] != '') {
$db =& JFactory::getDBO();
$row = new stdClass();
$row->id = NULL;
$row->discussion_id = $discussion->id;
$row->qm_flag = $data['isqm'];
$db->insertObject('#__myhs_qmflag', $row, 'id');
}
}
}
if (true == isset($error_messages) && 0 < sizeof($error_messages)) {
$res = array();
foreach ($error_messages as $key => $error_message) {
$res[] = $error_message;
}
$response = array("id" => 0, 'errors' => $res);
} else {
$response = array('id' => $discussion->id);
}
return $response;
}
示例11: save
/**
* Method to save the group
* @return false if create fail, return the group id if create is successful
* */
public function save($event, $isDuplicate = false)
{
// Check for request forgeries
JSession::checkToken('post') or jexit(JText::_('COM_COMMUNITY_INVALID_TOKEN'));
$mainframe = JFactory::getApplication();
$jinput = $mainframe->input;
$document = JFactory::getDocument();
$viewType = $document->getType();
$viewName = $jinput->get('view', $this->getName(), 'String');
$view = $this->getView($viewName, '', $viewType);
if (JString::strtoupper($jinput->getMethod()) != 'POST') {
$view->addWarning(JText::_('COM_COMMUNITY_PERMISSION_DENIED_WARNING'));
return false;
}
// Get my current data.
$my = CFactory::getUser();
$validated = true;
$model = $this->getModel('events');
$eventId = $jinput->get->get('eventid', 0, 'Int');
$isNew = $eventId == 0 ? true : false;
$postData = JRequest::get('post');
$repeataction = $jinput->get('repeataction', null, 'NONE');
$inviteAllMembers = $jinput->get('invitegroupmembers', 0, 'INT');
if (!isset($postData['allday'])) {
$postData['allday'] = 0;
}
//format startdate and eendate with time before we bind into event object
$postData = $this->_formatStartEndDate($postData);
$event->load($eventId);
// record event original start and end date
$postData['oldstartdate'] = $event->startdate;
$postData['oldenddate'] = $event->enddate;
$postData['unlisted'] = JRequest::getVar('unlisted', 0, 'post', 'int', JREQUEST_ALLOWRAW);
if (CFactory::getConfig()->get('eventshowtimezone')) {
$timezoneName = $postData['offset'];
$postData['offset'] = CTimeHelper::getOffsetByTimezone($postData['offset']);
//update offset before binding
}
$event->bind($postData);
if (!array_key_exists('permission', $postData)) {
$event->permission = 0;
}
if (!array_key_exists('allowinvite', $postData)) {
$event->allowinvite = 0;
} elseif (isset($postData['endtime-ampm']) && $postData['endtime-ampm'] == 'AM' && $postData['endtime-hour'] == 12) {
$postData['endtime-hour'] = 00;
}
$inputFilter = CFactory::getInputFilter(true);
// Despite the bind, we would still need to capture RAW description
$event->description = JRequest::getVar('description', '', 'post', 'string', JREQUEST_ALLOWRAW);
$event->description = $inputFilter->clean($event->description);
// binding the params
$params = new CParameter('');
$photoPermissionAdmin = $jinput->get('photopermission-admin', 0, 'STRING');
$photoPermissionMember = $jinput->get('photopermission-member', 0, 'STRING');
$videoPermissionAdmin = $jinput->get('videopermission-admin', 0, 'STRING');
$videoPermissionMember = $jinput->get('videopermission-member', 0, 'STRING');
$eventRecentPhotos = $jinput->get('eventrecentphotos', 6, 'STRING');
$eventRecentVideos = $jinput->get('eventrecentvideos', 6, 'STRING');
$params->set('eventrecentphotos', $eventRecentPhotos);
$params->set('eventrecentvideos', $eventRecentVideos);
$params->set('timezone', $timezoneName);
if ($photoPermissionAdmin) {
$params->set('photopermission', EVENT_PHOTO_PERMISSION_ADMINS);
if ($photoPermissionMember) {
$params->set('photopermission', EVENT_PHOTO_PERMISSION_ALL);
}
} else {
$params->set('photopermission', EVENT_PHOTO_PERMISSION_DISABLE);
}
if ($videoPermissionAdmin) {
$params->set('videopermission', EVENT_VIDEO_PERMISSION_ADMINS);
if ($videoPermissionMember) {
$params->set('videopermission', EVENT_VIDEO_PERMISSION_ALL);
}
} else {
$params->set('videopermission', EVENT_VIDEO_PERMISSION_DISABLE);
}
$event->params = $params->toString();
// @rule: Test for emptyness
if (empty($event->title)) {
$validated = false;
$mainframe->enqueueMessage(JText::_('COM_COMMUNITY_EVENTS_TITLE_ERROR'), 'error');
}
if (empty($event->location)) {
$validated = false;
$mainframe->enqueueMessage(JText::_('COM_COMMUNITY_EVENTS_LOCATION_ERR0R'), 'error');
}
// @rule: Test if the event is exists
if ($model->isEventExist($event->title, $event->location, $event->startdate, $event->enddate, $eventId, $event->parent)) {
$validated = false;
$mainframe->enqueueMessage(JText::_('COM_COMMUNITY_EVENTS_TAKEN_ERROR'), 'error');
}
// @rule: Start date cannot be empty
if (empty($event->startdate)) {
$validated = false;
//.........这里部分代码省略.........
示例12: check
public function check()
{
// Santinise data
$safeHtmlFilter = CFactory::getInputFilter();
$this->name = $safeHtmlFilter->clean($this->name);
$this->description = $safeHtmlFilter->clean($this->description);
if (empty($this->creator)) {
return false;
}
return true;
}
示例13: _saveDiscussion
private function _saveDiscussion(&$discussion)
{
$topicId = JRequest::getVar('topicid', 'POST');
$postData = JRequest::get('post');
$inputFilter = CFactory::getInputFilter(true);
$groupid = JRequest::getVar('groupid', '', 'REQUEST');
$my = CFactory::getUser();
$mainframe = JFactory::getApplication();
$groupid = JRequest::getVar('groupid', '', 'REQUEST');
$groupsModel =& $this->getModel('groups');
$group =& JTable::getInstance('Group', 'CTable');
$group->load($groupid);
$discussion->bind($postData);
CFactory::load('helpers', 'owner');
$creator = CFactory::getUser($discussion->creator);
if ($my->id != $creator->id && !empty($discussion->creator) && !$groupsModel->isAdmin($my->id, $discussion->groupid) && !COwnerHelper::isCommunityAdmin()) {
$mainframe->enqueueMessage(JText::_('CC ACCESS FORBIDDEN'), 'error');
return false;
}
$isNew = is_null($discussion->id) || !$discussion->id ? true : false;
if ($isNew) {
$discussion->creator = $my->id;
}
$discussion->groupid = $groupid;
$discussion->created = gmdate('Y-m-d H:i:s');
$discussion->lastreplied = $discussion->created;
$discussion->message = JRequest::getVar('message', '', 'post', 'string', JREQUEST_ALLOWRAW);
$discussion->message = $inputFilter->clean($discussion->message);
// @rule: do not allow html tags in the title
$discussion->title = strip_tags($discussion->title);
CFactory::load('libraries', 'apps');
$appsLib =& CAppPlugins::getInstance();
$saveSuccess = $appsLib->triggerEvent('onFormSave', array('jsform-groups-discussionform'));
$validated = true;
if (empty($saveSuccess) || !in_array(false, $saveSuccess)) {
if (empty($discussion->title)) {
$validated = false;
$mainframe->enqueueMessage(JText::_('CC DISCUSSION TOPIC CANNOT BE EMPTY'), 'error');
}
if (empty($discussion->message)) {
$validated = false;
$mainframe->enqueueMessage(JText::_('CC DISCUSSION CANNOT BE EMPTY'), 'error');
}
if ($validated) {
CFactory::load('models', 'discussions');
$discussion->store();
if ($isNew) {
$group =& JTable::getInstance('Group', 'CTable');
$group->load($groupid);
// @rule: only add the activities of the discussion if the group is not private.
if ($group->approvals == COMMUNITY_PUBLIC_GROUP) {
// Add logging.
$url = CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupid);
CFactory::load('libraries', 'activities');
$act = new stdClass();
$act->cmd = 'group.discussion.create';
$act->actor = $my->id;
$act->target = 0;
$act->title = JText::sprintf('CC ACTIVITIES NEW GROUP DISCUSSION', '{group_url}', $group->name);
$act->content = $message;
$act->app = 'groups';
$act->cid = $group->id;
$params = new JParameter('');
$params->set('action', 'group.discussion.create');
$params->set('topic_id', $discussion->id);
$params->set('topic', $discussion->title);
$params->set('group_url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
$params->set('topic_url', 'index.php?option=com_community&view=groups&task=viewdiscussion&groupid=' . $group->id . '&topicid=' . $discussion->id);
CActivityStream::add($act, $params->toString());
}
//@rule: Add notification for group members whenever a new discussion created.
$config = CFactory::getConfig();
if ($config->get('groupdiscussnotification') == 1) {
$model =& $this->getModel('groups');
$members = $model->getMembers($groupid, null);
$admins = $model->getAdmins($groupid, null);
$membersArray = array();
foreach ($members as $row) {
$membersArray[] = $row->id;
}
foreach ($admins as $row) {
$membersArray[] = $row->id;
}
unset($members);
unset($admins);
// Add notification
CFactory::load('libraries', 'notification');
$params = new JParameter('');
$params->set('url', 'index.php?option=com_community&view=groups&task=viewdiscussion&groupid=' . $group->id . '&topicid=' . $discussion->id);
$params->set('group', $group->name);
$params->set('user', $my->getDisplayName());
$params->set('subject', $discussion->title);
$params->set('message', $discussion->message);
CNotificationLibrary::add('groups.create.discussion', $discussion->creator, $membersArray, JText::sprintf('CC NEW DISCUSSION NOTIFICATION EMAIL SUBJECT', $group->name), '', 'groups.discussion', $params);
}
}
//add user points
CFactory::load('libraries', 'userpoints');
CUserPoints::assignPoint('group.discussion.create');
}
//.........这里部分代码省略.........
示例14: updategroupdiscussion
function updategroupdiscussion($data)
{
require_once JPATH_SITE . '/components/com_community/libraries/core.php';
CFactory::load('libraries', 'apps');
$error_messages = array();
$response = NULL;
$validated = true;
$db =& JFactory::getDBO();
if ("" == $data['creator'] || 0 == $data['creator']) {
$validated = false;
$error_messages[] = array("id" => 1, "fieldname" => "creator", "message" => "Creator cannot be blank");
}
if ("" == $data['discuss_id'] || 0 == $data['discuss_id']) {
$validated = false;
$error_messages[] = array("id" => 1, "fieldname" => "discussid", "message" => "Discuss_id cannot be blank");
}
if ("" == $data['groupid'] || 0 == $data['groupid']) {
$validated = false;
$error_messages[] = array("id" => 1, "fieldname" => "groupid", "message" => "Groupid cannot be blank");
}
if ($data['title'] == "") {
$validated = false;
$error_messages[] = array("id" => 1, "fieldname" => "title", "message" => "Title cannot be blank");
}
if ($data['message'] == "") {
$validated = false;
$error_messages[] = array("id" => 1, "fieldname" => "message", "message" => "Message cannot be blank");
}
$inputFilter = CFactory::getInputFilter(true);
$validated = true;
if (true == $validated) {
// Bind the data with the table first
$survey_filepath = JPATH_ROOT . DS . 'polltxtfiles/' . $data['survey_filename'];
$discussion =& JTable::getInstance('Discussion', 'CTable');
$discussion->set('id', strip_tags($data['discuss_id']));
$discussion->set('title', strip_tags($data['title']));
$discussion->set('message', $inputFilter->clean($data['message']));
$discussion->set('groupid', $data['groupid']);
$discussion->set('creator', $data['creator']);
$discussion->set('created', gmdate('Y-m-d H:i:s'));
$discussion->set('lastreplied', $discussion->created);
$isNew = is_null($discussion->id) || !$discussion->id ? true : false;
// Save the discussion.
$query = "SELECT id FROM #__users WHERE id =" . $data['creator'];
$db->setQuery($query);
$creator = $db->LoadResult();
$query = "SELECT id FROM #__community_groups WHERE id =" . $data['groupid'];
$db->setQuery($query);
$isgroup = $db->LoadResult();
if (!$creator) {
$error_messages[] = array("id" => 1, "fieldname" => "creator", "message" => "Invalid discussion creator id. Check 'creator' field in request");
}
if (!$isgroup) {
$error_messages[] = array("id" => 1, "fieldname" => "groupid", "message" => "Invalid group id. Check 'groupid' field in request");
} else {
$query = "SELECT id,alert_filename FROM #__myhsclosure_survey WHERE group_id = '" . $data['groupid'] . "' AND discussion_id ='" . $data['discuss_id'] . "'";
$db->setQuery($query);
$res = $db->LoadObjectList();
if ($data['survey_filename'] != "") {
//if($res[0]->alert_filename == "")
//{
if (!file_exists($survey_filepath)) {
$validated = false;
$error_messages[] = array("id" => 1, "fieldname" => "survey_filename", "message" => "Invalid Survey File Name");
} else {
// Save the discussion.
$discussion->store();
$survey = new stdClass();
$survey->id = $res[0]->id;
$survey->group_id = $data['groupid'];
$survey->discussion_id = $data['discuss_id'];
$survey->status = 0;
$survey->discussion_created_date = gmdate('Y-m-d H:i:s');
$survey->alert_filename = $data['survey_filename'];
$db->updateObject('#__myhsclosure_survey', $survey, 'id');
}
//}
}
}
if (true == isset($error_messages) && 0 < sizeof($error_messages)) {
$res = array();
foreach ($error_messages as $key => $error_message) {
$res[] = $error_message;
}
$response = array("id" => 0, 'errors' => $res);
} else {
$response = array('id' => $discussion->id);
}
return $response;
}
}
示例15: parseSettings
public static function parseSettings($settings, $saveKey)
{
$settingsArray = array();
$safeHtmlFilter = CFactory::getInputFilter();
foreach ($settings as $key => $value) {
if (!strlen($key)) {
continue;
}
// Build result array
if (strlen($value)) {
$key = $safeHtmlFilter->clean($key);
$value = $safeHtmlFilter->clean($value);
$settingsArray[$key] = $value;
}
}
// Store SCSS override JSON encoded in the database
$themeTable = JTable::getInstance('Theme', 'CommunityTable');
$themeTable->load('settings');
$themeTable->key = 'settings';
// needed for new record
if (strlen($themeTable->value)) {
$oldSettings = json_decode($themeTable->value, true);
} else {
$oldSettings = array('profile' => array(), 'general' => array());
}
$oldSettings[$saveKey] = $settingsArray;
$themeTable->value = json_encode($oldSettings);
$themeTable->store();
}