本文整理汇总了PHP中core::post方法的典型用法代码示例。如果您正苦于以下问题:PHP core::post方法的具体用法?PHP core::post怎么用?PHP core::post使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core
的用法示例。
在下文中一共展示了core::post方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_update
/**
* CRUD controller: UPDATE
*/
public function action_update()
{
$id_role = $this->request->param('id');
//we do not allow modify the admin
if ($id_role == Model_Role::ROLE_ADMIN) {
Alert::set(Alert::WARNING, __('Admin Role can not be modified!'));
$this->redirect(Route::url('oc-panel', array('controller' => 'role')));
}
$this->template->title = __('Update') . ' ' . __($this->_orm_model) . ' ' . $id_role;
$role = new Model_Role($id_role);
if ($this->request->post() and $role->loaded()) {
//delete all the access
DB::delete('access')->where('id_role', '=', $role->id_role)->execute();
//set all the access where post = on
foreach ($_POST as $key => $value) {
if ($value == 'on') {
DB::insert('access', array('id_role', 'access'))->values(array($role->id_role, str_replace('|', '.', $key)))->execute();
}
}
//saving the role params
$role->name = core::post('name');
$role->description = core::post('description');
$role->save();
Alert::set(Alert::SUCCESS, __('Item updated'));
$this->redirect(Route::get($this->_route_name)->uri(array('controller' => Request::current()->controller())));
}
//getting controllers actions
$controllers = Model_Access::list_controllers();
//get all the access this user has
$query = DB::select('access')->from('access')->where('id_role', '=', $id_role)->execute();
$access_in_use = array_keys($query->as_array('access'));
// d(in_array('access_index',$access_in_use));
//d($access_in_use);
return $this->render('oc-panel/pages/role/update', array('role' => $role, 'controllers' => $controllers, 'access_in_use' => $access_in_use));
}
示例2: check
/**
* check if its valid or not
* @param string $name for the session
* @return boolean
*/
public static function check($name = '', $ajax = FALSE)
{
//d(strtolower(core::post('captcha')));
//d(Session::instance()->get('captcha_'.$name));
//d(Session::instance()->get('captcha_'.$name) == strtolower(core::post('captcha')));
if (core::config('advertisement.captcha') == FALSE) {
// Captchas are disabled
return TRUE;
}
// verify with recaptcha if enabled
if (Core::config('general.recaptcha_active')) {
if (self::recaptcha_verify()) {
return TRUE;
} else {
return FALSE;
}
}
if (Session::instance()->get('captcha_' . $name) == strtolower(core::post('captcha'))) {
if ($ajax === FALSE) {
Session::instance()->set('captcha_' . $name, '');
}
return TRUE;
} else {
return FALSE;
}
}
示例3: action_update
/**
* Update new forum
*/
public function action_update()
{
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Edit Topic')));
$topic = new Model_Topic($this->request->param('id'));
$get_all = Model_Forum::get_all();
//get all forums to build forum parents in select
$forum_parents = array();
foreach ($get_all[0] as $parent) {
$forum_parents[$parent['id']] = $parent['name'];
}
$this->template->content = View::factory('oc-panel/pages/forum/topic', array('topic' => $topic, 'forum_parents' => $forum_parents));
if ($_POST) {
$topic->title = core::post('title');
$topic->id_forum = core::post('id_forum');
$topic->description = core::post('description');
if (core::post('seotitle') != $topic->seotitle) {
$topic->seotitle = $topic->gen_seotitle(core::post('seotitle'));
}
if (core::post('status') == 'on') {
$topic->status = 1;
} else {
$topic->status = 0;
}
try {
$topic->save();
Alert::set(Alert::SUCCESS, __('Topic is updated.'));
} catch (Exception $e) {
Alert::set(Alert::ERROR, $e->getMessage());
}
HTTP::redirect(Route::url('oc-panel', array('controller' => 'topic', 'action' => 'index')));
}
}
示例4: action_index
public function action_index()
{
//template header
$this->template->title = __('Contact Us');
$this->template->meta_description = __('Contact') . ' ' . core::config('general.site_name');
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Home'))->set_url(Route::url('default')));
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Contact Us')));
if ($this->request->post()) {
//captcha check
if (captcha::check('contact')) {
//check if user is loged in
if (Auth::instance()->logged_in()) {
$email_from = Auth::instance()->get_user()->email;
$name_from = Auth::instance()->get_user()->name;
} else {
$email_from = core::post('email');
$name_from = core::post('name');
}
//akismet spam filter
if (!core::akismet($name_from, $email_from, core::post('message'))) {
$replace = array('[EMAIL.BODY]' => core::post('message'), '[EMAIL.SENDER]' => $name_from, '[EMAIL.FROM]' => $email_from);
if (Email::content(core::config('email.notify_email'), core::config('general.site_name'), $email_from, $name_from, 'contact-admin', $replace)) {
Alert::set(Alert::SUCCESS, __('Your message has been sent'));
} else {
Alert::set(Alert::ERROR, __('Message not sent'));
}
} else {
Alert::set(Alert::WARNING, __('This email has been considered as spam! We are sorry but we can not send this email.'));
}
} else {
Alert::set(Alert::ERROR, __('Wrong captcha'));
}
}
$this->template->content = View::factory('pages/contact');
}
示例5: action_edit
public function action_edit()
{
$this->template->scripts['footer'] = array('js/oc-panel/edit_profile.js');
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Edit profile')));
// $this->template->title = $user->name;
//$this->template->meta_description = $user->name;//@todo phpseo
$user = Auth::instance()->get_user();
$this->template->bind('content', $content);
$this->template->content = View::factory('oc-panel/profile/edit', array('user' => $user, 'custom_fields' => Model_UserField::get_all()));
if ($this->request->post()) {
$user->name = core::post('name');
$user->description = core::post('description');
$user->email = core::post('email');
$user->subscriber = core::post('subscriber', 0);
//$user->seoname = $user->gen_seo_title(core::post('name'));
$user->last_modified = Date::unix2mysql();
//modify custom fields
foreach ($this->request->post() as $custom_field => $value) {
if (strpos($custom_field, 'cf_') !== FALSE) {
$user->{$custom_field} = $value;
}
}
try {
$user->save();
Alert::set(Alert::SUCCESS, __('You have successfully changed your data'));
} catch (Exception $e) {
//throw 500
throw HTTP_Exception::factory(500, $e->getMessage());
}
$this->redirect(Route::url('oc-panel', array('controller' => 'profile', 'action' => 'edit')));
}
}
示例6: check
/**
* check if its valid or not
* @param string $name for the session
* @return boolean
*/
public static function check($name = '')
{
if (Session::instance()->get('captcha_' . $name) == strtolower(core::post('captcha'))) {
Session::instance()->set('captcha_' . $name, '');
return TRUE;
} else {
return FALSE;
}
}
示例7: action_message
public function action_message()
{
Controller::$full_width = TRUE;
if ($this->request->param('id') !== NULL and is_numeric($id_msg_thread = $this->request->param('id'))) {
$messages = Model_Message::get_thread($id_msg_thread, $this->user->id_user);
if ($messages !== FALSE) {
$msg_thread = new Model_Message();
$msg_thread = $msg_thread->where('id_message', '=', $this->request->param('id'))->find();
// send reply message
if ($this->request->post() and Form::token('reply_message', TRUE)) {
$validation = Validation::factory($this->request->post())->rule('message', 'not_empty');
if ($validation->check()) {
$ret = Model_Message::reply(core::post('message'), $this->user->id_user, $id_msg_thread, NULL);
if ($ret !== FALSE) {
//who is who? if from is the same then send to TO, else to from
if ($msg_thread->id_user_from == $this->user->id_user) {
$user_to = $msg_thread->to;
$user_from = $msg_thread->from;
} else {
$user_to = $msg_thread->from;
$user_from = $msg_thread->to;
}
//email title
if ($msg_thread->id_ad !== NULL) {
$email_title = $msg_thread->ad->title;
} else {
$email_title = sprintf(__('Direct message from %s'), $user_from->name);
}
$user_to->email('messaging-reply', array('[TITLE]' => $email_title, '[DESCRIPTION]' => core::post('message'), '[URL.QL]' => $user_to->ql('oc-panel', array('controller' => 'messages', 'action' => 'message', 'id' => $this->request->param('id')))));
Alert::set(Alert::SUCCESS, __('Reply created.'));
$this->redirect(Route::url('oc-panel', array('controller' => 'messages', 'action' => 'message', 'id' => Request::current()->param('id'))));
} else {
Alert::set(Alert::ERROR, __('Message not sent'));
}
} else {
$errors = $validation->errors('message');
}
}
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Messaging'))->set_url(Route::url('oc-panel', array('controller' => 'messages', 'action' => 'index'))));
if ($msg_thread->id_ad !== NULL) {
Breadcrumbs::add(Breadcrumb::factory()->set_title($msg_thread->ad->title));
} else {
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Direct Message')));
}
$this->template->styles = array('css/jquery.sceditor.default.theme.min.css' => 'screen');
$this->template->scripts['footer'] = array('js/jquery.sceditor.bbcode.min.js', 'js/messages.js');
$this->template->content = View::factory('oc-panel/pages/messages/message', array('msg_thread' => $msg_thread, 'messages' => $messages, 'user' => $this->user));
} else {
Alert::set(Alert::ERROR, __('Message not found'));
$this->redirect(Route::url('oc-panel', array('controller' => 'messages', 'action' => 'index')));
}
} else {
Alert::set(Alert::ERROR, __('Message not found'));
$this->redirect(Route::url('oc-panel', array('controller' => 'messages', 'action' => 'index')));
}
}
示例8: action_index
public function action_index()
{
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Newsletter')));
$this->template->title = __('Newsletter');
//count all users
$user = new Model_User();
$user->where('status', '=', Model_User::STATUS_ACTIVE);
$count_all_users = $user->count_all();
//count support expired
$query = DB::select(DB::expr('COUNT(id_order) count'))->from('orders')->where('status', '=', Model_Order::STATUS_PAID)->where('support_date', '<', Date::unix2mysql())->execute();
$count_support_expired = $query->as_array();
$count_support_expired = $count_support_expired[0]['count'];
//count license expired
$query = DB::select(DB::expr('COUNT(id_license) count'))->from('licenses')->where('valid_date', 'IS NOT', NULL)->where('valid_date', '<', Date::unix2mysql())->execute();
$count_license_expired = $query->as_array();
$count_license_expired = $count_license_expired[0]['count'];
//orders per product, not accuarate since 1 user could buy more than 1 product but will do
$query = DB::select(DB::expr('COUNT(id_order) count'))->select('p.title')->select('p.id_product')->from(array('products', 'p'))->join(array('orders', 'o'))->using('id_product')->where('o.status', '=', Model_Order::STATUS_PAID)->group_by('p.id_product')->execute();
$products = $query->as_array();
//post done sending newsletter
if ($this->request->post() and Core::post('subject') != NULL) {
$users = array();
if (core::post('send_all') == 'on') {
$query = DB::select('email')->select('name')->from('users')->where('status', '=', Model_User::STATUS_ACTIVE)->execute();
$users = array_merge($users, $query->as_array());
}
if (Theme::get('premium') == 1) {
if (core::post('send_expired_support') == 'on') {
$query = DB::select('email')->select('name')->from(array('users', 'u'))->join(array('orders', 'o'))->using('id_user')->where('o.status', '=', Model_Order::STATUS_PAID)->where('o.support_date', '<', Date::unix2mysql())->where('u.subscriber', '=', 1)->group_by('u.id_user')->execute();
$users = array_merge($users, $query->as_array());
}
if (core::post('send_expired_license') == 'on') {
$query = DB::select('email')->select('name')->from(array('licenses', 'l'))->join(array('users', 'u'))->using('id_user')->where('l.valid_date', 'IS NOT', NULL)->where('l.valid_date', '<', Date::unix2mysql())->where('u.subscriber', '=', 1)->group_by('u.id_user')->execute();
$users = array_merge($users, $query->as_array());
}
if (is_numeric(core::post('send_product'))) {
$query = DB::select('email')->select('name')->from(array('users', 'u'))->join(array('orders', 'o'))->using('id_user')->where('o.id_product', '=', core::post('send_product'))->where('o.status', '=', Model_Order::STATUS_PAID)->where('u.subscriber', '=', 1)->group_by('u.id_user')->execute();
$users = array_merge($users, $query->as_array());
}
}
//NOTE $users may have duplicated emails, but phpmailer takes care of not sending the email 2 times to same recipient
//sending!
if (count($users) > 0) {
if (!Email::send($users, '', Core::post('subject'), Kohana::$_POST_ORIG['description'], Core::post('from'), Core::post('from_email'))) {
Alert::set(Alert::ERROR, __('Error on mail delivery, not sent'));
} else {
Alert::set(Alert::SUCCESS, __('Email sent'));
}
} else {
Alert::set(Alert::ERROR, __('Mail not sent'));
}
}
$this->template->content = View::factory('oc-panel/pages/newsletter', array('count_all_users' => $count_all_users, 'count_support_expired' => $count_support_expired, 'count_license_expired' => $count_license_expired, 'products' => $products));
}
示例9: check
/**
* check if its valid or not
* @param string $name for the session
* @return boolean
*/
public static function check($name = '')
{
//d(strtolower(core::post('captcha')));
//d(Session::instance()->get('captcha_'.$name));
//d(Session::instance()->get('captcha_'.$name) == strtolower(core::post('captcha')));
if (core::config('advertisement.captcha') == FALSE) {
// Captchas are disabled
return TRUE;
}
if (Session::instance()->get('captcha_' . $name) == strtolower(core::post('captcha'))) {
Session::instance()->set('captcha_' . $name, '');
return TRUE;
} else {
return FALSE;
}
}
示例10: action_save
/**
* action_save
* @return save widget (make active)
*/
public function action_save()
{
// save only changed values
if ($this->request->post()) {
//deleting the fragment cache...a bit ugly but works.
View::delete_fragment('sidebar_front');
View::delete_fragment('footer_front');
//get place holder name
$placeholder = core::post('placeholder');
//get widget class
$widget = core::post('widget_class');
//widget name
$widget_name = core::post('widget_name');
//$data = array();
//extract all the data and prepare array
foreach ($this->request->post() as $name => $value) {
if ($name != 'placeholder' and $name != 'widget_class' and $name != 'widget_name') {
$data[$name] = $value;
}
}
$old_placeholder = NULL;
$widget = new $widget();
//the widget exists, we load it since we need the previous placeholder
if ($widget_name != NULL) {
$widget->load($widget_name);
$old_placeholder = $widget->placeholder;
}
$widget->placeholder = $placeholder;
$widget->data = $data;
try {
$widget->save($old_placeholder);
//clean cache config
$c = new ConfigDB();
$c->reload_config();
if ($widget_name != NULL) {
Alert::set(Alert::SUCCESS, sprintf(__('Widget %s saved in %s'), $widget_name, $placeholder));
} else {
Alert::set(Alert::SUCCESS, sprintf(__('Widget created in %s'), $placeholder));
}
} catch (Exception $e) {
//throw 500
throw HTTP_Exception::factory(500, $e->getMessage());
}
$this->redirect(Route::url('oc-panel', array('controller' => 'widget', 'action' => 'index')));
}
}
示例11: action_message
public function action_message()
{
Controller::$full_width = TRUE;
if ($this->request->param('id') !== NULL and is_numeric($id_msg_thread = $this->request->param('id'))) {
$messages = Model_Message::get_thread($id_msg_thread, $this->user);
if ($messages !== FALSE) {
$msg_thread = new Model_Message();
$msg_thread = $msg_thread->where('id_message', '=', $id_msg_thread)->where('id_message_parent', '=', $id_msg_thread)->find();
// send reply message
if ($this->request->post() and Form::token('reply_message', TRUE)) {
$validation = Validation::factory($this->request->post())->rule('message', 'not_empty');
if ($validation->check()) {
$ret = Model_Message::reply(core::post('message'), $this->user, $id_msg_thread, NULL);
if ($ret !== FALSE) {
Alert::set(Alert::SUCCESS, __('Reply created.'));
$this->redirect(Route::url('oc-panel', array('controller' => 'messages', 'action' => 'message', 'id' => Request::current()->param('id'))));
} else {
Alert::set(Alert::ERROR, __('Message not sent'));
}
} else {
$errors = $validation->errors('message');
}
}
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Messaging'))->set_url(Route::url('oc-panel', array('controller' => 'messages', 'action' => 'index'))));
if ($msg_thread->id_ad !== NULL) {
Breadcrumbs::add(Breadcrumb::factory()->set_title($msg_thread->ad->title));
} else {
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Direct Message')));
}
$this->template->styles = array('css/jquery.sceditor.default.theme.min.css' => 'screen', '//cdn.jsdelivr.net/sweetalert/0.1.2/sweet-alert.min.css' => 'screen');
$this->template->scripts['footer'] = array('js/jquery.sceditor.bbcode.min.js', '//cdn.jsdelivr.net/sweetalert/0.1.2/sweet-alert.min.js', 'js/messages.js');
$this->template->content = View::factory('oc-panel/pages/messages/message', array('msg_thread' => $msg_thread, 'messages' => $messages, 'user' => $this->user));
} else {
Alert::set(Alert::ERROR, __('Message not found'));
$this->redirect(Route::url('oc-panel', array('controller' => 'messages', 'action' => 'index')));
}
} else {
Alert::set(Alert::ERROR, __('Message not found'));
$this->redirect(Route::url('oc-panel', array('controller' => 'messages', 'action' => 'index')));
}
}
示例12: action_register
/**
* simple registration without password
* @return [type] [description]
*/
public function action_register()
{
$provider_name = $this->request->param('id');
$this->template->content = View::factory('pages/auth/register-social', array('provider' => $provider_name, 'uid' => core::get('uid'), 'name' => core::get('name')));
if (core::post('email') and CSRF::valid('register_social')) {
$email = core::post('email');
if (Valid::email($email, TRUE)) {
//register the user in DB
Model_User::create_social($email, core::post('name'), $provider_name, core::get('uid'));
//log him in
Auth::instance()->social_login($provider_name, core::get('uid'));
Alert::set(Alert::SUCCESS, __('Welcome!'));
//change the redirect
$this->redirect(Route::url('default'));
} else {
Form::set_errors(array(__('Invalid Email')));
}
}
//template header
$this->template->title = __('Register new user');
}
示例13: action_options
/**
* theme options/settings
* @return [view] Renders view with form inputs
*/
public function action_options()
{
$options = NULL;
$data = NULL;
//this is how we manage the mobile options, or if we want to set other theme options without enableing it. ;)
if ($this->request->param('id')) {
$options = Theme::get_options($this->request->param('id'));
$data = Theme::load($this->request->param('id'));
}
if ($options === NULL) {
$options = Theme::$options;
}
if ($data === NULL) {
$data = Theme::$data;
}
// validation active
//$this->template->scripts['footer'][]= '/js/oc-panel/settings.js';
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Theme Options')));
$this->template->title = __('Theme Options');
// save only changed values
if ($this->request->post()) {
//for each option read the post and store it
foreach ($_POST as $key => $value) {
if (isset($options[$key])) {
//if textarea allow HTML
if ($options[$key]['display'] == 'textarea') {
$data[$key] = Kohana::$_POST_ORIG[$key];
} else {
$data[$key] = core::post($key);
}
}
}
Theme::save($this->request->param('id'), $data);
Alert::set(Alert::SUCCESS, __('Theme configuration updated'));
$this->request->redirect(Route::url('oc-panel', array('controller' => 'theme', 'action' => 'options', 'id' => $this->request->param('id'))));
}
$this->template->content = View::factory('oc-panel/pages/themes/options', array('options' => $options, 'data' => $data));
}
示例14: action_userprofile_contact
public function action_userprofile_contact()
{
$user = new Model_User($this->request->param('id'));
//message to user
if ($user->loaded() and $this->request->post()) {
if (captcha::check('contact')) {
//akismet spam filter
if (!core::akismet(core::post('name'), core::post('email'), core::post('message'))) {
$ret = $user->email('userprofile.contact', array('[EMAIL.BODY]' => core::post('message'), '[EMAIL.SENDER]' => core::post('name'), '[EMAIL.SUBJECT]' => core::post('subject'), '[EMAIL.FROM]' => core::post('email')), core::post('email'), core::post('name'));
//if succesfully sent
if ($ret) {
Alert::set(Alert::SUCCESS, __('Your message has been sent'));
} else {
Alert::set(Alert::ERROR, __('Message not sent'));
}
} else {
Alert::set(Alert::SUCCESS, __('This email has been considered as spam! We are sorry but we can not send this email.'));
}
} else {
Alert::set(Alert::ERROR, __('You made some mistake'));
}
Request::current()->redirect(Route::url('profile', array('seoname' => $user->seoname)));
}
}
示例15: __
echo Form::errors();
?>
<div class="form-group">
<div id="review_raty" data-baseurl="<?php
echo Route::url('default');
?>
"></div>
</div>
<div class="form-group">
<?php
echo FORM::label('description', __('Review'), array('for' => 'description'));
?>
<div class="controls">
<?php
echo FORM::textarea('description', core::post('description', ''), array('placeholder' => __('Review'), 'class' => 'form-control', 'name' => 'description', 'id' => 'description', 'required'));
?>
</div>
</div>
<?php
if (core::config('advertisement.captcha') != FALSE) {
?>
<div class="form-group">
<?php
if (Core::config('general.recaptcha_active')) {
?>
<?php
echo Captcha::recaptcha_display();
?>