function _valid_perform() { $object =& wrap_with_site_object(fetch_mapped_by_url()); if (!$object->delete()) { message_box::write_notice('Can not be deleted!'); return new failed_response(); } return new close_popup_response(RESPONSE_STATUS_FORM_SUBMITTED, RELOAD_SELF_URL, true); }
function perform() { $object =& site_object_factory::create('user_object'); if (!$object->activate_password()) { message_box::write_notice('Password activation failed!'); reload('/'); } return true; }
function perform() { $object =& site_object_factory::create('user_object'); if (!$object->activate_password()) { message_box::write_notice('Password activation failed!'); return new redirect_response(RESPONSE_STATUS_FAILED, '/'); } return new response(); }
function perform(&$request, &$response) { $object =& site_object_factory::create('user_object'); if (!$object->activate_password()) { message_box::write_notice('Password activation failed!'); $request->set_status(REQUEST_STATUS_FAILED); $response->redirect('/'); } }
function _valid_perform() { $object =& site_object_factory::create('poll_container'); $data = $this->_export(); if (!isset($data['answer'])) { message_box::write_notice(strings::get('no_answer', 'poll')); return false; } return $object->register_answer($data['answer']); }
function _valid_perform() { $this->_update_items_amount(); $this->_update_items_notes(); $cart =& cart::instance(); if ($cart->count_items() == 0) { message_box::write_error(strings::get('no_items_in_cart', 'cart')); return new close_popup_response(RESPONSE_STATUS_FAILURE); } return new redirect_response(RESPONSE_STATUS_FORM_SUBMITTED, '/root/cart?action=checkout&popup=1'); }
function _init_dataspace() { $object_data =& fetch_mapped_by_url(); $object =& site_object_factory::create($this->definition['site_object']); $object->import_attributes($object_data); if ($object->can_delete()) { return true; } else { message_box::write_notice('Can not be deleted!'); close_popup(); } }
function _valid_perform() { $object_data =& fetch_mapped_by_url(); $object =& site_object_factory::create($this->definition['site_object']); $object->import_attributes($object_data); if (!$object->delete()) { message_box::write_notice('Can not be deleted!'); return new failed_response(); } $parent_object_data = fetch_one_by_node_id($object_data['parent_node_id']); return new close_popup_response(RESPONSE_STATUS_FORM_SUBMITTED, RELOAD_SELF_URL, true); }
function _valid_perform(&$request, &$response) { $object =& site_object_factory::create('poll_container'); $data = $this->dataspace->export(); $request->set_status(REQUEST_STATUS_FAILURE); if (!isset($data['answer'])) { message_box::write_notice(strings::get('no_answer', 'poll')); return; } $object->register_answer($data['answer']); $request->set_status(REQUEST_STATUS_FORM_SUBMITTED); }
function _valid_perform() { $mail_data = $this->dataspace->export(); $body = sprintf(strings::get('body_template', 'feedback'), $mail_data['sender_name'], $mail_data['sender_email'], $mail_data['body']); $body = str_replace('<br>', "\n", $body); $subject = sprintf(strings::get('message_subject', 'feedback'), $mail_data['subject'], $_SERVER['HTTP_HOST']); $recipient_email = constant('ADMINISTRATOR_EMAIL'); if (!$recipient_email || !send_plain_mail(array($recipient_email), $mail_data['sender_email'], $subject, $body)) { message_box::write_error(strings::get('mail_not_sent', 'feedback')); return false; } return true; }
function _create_object_operation() { if (isset($_FILES[$this->name]['tmp_name']['file'])) { if ($_FILES[$this->name]['size']['file'] > ini_get('upload_max_filesize') * 1024 * 1024) { message_box::write_warning('uploaded file size exceeds limit'); return false; } $this->object->set_attribute('tmp_file_path', $_FILES[$this->name]['tmp_name']['file']); $this->object->set_attribute('file_name', $_FILES[$this->name]['name']['file']); $this->object->set_attribute('mime_type', $_FILES[$this->name]['type']['file']); } return parent::_create_object_operation(); }
function run(&$filter_chain, &$request, &$response) { $filter_chain->next(); if( $response->get_content_type() == 'text/html' && $response->get_status() == 200)//only 200? { if (debug :: is_console_enabled()) $response->write(debug :: parse_html_console()); $response->write(message_box :: parse());//It definetly should be somewhere else! } }
function _valid_perform(&$request, &$response) { $object =& wrap_with_site_object(fetch_requested_object()); if (!$object->delete()) { message_box::write_notice(strings::get('cant_be_deleted', 'error')); $request->set_status(REQUEST_STATUS_FAILURE); return; } $request->set_status(REQUEST_STATUS_FORM_SUBMITTED); if ($request->has_attribute('popup')) { $response->write(close_popup_response($request, RELOAD_SELF_URL, true)); } }
function _valid_perform() { $mail_data = $this->dataspace->export(); $body = sprintf(strings::get('body_template', 'feedback'), $mail_data['sender_name'], $mail_data['sender_email'], $mail_data['body']); $body = str_replace('<br>', "\n", $body); $subject = sprintf(strings::get('message_subject', 'feedback'), $mail_data['subject'], $_SERVER['HTTP_HOST']); $recipient_email = $this->_get_email(); if (!$recipient_email || !send_plain_mail(array($recipient_email), $mail_data['sender_email'], $subject, $body)) { message_box::write_error(strings::get('mail_not_sent', 'feedback')); return new failed_response(); } message_box::write_error(strings::get('message_was_sent', 'feedback')); return new redirect_response(RESPONSE_STATUS_FORM_SUBMITTED, PHP_SELF); }
function _valid_perform() { $object =& site_object_factory::create('poll_container'); $data = $this->dataspace->export(); if (!isset($data['answer'])) { message_box::write_notice(strings::get('no_answer', 'poll')); return new failed_response(); } if ($object->register_answer($data['answer'])) { return new redirect_response(RESPONSE_STATUS_FORM_SUBMITTED, '/root/polls'); } else { return new failed_response(); } }
function _valid_perform() { //$html_body = $this->_get_mail_body('/cart/mail_template.html'); $text_body = $this->_get_mail_body('/cart/mail_template.txt'); $subject = sprintf(strings::get('message_subject', 'cart'), $_SERVER['HTTP_HOST']); $recipient_email = $this->_get_email(); if (!send_plain_mail(array($recipient_email), $_SERVER['SERVER_ADMIN'] . '<' . $_SERVER['HTTP_HOST'] . '> ', $subject, $text_body)) { message_box::write_error(strings::get('mail_not_sent', 'cart')); return new close_popup_response(RESPONSE_STATUS_FAILURE); } $this->_clear_cart(); message_box::write_error(strings::get('message_was_sent', 'cart')); return new close_popup_response(RESPONSE_STATUS_FORM_SUBMITTED); }
function _update_object_operation(&$object) { if (isset($_FILES[$this->name]['tmp_name']['file'])) { if ($_FILES[$this->name]['size']['file'] > ini_get('upload_max_filesize') * 1024 * 1024) { message_box::write_warning('uploaded file size exceeds limit'); return false; } $object_data =& fetch_mapped_by_url(); $object->set_attribute('media_id', $object_data['media_id']); $object->set_attribute('tmp_file_path', $_FILES[$this->name]['tmp_name']['file']); $object->set_attribute('file_name', $_FILES[$this->name]['name']['file']); $object->set_attribute('mime_type', $_FILES[$this->name]['type']['file']); } return parent::_update_object_operation(&$object); }
function _valid_perform(&$request, &$response) { $this->_update_items_amount(); $this->_update_items_notes(); $cart =& cart::instance(); if ($cart->count_items() == 0) { message_box::write_error(strings::get('no_items_in_cart', 'cart')); $request->set_status(REQUEST_STATUS_FAILURE); if ($request->has_attribute('popup')) { $response->write(close_popup_response($request)); } return; } $request->set_status(REQUEST_STATUS_FORM_SUBMITTED); $response->redirect('/root/cart?action=checkout&popup=1'); }
function run() { $request =& request::instance(); $response =& new http_response(); $filter_chain =& new filter_chain($request, $response); $this->_register_filters($filter_chain); $filter_chain->process(); if ($response->get_content_type() == 'text/html' && $response->get_status() == 200) { if (debug::is_console_enabled()) { $response->write(debug::parse_html_console()); } $response->write(message_box::parse()); //It definetly should be somewhere else! } $response->commit(); }
function run() { $this->_inititiliaze_user_session(); $request =& request::instance(); $response =& new http_response(); $filter_chain =& new filter_chain($request, $response); $this->_register_filters($filter_chain); $filter_chain->process(); if (!$response->file_sent()) { if (debug::is_console_enabled()) { echo debug::parse_html_console(); } echo message_box::parse(); //It definetly should be somewhere else! } $response->commit(); }
function parse() { $message_box =& message_box::instance(); if(!($strings = $message_box->get_message_strings())) return ''; $js_function = " function show_message_boxes( message_strings ) { for(i=0; i<message_strings.length; i++) { arr = message_strings[i]; alert(arr['string']); } }"; $js = ''; $i = 0; foreach($strings as $id => $data) { $js .= "\nmessage_strings[$i] = new Array(); message_strings[$i]['label'] = '" . addslashes($data['label']) . "'; message_strings[$i]['string'] = '" . addslashes($data['string']) . "'; message_strings[$i]['level'] = '{$data['level']}'; "; $i++; } if($js) $js = "<script language='JavaScript'> <!-- $js_function var message_strings = new Array(); $js show_message_boxes(message_strings); //--> </script>"; $message_box->reset(); return $js; }
function change_password() { if (!($user_id = $this->get_id())) { debug::write_error('user id not set', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__); return false; } if (!($identifier = $this->get_identifier())) { debug::write_error('user identifier not set', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__); return false; } $this->set_attribute('password', user::get_crypted_password($identifier, $this->get_attribute('password'))); if ($user_id == user::get_id()) { user::logout(); message_box::write_warning(strings::get('need_relogin', 'user')); } else { session::destroy_user_session($user_id); } return $this->update(false); }
function parse() { $message_box =& message_box::instance(); if (!($strings = $message_box->get_message_strings())) { return ''; } $js_function = "\r\n function show_message_boxes( message_strings )\r\n {\r\n for(i=0; i<message_strings.length; i++)\r\n {\r\n arr = message_strings[i];\r\n alert(arr['string']);\r\n }\r\n }"; $js = ''; $i = 0; foreach ($strings as $id => $data) { $js .= "\nmessage_strings[{$i}] = new Array();\r\n\r\n message_strings[{$i}]['label'] = '" . addslashes($data['label']) . "';\r\n message_strings[{$i}]['string'] = '" . addslashes($data['string']) . "';\r\n message_strings[{$i}]['level'] = '{$data['level']}';\r\n "; $i++; } if ($js) { $js = "<script language='JavaScript'>\r\n <!--\r\n {$js_function}\r\n\r\n var message_strings = new Array();\r\n {$js}\r\n show_message_boxes(message_strings);\r\n //-->\r\n </script>"; } $message_box->reset(); return $js; }
function _valid_perform(&$request, &$response) { $mail_data = $this->dataspace->export(); if(isset($mail_data['sender_name']) ) $sender_name = $mail_data['sender_name']; else $sender_name = $mail_data['sender_firstname'] . ' ' . $mail_data['sender_lastname']; $body = sprintf(strings :: get('body_template', 'feedback'), $sender_name, $mail_data['sender_email'], $mail_data['body']); $body = str_replace('<br>', "\n", $body); $subject = sprintf(strings :: get('message_subject', 'feedback'), $mail_data['subject'], $_SERVER['HTTP_HOST']); $recipient_email = $this->_get_email(); if(!$recipient_email || !send_plain_mail(array($recipient_email), $mail_data['sender_email'], $subject, $body ) ) { message_box :: write_error(strings :: get('mail_not_sent', 'feedback')); $request->set_status(REQUEST_STATUS_FAILUER); return; } message_box :: write_error(strings :: get('message_was_sent', 'feedback')); $request->set_status(REQUEST_STATUS_FORM_SUBMITTED); $response->redirect($_SERVER['PHP_SELF']); }
function _valid_perform(&$request, &$response) { //$html_body = $this->_get_mail_body('/cart/mail_template.html'); $text_body = $this->_get_mail_body('/cart/mail_template.txt'); $subject = sprintf(strings::get('message_subject', 'cart'), $_SERVER['HTTP_HOST']); $recipient_email = $this->_get_email(); if (!send_plain_mail(array($recipient_email), $_SERVER['SERVER_ADMIN'] . '<' . $_SERVER['HTTP_HOST'] . '> ', $subject, $text_body)) { message_box::write_error(strings::get('mail_not_sent', 'cart')); $request->set_status(REQUEST_STATUS_FAILURE); if ($request->has_attribute('popup')) { $response->write(close_popup_response($request)); } return; } $this->_clear_cart(); message_box::write_error(strings::get('message_was_sent', 'cart')); $request->set_status(REQUEST_STATUS_FORM_SUBMITTED); if ($request->has_attribute('popup')) { $response->write(close_popup_response($request)); } }
<?php /********************************************************************************** * Copyright 2004 BIT, Ltd. http://www.0x00.ru, mailto: bit@0x00.ru * * Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html) *********************************************************************************** * * $Id$ * ***********************************************************************************/ require_once(LIMB_DIR . 'core/lib/session/session.class.php'); require_once(LIMB_DIR . 'core/model/chat/chat_user.class.php'); require_once(LIMB_DIR . 'core/request/response.class.php'); require_once(LIMB_DIR . 'core/lib/system/message_box.class.php'); start_user_session(); if($_POST['nickname'] && !chat_user :: login($_POST['nickname'])) message_box :: write_notice('such name already exists'); $response =& response :: instance(); $response->redirect($_SERVER['HTTP_REFERER']); $response->commit(); ?>
debug::add_timing_point('object fetched'); $site_object_controller =& $site_object->get_controller(); if (($action = $site_object_controller->determine_action()) === false) { debug::write_error('"' . $action . '" action not found', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__); ob_end_clean(); if (debug::is_console_enabled()) { echo debug::parse_html_console(); } header("HTTP/1.1 404 Not found"); exit; } $actions = $object_data['actions']; if (!isset($actions[$action])) { debug::write_error('"' . $action . '" action is not accessible', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__); ob_end_clean(); if (debug::is_console_enabled()) { echo debug::parse_html_console(); } header("HTTP/1.1 403 Access denied"); exit; } $response = $site_object_controller->process(); $stats_register = new stats_register(); $stats_register->register($node['id'], $action, $response->get_status()); $response->perform(); $site_object_controller->display_view(); echo message_box::parse(); if (debug::is_console_enabled()) { echo debug::parse_html_console(); } ob_end_flush();
require_once(LIMB_DIR . 'core/lib/http/control_flow.inc.php'); require_once(LIMB_DIR . 'core/lib/system/message_box.class.php'); start_user_session(); $request =& request :: instance(); $response =& new http_response(); $filter_chain =& new filter_chain($request, $response); $filter_chain->register_filter($f1 = LIMB_DIR . 'core/filters/locale_definition_filter'); $filter_chain->register_filter($f2 = LIMB_DIR . 'core/filters/authentication_filter'); $filter_chain->register_filter($f3 = LIMB_DIR . 'core/filters/logging_filter'); $filter_chain->register_filter($f4 = LIMB_DIR . 'core/filters/full_page_cache_filter'); $filter_chain->register_filter($f5 = LIMB_DIR . 'core/filters/jip_filter'); $filter_chain->register_filter($f6 = LIMB_DIR . 'core/filters/output_buffering_filter'); $filter_chain->register_filter($f7 = LIMB_DIR . 'core/filters/site_object_controller_filter'); $filter_chain->process(); if(!$response->file_sent())//FIXXX??? { if (debug :: is_console_enabled()) echo debug :: parse_html_console(); echo message_box :: parse();//It definetly should be somewhere else! } $response->commit(); ?>
function _check_result($result)//it's not really the place for it... { $image_variations = $this->_get_variations_ini_list(); foreach($image_variations as $variation => $variation_data) { $action = $this->get_attribute($variation . '_action'); if($action == 'upload' || $action == 'generate') { if (!$result[$variation]['saved']) { message_box :: write_warning($variation . ' not saved'); } if ($this->get_attribute($action . '_' . $variation . '_max_size') && !$result[$variation]['resized']) { message_box :: write_warning($variation . ' not resized'); } } } }