Пример #1
0
function upgrade_log($v = false)
{
    if (!$v) {
        $v = upgrade_version_num();
    }
    return db_execute('insert into sitellite_upgrade values (?, ?, now())', $v, session_username());
}
Пример #2
0
 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
0
 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
0
 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
0
    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
0
 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
0
 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
0
 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
0
 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
0
 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
0
    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
0
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
0
 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
0
 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
0
    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)"';
    }
Пример #16
0
 function onSubmit($vals)
 {
     $vals['public'] = $vals['public'] ? 'yes' : 'no';
     if ($vals['website'] == 'http://') {
         $vals['website'] = '';
     }
     // 1. update sitellite_user
     $res = session_user_edit(session_username(), array('firstname' => $vals['firstname'], 'lastname' => $vals['lastname'], 'company' => $vals['company'], 'website' => $vals['website'], 'country' => $vals['country'], 'province' => $vals['province'], 'email' => $vals['email'], 'expires' => date('Y-m-d H:i:s', time() + 3600), 'public' => $vals['public'], 'profile' => $vals['profile'], 'sig' => $vals['sig'], 'modified' => date('Y-m-d H:i:s')));
     if (!$res) {
         page_title('Unknown Error');
         echo '<p>' . intl_get('An error occurred while updating your account.  Please try again later.') . '</p>';
         return;
     }
     // 2. respond
     page_title(intl_get('Preferences Saved'));
     echo template_simple('<p>Your account information been updated.  <a href="{site/prefix}/index/sitemember-app">{intl Click here to continue.}</a></p>');
 }
Пример #17
0
 function onSubmit($vals)
 {
     if (!db_shift('select count(*) from sitellite_homepage where user = ?', session_username())) {
         if (!db_execute('insert into sitellite_homepage (user, title, template, body) values (?, ?, ?, ?)', session_username(), $vals['title'], $vals['template'], $vals['body'])) {
             page_title(intl_get('An Error Occurred'));
             echo '<p>' . intl_get('Error') . ': ' . db_error() . '</p>';
             return;
         }
     } else {
         if (!db_execute('update sitellite_homepage set title = ?, template = ?, body = ? where user = ?', $vals['title'], $vals['template'], $vals['body'], session_username())) {
             page_title(intl_get('An Error Occurred'));
             echo '<p>' . intl_get('Error') . ': ' . db_error() . '</p>';
             return;
         }
     }
     page_title(intl_get('Changes Saved'));
     echo '<p><a href="' . site_prefix() . '/index/sitemember-app">' . intl_get('Return to member home.') . '</a></p>';
 }
Пример #18
0
 /**
  * Returns the display HTML for this widget.  The optional
  * parameter determines whether or not to automatically display the widget
  * nicely, or whether to simply return the widget (for use in a template).
  * 
  * @access	public
  * @param	boolean	$generate_html
  * @return	string
  * 
  */
 function display($generate_html = 0)
 {
     parent::display($generate_html);
     global $intl, $simple;
     $attrstr = $this->getAttrs();
     if (empty($this->data_value)) {
         if (empty($this->default_value)) {
             $this->data_value = session_username();
         } else {
             $this->data_value = $this->default_value;
         }
     }
     $adv = $this->advanced ? ' class="advanced"' : '';
     if ($generate_html) {
         return "\t" . '<tr' . $adv . '>' . "\n\t\t" . '<td class="label"><label for="' . $this->name . '"' . $this->invalid() . '>' . $simple->fill($this->label_template, $this, '', true) . '</label></td>' . "\n\t\t" . '<td class="field"><strong>' . htmlentities_compat($this->data_value, ENT_COMPAT, $intl->charset) . '</strong><input type="hidden" name="' . $this->name . '" value="' . htmlentities_compat($this->data_value, ENT_COMPAT, $intl->charset) . '" /></td>' . "\n\t" . '</tr>' . "\n";
     } else {
         return '<input type="text" ' . $attrstr . ' value="' . htmlentities_compat($this->data_value, ENT_COMPAT, $intl->charset) . '" ' . $this->extra . ' />';
     }
 }
Пример #19
0
 function add($struct)
 {
     if (isset($struct['users'])) {
         $users = $struct['users'];
         unset($struct['users']);
     } else {
         $users = array(session_username());
     }
     $id = parent::add($struct);
     if (!$id) {
         return false;
     }
     foreach ($users as $user) {
         if (!db_execute('insert into timetracker_user_entry (id, user_id, entry_id) values (null, ?, ?)', $user, $id)) {
             $this->error = db_error();
             return false;
         }
     }
     return $id;
 }
Пример #20
0
 function vote($score, $id)
 {
     $ip = $_SERVER['REMOTE_ADDR'];
     $user = session_username();
     if (!$user) {
         $user = '******';
     }
     if ($score == 'yes') {
         db_execute('UPDATE digger_linkstory SET score = score + 1 WHERE id = ?', $id);
         db_execute('INSERT INTO digger_vote (id, story, score, user, ip, votetime) VALUES (null, ?, 1, ?, ?, NOW())', $id, $user, $ip);
     } else {
         db_execute('UPDATE digger_linkstory SET score=score-1 WHERE id = ?', $id);
         db_execute('INSERT INTO digger_vote (id, story, score, user, ip, votetime) VALUES (null, ?, -1, ?, ?, NOW())', $id, $user, $ip);
         $score = db_shift('select score from digger_linkstory where id = ?', $id);
         if ($score <= appconf('ban_threshold')) {
             db_execute('update digger_linkstory set status = "disabled" where id = ?', $id);
         }
     }
     return true;
 }
Пример #21
0
    function NewsCommentAddForm()
    {
        parent::MailForm();
        $this->parseSettings('inc/app/news/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 news_cancel (f) {
				window.location.href = "' . site_prefix() . '/index/news-app/story.' . $cgi->story_id . '";
				return false;
			}
		');
        $this->widgets['submit_button']->buttons[1]->extra = 'onclick="return news_cancel (this.form)"';
        if (!appconf('comments_security')) {
            unset($this->widgets['security_test']);
        }
    }
Пример #22
0
    function onSubmit($vals)
    {
        // 1. insert into sitefaq_submission table
        if ($vals['url'] == 'http://') {
            $vals['url'] = '';
        }
        $member_id = session_username();
        if (!$member_id) {
            $member_id = '';
        }
        if (!$vals['name']) {
            $vals['name'] = '';
        }
        if (!$vals['age']) {
            $vals['age'] = '';
        }
        if (!$vals['url']) {
            $vals['url'] = '';
        }
        db_execute('insert into sitefaq_submission
				(id, question, answer, ts, assigned_to, email, member_id, ip, name, age, url, sitellite_status, sitellite_access, sitellite_owner, sitellite_team)
			values
				(null, ?, "", now(), "", ?, ?, ?, ?, ?, ?, "draft", "private", "", "none")', $vals['question'], $vals['email'], $member_id, $_SERVER['REMOTE_ADDR'], $vals['name'], $vals['age'], $vals['url']);
        // 2. email all admins
        $admin_roles = session_admin_roles();
        $emails = db_shift_array('select distinct email from sitellite_user
			where role in("' . join('", "', $admin_roles) . '")');
        foreach ($emails as $email) {
            @mail($email, intl_get('FAQ Submission Notice'), template_simple('email_notice.spt', $vals), 'From: faq@' . str_replace('www.', '', site_domain()));
        }
        // 4. if the user provided an email address, send a thank you
        if (!empty($vals['email'])) {
            @mail($vals['email'], intl_get('FAQ Submission Received'), template_simple('email_thank_you.spt', $vals), 'From: faq@' . str_replace('www.', '', site_domain()));
        }
        // 3. output a thank you
        page_title(intl_get('Thank You'));
        echo template_simple('thank_you.spt', $vals);
    }
Пример #23
0
//}
if (!empty($cgi->maxlen)) {
    $maxlen = $cgi->maxlen;
} else {
    $maxlen = false;
}
$tproperties = db_fetch_array('select * from siteblog_category');
foreach ($tproperties as $t) {
    $properties[$t->id] = array('poster_visible' => $t->poster_visible, 'comments' => $t->comments);
}
if (isset($cgi->category)) {
    $catname = db_shift('select title from siteblog_category where id = ?', $cgi->category);
    if ($catname == 'All Blogs') {
        $query = 'select * from siteblog_post';
    } elseif ($catname == 'Personal Blog') {
        $query = 'select * from siteblog_post where author = "' . session_username() . '" and category = ' . $a->id;
    } else {
        $query = 'select * from siteblog_post where category = ' . $cgi->category;
    }
    $query .= ' ORDER BY created DESC ';
    if (isset($cgi->limit)) {
        $query .= ' limit ' . $cgi->limit;
    }
    $res = db_fetch_array($query);
} else {
    $catname = '';
    $res = db_fetch_array('select * from siteblog_post order by created desc limit 10');
}
foreach ($res as $k => $r) {
    if ($maxlen) {
        if (strlen($res[$k]->body) > $maxlen) {
Пример #24
0
 function onSubmit($vals)
 {
     loader_import('siteforum.Post');
     loader_import('siteforum.Filters');
     loader_import('siteforum.Topic');
     $p = new SiteForum_Post();
     if (!session_admin()) {
         $notice = 'no';
     } else {
         if ($vals['notice'] == 'Make this post a notice.') {
             $notice = 'yes';
         } else {
             $notice = 'no';
         }
     }
     $t = new SiteForum_Topic();
     $topic = $t->get($vals['topic']);
     if (!($res = $p->add(array('user_id' => session_username(), 'topic_id' => $vals['topic'], 'post_id' => $vals['post'], 'ts' => date('Y-m-d H:i:s'), 'subject' => $vals['subject'], 'body' => $vals['body'], 'sig' => db_shift('select sig from sitellite_user where username = ?', session_username()), 'notice' => $notice, 'sitellite_access' => $topic->sitellite_access, 'sitellite_status' => $topic->sitellite_status)))) {
         page_title(intl_get('Database Error'));
         echo '<p>' . intl_get('An error occurred.  Please try again later.') . '</p>';
         echo '<p>' . intl_get('Error Message') . ': ' . $p->error . '</p>';
         return;
     }
     $vals['id'] = $res;
     if (!empty($vals['post'])) {
         $p->touch($vals['post']);
     }
     if ($vals['subscribe'] == 'Subscribe me to this forum thread.') {
         if (!$vals['post']) {
             $vals['post'] = $res;
         }
         db_execute('insert into siteforum_subscribe (id, post_id, user_id) values (null, ?, ?)', $vals['post'], session_username());
     }
     $ae = appconf('admin_email');
     if ($ae) {
         @mail($ae, intl_get('Forum Posting Notice'), template_simple('post_email.spt', $vals), 'From: ' . appconf('forum_name') . '@' . site_domain());
     }
     $exempt = explode(',', $ae);
     $res = db_fetch_array('select distinct u.email, u.username from sitellite_user u, siteforum_subscribe s where s.user_id = u.username and s.post_id = ?', $vals['post']);
     foreach ($res as $row) {
         if (in_array($row->email, $exempt)) {
             continue;
         }
         $vals['user_id'] = $row->username;
         @mail($row->email, intl_get('Forum Posting Notice'), template_simple('post_email_subscriber.spt', $vals), 'From: ' . appconf('forum_name') . '@' . site_domain());
     }
     page_title(intl_get('Message Posted'));
     echo template_simple('post_submitted.spt', $vals);
 }
Пример #25
0
<?php

if (!isset($parameters['status'])) {
    $parameters['status'] = 'approved';
    $status = 'approved';
} elseif ($parameters['status'] == 'pending') {
    $status = 'draft';
} else {
    $status = $parameters['status'];
}
if ($parameters['status'] == 'approved') {
    $url = site_prefix() . '/index/news-app/story.';
} else {
    $url = site_prefix() . '/index/news-my-story-action/story.';
}
if (!isset($parameters['user'])) {
    $parameters['user'] = session_username();
}
$res = db_fetch_array('select id, title, date, category, summary from sitellite_news where author = ? and sitellite_status = ? order by date desc, time desc', $parameters['user'], $status);
if ($box['context'] == 'action') {
    page_title(ucfirst($parameters['status']) . ' ' . intl_get('News Stories') . ' (' . count($res) . ')');
}
loader_import('news.Functions');
echo template_simple('my_submissions.spt', array('list' => $res, 'url' => $url));
Пример #26
0
            // insert
            db_execute('insert into sitellite_msg_forward
					(id, user, location, info, priority)
				values
					(null, ?, ?, ?, ?)', session_username(), $cgi->high_location, $cgi->high_info, 'high');
        }
    } elseif (isset($data['high_info'])) {
        // delete
        db_execute('delete from sitellite_msg_forward where user = ? and priority = ?', session_username(), 'high');
    }
    if (!empty($cgi->urgent_info)) {
        if (isset($data['urgent_info'])) {
            // update
            db_execute('update sitellite_msg_forward set location = ?, info = ? where user = ? and priority = ?', $cgi->urgent_location, $cgi->urgent_info, session_username(), 'urgent');
        } else {
            // insert
            db_execute('insert into sitellite_msg_forward
					(id, user, location, info, priority)
				values
					(null, ?, ?, ?, ?)', session_username(), $cgi->urgent_location, $cgi->urgent_info, 'urgent');
        }
    } elseif (isset($data['urgent_info'])) {
        // delete
        db_execute('delete from sitellite_msg_forward where user = ? and priority = ?', session_username(), 'urgent');
    }
}
// respond
//page_title (intl_get ('Preferences Saved!'));
//echo '<p><a href="' . site_prefix () . '/index/cms-messages-action">' . intl_get ('Back') . '</a></p>';
header('Location: ' . site_prefix() . '/index/cms-messages-action?_msg=' . urlencode('Your preferences have been saved!'));
exit;
Пример #27
0
 /**
  * Clears all locks held by the current user.
  */
 function clear()
 {
     return db_execute('delete from sitellite_lock where user = ?', session_username());
 }
Пример #28
0
 /**
  * Open cache tag handler.
  * 
  * @access	private
  * @param	associative array	$node
  * @return	string
  * 
  */
 function _cache($node)
 {
     $user = '';
     if ($node['attributes']['scope'] == 'session') {
         if (session_valid()) {
             $user = session_username();
             $cacheable = true;
         } else {
             $cacheable = false;
         }
     } else {
         $cacheable = true;
     }
     $this->cache = false;
     if (!$cacheable) {
         return '';
     }
     if (!isset($node['attributes']['scope'])) {
         $node['attributes']['scope'] = 'application';
     }
     if (isset($node['attributes']['duration'])) {
         $duration = (int) $node['attributes']['duration'];
     } else {
         $duration = $this->cacheDuration;
     }
     if (!isset($node['attributes']['id'])) {
         $this->cacheCount++;
         $node['attributes']['id'] = $this->cacheCount;
     }
     loader_import('saf.Cache');
     $this->_cache = new Cache($this->cacheLocation . $node['attributes']['scope']);
     if ($this->_cache->expired($this->file . ':' . $node['attributes']['id'] . ':' . $user, $duration)) {
         // re-cache
         $this->cache = $this->file . ':' . $node['attributes']['id'] . ':' . $user;
         $this->output2 = $this->output;
         $this->output = '';
         return '';
     } else {
         // show from cache
         $out = $this->_cache->show($this->file . ':' . $node['attributes']['id'] . ':' . $user);
         $this->ignoreUntilLevel($node['level']);
     }
     return $out;
 }
Пример #29
0
<?php

if (!session_valid()) {
    header('Location: ' . site_prefix() . '/index/siteforum-app');
    exit;
}
if (!session_admin()) {
    global $cgi;
    $user = db_shift('select user_id from siteforum_post where id = ?', $cgi->id);
    if ($user != session_username()) {
        header('Location: ' . site_prefix() . '/index/siteforum-app');
        exit;
    }
}
class SiteforumPostEditForm extends MailForm
{
    function SiteforumPostEditForm()
    {
        parent::MailForm();
        page_title(intl_get('Edit a Post'));
        $this->parseSettings('inc/app/siteforum/forms/post/edit/settings.php');
        page_add_script('
			function siteforum_preview (f) {
				t = f.target;
				a = f.action;

				f.target = "_blank";
				f.action = "' . site_prefix() . '/index/siteforum-post-preview-action";
				f.submit ();

				f.target = t;
Пример #30
0
 function clear_all($url = false)
 {
     return db_execute('delete from sitellite_autosave where user_id = ?', session_username());
 }