本文整理汇总了PHP中appconf函数的典型用法代码示例。如果您正苦于以下问题:PHP appconf函数的具体用法?PHP appconf怎么用?PHP appconf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了appconf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}
示例2: sitegallery_get_thumbnail
function sitegallery_get_thumbnail($file, $file_store = false)
{
$full_path = sitegallery_get_path($file, $file_store);
$info = pathinfo($full_path);
$ext = strtolower($info['extension']);
if (!sitegallery_can_resize($ext)) {
return sitegallery_url_path($file, $file_store);
}
$save_to = md5($file) . '.' . $ext;
$save_path = 'inc/app/sitegallery/data/';
if (@file_exists($save_path . $save_to) && @filemtime($full_path) <= @filemtime($save_path . $save_to)) {
return site_prefix() . '/inc/app/sitegallery/pix/thumbnails/' . $save_to;
}
list($w, $h) = getimagesize($full_path);
$width = appconf('thumbnail_width');
$height = appconf('thumbnail_height');
if ($h > $w) {
// cropping the height
$hoffset = ($h - $w) / 2;
$woffset = 0;
$h -= $hoffset * 2;
} else {
// cropping the width
$woffset = ($w - $h) / 2;
$hoffset = 0;
$w -= $woffset * 2;
}
$jpg = @imagecreatefromjpeg($full_path);
$new = @imagecreatetruecolor($width, $height);
@imagecopyresampled($new, $jpg, 0, 0, $woffset, $hoffset, $width, $height, $w, $h);
@imagejpeg($new, 'inc/app/sitegallery/pix/thumbnails/' . $save_to);
@imagedestroy($jpg);
@imagedestroy($new);
return site_prefix() . '/inc/app/sitegallery/pix/thumbnails/' . $save_to;
}
示例3: 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());
}
}
示例4: pspell_new
function pspell_new($language)
{
_pspell_set('language', $language);
if (appconf('pspell_location')) {
_pspell_set('aspell', appconf('pspell_location'));
}
return true;
}
示例5: MF_Widget_xeditor
function MF_Widget_xeditor($name)
{
parent::MF_Widget($name);
if (@file_exists('inc/app/xed/conf/properties.php')) {
include 'inc/app/xed/conf/properties.php';
if (appconf('pspell_location')) {
$this->spellchecker = 'true';
}
}
}
示例6: ysearch_filter_title
function ysearch_filter_title($t)
{
foreach (appconf('titles') as $title) {
if (strpos($t, $title) === 0) {
$t = substr($t, strlen($title));
if (strlen($t) == 0) {
return 'Untitled';
}
return $t;
}
}
return $t;
}
示例7: SitefaqSubmissionForm
function SitefaqSubmissionForm()
{
parent::MailForm();
$this->parseSettings('inc/app/sitefaq/forms/submission/settings.php');
page_title(intl_get('Ask a Question'));
if (!appconf('user_details')) {
unset($this->widgets['name']);
unset($this->widgets['age']);
unset($this->widgets['url']);
}
if (appconf('user_email_not_required')) {
array_shift($this->widgets['email']->rules);
}
}
示例8: onSubmit
function onSubmit($vals)
{
loader_import('sitepoll.Comment');
$c = new SitepollComment();
$vals['ts'] = date('Y-m-d H:i:s');
unset($vals['submit_button']);
$c->add($vals);
$ce = appconf('comments_email');
if ($ce) {
@mail($ce, intl_get('Poll Comment Notice'), template_simple('comment_email.spt', $vals), 'From: ' . 'sitepoll@' . site_domain());
}
page_title(intl_get('Comment Added'));
echo template_simple('comment_added.spt', $vals);
}
示例9: sitegallery_first_image
function sitegallery_first_image($path)
{
loader_import('saf.File.Directory');
$valid = appconf('valid');
$files = Dir::fetch($path, true);
foreach ($files as $file) {
$info = pathinfo($file);
if (in_array($info['extension'], $valid)) {
$path = preg_replace('|^pix/|', '', $path);
return $path . '/' . $file;
}
}
return false;
}
示例10: verifyType
function verifyType($type)
{
$allowed = appconf('allowed');
if (count($allowed) > 0) {
if (!in_array($type, $allowed)) {
return false;
}
}
$not = appconf('not_allowed');
if (count($not) > 0) {
if (in_array($type, $not)) {
return false;
}
}
return true;
}
示例11: onSubmit
function onSubmit($vals)
{
// 1. add author if necessary
if (!db_shift('select * from sitellite_news_author where name = ?', $vals['author'])) {
db_execute('insert into sitellite_news_author (name) values (?)', $vals['author']);
}
// 2. submit story as 'draft'
loader_import('cms.Versioning.Rex');
$rex = new Rex('sitellite_news');
$res = $rex->create(array('title' => $vals['title'], 'author' => $vals['author'], 'category' => $vals['category'], 'summary' => $vals['summary'], 'body' => $vals['body'], 'date' => date('Y-m-d'), 'sitellite_status' => 'draft', 'sitellite_access' => 'public'), 'Story submission.');
$vals['id'] = $res;
// 3. email notification
@mail(appconf('submissions'), 'News Submission Notice', template_simple('submission_email.spt', $vals));
// 4. thank you screen
page_title(intl_get('Thank You!'));
echo template_simple('submissions.spt');
}
示例12: SettingsForm
function SettingsForm()
{
parent::MailForm();
$this->parseSettings('inc/app/devnotes/forms/settings/settings.php');
$this->widgets['notes']->setValues(array('on' => intl_get('On'), 'off' => intl_get('Off'), 'date' => intl_get('Until date')));
$this->widgets['submit_button']->setValues(intl_get('Save Changes'));
$this->widgets['notes_date']->setValue(date('Y-m-d'));
if (DEVNOTES === true) {
$this->widgets['notes']->setValue('on');
} elseif (DEVNOTES === false) {
$this->widgets['notes']->setValue('off');
} else {
$this->widgets['notes']->setValue('date');
$this->widgets['notes_date']->setValue(DEVNOTES);
}
$this->widgets['contact']->setValue(appconf('contact'));
$this->widgets['ignore_list']->setValue(join(', ', appconf('ignore')));
}
示例13: onSubmit
function onSubmit($vals)
{
ob_start();
passthru(appconf('wvhtml_location') . ' --targetdir=cache ' . escapeshellarg($vals['doc']->tmp_name) . ' -');
$html = ob_get_contents();
ob_end_clean();
list($one, $two) = explode('<!--Section Begins-->', $html);
list($two, $three) = explode('<!--Section Ends-->', $two);
loader_import('saf.HTML.Messy');
$messy = new Messy();
$two = $messy->clean($two);
//echo '<pre>' . htmlentities ($two); exit;
$two = str_replace('<p><div', '<div', $two);
$two = str_replace('</div></p>', '</div>', $two);
$vals['doc'] = $two;
echo template_simple('importer.spt', $vals);
exit;
}
示例14: onSubmit
function onSubmit($vals)
{
$vals['public'] = $vals['public'] ? 'yes' : 'no';
if ($vals['website'] == 'http://') {
$vals['website'] = '';
}
$session_id = session_make_pending_key();
$vals['verify'] = str_replace('PENDING:', '', $session_id);
// 1. insert into sitellite_user
$res = db_execute('
insert into sitellite_user
(username, password, firstname, lastname, company, website, country, province, email, session_id, role, team)
values
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $vals['user_id'], better_crypt($vals['password']), $vals['firstname'], $vals['lastname'], $vals['company'], $vals['website'], $vals['country'], $vals['province'], $vals['email'], $session_id, 'member', 'core');
if (!$res) {
page_title('Unknown Error');
echo '<p>An error occurred while creating your account. Please try again later.</p>';
echo '<p>Error Message: ' . db_error() . '</p>';
return;
}
// 2. insert into org_profile
/*db_execute (
'insert into org_profile
(user_id, public, about, sig)
values
(?, ?, ?, ?)',
$vals['user_id'],
$vals['public'],
$vals['about'],
$vals['sig']
);*/
// 3. email confirmation
@mail($vals['email'], 'Membership Confirmation', template_simple('member_confirmation.spt', $vals), 'From: ' . appconf('email'));
// 4. log them in
//global $cgi, $session;
//$cgi->username = $cgi->user_id;
//$session->username = $cgi->user_id;
//$session->password = $cgi->password;
//$session->start ();
// 5. respond
page_title(intl_get('Welcome') . ' ' . $vals['firstname'] . ' ' . $vals['lastname']);
echo '<p>Your account has been created. An email has also been sent to your address containing information necessary to activate your account.</p>';
}
示例15: vote
function vote($score, $id)
{
$ip = $_SERVER['REMOTE_ADDR'];
$user = session_username();
if (!$user) {
$user = 'anon';
}
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;
}