本文整理汇总了PHP中Current_User::getAuthKey方法的典型用法代码示例。如果您正苦于以下问题:PHP Current_User::getAuthKey方法的具体用法?PHP Current_User::getAuthKey怎么用?PHP Current_User::getAuthKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Current_User
的用法示例。
在下文中一共展示了Current_User::getAuthKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setTitle
public static function setTitle($module, $link, $add_authkey = false)
{
if ($add_authkey) {
$link = sprintf('%s&authkey=%s', $link, Current_User::getAuthKey());
}
$GLOBALS['MiniAdmin'][$module]['title_link'] = $link;
}
示例2: pagerTags
public function pagerTags()
{
$vars['command'] = 'reset_feed';
$vars['feed_id'] = $this->id;
$links[] = PHPWS_Text::secureLink('<i class="fa fa-refresh" title="' . dgettext('rss', 'Reset') . '"></i>', 'rss', $vars);
$links[] = '<i data-id="' . $this->id . '" class="edit-feed pointer fa fa-edit" title="' . dgettext('rss', 'Edit the feed') . '"></i>';
$js['QUESTION'] = dgettext('rss', 'Are you sure you want to delete this RSS feed?');
$js['ADDRESS'] = sprintf('index.php?module=rss&command=delete_feed&feed_id=%s&authkey=%s', $this->id, Current_User::getAuthKey());
$js['LINK'] = '<i class="fa fa-trash-o" title="' . dgettext('rss', 'Delete feed') . '"></i>';
$links[] = javascript('confirm', $js);
$tpl['ACTION'] = implode(' ', $links);
if ($this->display) {
$vars['command'] = 'turn_off_display';
$tpl['DISPLAY'] = PHPWS_Text::secureLink(dgettext('rss', 'Yes'), 'rss', $vars);
} else {
$vars['command'] = 'turn_on_display';
$tpl['DISPLAY'] = PHPWS_Text::secureLink(dgettext('rss', 'No'), 'rss', $vars);
}
$hours = floor($this->refresh_time / 3600);
$remaining = $this->refresh_time - $hours * 3600;
$minutes = floor($remaining / 60);
$seconds = $remaining - $minutes * 60;
$time = NULL;
if ($seconds) {
$time = sprintf(dgettext('rss', '%d seconds'), $seconds);
}
if ($minutes) {
if (isset($time)) {
$time = sprintf(dgettext('rss', '%d minutes, '), $minutes) . $time;
} else {
$time = sprintf(dgettext('rss', '%d minutes'), $minutes) . $time;
}
}
if ($hours) {
if (isset($time)) {
$time = sprintf(dgettext('rss', '%d hours, '), $hours) . $time;
} else {
$time = sprintf(dgettext('rss', '%d hours'), $hours) . $time;
}
}
$refresh_time = sprintf(dgettext('rss', 'Every %s'), $time);
$shortened_array = parse_url($this->address);
$shortened = $shortened_array['scheme'] . '://' . $shortened_array['host'];
$tpl['ADDRESS'] = sprintf('<a href="%s" title="%s">%s</a>', $this->address, $this->address, $shortened);
$tpl['REFRESH_TIME'] = $refresh_time;
return $tpl;
}
示例3: getLink
public function getLink($addTitle = true)
{
if ($addTitle) {
$title = $this->getTitle();
$link = $this->getLink(false);
$link_title = $this->getLinkTitle();
if ($this->_strict) {
return sprintf('<a href="%s"%s>%s</a>', $link, $link_title, $title);
} elseif ($this->_secure) {
$authkey = Current_User::getAuthKey();
return sprintf('<a href="%s&tab=%s&authkey=%s"%s>%s</a>', $link, $this->id, $authkey, $link_title, $title);
} else {
return sprintf('<a href="%s&tab=%s"%s>%s</a>', $link, $this->id, $link_title, $title);
}
} else {
return $this->link;
}
}
示例4: newManagerSetup
private function newManagerSetup()
{
$development = false;
if ($development) {
$script_file = 'src/Signup.jsx';
$type = 'text/jsx';
} else {
$script_file = 'build/Signup.js';
$type = 'text/javascript';
}
$data['development'] = $development;
$data['addons'] = true;
javascript('react', $data);
$script = '<script type="' . $type . '" src="' . PHPWS_SOURCE_HTTP . 'mod/properties/javascript/ManagerSignUp/' . $script_file . '"></script>';
\Layout::addJSHeader($script);
$vars['authkey'] = \Current_User::getAuthKey();
$template = new \Template($vars);
$template->setModuleTemplate('properties', 'ManagerSignUp.html');
$this->title = 'New Manager Sign-Up';
$this->content = $template->get();
}
示例5: row_tags
public function row_tags($contact_command = false)
{
//$tpl['NAME'] = $this->viewLink($this->name);
$name = strlen($this->name) > 30 ? substr($this->name, 0, 30) . '...' : $this->name;
$tpl['NAME'] = $this->viewLink($name);
if ($contact_command) {
$cmd = 'cop';
$cmd_array['k'] = $_SESSION['Contact_User']->getKey();
} else {
$cmd = 'aop';
$cmd_array['authkey'] = \Current_User::getAuthKey();
}
$cmd_array['pid'] = $this->id;
if ($this->active) {
$cmd_array[$cmd] = 'deactivate_property';
$admin[] = \PHPWS_Text::moduleLink(\Icon::show('active', 'Click to deactivate'), 'properties', $cmd_array);
} else {
$cmd_array[$cmd] = 'activate_property';
$admin[] = \PHPWS_Text::moduleLink(\Icon::show('inactive', 'Click to activate'), 'properties', $cmd_array);
}
$cmd_array[$cmd] = 'edit_property';
$admin[] = \PHPWS_Text::secureLink(\Icon::show('edit'), 'properties', $cmd_array);
$cmd_array[$cmd] = 'update';
if ($this->active) {
$tpl['TIMEOUT'] = \PHPWS_Text::moduleLink($this->getTimeout(), 'properties', $cmd_array);
} else {
$tpl['TIMEOUT'] = 'N/A';
}
$photo = new Photo();
$photo->setPropertyId($this->id);
$admin[] = $photo->uploadNew();
$js['LINK'] = \Icon::show('delete');
$js['QUESTION'] = 'Are you sure you want to delete this property?';
if ($contact_command) {
$js['ADDRESS'] = 'index.php?module=properties&cop=delete_property&pid=' . $this->id . '&k=' . $_SESSION['Contact_User']->getKey();
} else {
$js['ADDRESS'] = 'index.php?module=properties&aop=delete_property&pid=' . $this->id . '&authkey=' . \Current_User::getAuthKey();
}
$admin[] = javascript('confirm', $js);
$tpl['ACTION'] = implode('', $admin);
return $tpl;
}
示例6: row_tags
public function row_tags()
{
$tpl['LAST_NAME'] = sprintf('<a href="mailto:%s">%s, %s <i class="fa fa-envelope-o"></i></a>', $this->email_address, $this->last_name, $this->first_name);
$tpl['PHONE'] = $this->getPhone();
$tpl['COMPANY_NAME'] = $this->getCompanyUrl();
if ($this->active) {
$admin[] = \PHPWS_Text::secureLink(\Icon::show('active', 'Click to deactivate'), 'properties', array('aop' => 'deactivate_contact', 'cid' => $this->id));
} else {
$admin[] = \PHPWS_Text::secureLink(\Icon::show('inactive', 'Click to activate'), 'properties', array('aop' => 'activate_contact', 'cid' => $this->id));
}
$admin[] = \PHPWS_Text::secureLink(\Icon::show('add'), 'properties', array('aop' => 'edit_property', 'cid' => $this->id));
$admin[] = \PHPWS_Text::secureLink(\Icon::show('edit'), 'properties', array('aop' => 'edit_contact', 'cid' => $this->id));
$js['LINK'] = \Icon::show('delete');
$js['QUESTION'] = 'Are you sure you want to delete this contact and all their properties?';
$js['ADDRESS'] = 'index.php?module=properties&aop=delete_contact&cid=' . $this->id . '&authkey=' . \Current_User::getAuthKey();
$admin[] = javascript('confirm', $js);
$admin[] = \PHPWS_Text::secureLink(\Icon::show('home', 'Show properties'), 'properties', array('aop' => 'show_properties', 'cid' => $this->id));
if ($this->last_log) {
$tpl['LAST_LOG'] = strftime('%x', $this->last_log);
} else {
$tpl['LAST_LOG'] = 'Never';
}
$tpl['ACTION'] = implode('', $admin);
return $tpl;
}
示例7: rowTags
public function rowTags()
{
static $folder = null;
if (empty($folder)) {
$folder = new Folder($this->folder_id);
}
if (Current_User::allow('filecabinet', 'edit_folders', $this->folder_id, 'folder')) {
if ($this->embedded) {
$command = 'edit_rtmp';
} else {
$command = 'upload_multimedia_form';
}
//$links[] = $folder->uploadLink('icon', $this->id);
//$authkey = \Current_User::getAuthKey(\PHPWS_Text::saltArray(array('mop'=>'delete_multimedia','file_id'=>$this->id)));
$authkey = \Current_User::getAuthKey();
$links[] = <<<EOF
<i style='cursor:pointer' class='fa fa-trash-o delete-file' data-folder-id='{$this->folder_id}' data-id='{$this->id}' data-type='mop' data-command='delete_multimedia' data-authkey='{$authkey}'></i>
EOF;
//$links[] = $this->editLink(true);
//$links[] = $this->deleteLink(true);
}
if (isset($links)) {
$tpl['ACTION'] = implode('', $links);
}
$tpl['SIZE'] = $this->getSize(TRUE);
$tpl['FILE_NAME'] = $this->file_name;
$tpl['THUMBNAIL'] = $this->getJSView(true);
$tpl['TITLE'] = $this->getJSView(false, $this->title);
if ($this->isVideo()) {
$tpl['DIMENSIONS'] = sprintf('%s x %s', $this->width, $this->height);
}
return $tpl;
}
示例8: getAuthKey
public function getAuthKey()
{
// if not secure, authkey irrelevant
if (!$this->secure || !class_exists('Current_User')) {
return null;
}
if ($this->salted) {
// Have to make them strings because GET will change them on the
// other side.
return Current_User::getAuthKey(PHPWS_Text::saltArray($this->values));
} else {
$result = Current_User::getAuthKey();
return $result;
}
}
示例9: includeAuthkey
public static function includeAuthkey()
{
static $authkey_inserted = false;
if ($authkey_inserted) {
return;
} else {
$authkey = \Current_User::getAuthKey();
$script = "<script type='text/javascript'>var authkey='{$authkey}';</script>";
\Layout::addJSHeader($script, 'authkey');
$authkey_inserted = true;
}
}
示例10: rowTags
public function rowTags()
{
if ($this->checkPermissions()) {
$links[] = '<i class="fa fa-plus add-event" style="cursor:pointer" data-schedule-id="' . $this->id . '" data-date="' . time() . '"></i>';
//$links[] = $this->addEventLink(null, true, true);
$links[] = $this->uploadEventsLink(null, true);
$links[] = $this->downloadEventsLink(null, true);
$links[] = '<i class="fa fa-edit" id="edit-schedule" data-schedule-id="' . $this->id . '" style="cursor:pointer" title="' . dgettext('calendar', 'Edit schedule') . '"></i>';
}
if (Current_User::allow('calendar', 'delete_schedule') && Current_User::isUnrestricted('calendar')) {
$js['QUESTION'] = dgettext('calendar', 'Are you sure you want to delete this schedule?');
$js['ADDRESS'] = sprintf('index.php?module=calendar&aop=delete_schedule&sch_id=%s&authkey=%s', $this->id, Current_User::getAuthKey());
$js['LINK'] = Icon::show('delete');
$links[] = javascript('confirm', $js);
}
if ($this->public && Current_User::isUnrestricted('calendar')) {
$public_schedule = PHPWS_Settings::get('calendar', 'public_schedule');
if ($public_schedule != $this->id) {
$link_vars['aop'] = 'make_default_public';
$link_vars['sch_id'] = $this->id;
$links[] = PHPWS_Text::secureLink(dgettext('calendar', 'Make default public'), 'calendar', $link_vars);
} else {
$links[] = dgettext('calendar', 'Default public');
}
}
if (!empty($links)) {
$tags['ADMIN'] = implode(' ', $links);
} else {
$tags['ADMIN'] = dgettext('calendar', 'None');
}
$tags['TITLE'] = $this->getViewLink();
if ($this->public) {
$tags['AVAILABILITY'] = dgettext('calendar', 'Public');
} else {
$tags['AVAILABILITY'] = dgettext('calendar', 'Private');
}
return $tags;
}
示例11: form
public function form()
{
$form = new \PHPWS_Form('photo-form');
$form->addHidden('module', 'properties');
if (isset($_SESSION['Contact_User'])) {
$form->addHidden('cop', 'post_photo');
$form->addHidden('k', $_SESSION['Contact_User']->getKey());
} else {
$form->addHidden('aop', 'post_photo');
}
if (isset($_GET['v'])) {
$form->addHidden('v', 1);
}
$form->addHidden('pid', $_GET['pid']);
$form->addText('title');
$form->setLabel('title', 'Title');
$form->addFile('photo');
$form->addSubmit('submit', 'Upload photo');
$tpl = $form->getTemplate();
$tpl['WIDTH'] = PROP_THUMBNAIL_WIDTH;
$tpl['HEIGHT'] = PROP_THUMBNAIL_HEIGHT;
$tpl['AUTH'] = \Current_User::getAuthKey();
$tpl['THUMBNAILS'] = Photo::getThumbs($_GET['pid']);
if (isset($_SESSION['Contact_User'])) {
$tpl['CMD'] = 'k=' . $_SESSION['Contact_User']->getKey() . '&cop';
} else {
$tpl['CMD'] = 'aop';
}
return \PHPWS_Template::process($tpl, 'properties', 'photo_form.tpl');
}
示例12: pageList
public function pageList()
{
Layout::addStyle('pagesmith');
PHPWS_Core::initCoreClass('DBPager.php');
PHPWS_Core::initModClass('pagesmith', 'PS_Page.php');
$pgtags['ACTION_LABEL'] = dgettext('pagesmith', 'Action');
$createText = dgettext('pagesmith', 'New Page');
$pgtags['NEW'] = "<a href='index.php?module=pagesmith&aop=menu&tab=new' class='button'>{$createText}/a>";
if (PHPWS_Settings::get('pagesmith', 'text_only_default')) {
$pgtags['NEW_PAGE_LINK_URI'] = 'index.php?module=pagesmith&aop=pick_template&tpl=text_only&pid=0&authkey=' . \Current_User::getAuthKey();
} else {
$pgtags['NEW_PAGE_LINK_URI'] = "index.php?module=pagesmith&aop=menu&tab=new";
}
$pgtags['NEW_PAGE_LINK_TEXT'] = $createText;
$pager = new DBPager('ps_page', 'PS_Page');
$pager->cacheQueries();
$pager->addPageTags($pgtags);
$pager->setModule('pagesmith');
$pager->setTemplate('page_list.tpl');
$pager->addRowTags('row_tags');
$pager->setEmptyMessage(dgettext('pagesmith', 'No pages have been created.'));
$pager->setSearch('title', 'id');
$pager->addSortHeader('id', dgettext('pagesmith', 'Id'));
$pager->addSortHeader('title', dgettext('pagesmith', 'Title'));
$pager->addSortHeader('create_date', dgettext('pagesmith', 'Created'));
$pager->addSortHeader('last_updated', dgettext('pagesmith', 'Updated'));
$pager->addWhere('parent_page', 0);
$pager->setDefaultLimit(10);
$pager->setDefaultOrder('last_updated', 'desc');
$this->ps->title = dgettext('pagesmith', 'Pages');
$pager->initialize();
$this->pullUpdated($pager);
$this->ps->content = $pager->get();
}
示例13: shortcut_menu
public static function shortcut_menu()
{
PHPWS_Core::initModClass('access', 'Shortcut.php');
$sch_id = filter_input(INPUT_GET, 'sch_id', FILTER_SANITIZE_NUMBER_INT);
if ($sch_id === false) {
$sch_id = 0;
}
if (!$sch_id) {
@($key_id = $_REQUEST['key_id']);
if (!$key_id) {
javascript('close_window');
return;
} else {
$shortcut = new Access_Shortcut();
$key = new Key($key_id);
if (!$key->id) {
javascript('close_window');
return;
}
$shortcut->keyword = trim(preg_replace('/[^\\w\\s\\-]/', '', $key->title));
}
} else {
$shortcut = new Access_Shortcut($sch_id);
if (!$shortcut->id) {
return 'Error: shortcut not found';
}
}
$form = new \Form();
$form->setAction('index.php');
$form->appendCSS('bootstrap');
$form->setId('shortcut-menu');
$form->addHidden('authkey', \Current_User::getAuthKey());
$form->addHidden('module', 'access');
$form->addHidden('command', 'post_shortcut');
if (isset($key_id)) {
$form->addHidden('key_id', $key_id);
} else {
$form->addHidden('sch_id', $shortcut->id);
}
$keyword = $form->addTextField('keyword', $shortcut->keyword)->setRequired();
$keyword->setPlaceholder(dgettext('access', 'Type in a keyword'));
$tpl = $form->getInputStringArray();
$template = new \Template($tpl);
$template->setModuleTemplate('access', 'shortcut_menu.tpl');
$content = $template->render();
return $content;
}
示例14: sendMessage
public static function sendMessage($message, $command)
{
$_SESSION['User_Admin_Message'] = $message;
PHPWS_Core::reroute('index.php?module=users&action=admin&command=' . $command . '&authkey=' . Current_User::getAuthKey());
}
示例15: assign
public function assign()
{
Layout::addStyle('checkin');
javascriptMod('checkin', 'send_note');
javascriptMod('checkin', 'reassign', array('authkey' => Current_User::getAuthKey()));
$this->title = dgettext('checkin', 'Assignment');
$this->loadVisitorList(null, true);
$this->loadStaffList(true);
// id and name only for drop down menu
$staff_list = $this->getStaffList(false, true, true);
$staff_list = array_reverse($staff_list, true);
$staff_list[0] = dgettext('checkin', 'Unassigned');
$staff_list[-1] = dgettext('checkin', '-- Move visitor --');
$staff_list = array_reverse($staff_list, true);
if (empty($this->staff_list)) {
$this->content = dgettext('checkin', 'No staff found.');
return;
}
$status_list = $this->getStatusColors();
// unassigned visitors
$staff = new Checkin_Staff();
$staff->display_name = dgettext('checkin', 'Unassigned');
$row['VISITORS'] = $this->listVisitors($staff, $staff_list);
$row['COLOR'] = '#ffffff';
$row['DISPLAY_NAME'] = $staff->display_name;
$tpl['rows'][] = $row;
$count = 1;
$backcount = -1;
// Go through staff and list assignments
foreach ($this->staff_list as $staff) {
$row = array();
$this->current_staff =& $staff;
$row['VISITORS'] = $this->listVisitors($staff, $staff_list);
$row['COLOR'] = $status_list[$staff->status];
$row['DISPLAY_NAME'] = $staff->display_name;
if (!isset($this->visitor_list[$staff->id])) {
$this->current_visitor = null;
} else {
$this->current_visitor =& $this->visitor_list[$staff->id][0];
}
$this->statusButtons($row);
if ($staff->status == 3) {
$tpl['rows'][$backcount] = $row;
$backcount--;
} else {
$tpl['rows'][$count] = $row;
$count++;
}
}
ksort($tpl['rows']);
$tpl['VISITORS_LABEL'] = dgettext('checkin', 'Visitors');
$tpl['DISPLAY_NAME_LABEL'] = dgettext('checkin', 'Staff name');
$tpl['TIME_WAITING_LABEL'] = dgettext('checkin', 'Time waiting');
$tpl['HIDE_PANEL'] = $this->hidePanelLink();
$tpl['HIDE_SIDEBAR'] = $this->hideSidebarLink();
$tpl['REFRESH'] = sprintf('<a href="index.php?module=checkin&tab=assign">%s</a>', dgettext('checkin', 'Refresh'));
// UNASSIGN_ALL and AUTO_ASSIGN are links for testing functionality of automatic visitor assignment.
//$tpl['UNASSIGN_ALL'] = sprintf('<a href="index.php?module=checkin&aop=unassignAll">%s</a>', dgettext('checkin', 'Unassign All')); // For testing purposes only
//$tpl['AUTO_ASSIGN'] = sprintf('<a href="index.php?module=checkin&aop=auto_assign">%s</a>', dgettext('checkin', 'Auto Assign')); // For testing purposes only
$this->content = PHPWS_Template::process($tpl, 'checkin', 'visitors.tpl');
Layout::metaRoute('index.php?module=checkin&aop=assign', PHPWS_Settings::get('checkin', 'assign_refresh'));
}