本文整理汇总了PHP中form_date函数的典型用法代码示例。如果您正苦于以下问题:PHP form_date函数的具体用法?PHP form_date怎么用?PHP form_date使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了form_date函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: load_from_Request
/**
* Load data from Request form fields.
*
* @return boolean true if loaded data seems valid.
*/
function load_from_Request()
{
global $Messages, $localtimenow;
// Group ID
param('ivc_grp_ID', 'integer');
param_check_not_empty('ivc_grp_ID', T_('Please select a group'));
$this->set_from_Request('grp_ID', 'ivc_grp_ID', true);
// Code
param('ivc_code', 'string');
param_check_not_empty('ivc_code', T_('You must provide an invitation code!'));
param_check_regexp('ivc_code', '#^[A-Za-z0-9\\-_]{3,32}$#', T_('Invitation code must be from 3 to 32 letters, digits or signs "-", "_".'));
$this->set_from_Request('code', 'ivc_code');
// Expire date
if (param_date('ivc_expire_date', T_('Please enter a valid date.'), true) && param_time('ivc_expire_time')) {
// If date and time were both correct we may set the 'expire_ts' value
$this->set('expire_ts', form_date(get_param('ivc_expire_date'), get_param('ivc_expire_time')));
}
// Source
param('ivc_source', 'string');
$this->set_from_Request('source', 'ivc_source', true);
if (mysql2timestamp($this->get('expire_ts')) < $localtimenow) {
// Display a warning if date is expired
$Messages->add($this->ID == 0 ? T_('Note: The newly created invitation code is already expired') : T_('Note: The updated invitation code is already expired'), 'warning');
}
return !param_errors_detected();
}
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:31,代码来源:_invitation.class.php
示例2: render_views
public function render_views($params)
{
$filename = isset($params['filename']) ? $params['filename'] : '';
$vars = isset($params['vars']) ? $params['vars'] : '';
//if (!isset($vars['fields']) || empty($vars['fields']) || !is_array($vars['fields']))
// return;
$form_fields = '';
die('<pre>' . print_r($vars['fields'], true));
$this->ci->load->helper('form');
foreach ($vars['fields'] as $name => $opts) {
switch (strtolower($opts['field_type'])) {
case 'checkbox':
$form_fields .= form_checkbox($name, 1);
break;
case 'date':
$form_fields .= form_date(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>"));
break;
case 'datetime':
$form_fields .= form_datetime(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>"));
break;
case 'dropdown':
$options = isset($opts['options']) ? $opts['options'] : array();
$form_fields .= form_dropdown(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>"), $options);
break;
case 'email':
$form_fields .= form_email(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>"));
break;
case 'input':
$form_fields .= form_input(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>"));
break;
case 'month':
$form_fields .= form_month(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>"));
break;
case 'number':
$form_fields .= form_number(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>"));
break;
case 'range':
$form_fields .= form_range(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>"));
break;
case 'textarea':
$rows = 10;
$cols = 40;
$form_fields .= form_input(array('name' => $name, 'class' => 'input-xxlarge', 'value' => "<?php echo set_value('{$name}') ?>", 'rows' => $rows, 'cols' => $cols));
break;
case 'url':
$form_fields .= form_url(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>"));
break;
}
}
//echo '<pre>';
//die(print_r($params));
$this->tpl = str_replace('{form_fields}', $form_fields, $this->tpl);
}
开发者ID:raviphad,项目名称:Bonfire-builder,代码行数:53,代码来源:crud_generator.php
示例3: load_from_Request
/**
* Load data from Request form fields.
*
* This requires the blog (e.g. {@link $blog_ID} or {@link $main_cat_ID} to be set).
*
* @param boolean true if we are returning to edit mode (new, switchtab...)
* @return boolean true if loaded data seems valid.
*/
function load_from_Request($editing = false, $creating = false)
{
global $default_locale, $current_User, $localtimenow;
global $posttypes_reserved_IDs, $item_typ_ID;
// LOCALE:
if (param('post_locale', 'string', NULL) !== NULL) {
$this->set_from_Request('locale');
}
// POST TYPE:
$item_typ_ID = get_param('item_typ_ID');
if (empty($item_typ_ID)) {
// Try to get this from request if it has been not initialized by controller:
$item_typ_ID = param('item_typ_ID', 'integer', NULL);
}
if (!empty($item_typ_ID)) {
// Set new post type ID only if it is defined on request:
$this->set('ityp_ID', $item_typ_ID);
}
// URL associated with Item:
$post_url = param('post_url', 'string', NULL);
if ($post_url !== NULL) {
param_check_url('post_url', 'posting', '');
$this->set_from_Request('url');
}
if (empty($post_url) && $this->get_type_setting('use_url') == 'required') {
// URL must be entered
param_check_not_empty('post_url', T_('Please provide a "Link To" URL.'), '');
}
// Item parent ID:
$post_parent_ID = param('post_parent_ID', 'integer', NULL);
if ($post_parent_ID !== NULL) {
// If item parent ID is entered:
$ItemCache =& get_ItemCache();
if ($ItemCache->get_by_ID($post_parent_ID, false, false)) {
// Save only ID of existing item:
$this->set_from_Request('parent_ID');
} else {
// Display an error of the entered item parent ID is incorrect:
param_error('post_parent_ID', T_('The parent ID is not a correct Item ID.'));
}
}
if (empty($post_parent_ID)) {
// If empty parent ID is entered:
if ($this->get_type_setting('use_parent') == 'required') {
// Item parent ID must be entered:
param_check_not_empty('post_parent_ID', T_('Please provide a parent ID.'), '');
} else {
// Remove parent ID:
$this->set_from_Request('parent_ID');
}
}
if ($this->status == 'redirected' && empty($this->url)) {
// Note: post_url is not part of the simple form, so this message can be a little bit awkward there
param_error('post_url', T_('If you want to redirect this post, you must specify an URL!') . ' (' . T_('Advanced properties panel') . ')', T_('If you want to redirect this post, you must specify an URL!'));
}
// ISSUE DATE / TIMESTAMP:
$this->load_Blog();
if ($current_User->check_perm('admin', 'restricted') && $current_User->check_perm('blog_edit_ts', 'edit', false, $this->Blog->ID)) {
// Allow to update timestamp fields only if user has a permission to edit such fields
// and also if user has an access to back-office
$item_dateset = param('item_dateset', 'integer', NULL);
if ($item_dateset !== NULL) {
$this->set('dateset', $item_dateset);
if ($editing || $this->dateset == 1) {
// We can use user date:
if (param_date('item_issue_date', T_('Please enter a valid issue date.'), true) && param_time('item_issue_time')) {
// only set it, if a (valid) date and time was given:
$this->set('issue_date', form_date(get_param('item_issue_date'), get_param('item_issue_time')));
// TODO: cleanup...
}
} elseif ($this->dateset == 0) {
// Set date to NOW:
$this->set('issue_date', date('Y-m-d H:i:s', $localtimenow));
}
}
}
// DEADLINE:
if (param_date('item_deadline', T_('Please enter a valid deadline.'), false, NULL) !== NULL) {
$this->set_from_Request('datedeadline', 'item_deadline', true);
}
// SLUG:
if (param('post_urltitle', 'string', NULL) !== NULL) {
$this->set_from_Request('urltitle');
}
// <title> TAG:
$titletag = param('titletag', 'string', NULL);
if ($titletag !== NULL) {
$this->set_from_Request('titletag', 'titletag');
}
if (empty($titletag) && $this->get_type_setting('use_title_tag') == 'required') {
// Title tag must be entered
param_check_not_empty('titletag', T_('Please provide a title tag.'), '');
//.........这里部分代码省略.........
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:101,代码来源:_item.class.php
示例4: preview_from_request
/**
* We want to preview a single post, we are going to fake a lot of things...
*/
function preview_from_request()
{
global $current_User;
if (empty($current_User)) {
// dh> only logged in user's can preview. Alternatively we need those checks where $current_User gets used below.
return;
}
global $DB, $localtimenow, $Messages, $BlogCache;
global $Plugins;
$preview_userid = param('preview_userid', 'integer', true);
$post_status = param('post_status', 'string', true);
$post_locale = param('post_locale', 'string', $current_User->locale);
$content = param('content', 'html', true);
$post_title = param('post_title', 'html', true);
$post_excerpt = param('post_excerpt', 'string', true);
$post_url = param('post_url', 'string', '');
$post_category = param('post_category', 'integer', true);
$post_views = param('post_views', 'integer', 0);
$renderers = param('renderers', 'array', array('default'));
if (!is_array($renderers)) {
// dh> workaround for param() bug. See rev 1.93 of /inc/_misc/_misc.funcs.php
$renderers = array('default');
}
$comment_Blog =& $BlogCache->get_by_ID(get_catblog($post_category));
if ($comment_Blog->allowcomments == 'post_by_post') {
// param is required
$post_comment_status = param('post_comment_status', 'string', true);
} else {
$post_comment_status = $comment_Blog->allowcomments;
}
// Get issue date, using the user's locale (because it's entered like this in the form):
locale_temp_switch($current_User->locale);
param_date('item_issue_date', T_('Please enter a valid issue date.'), false);
// TODO: dh> get_param() is always true here, also on invalid dates:
if (strlen(get_param('item_issue_date'))) {
// only set it, if a date was given:
param_time('item_issue_time');
$item_issue_date = form_date(get_param('item_issue_date'), get_param('item_issue_time'));
// TODO: cleanup...
} else {
$item_issue_date = date('Y-m-d H:i:s', $localtimenow);
}
locale_restore_previous();
if (!($item_typ_ID = param('item_typ_ID', 'integer', NULL))) {
$item_typ_ID = NULL;
}
if (!($item_st_ID = param('item_st_ID', 'integer', NULL))) {
$item_st_ID = NULL;
}
if (!($item_assigned_user_ID = param('item_assigned_user_ID', 'integer', NULL))) {
$item_assigned_user_ID = NULL;
}
if (!($item_deadline = param('item_deadline', 'string', NULL))) {
$item_deadline = NULL;
}
$item_priority = param('item_priority', 'integer', NULL);
// QUESTION: can this be also empty/NULL?
// Do some optional filtering on the content
// Typically stuff that will help the content to validate
// Useful for code display.
// Will probably be used for validation also.
$Plugins_admin =& get_Cache('Plugins_admin');
$Plugins_admin->filter_contents($post_title, $content, $renderers);
$post_title = format_to_post($post_title);
$content = format_to_post($content);
$this->sql = "SELECT\r\n\t\t\t0 AS post_ID,\r\n\t\t\t{$preview_userid} AS post_creator_user_ID,\r\n\t\t\t{$preview_userid} AS post_lastedit_user_ID,\r\n\t\t\t'{$item_issue_date}' AS post_datestart,\r\n\t\t\t'{$item_issue_date}' AS post_datecreated,\r\n\t\t\t'{$item_issue_date}' AS post_datemodified,\r\n\t\t\t'" . $DB->escape($post_status) . "' AS post_status,\r\n\t\t\t'" . $DB->escape($post_locale) . "' AS post_locale,\r\n\t\t\t'" . $DB->escape($content) . "' AS post_content,\r\n\t\t\t'" . $DB->escape($post_title) . "' AS post_title,\r\n\t\t\t'" . $DB->escape($post_excerpt) . "' AS post_excerpt,\r\n\t\t\tNULL AS post_urltitle,\r\n\t\t\t'" . $DB->escape($post_url) . "' AS post_url,\r\n\t\t\t{$post_category} AS post_main_cat_ID,\r\n\t\t\t{$post_views} AS post_views,\r\n\t\t\t'' AS post_flags,\r\n\t\t\t'noreq' AS post_notifications_status,\r\n\t\t\tNULL AS post_notifications_ctsk_ID,\r\n\t\t\t" . bpost_count_words($content) . " AS post_wordcount,\r\n\t\t\t" . $DB->quote($post_comment_status) . " AS post_comment_status,\r\n\t\t\t'" . $DB->escape(implode('.', $renderers)) . "' AS post_renderers,\r\n\t\t\t" . $DB->quote($item_assigned_user_ID) . " AS post_assigned_user_ID,\r\n\t\t\t" . $DB->quote($item_typ_ID) . " AS post_ptyp_ID,\r\n\t\t\t" . $DB->quote($item_st_ID) . " AS post_pst_ID,\r\n\t\t\t" . $DB->quote($item_deadline) . " AS post_datedeadline,\r\n\t\t\t" . $DB->quote($item_priority) . " AS post_priority";
$this->total_rows = 1;
$this->total_pages = 1;
$this->page = 1;
// ATTENTION: we skip the parent on purpose here!! fp> refactor
DataObjectList2::query(false, false, false, 'PREVIEW QUERY');
$Item =& $this->Cache->instantiate($this->rows[0]);
// Trigger plugin event, allowing to manipulate or validate the item before it gets previewed
$Plugins->trigger_event('AppendItemPreviewTransact', array('Item' => &$Item));
if ($errcontent = $Messages->display(T_('Invalid post, please correct these errors:'), '', false, 'error')) {
$Item->content = $errcontent . "\n<hr />\n" . $content;
}
// little funky fix for IEwin, rawk on that code
global $Hit;
if ($Hit->is_winIE && !isset($IEWin_bookmarklet_fix)) {
// QUESTION: Is this still needed? What about $IEWin_bookmarklet_fix? (blueyed)
$Item->content = preg_replace('/\\%u([0-9A-F]{4,4})/e', "'&#'.base_convert('\\1',16,10). ';'", $Item->content);
}
}
开发者ID:LFSF,项目名称:oras,代码行数:87,代码来源:_itemlist.class.php
示例5: load_from_Request
/**
* Load data from Request form fields.
*
* @return boolean true if loaded data seems valid.
*/
function load_from_Request($cron_job_names = array(), $cron_job_params = array())
{
if ($this->ID > 0 || get_param('ctsk_ID') > 0) {
// Update or copy cron job
$cjob_name = param('cjob_name', 'string', true);
param_check_not_empty('cjob_name', T_('Please enter job name'));
} else {
// Create new cron job
$cjob_type = param('cjob_type', 'string', true);
if (!isset($cron_job_params[$cjob_type])) {
// This cron job type doesn't exist, so this is an invalid state
debug_die('Invalid job type received');
$cjob_name = '';
} else {
$cjob_name = $cron_job_names[$cjob_type];
}
}
// start datetime:
param_date('cjob_date', T_('Please enter a valid date.'), true);
param_time('cjob_time');
$this->set('start_datetime', form_date(get_param('cjob_date'), get_param('cjob_time')));
// repeat after:
$cjob_repeat_after = param_duration('cjob_repeat_after');
if ($cjob_repeat_after == 0) {
$cjob_repeat_after = NULL;
}
$this->set('repeat_after', $cjob_repeat_after);
// name:
if (!empty($cjob_name) && $cjob_name != $this->get('name')) {
$this->set('name', $cjob_name);
}
if ($this->ID == 0 && get_param('ctsk_ID') == 0) {
// Set these params only on creating and copying actions
// controller:
$this->set('controller', $cron_job_params[$cjob_type]['ctrl']);
// params:
$this->set('params', $cron_job_params[$cjob_type]['params']);
}
return !param_errors_detected();
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:45,代码来源:_cronjob.class.php
示例6: user_settings
//.........这里部分代码省略.........
$msg .= error(_("Please enter your e-mail."), true);
}
$email_shiftinfo = isset($_REQUEST['email_shiftinfo']);
if (isset($_REQUEST['jabber']) && strlen(strip_request_item('jabber')) > 0) {
$jabber = strip_request_item('jabber');
if (!check_email($jabber)) {
$ok = false;
$msg .= error(_("Please check your jabber account information."), true);
}
}
if (isset($_REQUEST['tshirt_size']) && isset($tshirt_sizes[$_REQUEST['tshirt_size']])) {
$tshirt_size = $_REQUEST['tshirt_size'];
} elseif ($enable_tshirt_size) {
$ok = false;
}
if (isset($_REQUEST['planned_arrival_date']) && DateTime::createFromFormat("Y-m-d", trim($_REQUEST['planned_arrival_date']))) {
$planned_arrival_date = DateTime::createFromFormat("Y-m-d", trim($_REQUEST['planned_arrival_date']))->getTimestamp();
} else {
$ok = false;
$msg .= error(_("Please enter your planned date of arrival."), true);
}
if (isset($_REQUEST['planned_departure_date']) && $_REQUEST['planned_departure_date'] != '') {
if (DateTime::createFromFormat("Y-m-d", trim($_REQUEST['planned_departure_date']))) {
$planned_departure_date = DateTime::createFromFormat("Y-m-d", trim($_REQUEST['planned_departure_date']))->getTimestamp();
} else {
$ok = false;
$msg .= error(_("Please enter your planned date of departure."), true);
}
} else {
$planned_departure_date = null;
}
// Trivia
if (isset($_REQUEST['lastname'])) {
$lastname = strip_request_item('lastname');
}
if (isset($_REQUEST['prename'])) {
$prename = strip_request_item('prename');
}
if (isset($_REQUEST['age']) && preg_match("/^[0-9]{0,4}\$/", $_REQUEST['age'])) {
$age = strip_request_item('age');
}
if (isset($_REQUEST['tel'])) {
$tel = strip_request_item('tel');
}
if (isset($_REQUEST['dect'])) {
$dect = strip_request_item('dect');
}
if (isset($_REQUEST['mobile'])) {
$mobile = strip_request_item('mobile');
}
if (isset($_REQUEST['hometown'])) {
$hometown = strip_request_item('hometown');
}
if ($ok) {
sql_query("\n UPDATE `User` SET\n `Nick`='" . sql_escape($nick) . "',\n `Vorname`='" . sql_escape($prename) . "',\n `Name`='" . sql_escape($lastname) . "',\n `Alter`='" . sql_escape($age) . "',\n `Telefon`='" . sql_escape($tel) . "',\n `DECT`='" . sql_escape($dect) . "',\n `Handy`='" . sql_escape($mobile) . "',\n `email`='" . sql_escape($mail) . "',\n `email_shiftinfo`=" . sql_bool($email_shiftinfo) . ",\n `jabber`='" . sql_escape($jabber) . "',\n `Size`='" . sql_escape($tshirt_size) . "',\n `Hometown`='" . sql_escape($hometown) . "',\n `planned_arrival_date`='" . sql_escape($planned_arrival_date) . "',\n `planned_departure_date`=" . sql_null($planned_departure_date) . "\n WHERE `UID`='" . sql_escape($user['UID']) . "'");
success(_("Settings saved."));
redirect(page_link_to('user_settings'));
}
} elseif (isset($_REQUEST['submit_password'])) {
$ok = true;
if (!isset($_REQUEST['password']) || !verify_password($_REQUEST['password'], $user['Passwort'], $user['UID'])) {
$msg .= error(_("-> not OK. Please try again."), true);
} elseif (strlen($_REQUEST['new_password']) < MIN_PASSWORD_LENGTH) {
$msg .= error(_("Your password is to short (please use at least 6 characters)."), true);
} elseif ($_REQUEST['new_password'] != $_REQUEST['new_password2']) {
$msg .= error(_("Your passwords don't match."), true);
} elseif (set_password($user['UID'], $_REQUEST['new_password'])) {
success(_("Password saved."));
} else {
error(_("Failed setting password."));
}
redirect(page_link_to('user_settings'));
} elseif (isset($_REQUEST['submit_theme'])) {
$ok = true;
if (isset($_REQUEST['theme']) && isset($themes[$_REQUEST['theme']])) {
$selected_theme = $_REQUEST['theme'];
} else {
$ok = false;
}
if ($ok) {
sql_query("UPDATE `User` SET `color`='" . sql_escape($selected_theme) . "' WHERE `UID`='" . sql_escape($user['UID']) . "'");
success(_("Theme changed."));
redirect(page_link_to('user_settings'));
}
} elseif (isset($_REQUEST['submit_language'])) {
$ok = true;
if (isset($_REQUEST['language']) && isset($locales[$_REQUEST['language']])) {
$selected_language = $_REQUEST['language'];
} else {
$ok = false;
}
if ($ok) {
sql_query("UPDATE `User` SET `Sprache`='" . sql_escape($selected_language) . "' WHERE `UID`='" . sql_escape($user['UID']) . "'");
$_SESSION['locale'] = $selected_language;
success("Language changed.");
redirect(page_link_to('user_settings'));
}
}
return page_with_title(settings_title(), array($msg, msg(), div('row', array(div('col-md-6', array(form(array(form_info('', _("Here you can change your user details.")), form_info(entry_required() . ' = ' . _("Entry required!")), form_text('nick', _("Nick"), $nick, true), form_text('lastname', _("Last name"), $lastname), form_text('prename', _("First name"), $prename), form_date('planned_arrival_date', _("Planned date of arrival") . ' ' . entry_required(), $planned_arrival_date, time()), form_date('planned_departure_date', _("Planned date of departure"), $planned_departure_date, time()), form_text('age', _("Age"), $age), form_text('tel', _("Phone"), $tel), form_text('dect', _("DECT"), $dect), form_text('mobile', _("Mobile"), $mobile), form_text('mail', _("E-Mail") . ' ' . entry_required(), $mail), form_checkbox('email_shiftinfo', _("Please send me an email if my shifts change"), $email_shiftinfo), form_text('jabber', _("Jabber"), $jabber), form_text('hometown', _("Hometown"), $hometown), $enable_tshirt_size ? form_select('tshirt_size', _("Shirt size"), $tshirt_sizes, $tshirt_size) : '', form_info('', _('Please visit the angeltypes page to manage your angeltypes.')), form_submit('submit', _("Save")))))), div('col-md-6', array(form(array(form_info(_("Here you can change your password.")), form_password('password', _("Old password:")), form_password('new_password', _("New password:")), form_password('new_password2', _("Password confirmation:")), form_submit('submit_password', _("Save")))), form(array(form_info(_("Here you can choose your color settings:")), form_select('theme', _("Color settings:"), $themes, $selected_theme), form_submit('submit_theme', _("Save")))), form(array(form_info(_("Here you can choose your language:")), form_select('language', _("Language:"), $locales, $selected_language), form_submit('submit_language', _("Save"))))))))));
}
开发者ID:max-weller,项目名称:engelsystem,代码行数:101,代码来源:user_settings.php
示例7: upgrade_b2evo_tables
//.........这里部分代码省略.........
KEY cmvt_user_ID (cmvt_user_ID)
) ENGINE = innodb');
task_end();
task_begin('Adding new comments columns...');
$DB->query('ALTER TABLE T_comments
ADD comment_helpful_addvotes INT NOT NULL DEFAULT 0 AFTER comment_nofollow ,
ADD comment_helpful_countvotes INT UNSIGNED NOT NULL DEFAULT 0 AFTER comment_helpful_addvotes ,
ADD comment_spam_addvotes INT NOT NULL DEFAULT 0 AFTER comment_helpful_countvotes ,
ADD comment_spam_countvotes INT UNSIGNED NOT NULL DEFAULT 0 AFTER comment_spam_addvotes ,
CHANGE COLUMN comment_notif_ctsk_ID comment_notif_ctsk_ID INT(10) unsigned NULL DEFAULT NULL COMMENT "When notifications for this comment are sent through a scheduled job, what is the job ID?"');
task_end();
task_begin('Adding new user permission for spam voting...');
$DB->query('ALTER TABLE T_coll_user_perms
ADD bloguser_perm_vote_spam_cmts tinyint NOT NULL default 0 AFTER bloguser_perm_edit_ts');
task_end();
task_begin('Adding new group permission for spam voting...');
$DB->query('ALTER TABLE T_coll_group_perms
ADD bloggroup_perm_vote_spam_cmts tinyint NOT NULL default 0 AFTER bloggroup_perm_edit_ts');
task_end();
task_begin('Upgrading countries table...');
$DB->query('ALTER TABLE ' . $tableprefix . 'country ADD COLUMN ctry_preferred tinyint(1) NOT NULL DEFAULT 0 AFTER ctry_enabled');
task_end();
$DB->query('ALTER TABLE T_items__subscriptions CHANGE COLUMN isub_comments isub_comments tinyint(1) NOT NULL DEFAULT 0 COMMENT "The user wants to receive notifications for new comments on this post"');
set_upgrade_checkpoint('10300');
}
if ($old_db_version < 10400) {
// 4.2 part 2
task_begin('Updating "Post by Email" settings...');
$DB->query('UPDATE T_settings SET set_name = "eblog_autobr" WHERE set_name = "AutoBR"');
task_end();
if ($DB->get_var('SELECT set_value FROM T_settings WHERE set_name = "eblog_enabled"')) {
// eblog enabled, let's create a scheduled job for it
task_begin('Creating "Post by Email" scheduled job...');
$start_date = form_date(date2mysql($GLOBALS['localtimenow'] + 86400), '05:00:00');
// start tomorrow
$DB->query('
INSERT INTO T_cron__task ( ctsk_start_datetime, ctsk_repeat_after, ctsk_name, ctsk_controller, ctsk_params )
VALUES ( ' . $DB->quote($start_date) . ', 86400, ' . $DB->quote(T_('Create posts by email')) . ', ' . $DB->quote('cron/jobs/_post_by_email.job.php') . ', ' . $DB->quote('N;') . ' )');
task_end();
}
task_begin('Upgrading hitlog table...');
$DB->query('ALTER TABLE T_hitlog
ADD COLUMN hit_disp VARCHAR(30) DEFAULT NULL AFTER hit_uri,
ADD COLUMN hit_ctrl VARCHAR(30) DEFAULT NULL AFTER hit_disp,
ADD COLUMN hit_response_code INT DEFAULT NULL AFTER hit_agent_type ');
task_end();
task_begin('Upgrading file types...');
// Update ftyp_icon column
// Previous versions used a image file name for this field,
// but from now we should use a icon name from the file /conf/_icons.php
$DB->query('UPDATE T_filetypes
SET ftyp_icon = "file_image"
WHERE ftyp_extensions IN ( "gif", "png", "jpg jpeg" )');
$DB->query('UPDATE T_filetypes
SET ftyp_icon = "file_document"
WHERE ftyp_extensions = "txt"');
$DB->query('UPDATE T_filetypes
SET ftyp_icon = "file_www"
WHERE ftyp_extensions = "htm html"');
$DB->query('UPDATE T_filetypes
SET ftyp_icon = "file_pdf"
WHERE ftyp_extensions = "pdf"');
$DB->query('UPDATE T_filetypes
SET ftyp_icon = "file_doc"
WHERE ftyp_extensions = "doc"');
$DB->query('UPDATE T_filetypes
开发者ID:Edind304,项目名称:b2evolution,代码行数:67,代码来源:_functions_evoupgrade.php
示例8: preview_from_request
/**
* We want to preview a single post, we are going to fake a lot of things...
*/
function preview_from_request()
{
global $current_User;
if (empty($current_User)) {
// dh> only logged in user's can preview. Alternatively we need those checks where $current_User gets used below.
return;
}
global $DB, $localtimenow, $Messages, $BlogCache;
global $Plugins;
if ($this->Blog->get_setting('allow_html_post')) {
// HTML is allowed for this post
$text_format = 'html';
} else {
// HTML is disallowed for this post
$text_format = 'htmlspecialchars';
}
$preview_userid = param('preview_userid', 'integer', true);
$post_status = param('post_status', 'string', true);
$post_locale = param('post_locale', 'string', $current_User->locale);
$content = param('content', $text_format, true);
$post_title = param('post_title', $text_format, true);
$post_titletag = param('titletag', 'string', true);
$post_excerpt = param('post_excerpt', 'string', true);
$post_url = param('post_url', 'string', '');
check_categories_nosave($post_category, $post_extracats);
$post_views = param('post_views', 'integer', 0);
$renderers = param('renderers', 'array/string', array('default'));
if (!is_array($renderers)) {
// dh> workaround for param() bug. See rev 1.93 of /inc/_misc/_misc.funcs.php
$renderers = array('default');
}
if ($post_category == 0) {
$post_category = $this->Blog->get_default_cat_ID();
}
$comment_Blog =& $BlogCache->get_by_ID(get_catblog($post_category));
if ($comment_Blog->get_setting('allow_comments') != 'never' && $comment_Blog->get_setting('disable_comments_bypost')) {
// param is required
$post_comment_status = param('post_comment_status', 'string', true);
} else {
$post_comment_status = $comment_Blog->get_setting('allow_comments');
}
// Get issue date, using the user's locale (because it's entered like this in the form):
locale_temp_switch($current_User->locale);
param_date('item_issue_date', T_('Please enter a valid issue date.'), false);
// TODO: dh> get_param() is always true here, also on invalid dates:
if (strlen(get_param('item_issue_date'))) {
// only set it, if a date was given:
param_time('item_issue_time');
$item_issue_date = form_date(get_param('item_issue_date'), get_param('item_issue_time'));
// TODO: cleanup...
} else {
$item_issue_date = date('Y-m-d H:i:s', $localtimenow);
}
locale_restore_previous();
$item_typ_ID = param('item_typ_ID', 'integer', NULL);
$item_st_ID = param('item_st_ID', 'integer', NULL);
$item_assigned_user_ID = param('item_assigned_user_ID', 'integer', NULL);
$item_deadline = param('item_deadline', 'string', NULL);
$item_priority = param('item_priority', 'integer', NULL);
// QUESTION: can this be also empty/NULL?
// Do some optional filtering on the content
// Typically stuff that will help the content to validate
// Useful for code display.
// Will probably be used for validation also.
$Plugins_admin =& get_Plugins_admin();
$params = array('object_type' => 'Item', 'object_Blog' => &$comment_Blog);
$Plugins_admin->filter_contents($post_title, $content, $renderers, $params);
$post_title = format_to_post($post_title);
$content = format_to_post($content);
$post_ID = param('post_ID', 'integer', 0);
$this->sql = "SELECT\n\t\t\t{$post_ID} AS post_ID,\n\t\t\t{$preview_userid} AS post_creator_user_ID,\n\t\t\t{$preview_userid} AS post_lastedit_user_ID,\n\t\t\t'{$item_issue_date}' AS post_datestart,\n\t\t\t'{$item_issue_date}' AS post_datecreated,\n\t\t\t'{$item_issue_date}' AS post_datemodified,\n\t\t\t'{$item_issue_date}' AS post_last_touched_ts,\n\t\t\t0 AS post_dateset,\n\t\t\t'" . $DB->escape($post_status) . "' AS post_status,\n\t\t\t'" . $DB->escape($post_locale) . "' AS post_locale,\n\t\t\t'" . $DB->escape($content) . "' AS post_content,\n\t\t\t'" . $DB->escape($post_title) . "' AS post_title,\n\t\t\t'" . $DB->escape($post_titletag) . "' AS post_titletag,\n\t\t\t'" . $DB->escape($post_excerpt) . "' AS post_excerpt,\n\t\t\tNULL AS post_excerpt_autogenerated,\n\t\t\tNULL AS post_urltitle,\n\t\t\tNULL AS post_canonical_slug_ID,\n\t\t\tNULL AS post_tiny_slug_ID,\n\t\t\t'" . $DB->escape($post_url) . "' AS post_url,\n\t\t\t{$post_category} AS post_main_cat_ID,\n\t\t\t{$post_views} AS post_views,\n\t\t\t'' AS post_flags,\n\t\t\t'noreq' AS post_notifications_status,\n\t\t\tNULL AS post_notifications_ctsk_ID,\n\t\t\t" . bpost_count_words($content) . " AS post_wordcount,\n\t\t\t" . $DB->quote($post_comment_status) . " AS post_comment_status,\n\t\t\t'" . $DB->escape(implode('.', $renderers)) . "' AS post_renderers,\n\t\t\t" . $DB->quote($item_assigned_user_ID) . " AS post_assigned_user_ID,\n\t\t\t" . $DB->quote($item_typ_ID) . " AS post_ptyp_ID,\n\t\t\t" . $DB->quote($item_st_ID) . " AS post_pst_ID,\n\t\t\t" . $DB->quote($item_deadline) . " AS post_datedeadline,\n\t\t\t" . $DB->quote($item_priority) . " AS post_priority,";
$this->sql .= $DB->quote(param('item_order', 'double', NULL)) . ' AS post_order' . ",\n" . $DB->quote(param('item_featured', 'integer', NULL)) . ' AS post_featured' . "\n";
$this->total_rows = 1;
$this->total_pages = 1;
$this->page = 1;
// ATTENTION: we skip the parent on purpose here!! fp> refactor
DataObjectList2::query(false, false, false, 'PREVIEW QUERY');
$Item =& $this->Cache->instantiate($this->rows[0]);
// set Item settings
$Item->set_setting('hide_teaser', param('item_hideteaser', 'integer', 0));
$Item->set_setting('post_metadesc', param('metadesc', 'string', true));
$Item->set_setting('post_custom_headers', param('custom_headers', 'string', true));
// set custom Item settings
foreach (array('double', 'varchar') as $type) {
$count_custom_field = $comment_Blog->get_setting('count_custom_' . $type);
$param_type = $type == 'varchar' ? 'string' : $type;
for ($i = 1; $i <= $count_custom_field; $i++) {
// For each custom double field:
$field_guid = $comment_Blog->get_setting('custom_' . $type . $i);
$Item->set_setting('custom_' . $type . '_' . $field_guid, param('item_' . $type . '_' . $field_guid, $param_type, NULL));
}
}
// Trigger plugin event, allowing to manipulate or validate the item before it gets previewed
$Plugins->trigger_event('AppendItemPreviewTransact', array('Item' => &$Item));
if ($Messages->has_errors()) {
$errcontent = $Messages->display(T_('Invalid post, please correct these errors:'), '', false);
$Item->content = $errcontent . "\n<hr />\n" . $content;
//.........这里部分代码省略.........
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:101,代码来源:_itemlist.class.php
示例9: form_input
echo '<div class="col-xs-10">' . form_input($data) . '</div></div>';
}
if ($col->type == 'enum') {
$enum = $col->enum;
$options = "";
for ($i = 1; $i < $col->enum[0]; $i++) {
$options[$enum[$i]] = $enum[$i];
}
echo '<div class="form-group">
<label class="control-label col-xs-2">' . $col->name . '</label>';
echo '<div class="col-xs-10">' . form_dropdown($col->name, $options) . '</div></div>';
}
if ($col->type == 'date') {
$data = array('name' => $col->name, 'id' => $col->name, 'value' => $dat->{$name});
echo '<div class="form-group">
<div class="form-group">
<label class="control-label col-xs-2">' . $col->name . '</label>';
echo '<div class="col-xs-10">' . form_date($data) . '</div></div>';
}
}
}
}
echo '<div class="control">' . form_submit('mysubmit', 'Submit Post!', 'class="button btn-primary"') . '</div>';
?>
</div>
</div>
</body>
</html>
开发者ID:lukmannhakim,项目名称:dynamic-app,代码行数:31,代码来源:form.php
示例10: build_link
} else {
$registered[] = '<a href="' . build_link('v_profile.php?user[userid]=' . $online['userid']) . '">' . parse_code($online['username']) . '</a>' . ($online['userinvisible'] ? ' (Unsichtbar)' : '');
}
}
} else {
$onlinecount++;
$guests++;
}
}
$maxusers = explode('|', $config['max_useronline']);
if ($onlinecount > $maxusers[0]) {
thwb_query("UPDATE {$pref}" . "registry SET keyvalue='" . $onlinecount . '|' . time() . "' WHERE keyname='max_useronline'");
$maxusers[0] = $onlinecount;
$maxusers[1] = time();
}
$useronline = 'Online Rekord: <b>' . $maxusers[0] . '</b> Benutzer, und zwar am ' . form_date($maxusers[1], 0) . '.<br>';
if ($onlinecount == 1) {
$useronline .= 'Es ist zur Zeit ein Benutzer online:<br>';
} else {
$useronline .= 'Es sind zur Zeit ' . $onlinecount . ' Benutzer online:<br>';
}
$useronline .= @implode(', ', $registered);
if ($guests > 0) {
if ($guests > 1) {
if (count($registered) > 0) {
$useronline .= " sowie {$guests} Gäste";
} else {
$useronline .= "{$guests} Gäste";
}
} else {
if (count($registered) > 0) {
开发者ID:adrianbroher,项目名称:thwboard,代码行数:31,代码来源:index.php
示例11: load_from_Request
/**
* Load data from Request form fields.
*
* This requires the blog (e.g. {@link $blog_ID} or {@link $main_cat_ID} to be set).
*
* @param boolean true to force edit date (as long as perms permit)
* @return boolean true if loaded data seems valid.
*/
function load_from_Request($force_edit_date = false)
{
global $default_locale, $current_User;
if (param('post_locale', 'string', NULL) !== NULL) {
$this->set_from_Request('locale');
}
if (param('item_typ_ID', 'integer', NULL) !== NULL) {
$this->set_from_Request('ptyp_ID', 'item_typ_ID');
}
if (param('post_url', 'string', NULL) !== NULL) {
param_check_url('post_url', 'posting', '');
$this->set_from_Request('url');
}
// Note: post_url is not part of the simple form, so this message can be a little bit awkward there
if ($this->status == 'redirected' && empty($this->url)) {
param_error('post_url', T_('If you want to redirect this post, you must specify an URL! (Expert mode)'));
}
if (($force_edit_date || param('edit_date', 'integer', 0)) && $current_User->check_perm('edit_timestamp')) {
// We can use user date:
param_date('item_issue_date', T_('Please enter a valid issue date.'), $force_edit_date);
if (strlen(get_param('item_issue_date'))) {
// only set it, if a date was given:
param_time('item_issue_time');
$this->set('issue_date', form_date(get_param('item_issue_date'), get_param('item_issue_time')));
// TODO: cleanup...
}
}
if (param('post_excerpt', 'string', NULL) !== NULL) {
$this->set_from_Request('excerpt');
}
if (param('post_urltitle', 'string', NULL) !== NULL) {
$this->set_from_Request('urltitle');
}
if (param('item_tags', 'string', NULL) !== NULL) {
$this->set_tags_from_string(get_param('item_tags'));
// pre_dump( $this->tags );
}
// Workflow stuff:
if (param('item_st_ID', 'integer', NULL) !== NULL) {
$this->set_from_Request('pst_ID', 'item_st_ID');
}
if (param('item_assigned_user_ID', 'integer', NULL) !== NULL) {
$this->assign_to(get_param('item_assigned_user_ID'));
}
if (param('item_priority', 'integer', NULL) !== NULL) {
$this->set_from_Request('priority', 'item_priority', true);
}
if (param_date('item_deadline', T_('Please enter a valid deadline.'), false, NULL) !== NULL) {
$this->set_from_Request('datedeadline', 'item_deadline', true);
}
// Allow comments for this item (only if set to "post_by_post" for the Blog):
$this->load_Blog();
if ($this->Blog->allowcomments == 'post_by_post') {
if (param('post_comment_status', 'string', 'open') !== NULL) {
// 'open' or 'closed' or ...
$this->set_from_Request('comment_status');
}
}
if (param('renderers_displayed', 'integer', 0)) {
// use "renderers" value only if it has been displayed (may be empty)
$Plugins_admin =& get_Cache('Plugins_admin');
$renderers = $Plugins_admin->validate_renderer_list(param('renderers', 'array', array()));
$this->set('renderers', $renderers);
} else {
$renderers = $this->get_renderers_validated();
}
if (param('content', 'html', NULL) !== NULL) {
param('post_title', 'html', NULL);
// Do some optional filtering on the content
// Typically stuff that will help the content to validate
// Useful for code display.
// Will probably be used for validation also.
$Plugins_admin =& get_Cache('Plugins_admin');
$Plugins_admin->filter_contents($GLOBALS['post_title'], $GLOBALS['content'], $renderers);
// Format raw HTML input to cleaned up and validated HTML:
param_check_html('post_title', T_('Invalid title.'), '');
$this->set('title', get_param('post_title'));
param_check_html('content', T_('Invalid content.'));
$this->set('content', get_param('content'));
}
return !param_errors_detected();
}
开发者ID:LFSF,项目名称:oras,代码行数:90,代码来源:_item.class.php
示例12: Template
} else {
$t_stats = new Template('./templates/' . $style['styletemplate'] . '/stats_default.html');
$a_stats = array();
// create $a_stats['userposts']
$r_stats = mysql_query("SELECT userposts FROM " . $pref . "user WHERE userid={$g_user['userid']}");
$g_user['userposts'] = @mysql_result($r_stats, 0);
mysql_free_result($r_stats);
if ($g_user['userid'] != 0 && $g_user['userposts'] != 0) {
$a_stats['userposts'] = $g_user['userposts'];
} else {
$a_stats['userposts'] = '<i>Nicht eingeloggt oder noch kein Post getätigt.</i>';
}
// create $a_stats['firstactivate']
$r_stats = thwb_query("SELECT userjoin FROM " . $pref . "user ORDER BY userjoin ASC LIMIT 1");
if (mysql_num_rows($r_stats) != 0) {
$a_stats['firstactivate'] = form_date(mysql_result($r_stats, 0));
} else {
$a_stats['firstactivate'] = '-';
}
mysql_free_result($r_stats);
// create $a_stats['usercount']
$r_stats = thwb_query("SELECT count(userid) FROM " . $pref . "user");
if (mysql_num_rows($r_stats) != 0) {
$a_stats['usercount'] = mysql_result($r_stats, 0);
} else {
$a_stats['usercount'] = '-';
}
mysql_free_result($r_stats);
// create $a_stats['activeusers']
$r_stats = thwb_query("SELECT count(userid) AS activeusers FROM " . $pref . "user WHERE userlastpost > " . (time() - 60 * 60 * 24 * 31));
$a_stats = array_merge($a_stats, mysql_fetch_assoc($r_stats));
开发者ID:adrianbroher,项目名称:thwboard,代码行数:31,代码来源:default.stats.php
示例13: build_link
$option[] = '<a href="' . build_link("help.php") . '">Hilfe/FAQ</a>';
$option[] = '<a href="' . build_link("search.php") . '">Suche</a>';
$option[] = '<a href="' . build_link("memberlist.php") . '">Memberlist</a>';
$option[] = '<a href="' . build_link("index.php") . '">Home</a>';
$option[] = '<a href="' . build_link("stats.php") . '">Statistik</a>';
$option[] = '<a href="' . build_link("calendar.php") . '">Kalender</a>';
$option[] = '<a hre
|
请发表评论