Request PHP Class Code Examples

This page contains top rated real world PHP examples of class Request extracted from open source projects. You can rate examples to help us improve the quality of examples

Example #1
Show file File: cr_product_add_review_link_cz.php Project: KICHIRO20/-Myproject_part1-
0
 /**
  * Outputs Forbidden Template
  * use case: customer is anonyous while posting a review
  *           is available for signed-in customers
  */
 function outputForbidden()
 {
     global $application;
     if ($this->_view == CURRENT_REQUEST_URL) {
         $return_url = modApiFunc('Request', 'selfURL');
         if (_ml_strpos($return_url, '#') !== false) {
             $return_url = _ml_substr($return_url, 0, _ml_strpos($return_url, '#'));
         }
         $return_url .= '#add_review_' . $this->_product_data['product_id'];
     } else {
         $r = new Request();
         $r->setView($this->_view);
         $r->setAction('SetCurrentProduct');
         $r->setKey('prod_id', $this->_product_data['product_id']);
         $r->setAnchor('add_review_' . $this->_product_data['product_id']);
         $return_url = $r->getURL();
     }
     $r = new Request();
     $r->setView($this->_view);
     $r->setAction('sign_in_required');
     $r->setKey('returnURL', urlencode($return_url));
     $_tags = array('Local_Link' => $r->getURL());
     $this->_Template_Contents = $_tags;
     $application->registerAttributes($this->_Template_Contents);
     return $this->mTmplFiller->fill($this->_templates['forbidden']);
 }
Example #2
Show file File: dsr_input_az.php Project: KICHIRO20/-Myproject_part1-
0
 /**
  * @return HTML code for this view
  */
 function output()
 {
     global $application;
     loadCoreFile('html_form.php');
     $HtmlForm1 = new HtmlForm();
     if ($this->ViewState["hasCloseScript"] == "true") {
         modApiFunc("application", "closeChild_UpdateParent");
         return;
     }
     $outputed_rate_units = $this->outputRateUnits();
     $request = new Request();
     $request->setView('CheckoutShippingModuleSettings');
     $request->setAction("update_dsr_settings");
     $form_action = $request->getURL();
     $request = new Request();
     $request->setView(CURRENT_REQUEST_URL);
     $return_link = $request->getURL();
     $template_contents = array("EditSMForm" => $HtmlForm1->genForm($form_action, "POST", "EditSMForm"), "HiddenArrayViewState" => $this->outputViewState(), "ModuleType" => $this->MessageResources->getMessage('MODULE_TYPE'), "ModuleName" => $this->MessageResources->getMessage('MODULE_NAME'), "Subtitle" => $this->MessageResources->getMessage('FORM_SUBTITLE'), "TopErrors" => $this->outputTopErrors(), "ModuleStatusFieldName" => $this->MessageResources->getMessage('MODULE_STATUS_FIELD_NAME'), "ModuleStatusField" => $this->outputStatus(), "ModuleNameFieldName" => $this->MessageResources->getMessage('MODULE_NAME_FIELD_NAME'), "ModuleNameField" => $this->MessageResources->getMessage('MODULE_NAME'), "ModuleDescrFieldName" => $this->MessageResources->getMessage('MODULE_DESCR_FIELD_NAME'), "ModuleDescrFieldValue" => $this->MessageResources->getMessage('MODULE_DESCR'), "ModuleRateUnitFieldName" => $this->MessageResources->getMessage('MODULE_RATE_UNIT_FIELD_NAME'), "ModuleRateUnitDescrFieldName" => $this->Hints->getHintLink(array('MODULE_RATE_UNIT_FIELD_NAME', 'shipping-module-dsr-messages')), "RateUnits" => $outputed_rate_units, "RateUnitUnitsValue" => $this->CurrentRateUnitSign, "UnitType" => $this->CurrentRateUnitValue, "JSmethodsIDs" => $this->outputJSmethodsIDs(), "MethodsHeader" => $this->MessageResources->getMessage('METHODS_HEADER'), "MethodsList" => $this->outputShippingMethods(), "LabelSMName" => $this->MessageResources->getMessage('LABEL_SHIPPING_METHOD_NAME'), "LabelSMDestination" => $this->MessageResources->getMessage('LABEL_SHIPPING_METHOD_DESTINATION'), "LabelSMAvailable" => $this->MessageResources->getMessage('LABEL_SHIPPING_METHOD_AVAILABLE'), "MethodsCount" => count($this->shipping_methods), "lbl_DeleteSelected" => $this->MessageResources->getMessage('LBL_DELETE_SELECTED'), "lbl_CloneSelected" => $this->MessageResources->getMessage('LBL_CLONE_SELECTED'), "lbl_RenameSelected" => $this->MessageResources->getMessage('LBL_RENAME_SELECTED'), "lbl_NewMethodName" => $this->MessageResources->getMessage('LBL_NEW_METHOD_NAME'), "RatesTable" => $this->outputRatesTable(), "Alert_001" => $this->MessageResources->getMessage('ALERT_001'), "Alert_002" => $this->MessageResources->getMessage('ALERT_002'), "Alert_003" => $this->MessageResources->getMessage('ALERT_003'), "Alert_004" => $this->MessageResources->getMessage('ALERT_004'), "Alert_005" => $this->MessageResources->getMessage('ALERT_005'), "HintLink_MDESCR" => $this->Hints->getHintLink(array('MODULE_DESCR_FIELD_NAME', 'shipping-module-dsr-messages')), "DSR_Return_Link" => "location.href='{$return_link}'");
     $this->_Template_Contents = $template_contents;
     $application->registerAttributes($this->_Template_Contents);
     if (!$request->getValueByKey("rates_method_id", NULL)) {
         return $this->mTmplFiller->fill("shipping_module_dsr/", "list.tpl.html", array());
     } else {
         return $this->mTmplFiller->fill("shipping_module_dsr/", "rates-list.tpl.html", array());
     }
 }
Example #3
Show file File: MMapExternTest.php Project: DavidGarciaCat/eyeos
0
 public function testCheckRequest()
 {
     $request = new Request();
     $_GET['extern'] = 'test';
     $this->assertEquals(true, $this->myMMapExtern->checkRequest($request));
     $request = new Request();
     $_GET['extern'] = null;
     $this->assertEquals(false, $this->myMMapExtern->checkRequest($request));
 }
Example #4
Show file File: ParticipantControllerSpec.php Project: cespedosa/kreta
0
 function it_posts_participant(ContainerInterface $container, Request $request, ProjectInterface $project, UserRepository $userRepository, UserInterface $user, Request $request, Handler $handler, ParticipantInterface $participant)
 {
     $container->get('kreta_user.repository.user')->shouldBeCalled()->willReturn($userRepository);
     $userRepository->findAll()->shouldBeCalled()->willReturn([$user]);
     $container->get('kreta_project.form_handler.participant')->shouldBeCalled()->willReturn($handler);
     $request->get('project')->shouldBeCalled()->willReturn($project);
     $handler->processForm($request, null, ['project' => $project, 'users' => [$user]])->shouldBeCalled()->willReturn($participant);
     $this->postParticipantsAction($request, 'project-id')->shouldReturn($participant);
 }
Example #5
Show file File: edit-custom-field-action.php Project: KICHIRO20/-Myproject_part1-
0
 function onAction()
 {
     global $application;
     $request = $application->getInstance('Request');
     $attr_id = $request->getValueByKey("customFieldsList");
     if (!isset($_POST['customFieldVisible'])) {
         $_POST['customFieldVisible'] = 0;
     }
     if (!isset($_POST['customFieldRequired'])) {
         $_POST['customFieldRequired'] = 0;
     }
     if ($_POST['customFieldRequired'] == 1) {
         $_POST['customFieldVisible'] = 1;
     }
     if ($_POST['customFieldVisible'] == 0) {
         $_POST['customFieldRequired'] = 0;
     }
     #validation
     if (isset($_POST['params'])) {
         foreach ($_POST['params'] as $name => $v) {
             if (!preg_match("/^\\d+\$/", $v)) {
                 $_data = $_POST;
                 $_data['invalid_params'] = $_POST['customFieldType'];
                 modApiFunc("Session", "set", "FormData", $_data);
                 modApiFunc("Session", "set", "ResultMessage", 'MSG_INVALID_DATA');
                 $request = new Request();
                 $request->setView(CURRENT_REQUEST_URL);
                 $request->setKey('page_view', 'ManageCustomFields');
                 $request->setKey('variant_id', $_POST['variant_id']);
                 $request->setKey('attribute_id', $attr_id);
                 $request->setKey('mode', 'edit');
                 $application->redirect($request);
                 return;
             }
         }
     }
     $params = null;
     if (isset($_POST['params'])) {
         $params = serialize($_POST['params']);
     }
     $values = array();
     if (isset($_POST['customFieldValues'])) {
         $values = explode("\n", $_POST['customFieldValues']);
         foreach ($values as $i => $v) {
             $values[$i] = trim($v);
         }
     }
     $r = modApiFunc('Checkout', 'updateCustomField', $_POST['variant_id'], $attr_id, $_POST['customFieldVisibleName'], $_POST['customFieldDescription'], $_POST['customFieldVisible'], $_POST['customFieldRequired'], $_POST['customFieldType'], $values, $params);
     modApiFunc('Checkout', 'updateCheckoutFormHash');
     modApiFunc("Session", "set", "UpdateParent", true);
     $request = new Request();
     $request->setView(CURRENT_REQUEST_URL);
     $request->setKey('page_view', 'ManageCustomFields');
     $request->setKey('variant_id', $_POST['variant_id']);
     $request->setKey('attribute_id', $attr_id);
     $request->setKey('mode', 'edit');
     $application->redirect($request);
 }
Example #6
Show file File: QueryParameterTokenExtractorTest.php Project: disider/LexikJWTAuthenticationBundle
0
 /**
  * test getRequestToken
  */
 public function testGetTokenRequest()
 {
     $extractor = new QueryParameterTokenExtractor('bearer');
     $request = new Request(array('bear' => 'testtoken'));
     $this->assertFalse($extractor->extract($request));
     $request = new Request(array('bearer' => 'testtoken'));
     $this->assertEquals('testtoken', $extractor->extract($request));
 }
Example #7
Show file File: MediaTest.php Project: fedeisas/lithium
0
 public function testContentNegotiationByUserAgent()
 {
     Media::type('iphone', 'application/xhtml+xml', array('conditions' => array('mobile' => true)));
     $request = new Request(array('env' => array('HTTP_USER_AGENT' => 'Safari', 'HTTP_ACCEPT' => 'application/xhtml+xml,text/html')));
     $this->assertEqual('html', Media::negotiate($request));
     $request = new Request(array('env' => array('HTTP_USER_AGENT' => 'iPhone', 'HTTP_ACCEPT' => 'application/xhtml+xml,text/html')));
     $this->assertEqual('iphone', Media::negotiate($request));
 }
Example #8
Show file File: CachedPerRequestChannelContextSpec.php Project: ahmadrabie/Sylius
0
 function it_caches_channels_for_the_same_request_even_if_there_are_other_request_in_between(ChannelContextInterface $decoratedChannelContext, RequestStack $requestStack, Request $firstRequest, Request $secondRequest, ChannelInterface $firstChannel, ChannelInterface $secondChannel)
 {
     $requestStack->getMasterRequest()->willReturn($firstRequest, $secondRequest, $firstRequest);
     $decoratedChannelContext->getChannel()->willReturn($firstChannel, $secondChannel)->shouldBeCalledTimes(2);
     $this->getChannel()->shouldReturn($firstChannel);
     $this->getChannel()->shouldReturn($secondChannel);
     $this->getChannel()->shouldReturn($firstChannel);
 }
Example #9
Show file File: Util.php Project: slrondon/MikrotikCenter
0
 /**
  * Executes a RouterOS script.
  * 
  * Same as the public equivalent, with the addition of allowing you to get
  * the contents of the script post execution, instead of removing it.
  * 
  * @param string|resource $source The source of the script, as a string or
  *     stream. If a stream is provided, reading starts from the current
  *     position to the end of the stream, and the pointer stays at the end
  *     after reading is done.
  * @param array           $params An array of parameters to make available
  *     in the script as local variables.
  *     Variable names are array keys, and variable values are array values.
  *     Array values are automatically processed with
  *     {@link static::escapeValue()}. Streams are also supported, and are
  *     processed in chunks, each processed with
  *     {@link static::escapeString()}. Processing starts from the current
  *     position to the end of the stream, and the stream's pointer is left
  *     untouched after the reading is done.
  *     Note that the script's (generated) name is always added as the
  *     variable "_", which will be inadvertently lost if you overwrite it
  *     from here.
  * @param string          $policy Allows you to specify a policy the script
  *     must follow. Has the same format as in terminal.
  *     If left NULL, the script has no restrictions beyond those imposed by
  *     the username.
  * @param string          $name   The script is executed after being saved
  *     in "/system script" under a random name (prefixed with the computer's
  *     name), and is removed after execution. To eliminate any possibility
  *     of name clashes, you can specify your own name.
  * @param bool            $get    Whether to get the source of the script.
  * 
  * @return ResponseCollection|string Returns the response collection of the
  *     run, allowing you to inspect errors, if any.
  *     If the script was not added successfully before execution, the
  *     ResponseCollection from the add attempt is going to be returned.
  *     If $get is TRUE, returns the source of the script on success.
  */
 private function _exec($source, array $params = array(), $policy = null, $name = null, $get = false)
 {
     $request = new Request('/system/script/add');
     if (null === $name) {
         $name = uniqid(gethostname(), true);
     }
     $request->setArgument('name', $name);
     $request->setArgument('policy', $policy);
     $params += array('_' => $name);
     $finalSource = fopen('php://temp', 'r+b');
     fwrite($finalSource, '/' . str_replace('/', ' ', substr($this->menu, 1)) . "\n");
     static::appendScript($finalSource, $source, $params);
     fwrite($finalSource, "\n");
     rewind($finalSource);
     $request->setArgument('source', $finalSource);
     $result = $this->client->sendSync($request);
     if (0 === count($result->getAllOfType(Response::TYPE_ERROR))) {
         $request = new Request('/system/script/run');
         $request->setArgument('number', $name);
         $result = $this->client->sendSync($request);
         if ($get) {
             $result = $this->client->sendSync(new Request('/system/script/print .proplist="source"', Query::where('name', $name)))->getProperty('source');
         }
         $request = new Request('/system/script/remove');
         $request->setArgument('numbers', $name);
         $this->client->sendSync($request);
     }
     return $result;
 }
Example #10
Show file File: ServerTest.php Project: huangzhwork/oauth2-server-php
0
 public function testAddingResponseType()
 {
     $storage = $this->getMock('OAuth2\\Storage\\Memory');
     $storage->expects($this->any())->method('getClientDetails')->will($this->returnValue(array('client_id' => 'some_client')));
     $storage->expects($this->any())->method('checkRestrictedGrantType')->will($this->returnValue(true));
     // add with the "code" key explicitly set
     $codeType = new AuthorizationCode($storage);
     $server = new Server();
     $server->addStorage($storage);
     $server->addResponseType($codeType);
     $request = new Request(array('response_type' => 'code', 'client_id' => 'some_client', 'redirect_uri' => 'http://example.com', 'state' => 'xyx'));
     $server->handleAuthorizeRequest($request, $response = new Response(), true);
     // the response is successful
     $this->assertEquals($response->getStatusCode(), 302);
     $parts = parse_url($response->getHttpHeader('Location'));
     parse_str($parts['query'], $query);
     $this->assertTrue(isset($query['code']));
     $this->assertFalse(isset($query['error']));
     // add with the "code" key not set
     $codeType = new AuthorizationCode($storage);
     $server = new Server(array($storage), array(), array(), array($codeType));
     $request = new Request(array('response_type' => 'code', 'client_id' => 'some_client', 'redirect_uri' => 'http://example.com', 'state' => 'xyx'));
     $server->handleAuthorizeRequest($request, $response = new Response(), true);
     // the response is successful
     $this->assertEquals($response->getStatusCode(), 302);
     $parts = parse_url($response->getHttpHeader('Location'));
     parse_str($parts['query'], $query);
     $this->assertTrue(isset($query['code']));
     $this->assertFalse(isset($query['error']));
 }
Example #11
Show file File: mail_info_az.php Project: KICHIRO20/-Myproject_part1-
0
 /**
  * MailInfo constructor
  */
 function MailInfo()
 {
     global $application;
     $MR =& $application->getInstance('MessageResources');
     //initialize form data with null values when adding a new notification
     $this->currentNotificationId = modApiFunc("Notifications", "getCurrentNotificationId");
     if ($this->currentNotificationId == 'Add') {
         $this->notificationInfo = array('Id' => '', 'Name' => '', 'Subject' => '', 'Body' => '', 'JavascriptBody' => '', 'From_addr' => '', 'Email_Code' => '', 'Active' => 'checked', 'Action_id' => 1);
         $request = new Request();
         $request->setView('NotificationInfo');
         $request->setAction('AddNotification');
         $formAction = $request->getURL();
         $this->properties = array('SubmitButton' => $MR->getMessage('BTN_ADD'), 'FormAction' => $formAction);
     } else {
         //initialize form data with database values when editing the notification
         $this->notificationInfo = modApiFunc("Notifications", "getNotificationInfo", $this->currentNotificationId);
         if (sizeof($this->notificationInfo) == 1) {
             $this->notificationInfo = $this->notificationInfo[0];
             $this->notificationInfo['JavascriptBody'] = addcslashes(addslashes($this->notificationInfo['Body']), "..");
             $this->notificationInfo['Body'] = prepareHTMLDisplay($this->notificationInfo['Body']);
         } else {
             $this->currentNotificationId = 'Add';
             $this->notificationInfo = array('Id' => '', 'Name' => '', 'Subject' => '', 'Body' => '', 'JavascriptBody' => '', 'From_addr' => '', 'Email_Code' => '', 'Active' => 'checked', 'Action_id' => 1);
         }
         $request = new Request();
         $request->setView('NotificationInfo');
         $request->setAction('SaveNotification');
         $formAction = $request->getURL();
         $this->properties = array('SubmitButton' => $MR->getMessage('BTN_SAVE'), 'FormAction' => $formAction);
     }
     $this->actionsList = modApiFunc("Notifications", "getActionsList");
     $this->InfoTags = modApiFunc("Notifications", "getAvailableTagsList", $this->actionsList);
 }
Example #12
Show file File: credit_card_settings_az.php Project: KICHIRO20/-Myproject_part1-
0
 /**
  *
  */
 function output()
 {
     global $application;
     loadCoreFile('html_form.php');
     $HtmlForm1 = new HtmlForm();
     if ($this->ViewState["hasCloseScript"] == "true") {
         modApiFunc("application", "closeChild_UpdateParent");
         return;
     }
     $this->CurrentRateUnitValue = "currency";
     $this->CurrentRateUnit = "Price";
     $request = new Request();
     $request->setView('CreditCardSettings');
     /* $request->setAction("UpdateCreditCardSettings"); */
     $form_action = $request->getURL();
     $request = new Request();
     $request->setView('SortCreditCardTypes');
     $sort_href = $request->getURL();
     $settings = modApiFunc("Discounts", "getSettings");
     $template_contents = array("EditCreditCardSettingsForm" => $HtmlForm1->genForm($form_action, "POST", "EditCreditCardSettingsForm"), "HiddenArrayViewState" => $this->outputViewState(), "Items" => $this->outputCCTypes(), "SortCreditCardTypesHref" => $sort_href, 'ResultMessageRow' => $this->outputResultMessage());
     $this->_Template_Contents = $template_contents;
     $application->registerAttributes($this->_Template_Contents);
     $obj =& $application->getInstance('MessageResources');
     $output = modApiFunc('TmplFiller', 'fill', './../../js/', 'validate.msgs.js.tpl', array("STRING512" => $obj->getMessage(new ActionMessage(array('PRDADD_010')))));
     return $output . $this->mTmplFiller->fill("configuration/credit_card_settings/", "container.tpl.html", array());
 }
Example #13
Show file File: MediaFileUploadTest.php Project: andytan2624/andytan.net
0
 public function testProcess()
 {
     $client = $this->getClient();
     $data = 'foo';
     // Test data *only* uploads.
     $request = new Request('POST', 'http://www.example.com');
     $media = new Google_Http_MediaFileUpload($client, $request, 'image/png', $data, false);
     $request = $media->getRequest();
     $this->assertEquals($data, (string) $request->getBody());
     // Test resumable (meta data) - we want to send the metadata, not the app data.
     $request = new Request('POST', 'http://www.example.com');
     $reqData = json_encode("hello");
     $request = $request->withBody(Psr7\stream_for($reqData));
     $media = new Google_Http_MediaFileUpload($client, $request, 'image/png', $data, true);
     $request = $media->getRequest();
     $this->assertEquals(json_decode($reqData), (string) $request->getBody());
     // Test multipart - we are sending encoded meta data and post data
     $request = new Request('POST', 'http://www.example.com');
     $reqData = json_encode("hello");
     $request = $request->withBody(Psr7\stream_for($reqData));
     $media = new Google_Http_MediaFileUpload($client, $request, 'image/png', $data, false);
     $request = $media->getRequest();
     $this->assertContains($reqData, (string) $request->getBody());
     $this->assertContains(base64_encode($data), (string) $request->getBody());
 }
Example #14
Show file File: product_class.php Project: KICHIRO20/-Myproject_part1-
0
 function getProductInfoLink($product_id, $category_id)
 {
     global $zone;
     if ($zone == 'CustomerZone') {
         $request = new Request();
         $product_type_id = $this->getProductTagValue("TypeID");
         if ($product_type_id == GC_PRODUCT_TYPE_ID) {
             $request->setView('GiftCertificate');
             return $request->getURL();
         }
         $request->setView('ProductInfo');
         $request->setAction('SetCurrentProduct');
         $request->setKey('prod_id', $product_id);
         $request->setCategoryID($category_id);
         $request->setProductID($product_id);
         return $request->getURL();
     } else {
         $request = new Request();
         $request->setView('Catalog_EditProduct');
         $request->setAction('SetCurrentProduct');
         $request->setKey('prod_id', $product_id);
         $request->setCategoryID($category_id);
         $request->setProductID($product_id);
         return $request->getURL();
     }
 }
Example #15
Show file File: ml_select_language_cz.php Project: KICHIRO20/-Myproject_part1-
0
 /**
  * Shows multilang paginator URLs if exist
  */
 function showPaginatorURLs()
 {
     if (count($this->_languages) <= 1) {
         return '';
     }
     $urls = array();
     $_lang = modApiFunc('MultiLang', 'getLanguage');
     $def_lng = modApiFunc('MultiLang', 'getDefaultLanguage');
     modApiFunc('MultiLang', 'setLanguage', $def_lng);
     $request = new Request();
     $request->setView('ProductList');
     $request->setAction('Paginator_SetPage');
     $request->setKey('pgname', modApiFunc('Request', 'getValueByKey', 'pgname'));
     $request->setKey('pgnum', modApiFunc('Request', 'getValueByKey', 'pgnum'));
     $def_url = urlencode($request->getURL());
     $urls[$def_lng] = $def_url;
     foreach ($this->_languages as $v) {
         if ($v['lng'] == $def_lng) {
             continue;
         }
         modApiFunc('MultiLang', 'setLanguage', $v['lng']);
         $request = new Request();
         $request->setView('ProductList');
         $request->setAction('Paginator_SetPage');
         $request->setKey('pgname', modApiFunc('Request', 'getValueByKey', 'pgname'));
         $request->setKey('pgnum', modApiFunc('Request', 'getValueByKey', 'pgnum'));
         $url = urlencode($request->getURL());
         if ($url != $def_url) {
             $urls[$v['lng']] = $url;
         }
     }
     modApiFunc('MultiLang', 'setLanguage', $_lang);
     return $urls;
 }
Example #16
Show file File: LabelControllerSpec.php Project: cespedosa/kreta
0
 function it_posts_label(ContainerInterface $container, Request $request, ProjectInterface $project, Request $request, Handler $handler, LabelInterface $label)
 {
     $container->get('kreta_project.form_handler.label')->shouldBeCalled()->willReturn($handler);
     $request->get('project')->shouldBeCalled()->willReturn($project);
     $handler->processForm($request, null, ['project' => $project])->shouldBeCalled()->willReturn($label);
     $this->postLabelsAction($request, 'project-id')->shouldReturn($label);
 }
Example #17
Show file File: add_value_to_option.php Project: KICHIRO20/-Myproject_part1-
0
 function onAction()
 {
     global $application;
     $oid = $_POST["option_id"];
     unset($_POST["option_id"]);
     $data = array("value_name" => $_POST["NewValue"]["Name"], "is_default" => isset($_POST["NewValue"]["IsDefault"]) ? 'Y' : 'N');
     foreach ($_POST["NewValue"] as $key => $value) {
         if (preg_match("/_modifier\$/", $key)) {
             $data[$key] = floatval(str_replace(",", ".", trim($value)));
         }
     }
     $check_result = modApiFunc("Product_Options", "checkDataFor", "addValueToOption", $data);
     if (!empty($check_result)) {
         modApiFunc("Session", "set", "Errors", $check_result);
         modApiFunc("Session", "set", "SessionPost", $_POST);
         $request = new Request();
         $request->setKey("option_id", $oid);
         $request->setView('PO_EditOption');
         $application->redirect($request);
     } else {
         $data["option_id"] = $oid;
         $add_result = modApiFunc("Product_Options", "addValueToOption", $data);
         if ($add_result == false) {
             modApiFunc("Session", "set", "SessionPost", $_POST);
             modApiFunc("Session", "set", "ResultMessage", "MSG_VALUE_NOT_ADDED");
         } else {
             modApiFunc("Session", "un_set", "SessionPost");
             modApiFunc("Session", "set", "ResultMessage", "MSG_VALUE_ADDED");
         }
         $request = new Request();
         $request->setView('PO_EditOption');
         $request->setKey("option_id", $oid);
         $application->redirect($request);
     }
 }
Example #18
Show file File: controller_test.php Project: MrAdder/phpbb
0
 public function test_controller_resolver()
 {
     $container = new ContainerBuilder();
     // YamlFileLoader only uses one path at a time, so we need to loop
     // through all of the ones we are using.
     foreach (array(__DIR__ . '/config', __DIR__ . '/ext/vendor2/foo/config') as $path) {
         $loader = new YamlFileLoader($container, new FileLocator($path));
         $loader->load('services.yml');
     }
     // Autoloading classes within the tests folder does not work
     // so I'll include them manually.
     if (!class_exists('vendor2\\foo\\controller')) {
         include __DIR__ . '/ext/vendor2/foo/controller.php';
     }
     if (!class_exists('phpbb\\controller\\foo')) {
         include __DIR__ . '/phpbb/controller/foo.php';
     }
     $resolver = new \phpbb\controller\resolver($container, dirname(__FILE__) . '/');
     $symfony_request = new Request();
     $symfony_request->attributes->set('_controller', 'foo.controller:handle');
     $this->assertEquals($resolver->getController($symfony_request), array(new foo\controller(), 'handle'));
     $symfony_request = new Request();
     $symfony_request->attributes->set('_controller', 'core_foo.controller:bar');
     $this->assertEquals($resolver->getController($symfony_request), array(new phpbb\controller\foo(), 'bar'));
 }
Example #19
Show file File: add_promo_code_action.php Project: KICHIRO20/-Myproject_part1-
0
 /**
  *            Promo Code'
  */
 function onAction()
 {
     global $application;
     $request = $application->getInstance('Request');
     $promo_code = $request->getValueByKey('promo_code');
     $promo_code_id = modApiFunc("PromoCodes", "getPromoCodeIdByPromoCode", $promo_code);
     if ($promo_code_id === false) {
         $b_applicable = false;
     } else {
         $b_applicable = modApiFunc("PromoCodes", "isPromoCodeApplicableWithoutMinSubtotal", $promo_code_id);
         $area_applicable = modApiFunc("PromoCodes", 'isPromoCodeEffectiveAreaNotEmpty', $promo_code_id);
     }
     if ($b_applicable === true && $area_applicable === true) {
         modApiFunc('PromoCodes', 'setPromoCodeId', $promo_code_id);
         $request = new Request();
         $request->setView(CURRENT_REQUEST_URL);
         $application->redirect($request);
     } else {
         //               Promo Code       .
         modApiFunc("PromoCodes", "setAddPromoCodeError", "CART_ADD_PROMO_CODE_ERROR_001");
         $request = new Request();
         $request->setView(CURRENT_REQUEST_URL);
         $application->redirect($request);
     }
 }
Example #20
Show file File: IssuePriorityControllerSpec.php Project: cespedosa/kreta
0
 function it_posts_issue_priority(ContainerInterface $container, Request $request, ProjectInterface $project, Request $request, Handler $handler, IssuePriorityInterface $issuePriority)
 {
     $container->get('kreta_project.form_handler.issue_priority')->shouldBeCalled()->willReturn($handler);
     $request->get('project')->shouldBeCalled()->willReturn($project);
     $handler->processForm($request, null, ['project' => $project])->shouldBeCalled()->willReturn($issuePriority);
     $this->postIssuePrioritiesAction($request, 'project-id')->shouldReturn($issuePriority);
 }
Example #21
Show file File: del_option_from_entity.php Project: KICHIRO20/-Myproject_part1-
0
 function onAction()
 {
     global $application;
     $data = array("parent_entity" => $_POST["parent_entity"], "entity_id" => intval($_POST["entity_id"]), "option_id" => intval($_POST["option_id"]));
     $check_result = modApiFunc("Product_Options", "checkDataFor", "delOptionFromEntity", $data);
     if (!empty($check_result)) {
         modApiFunc("Session", "set", "Errors", $check_result);
         $request = new Request();
         $request->setKey("parent_entity", $data["parent_entity"]);
         $request->setKey("entity_id", $data["entity_id"]);
         $request->setView('PO_OptionsList');
         $application->redirect($request);
     } else {
         $del_result = modApiFunc("Product_Options", "delOptionFromEntity", $data);
         if ($del_result == true) {
             modApiFunc("Session", "set", "ResultMessage", "MSG_OPTION_DELETED");
         } else {
             modApiFunc("Session", "set", "ResultMessage", "MSG_OPTION_NOT_DELETED");
         }
         $request = new Request();
         $request->setView('PO_OptionsList');
         $request->setKey('parent_entity', $data["parent_entity"]);
         $request->setKey('entity_id', $data["entity_id"]);
         $application->redirect($request);
     }
 }
Example #22
Show file File: Browser.php Project: mwiercioch/FreshmailBundle
0
 public function doRequest($url, array $params = array())
 {
     if (empty($params)) {
         $postData = '';
     } else {
         $postData = json_encode($params);
     }
     $sign = sha1($this->apiKey . '/' . $this->prefix . $url . $postData . $this->apiSecret);
     if ($postData) {
         $request = new \Buzz\Message\Request('POST', $this->prefix . $url, $this->host);
         $request->setContent($postData);
     } else {
         $request = new \Buzz\Message\Request('GET', $this->prefix . $url, $this->host);
     }
     $request->setHeaders(array('X-Rest-ApiKey' => $this->apiKey, 'X-Rest-ApiSign' => $sign, 'Content-Type' => 'application/json'));
     $response = new \Buzz\Message\Response();
     $this->buzzBrowser->send($request, $response);
     $responseData = json_decode($response->getContent(), true);
     if (!$response->isOk()) {
         $errors = $responseData['errors'];
         if (is_array($errors)) {
             foreach ($errors as $e) {
                 throw new RestException($e['message'], $e['code']);
             }
         }
     }
     if (is_array($responseData) == false) {
         throw new \Exception('Invalid json response');
     }
     return $responseData;
 }
Example #23
Show file File: del_values_from_option.php Project: KICHIRO20/-Myproject_part1-
0
 function onAction()
 {
     global $application;
     $oid = $_POST["option_id"];
     unset($_POST["option_id"]);
     $data = array("option_id" => $oid, "values_ids" => array_keys($_POST["toDeleteValues"]));
     $check_result = modApiFunc("Product_Options", "checkDataFor", "delValuesFromOption", $data);
     if (!empty($check_result)) {
         modApiFunc("Session", "set", "Errors", $check_result);
         $request = new Request();
         $request->setKey("option_id", $oid);
         $request->setView('PO_EditOption');
         $application->redirect($request);
     } else {
         $del_result = modApiFunc("Product_Options", "delValuesFromOption", $data);
         if ($del_result == false) {
             modApiFunc("Session", "set", "ResultMessage", "MSG_VALUES_NOT_DELETED");
         } else {
             modApiFunc("Session", "set", "ResultMessage", "MSG_VALUES_DELETED");
         }
         $request = new Request();
         $request->setView('PO_EditOption');
         $request->setKey('option_id', $oid);
         $application->redirect($request);
     }
 }
Example #24
Show file File: backup_az.php Project: KICHIRO20/-Myproject_part1-
0
 /**
  *
  */
 function output()
 {
     global $application;
     $request = new Request();
     $request->setView('AdminBackupCreate');
     //$request->setAction('DBStat');
     $Backup_Create_Link = $request->getURL();
     $request = new Request();
     $request->setView('AdminBackup');
     $request->setAction('BackupDeleteAction');
     $request->setKey('file', '');
     $DeleteFormAction = $request->getURL();
     $request = new Request();
     $request->setView('Downdoad');
     $request->setKey('directory', 'backup');
     $request->setKey('file', '');
     $DownloadFormAction = $request->getURL();
     $request = new Request();
     $request->setView('AdminBackupRestore');
     $request->setAction('DBStat');
     //SetRestoreFile');
     $request->setKey('BackupFile', '');
     $RestoreFormAction = $request->getURL();
     $template_contents = array("Items" => $this->outputBackupFilesList(), "Warnings" => $this->outputWarnings(), "Backup_Create_Link" => $Backup_Create_Link, "DeleteFormAction" => $DeleteFormAction, "DownloadFormAction" => $DownloadFormAction, "RestoreFormAction" => $RestoreFormAction, "BackupFolderWarning" => $this->BackupFolderWarning ? "display: none;" : "", "ImagesFolderWarning" => $this->ImagesFolderWarning ? "display: none;" : "");
     $this->_Template_Contents = $template_contents;
     $application->registerAttributes($this->_Template_Contents);
     return modApiFunc('TmplFiller', 'fill', "tools/backup/", "container.tpl.html", array());
 }
Example #25
Show file File: Server.php Project: poovarasanvasudevan/Websocket
0
 /**
  * Create a Websocket server.
  *
  * @param   \Hoa\Socket\Server  $server    Server.
  * @param   \Hoa\Http\Request   $request   Request parser.
  * @return  void
  * @throws  \Hoa\Socket\Exception
  */
 public function __construct(Socket\Server $server, Http\Request $request = null)
 {
     parent::__construct($server);
     if (null === $request) {
         $request = new Http\Request();
     }
     $this->setRequest($request);
     return;
 }
Frequently Used Methods