本文整理汇总了PHP中session_username函数的典型用法代码示例。如果您正苦于以下问题:PHP session_username函数的具体用法?PHP session_username怎么用?PHP session_username使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了session_username函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade_log
function upgrade_log($v = false)
{
if (!$v) {
$v = upgrade_version_num();
}
return db_execute('insert into sitellite_upgrade values (?, ?, now())', $v, session_username());
}
示例2: SiteblogCommentForm
function SiteblogCommentForm()
{
parent::MailForm();
global $cgi;
$this->parseSettings('inc/app/siteblog/forms/comment/settings.php');
if (isset($cgi->_key) && !empty($cgi->_key)) {
//edit a comment
page_title('Editing Comment');
$comment = db_single('select * from siteblog_comment where id = ?', $cgi->_key);
$this->widgets['name']->setValue($comment->author);
$this->widgets['email']->setValue($comment->email);
$this->widgets['url']->setValue($comment->url);
$this->widgets['body']->setValue($comment->body);
} elseif (!isset($cgi->post)) {
header('Location: ' . site_prefix() . '/index');
exit;
} else {
if (session_valid()) {
$this->widgets['name']->setValue(session_username());
$user = session_get_user();
$this->widgets['email']->setValue($user->email);
$this->widgets['url']->setValue($user->website);
}
$this->widgets['post']->setValue($cgi->post);
//page_title ('Post a Comment');
}
if (!appconf('comments_security')) {
unset($this->widgets['security_test']);
}
}
示例3: SiteblogEditForm
function SiteblogEditForm()
{
parent::MailForm();
global $cgi;
$refer = $_SERVER['HTTP_REFERER'];
$this->parseSettings('inc/app/siteblog/forms/edit/settings.php');
$this->widgets['refer']->setValue($refer);
//if add is true, we're creating a blog post, otherwise we're editing a blog post
$add = isset($cgi->_key) && !empty($cgi->_key) ? false : true;
$this->widgets['status']->setValues(array('Live', 'Not Live'));
$cats = db_pairs('select id, title from siteblog_category where status = "on"');
if ($add) {
page_title('Adding a Blog Post');
$this->widgets['author']->setValue(session_username());
unset($this->widgets['icategory']);
$this->widgets['category']->setValues($cats);
} else {
loader_import('cms.Versioning.Rex');
$rex = new Rex('siteblog_post');
$document = $rex->getCurrent($cgi->_key);
page_title('Editing a Blog Post');
//populate fields
$this->widgets['subject']->setValue($document->subject);
$this->widgets['author']->setValue($document->author);
$this->widgets['status']->setValue($document->status);
unset($this->widgets['category']);
$catname = db_shift('select title from siteblog_category where id = ?', $document->category);
$this->widgets['icategory']->setValue($catname);
$this->widgets['oldcat']->setValue($document->category);
$this->widgets['body']->setValue($document->body);
}
}
示例4: onSubmit
function onSubmit($vals)
{
// 1. prepare vals for insertion
if ($vals['contact_url'] == 'http://') {
$vals['contact_url'] = '';
}
if ($vals['loc_map'] == 'http://') {
$vals['loc_map'] = '';
}
$vals['details'] = nl2br(wordwrap(htmlentities_compat($vals['details']), 70, "\n", true));
if (!$vals['public'] || empty($vals['public'])) {
$vals['public'] = 'no';
}
if (!$vals['media'] || empty($vals['media'])) {
$vals['media'] = 'no';
}
if (!empty($vals['loc_addr2'])) {
$vals['loc_address'] .= "\n" . $vals['loc_addr2'];
}
$data = array('title' => $vals['title'], 'date' => $vals['date'], 'until_date' => $vals['end_date'], 'time' => $vals['time'], 'until_time' => $vals['end_time'], 'category' => $vals['category'], 'audience' => $vals['audience'], 'details' => $vals['details'], 'contact' => $vals['contact'], 'contact_email' => $vals['contact_email'], 'contact_phone' => $vals['contact_phone'], 'contact_url' => $vals['contact_url'], 'loc_name' => $vals['loc_name'], 'loc_address' => $vals['loc_address'], 'loc_city' => $vals['loc_city'], 'loc_province' => $vals['loc_province'], 'loc_country' => $vals['loc_country'], 'sponsor' => $vals['sponsor'], 'rsvp' => $vals['rsvp'], 'public' => $vals['public'], 'media' => $vals['media'], 'sitellite_status' => 'draft', 'sitellite_access' => 'public');
if (session_valid()) {
$data['sitellite_owner'] = session_username();
$data['sitellite_team'] = session_team();
}
// 2. submit event as 'draft'
loader_import('cms.Versioning.Rex');
$rex = new Rex('siteevent_event');
$res = $rex->create($data, 'Event submission.');
$vals['id'] = $res;
// 3. email notification
@mail(appconf('submissions'), 'Event Submission Notice', template_simple('submission_email.spt', $vals));
// 4. thank you screen
page_title(intl_get('Thank You!'));
echo template_simple('submissions.spt');
}
示例5: SitefaqEditForm
function SitefaqEditForm()
{
parent::MailForm();
global $page, $cgi;
$this->extra = 'id="cms-edit-form"';
// get copy from repository
loader_import('cms.Versioning.Rex');
$rex = new Rex($cgi->_collection);
// default: database, database
$_document = $rex->getCurrent($cgi->_key);
$widgets = $rex->getStruct();
if (!$widgets) {
$widgets = array();
}
// edit widgets go here
$this->widgets = array_merge($this->widgets, $widgets);
foreach ($this->widgets as $k => $v) {
if (isset($_document->{$k})) {
$this->widgets[$k]->setValue($_document->{$k});
}
}
$w =& $this->addWidget('hidden', '_key');
$w =& $this->addWidget('hidden', '_collection');
$w =& $this->addWidget('hidden', '_return');
if ($rex->isVersioned) {
$t =& $this->addWidget('textarea', 'changelog');
$t->alt = intl_get('Change Summary');
$t->rows = 3;
$t->labelPosition = 'left';
$t->extra = 'id="changelog"';
}
// submit buttons
$w =& $this->addWidget('msubmit', 'submit_button');
$b =& $w->getButton();
$b->setValues(intl_get('Save'));
$b =& $w->addButton('submit_button', intl_get('Cancel'));
$b->extra = 'onclick="return cms_cancel (this.form)"';
$this->error_mode = 'all';
if ($rex->info['Collection']['singular']) {
page_title(intl_get('Editing') . ' ' . $rex->info['Collection']['singular'] . ': ' . $_document->{$rex->key});
} else {
page_title(intl_get('Editing Item') . ': ' . $_document->{$rex->key});
}
// the SiteFAQ additions:
if (appconf('user_anonymity')) {
unset($this->widgets['name']);
unset($this->widgets['email']);
unset($this->widgets['url']);
unset($this->widgets['ip']);
unset($this->widgets['member_id']);
}
$admin_roles = session_admin_roles();
$this->widgets['assigned_to']->setValues(db_pairs('select username, concat(lastname, ", ", firstname, " (", username, ")")
from sitellite_user
where role in("' . join('", "', $admin_roles) . '")
order by lastname, firstname, username'));
if (!$_document->assigned_to) {
$this->widgets['assigned_to']->setValue(session_username());
}
}
示例6: EntryAddForm
function EntryAddForm()
{
parent::MailForm();
$this->parseSettings('inc/app/timetracker/forms/entry/add/settings.php');
$res = db_fetch('select username, firstname, lastname from sitellite_user order by lastname asc');
if (!$res) {
$res = array();
} elseif (is_object($res)) {
$res = array($res);
}
$users = array();
foreach ($res as $row) {
if (!empty($row->lastname)) {
$users[$row->username] = $row->lastname;
if (!empty($row->firstname)) {
$users[$row->username] .= ', ' . $row->firstname;
}
$users[$row->username] .= ' (' . $row->username . ')';
} else {
$users[$row->username] = $row->username;
}
}
$this->widgets['users']->setValues($users);
$this->widgets['users']->setDefault(session_username());
$this->widgets['users']->addRule('not empty', 'You must select at least one user.');
$this->widgets['started']->setDefault(date('Y-m-d H:i:s'));
$this->widgets['ended']->setDefault(date('Y-m-d H:i:s'));
global $cgi;
$this->widgets['proj_name']->setValue(db_shift('select name from timetracker_project where id = ?', $cgi->project));
$this->widgets['submit_button']->buttons[1]->extra = 'onclick="history.go (-1); return false"';
}
示例7: delete
function delete($id)
{
$res = db_execute('delete from sitellite_bookmark where user = ? and id = ?', session_username(), $id);
if (!$res) {
$this->error = db_error();
}
return $res;
}
示例8: onSubmit
function onSubmit($vals)
{
// process the form
db_execute('INSERT INTO digger_comments (story, user, comment_date, comments) VALUES (?, ?, NOW(), ?)', $vals['id'], session_username(), $vals['comments']);
$cid = db_lastid();
// return back to main page
header('Location: /index/digger-comments-action/id.' . $vals['id'] . '#digger-comment-' . $cid);
exit;
}
示例9: getInfo
function getInfo($name, $data)
{
$res = $this->_getIndex($name);
$struct = array('sitellite_status' => 'approved', 'sitellite_access' => 'public', 'sitellite_owner' => session_username(), 'sitellite_team' => session_team(), 'filesize' => 0, 'last_modified' => '0000-00-00 00:00:00');
if (is_object($res)) {
if (!empty($res->sitellite_status)) {
$struct['sitellite_status'] = $res->sitellite_status;
}
if (!empty($res->sitellite_access)) {
$struct['sitellite_access'] = $res->sitellite_access;
}
$struct['filesize'] = $res->filesize;
$struct['last_modified'] = $res->last_modified;
$struct['sitellite_owner'] = $res->sitellite_owner;
$struct['sitellite_team'] = $res->sitellite_team;
$struct['keywords'] = $res->keywords;
$struct['description'] = $res->description;
$struct['display_title'] = $res->display_title;
}
if (isset($data['sitellite_status'])) {
$struct['sitellite_status'] = $data['sitellite_status'];
}
if (isset($data['sitellite_access'])) {
$struct['sitellite_access'] = $data['sitellite_access'];
}
if (isset($data['sitellite_owner'])) {
$struct['sitellite_owner'] = $data['sitellite_owner'];
}
if (isset($data['sitellite_team'])) {
$struct['sitellite_team'] = $data['sitellite_team'];
}
if (isset($data['keywords'])) {
$struct['keywords'] = $data['keywords'];
}
if (isset($data['description'])) {
$struct['description'] = $data['description'];
}
if (isset($data['display_title'])) {
$struct['display_title'] = $data['display_title'];
}
if (isset($data['body'])) {
if (is_object($data['body'])) {
if (strpos($data['name'], '/') === 0) {
$name = $this->path . $data['name'];
} else {
$name = $this->path . '/' . $data['name'];
}
$struct['filesize'] = $data['body']->size;
} else {
$struct['filesize'] = strlen($data['body']);
}
$struct['last_modified'] = date('Y-m-d H:i:s');
}
return $struct;
}
示例10: delete
function delete($name, $user = false)
{
if (!$user) {
$user = session_username();
}
$res = db_execute('delete from sitellite_msg_category where name = ? and user = ?', $name, $user);
if (!$res) {
$this->error = db_error();
}
return $res;
}
示例11: CmsAddSitellite_filesystemForm
function CmsAddSitellite_filesystemForm()
{
parent::MailForm();
global $page, $cgi;
$this->parseSettings('inc/app/cms/forms/add/sitellite_filesystem/settings.php');
page_title(intl_get('Adding File'));
loader_import('ext.phpsniff');
$sniffer = new phpSniff();
$this->_browser = $sniffer->property('browser');
// include formhelp, edit panel init, and cancel handler
page_add_script(site_prefix() . '/js/formhelp-compressed.js');
page_add_script(CMS_JS_FORMHELP_INIT);
page_add_script('
function cms_cancel (f) {
onbeforeunload_form_submitted = true;
if (arguments.length == 0) {
window.location.href = "/index/cms-browse-action?collection=sitellite_filesystem";
} else {
if (f.elements["_return"] && f.elements["_return"].value.length > 0) {
window.location.href = f.elements["_return"].value;
} else {
window.location.href = "/index/cms-browse-action?collection=sitellite_filesystem";
}
}
return false;
}
function cms_preview_action (f) {
cms_copy_values (f);
return cms_preview (f);
}
function cms_cancel_action (f) {
cms_copy_values (f);
if (confirm (\'Are you sure you want to cancel?\')) {
return cms_cancel (f);
}
return false;
}
');
if (session_pref('form_help') == 'off') {
page_add_script('
formhelp_disable = true;
');
}
$this->widgets['sitellite_owner']->setValue(session_username());
$this->widgets['sitellite_team']->setValue(session_team());
// add cancel handler
$this->widgets['submit_button']->buttons[1]->extra = 'onclick="return cms_cancel (this.form)"';
}
示例12: digger_has_voted
function digger_has_voted($id)
{
if (!session_valid()) {
return false;
}
// can't vote on own stories
if (db_shift('select count(*) from digger_linkstory where id = ? and user = ?', $id, session_username())) {
return true;
}
// voted already
if (db_shift('select count(*) from digger_vote where story = ? and user = ?', $id, session_username())) {
return true;
}
return false;
}
示例13: onSubmit
function onSubmit($vals)
{
loader_import('cms.Workspace.Message');
$msg = new WorkspaceMessage();
if (!$vals['response_id']) {
$vals['response_id'] = '0';
}
$res = $msg->send($vals['subject'], $vals['body'], explode(',', $vals['recipients']), array(), $vals['response_id'], $vals['priority'], session_username());
if (!$res) {
echo '<p>Error: ' . $msg->error . '</p>';
}
session_set('sitellite_alert', intl_get('Your message has been sent.'));
header('Location: ' . site_prefix() . '/index/cms-cpanel-action?_msg=sent');
exit;
}
示例14: NewsSubmissionsForm
function NewsSubmissionsForm()
{
parent::MailForm();
$this->parseSettings('inc/app/news/forms/submissions/settings.php');
if (session_valid()) {
$this->widgets['author']->setDefault(session_username());
}
$list = array();
foreach (db_fetch_array('select * from sitellite_news_category') as $cat) {
$list[$cat->name] = intl_get($cat->name);
}
$this->widgets['category']->setValues($list);
page_title(intl_get('Submit A Story'));
if (!appconf('comments_security')) {
unset($this->widgets['security_test']);
}
}
示例15: SitepollCommentAddForm
function SitepollCommentAddForm()
{
parent::MailForm();
$this->parseSettings('inc/app/sitepoll/forms/comment/add/settings.php');
page_title(intl_get('Add Comment'));
if (session_valid()) {
$this->widgets['user_id']->setDefault(session_username());
}
global $cgi;
page_add_script('
function sitepoll_cancel (f) {
window.location.href = "' . site_prefix() . '/index/sitepoll-results-action/poll.' . $cgi->poll . '";
return false;
}
');
$this->widgets['submit_button']->buttons[1]->extra = 'onclick="return sitepoll_cancel (this.form)"';
}