コード例 #1
0
ファイル: functions.php プロジェクト: lorea/Hydra-dev
/**
 * Validate if the supplied security code for upgrade.php is correct
 *
 * @param string $code the security code to validate
 *
 * @return boolean true if valid
 */
function security_tools_validate_upgrade_code($code)
{
    $result = false;
    if (empty($code)) {
        return $result;
    }
    $valid_code = security_tools_generate_upgrade_code();
    if ($valid_code === $code) {
        $result = true;
    }
    return $result;
}
コード例 #2
0
ファイル: settings.php プロジェクト: lorea/Hydra-dev
<?php

$plugin = elgg_extract("entity", $vars);
$yesno_options = array("yes" => elgg_echo("option:yes"), "no" => elgg_echo("option:no"));
$noyes_options = array_reverse($yesno_options);
// Upgrade
$upgrade_settings = "<div>";
$upgrade_settings .= elgg_echo("security_tools:settings:secure_upgrade");
$upgrade_settings .= "&nbsp;" . elgg_view("input/dropdown", array("name" => "params[secure_upgrade]", "value" => $plugin->secure_upgrade, "options_values" => $yesno_options));
$upgrade_settings .= "<div class='elgg-subtext'>" . elgg_echo("security_tools:settings:secure_upgrade:description") . "</div>";
$upgrade_settings .= "<pre>" . elgg_get_site_url() . "upgrade.php?code=" . security_tools_generate_upgrade_code() . "</pre>";
$upgrade_settings .= "</div>";
// Mail
$mail_settings = "<div>";
$mail_settings .= elgg_echo("security_tools:settings:mails_admin_admins");
$mail_settings .= "&nbsp;" . elgg_view("input/dropdown", array("name" => "params[mails_admin_admins]", "value" => $plugin->mails_admin_admins, "options_values" => $yesno_options));
$mail_settings .= "<div class='elgg-subtext'>" . elgg_echo("security_tools:settings:mails_admin_admins:description") . "</div>";
$mail_settings .= "</div>";
$mail_settings .= "<div>";
$mail_settings .= elgg_echo("security_tools:settings:mails_admin_user");
$mail_settings .= "&nbsp;" . elgg_view("input/dropdown", array("name" => "params[mails_admin_user]", "value" => $plugin->mails_admin_user, "options_values" => $noyes_options));
$mail_settings .= "<div class='elgg-subtext'>" . elgg_echo("security_tools:settings:mails_admin_user:description") . "</div>";
$mail_settings .= "</div>";
$mail_settings .= "<div>";
$mail_settings .= elgg_echo("security_tools:settings:mails_password_change");
$mail_settings .= "&nbsp;" . elgg_view("input/dropdown", array("name" => "params[mails_password_change]", "value" => $plugin->mails_password_change, "options_values" => $yesno_options));
$mail_settings .= "<div class='elgg-subtext'>" . elgg_echo("security_tools:settings:mails_password_change:description") . "</div>";
$mail_settings .= "</div>";
$mail_settings .= "<div>";
$mail_settings .= elgg_echo("security_tools:settings:mails_banned");
$mail_settings .= "&nbsp;" . elgg_view("input/dropdown", array("name" => "params[mails_banned]", "value" => $plugin->mails_banned, "options_values" => $noyes_options));