本文整理汇总了PHP中elgg_make_sticky_form函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_make_sticky_form函数的具体用法?PHP elgg_make_sticky_form怎么用?PHP elgg_make_sticky_form使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_make_sticky_form函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: recaptcha_check_form
/**
* @param $hook
* @param $type
* @param $returnvalue
* @param $params
*
* @return bool
*
* function called when the below plugin trigger is initiated
* @see /engine/lib/actions.php
* @see elgg_trigger_plugin_hook('action', $action, null, $event_result);
*
* this hook is triggered for the action = "register"
* this hooks is called before the default "register" action handler at /actions/register.php
* checks if recaptcha is valid - if not register an error
*/
function recaptcha_check_form($hook, $type, $returnvalue, $params)
{
// retain entered form values and re-populate form fields if validation error
elgg_make_sticky_form('register');
/*-- check if the 'Use Recaptcha for user registration' Plugin setting is enabled --*/
//fetch the plugin settings
$plugin_entity = elgg_get_plugin_from_id('recaptcha');
$plugin_settings = $plugin_entity->getAllSettings();
if (array_key_exists('recaptcha_verified', $_SESSION) && $_SESSION['recaptcha_verified'] == 1) {
//do nothing
} else {
if ($plugin_settings['require_recaptcha'] == 'on') {
//if the setting is enabled
// include the recaptcha lib
require_once 'lib/recaptchalib.php';
// check the recaptcha
$resp = recaptcha_check_answer($plugin_settings['recaptcha_private_key'], $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
register_error(elgg_echo('recaptcha:human_verification_failed'));
forward(REFERER);
} else {
/* note that the user has successfully passed the captcha
* in case the form submission fails due to other factors, we do not want to
* ask the user to fill in the captcha details again
* so we store it in a session variable and destroy it after the form is successfully submitted
*/
$_SESSION['recaptcha_verified'] = 1;
}
}
}
return true;
}
示例2: agerestriction_register_hook
function agerestriction_register_hook()
{
elgg_make_sticky_form('register');
if (get_input('agevalid', false) != 'true') {
register_error(elgg_echo('agerestriction:required'));
forward(REFERER);
}
}
示例3: action_hook
function action_hook($h, $t, $r, $p)
{
$actions = get_recaptcha_actions();
if (is_array($actions) && in_array($t, $actions)) {
if (!validate_recaptcha()) {
elgg_make_sticky_form($t);
register_error(elgg_echo('elgg_recaptcha:message:fail'));
// workaround for https://github.com/Elgg/Elgg/issues/8960
elgg_unregister_plugin_hook_handler('forward', 'system', 'uservalidationbyemail_after_registration_url');
forward(REFERER);
}
}
}
示例4: image_captcha_verify_action_hook
/**
* Listen to the action plugin hook and check the captcha.
*
* @param string $hook name of the hook
* @param string $action the action being called
* @param array $returnvalue current returnvalue
* @param array $params parameters
*
* @return boolean
*/
function image_captcha_verify_action_hook($hook, $action, $returnvalue, $params)
{
$token = get_input('image_captcha');
if ($token && $token == $_SESSION["image_captcha"]) {
return true;
}
if ($action === 'register') {
// Make sure the entered user data is not lost
elgg_make_sticky_form('register');
}
register_error(elgg_echo('image_captcha:verify:fail'));
// forward to referrer or else action code sends to front page
forward(REFERER);
}
示例5: execute
/**
* Executes an action
* Triggers 'action:after', $ation hook that allows you to filter the Result object
*
* @param mixed $controller Action name or instance of Action
* @param bool $feedback Display errors and messages
* @return ActionResult
*/
public function execute($controller = null, $feedback = true)
{
try {
$action = $this->parseActionName($controller);
elgg_make_sticky_form($action);
if (!$controller instanceof Action) {
$controller = $this->getController($action);
}
if (!$controller instanceof Action) {
throw new Exception("Not a valid action controller");
}
$controller->setup();
if ($controller->validate() === false) {
throw new ActionValidationException("Invalid input for action {$action}");
}
$controller->execute();
$this->result = $controller->getResult();
} catch (ActionValidationException $ex) {
$this->result->addError($ex->getMessage());
elgg_log($ex->getMessage(), 'ERROR');
} catch (PermissionsException $ex) {
$this->result->addError(elgg_echo('apps:permissions:error'));
elgg_log($ex->getMessage(), 'ERROR');
} catch (InvalidEntityException $ex) {
$this->result->addError(elgg_echo('apps:entity:error'));
elgg_log($ex->getMessage(), 'ERROR');
} catch (Exception $ex) {
$this->result->addError(elgg_echo('apps:action:error'));
elgg_log($ex->getMessage(), 'ERROR');
}
$errors = $this->result->getErrors();
$messages = $this->result->getMessages();
if (empty($errors)) {
elgg_clear_sticky_form($action);
} else {
$this->result->setForwardURL(REFERRER);
}
if ($feedback) {
foreach ($errors as $error) {
register_error($error);
}
foreach ($messages as $message) {
system_message($message);
}
}
return elgg_trigger_plugin_hook('action:after', $action, null, $this->result);
}
示例6: terms_of_use_check_form
/**
* @param $hook
* @param $type
* @param $returnvalue
* @param $params
*
* @return bool
*
* function called when the below plugin trigger is initiated
* @see /engine/lib/actions.php
* @see elgg_trigger_plugin_hook('action', $action, null, $event_result); [
*
* this hook is triggered for the action = "register"
* this hooks is called before the default "register" action handler at /actions/register.php
* checks if the terms of use checkbox is checked - if not register an error
*/
function terms_of_use_check_form($hook, $type, $returnvalue, $params)
{
// retain entered form values and re-populate form fields if validation error
elgg_make_sticky_form('register');
/*-- check if the 'Require user to accept terms' Plugin setting is enabled --*/
//fetch the plugin settings
$plugin_obj = elgg_get_plugin_from_id('terms_of_use');
$plugin_settings = $plugin_obj->getAllSettings();
if ($plugin_settings['require_terms_of_use'] == 'on') {
//if the setting is enabled
// Get POST variables
$require_terms_of_use = get_input('checkbox-require-terms-of-use');
if (trim($require_terms_of_use) != 'on') {
register_error(elgg_echo('terms_of_use:registration_exception:require_checkbox'));
forward(REFERER);
}
}
return true;
}
示例7: htmlspecialchars
<?php
/**
* Topic save action
*/
// Get variables
$title = htmlspecialchars(get_input('title', '', false), ENT_QUOTES, 'UTF-8');
$desc = get_input("description");
$status = get_input("status");
$access_id = (int) get_input("access_id");
$container_guid = (int) get_input('container_guid');
$guid = (int) get_input('topic_guid');
$tags = get_input("tags");
elgg_make_sticky_form('topic');
// validation of inputs
if (!$title || !$desc) {
register_error(elgg_echo('discussion:error:missing'));
forward(REFERER);
}
$container = get_entity($container_guid);
if (!$container || !$container->canWriteToContainer(0, 'object', 'groupforumtopic')) {
register_error(elgg_echo('discussion:error:permissions'));
forward(REFERER);
}
// check whether this is a new topic or an edit
$new_topic = true;
if ($guid > 0) {
$new_topic = false;
}
if ($new_topic) {
$topic = new ElggObject();
示例8: array
$input = array();
foreach ($variables as $name => $type) {
if ($name == 'title') {
$input[$name] = htmlspecialchars(get_input($name, '', false), ENT_QUOTES, 'UTF-8');
} else {
$input[$name] = get_input($name);
}
if ($type == 'tags') {
$input[$name] = string_to_tag_array($input[$name]);
}
}
// Get guids
$page_guid = (int) get_input('page_guid');
$container_guid = (int) get_input('container_guid');
$parent_guid = (int) get_input('parent_guid');
elgg_make_sticky_form('page');
if (!$input['title']) {
register_error(elgg_echo('pages:error:no_title'));
forward(REFERER);
}
if ($page_guid) {
$page = get_entity($page_guid);
if (!$page || !$page->canEdit()) {
register_error(elgg_echo('pages:error:no_save'));
forward(REFERER);
}
/*elseif($page->checkedOut && $page->checkedOut != elgg_get_logged_in_user_guid()){
$checkee = get_entity($page->checkedOut)->name;
register_error(elgg_echo('Page is currently checked out by: '.$checkee));
forward($page->getURL());
}*/
示例9: elgg_make_sticky_form
<?php
/**
* Elgg groups plugin edit action.
*
* @package ElggGroups
*/
elgg_make_sticky_form('groups');
/**
* wrapper for recursive array walk decoding
*/
function profile_array_decoder(&$v)
{
$v = _elgg_html_decode($v);
}
// Get group fields
$input = array();
foreach (elgg_get_config('group') as $shortname => $valuetype) {
$input[$shortname] = get_input($shortname);
// @todo treat profile fields as unescaped: don't filter, encode on output
if (is_array($input[$shortname])) {
array_walk_recursive($input[$shortname], 'profile_array_decoder');
} else {
$input[$shortname] = _elgg_html_decode($input[$shortname]);
}
if ($valuetype == 'tags') {
$input[$shortname] = string_to_tag_array($input[$shortname]);
}
}
$input['name'] = htmlspecialchars(get_input('name', '', false), ENT_QUOTES, 'UTF-8');
$user = elgg_get_logged_in_user_entity();
示例10: get_input
$title = get_input('title');
$description = get_input('description');
$tags = get_input('tags');
$container_guid = (int) get_input('container_guid');
$guid = (int) get_input('guid');
$access_id = get_input('access_id');
$user_guid = elgg_get_logged_in_user_guid();
if (is_null($access_id)) {
$access_id = get_default_access($user_guid);
$sysmsg = " failed to get access id";
}
if (!can_write_to_container($user_guid, $container_guid)) {
register_error(elgg_echo('answers:error'));
forward(REFERER);
}
elgg_make_sticky_form('question');
// Make sure the title / description aren't blank
if (empty($title)) {
register_error(elgg_echo('answers:question:blank'));
forward(REFERER);
}
// Otherwise, save the question
if ($guid) {
$question = get_entity($guid);
$new = false;
} else {
$question = new ElggObject();
$question->subtype = 'question';
$new = true;
}
$question->access_id = $access_id;
示例11: elgg_make_sticky_form
<?php
/**
* Elgg add action
*
* @package Elgg
* @subpackage Core
*/
elgg_make_sticky_form('useradd');
// Get variables
$username = get_input('username');
$password = get_input('password');
$password2 = get_input('password2');
$email = get_input('email');
$name = get_input('name');
$admin = get_input('admin');
if (is_array($admin)) {
$admin = $admin[0];
}
$notify = get_input('notify', false);
if (is_array($notify)) {
$notify = $notify[0];
}
$use_default_access = get_input('use_default_access', false);
if (is_array($use_default_access)) {
$use_default_access = $use_default_access[0];
}
$custom_profile_fields = get_input("custom_profile_fields");
// For now, just try and register the user
try {
$guid = register_user($username, $password, $name, $email, TRUE);
示例12: subsite_manager_set_missing_subsite_profile_fields
function subsite_manager_set_missing_subsite_profile_fields($user_guid = 0)
{
$result = false;
$accesslevel = get_input('accesslevel');
elgg_make_sticky_form("subsite_missing_profile_fields");
if (empty($user_guid)) {
$user_guid = elgg_get_logged_in_user_guid();
}
if (!empty($user_guid) && ($user = get_user($user_guid))) {
$form_vars = elgg_get_sticky_values("subsite_missing_profile_fields");
$profile_fields = array();
// filter the input
foreach ($form_vars as $key => $value) {
if (strpos($key, "custom_profile_fields_") === 0) {
$key = substr($key, 22);
$profile_fields[$key] = $value;
}
}
if (!empty($profile_fields)) {
foreach ($profile_fields as $key => $value) {
remove_metadata($user->getGUID(), $key);
if (!empty($value)) {
if ($accesslevel && array_key_exists($key, $accesslevel)) {
$access_id = $accesslevel[$key];
} else {
$access_id = get_default_access($user);
}
if (is_array($value)) {
foreach ($value as $index => $v) {
$multiple = false;
if ($index > 0) {
$multiple = true;
}
create_metadata($user->getGUID(), $key, $v, "text", $user->getGUID(), $access_id, $multiple);
}
} else {
create_metadata($user->getGUID(), $key, $value, "text", $user->getGUID(), $access_id);
}
}
}
// in javascript we trust ;)
$result = true;
} else {
$result = true;
}
}
return $result;
}
示例13: elgg_make_sticky_form
<?php
/**
* Add recipients to a newsletter.
*
* This can be done by providing
* - user_guids
* - group_guids
* - email addresses
* - set subscibers
* - set members (site or group)
* - uploading a CSV with email addresses
*/
elgg_make_sticky_form("newsletter_recipients");
$guid = (int) get_input("guid");
$user_guids = get_input("user_guids");
$group_guids = get_input("group_guids");
$emails = get_input("emails");
$subscribers = (int) get_input("subscribers");
$members = (int) get_input("members");
$forward_url = REFERER;
if (!empty($guid)) {
$entity = get_entity($guid);
if (!empty($entity) && $entity->canEdit()) {
if (elgg_instanceof($entity, "object", Newsletter::SUBTYPE)) {
$recipients = $entity->getRecipients();
if (empty($recipients)) {
$forward_url = "newsletter/edit/" . $entity->getGUID() . "/schedule";
}
// make sere we have the correct format
if (empty($user_guids)) {
示例14: saveStickyValues
/**
* Store submitted sticky values
*
* @param string $action Action name
* @return bool
*/
public function saveStickyValues($action = '')
{
return elgg_make_sticky_form($action);
}
示例15: elgg_make_sticky_form
<?php
elgg_make_sticky_form('data_generator/run');
$amount = get_input('amount');
$profile = get_input('profile');
$locale = get_input('locale');
try {
$mt = microtime(true);
$success = data_generator::generate($amount, $profile, $locale);
$total = microtime(true) - $mt;
system_message(elgg_echo('data_generator:action:run:success', array($success, $total)));
elgg_clear_sticky_form('data_generator/run');
} catch (Exception $e) {
register_error($e->getMessage());
}