本文整理汇总了PHP中WT\Auth::isModerator方法的典型用法代码示例。如果您正苦于以下问题:PHP Auth::isModerator方法的具体用法?PHP Auth::isModerator怎么用?PHP Auth::isModerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WT\Auth
的用法示例。
在下文中一共展示了Auth::isModerator方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: canAcceptChanges
public function canAcceptChanges(User $user)
{
return Auth::isModerator($this, $user);
}
示例2: define
$WT_TREE = null;
foreach (WT_Tree::getAll() as $tree) {
$WT_TREE = $tree;
if ($WT_TREE->tree_name == $GEDCOM && ($WT_TREE->imported || Auth::isAdmin())) {
break;
}
}
// These attributes of the currently-selected tree are used frequently
if ($WT_TREE) {
define('WT_GEDCOM', $WT_TREE->tree_name);
define('WT_GED_ID', $WT_TREE->tree_id);
define('WT_GEDURL', $WT_TREE->tree_name_url);
define('WT_TREE_TITLE', $WT_TREE->tree_title_html);
define('WT_IMPORTED', $WT_TREE->imported);
define('WT_USER_GEDCOM_ADMIN', Auth::isManager($WT_TREE));
define('WT_USER_CAN_ACCEPT', Auth::isModerator($WT_TREE));
define('WT_USER_CAN_EDIT', Auth::isEditor($WT_TREE));
define('WT_USER_CAN_ACCESS', Auth::isMember($WT_TREE));
define('WT_USER_GEDCOM_ID', $WT_TREE->userPreference(WT_USER_ID, 'gedcomid'));
define('WT_USER_ROOT_ID', $WT_TREE->userPreference(WT_USER_ID, 'rootid') ? $WT_TREE->userPreference(WT_USER_ID, 'rootid') : WT_USER_GEDCOM_ID);
define('WT_USER_PATH_LENGTH', $WT_TREE->userPreference(WT_USER_ID, 'RELATIONSHIP_PATH_LENGTH'));
if (WT_USER_GEDCOM_ADMIN) {
define('WT_USER_ACCESS_LEVEL', WT_PRIV_NONE);
} elseif (WT_USER_CAN_ACCESS) {
define('WT_USER_ACCESS_LEVEL', WT_PRIV_USER);
} else {
define('WT_USER_ACCESS_LEVEL', WT_PRIV_PUBLIC);
}
load_gedcom_settings(WT_GED_ID);
} else {
define('WT_GEDCOM', '');
示例3:
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
use WT\Log;
define('WT_SCRIPT_NAME', 'edit_changes.php');
require './includes/session.php';
require WT_ROOT . 'includes/functions/functions_import.php';
$controller = new WT_Controller_Simple();
$controller->restrictAccess(Auth::isModerator())->setPageTitle(WT_I18N::translate('Pending changes'))->pageHeader()->addInlineJavascript("\n\t\tfunction show_diff(diffurl) {\n\t\t\twindow.opener.location = diffurl;\n\t\t\treturn false;\n\t\t}\n\t");
$action = WT_Filter::get('action');
$change_id = WT_Filter::getInteger('change_id');
$index = WT_Filter::get('index');
$ged = WT_Filter::getInteger('ged');
echo '<div id="pending"><h2>', WT_I18N::translate('Pending changes'), '</h2>';
switch ($action) {
case 'undo':
$gedcom_id = WT_DB::prepare("SELECT gedcom_id FROM `##change` WHERE change_id=?")->execute(array($change_id))->fetchOne();
$xref = WT_DB::prepare("SELECT xref FROM `##change` WHERE change_id=?")->execute(array($change_id))->fetchOne();
// Undo a change, and subsequent changes to the same record
WT_DB::prepare("UPDATE `##change`" . " SET status = 'rejected'" . " WHERE status = 'pending'" . " AND gedcom_id = ?" . " AND xref = ?" . " AND change_id >= ?")->execute(array($gedcom_id, $xref, $change_id));
break;
case 'accept':
$gedcom_id = WT_DB::prepare("SELECT gedcom_id FROM `##change` WHERE change_id=?")->execute(array($change_id))->fetchOne();
$xref = WT_DB::prepare("SELECT xref FROM `##change` WHERE change_id=?")->execute(array($change_id))->fetchOne();